Core/RBAC: Create new permissions 'Skips needed requirements to use channel check', 'Filter whispers', 'Allow say chat between factions'. Last one needs config option to be enabled and both sender and receiver to have the permission
This commit is contained in:
1 parent
9bd697066b
commit
18562a43ba
4 files changed
+51
-12
No files matched your search
@@ -0,0 +1,34 @@
|
||||
-- Add new permissions
|
||||
DELETE FROM `rbac_permissions` WHERE `id` IN (19, 25, 36);
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
|
||||
(19, 'Skips needed requirements to use channel check'),
|
||||
(25, 'Allow say chat between factions'),
|
||||
(36, 'Filter whispers');
|
||||
|
||||
-- Add new role
|
||||
DELETE FROM `rbac_roles` WHERE `id` IN (27, 28, 29);
|
||||
INSERT INTO `rbac_roles` (`id`, `name`) VALUES
|
||||
(27, 'Skips needed requirements to use channel check'),
|
||||
(28, 'Allow say chat between factions'),
|
||||
(29, 'Filter whispers');
|
||||
|
||||
-- Add the permission to the role
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (27, 28, 29);
|
||||
INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
|
||||
(27, 19),
|
||||
(28, 25),
|
||||
(29, 36);
|
||||
|
||||
-- Add it to all GM+ groups
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (27, 28, 29);
|
||||
INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES
|
||||
(2, 27),
|
||||
(3, 27),
|
||||
(4, 27),
|
||||
(1, 28),
|
||||
(2, 28),
|
||||
(3, 28),
|
||||
(4, 28),
|
||||
(2, 29),
|
||||
(3, 29),
|
||||
(4, 29);
|
||||
@@ -60,16 +60,19 @@ enum RBACPermissions
|
||||
RBAC_PERM_ADMINISTRATOR_COMMANDS = 10,
|
||||
RBAC_PERM_LOG_GM_TRADE = 11,
|
||||
RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES = 13,
|
||||
RBAC_PERM_SKIP_CHECK_CHAT_CHANNEL_REQ = 19,
|
||||
RBAC_PERM_SKIP_CHECK_DISABLE_MAP = 20,
|
||||
RBAC_PERM_SKIP_CHECK_MORE_TALENTS_THAN_ALLOWED = 21,
|
||||
RBAC_PERM_SKIP_CHECK_CHAT_SPAM = 22,
|
||||
RBAC_PERM_SKIP_CHECK_OVERSPEED_PING = 23,
|
||||
RBAC_PERM_TWO_SIDE_INTERACTION_CHAT = 25,
|
||||
RBAC_PERM_TWO_SIDE_INTERACTION_MAIL = 27,
|
||||
RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY = 30,
|
||||
RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS = 31,
|
||||
RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET = 32,
|
||||
RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR = 33,
|
||||
RBAC_PERM_COMMANDS_APPEAR_IN_GM_LIST = 34,
|
||||
RBAC_PERM_CAN_FILTER_WHISPERS = 36,
|
||||
RBAC_PERM_CHAT_USE_STAFF_BADGE = 37,
|
||||
RBAC_PERM_RESURRECT_WITH_FULL_HPS = 38,
|
||||
RBAC_PERM_RESTORE_SAVED_GM_STATE = 39,
|
||||
|
||||
@@ -668,7 +668,7 @@ Player::Player(WorldSession* session): Unit(true)
|
||||
//m_pad = 0;
|
||||
|
||||
// players always accept
|
||||
if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
|
||||
if (!GetSession()->HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS))
|
||||
SetAcceptWhispers(true);
|
||||
|
||||
m_curSelection = 0;
|
||||
|
||||
@@ -273,20 +273,22 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
Player* receiver = sObjectAccessor->FindPlayerByName(to);
|
||||
bool senderIsPlayer = AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
bool receiverIsPlayer = AccountMgr::IsPlayerAccount(receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER);
|
||||
if (!receiver || (senderIsPlayer && !receiverIsPlayer && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
|
||||
if (!receiver || (!HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) &&
|
||||
receiver->GetSession()->HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) &&
|
||||
!receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
|
||||
{
|
||||
SendPlayerNotFoundNotice(to);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer)
|
||||
if (GetPlayer()->GetTeam() != receiver->GetTeam())
|
||||
{
|
||||
SendWrongFactionNotice();
|
||||
return;
|
||||
}
|
||||
if (GetPlayer()->GetTeam() != receiver->GetTeam() &&
|
||||
(!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) ||
|
||||
!HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHAT) ||
|
||||
!receiver->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHAT)))
|
||||
{
|
||||
SendWrongFactionNotice();
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetPlayer()->HasAura(1852) && !receiver->isGameMaster())
|
||||
{
|
||||
@@ -295,7 +297,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to
|
||||
if (!senderIsPlayer && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))
|
||||
if (HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))
|
||||
sender->AddWhisperWhiteList(receiver->GetGUID());
|
||||
|
||||
GetPlayer()->Whisper(msg, lang, receiver->GetGUID());
|
||||
@@ -420,7 +422,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
} break;
|
||||
case CHAT_MSG_CHANNEL:
|
||||
{
|
||||
if (AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHAT_CHANNEL_REQ))
|
||||
{
|
||||
if (_player->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user