mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Core/RBAC: Create new permissions 'Allow to use CMSG_WORLD_TELEPORT opcode' and 'Allow to use CMSG_WHOIS opcode'
This commit is contained in:
21
sql/updates/auth/2013_02_25_07_auth_misc.sql
Normal file
21
sql/updates/auth/2013_02_25_07_auth_misc.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- Add new permissions
|
||||
DELETE FROM `rbac_permissions` WHERE `id` IN (42, 43);
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
|
||||
(42, 'Allows to use CMSG_WORLD_TELEPORT opcode'),
|
||||
(43, 'Allows to use CMSG_WHOIS opcode');
|
||||
|
||||
-- Add new role
|
||||
DELETE FROM `rbac_roles` WHERE `id` = 18;
|
||||
INSERT INTO `rbac_roles` (`id`, `name`) VALUES
|
||||
(18, 'Allows Admin Opcodes');
|
||||
|
||||
-- Add the permission to the role
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` = 18;
|
||||
INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
|
||||
(18, 42),
|
||||
(18, 43);
|
||||
|
||||
-- Add it to all GM+ groups
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` = 18;
|
||||
INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES
|
||||
(4, 18);
|
||||
@@ -67,6 +67,8 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMANDS_APPEAR_IN_GM_LIST = 34,
|
||||
RBAC_PERM_CHAT_USE_STAFF_BADGE = 37,
|
||||
RBAC_PERM_RESURRECT_WITH_FULL_HPS = 38,
|
||||
RBAC_PERM_OPCODE_WORLD_TELEPORT = 42,
|
||||
RBAC_PERM_OPCODE_WHOIS = 43,
|
||||
RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE = 44,
|
||||
RBAC_PERM_MAX
|
||||
};
|
||||
|
||||
@@ -1248,7 +1248,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recvData)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f",
|
||||
GetPlayer()->GetName().c_str(), time, mapid, PositionX, PositionY, PositionZ, Orientation);
|
||||
|
||||
if (AccountMgr::IsAdminAccount(GetSecurity()))
|
||||
if (HasPermission(RBAC_PERM_OPCODE_WORLD_TELEPORT))
|
||||
GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation);
|
||||
else
|
||||
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
|
||||
@@ -1260,7 +1260,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recvData)
|
||||
std::string charname;
|
||||
recvData >> charname;
|
||||
|
||||
if (!AccountMgr::IsAdminAccount(GetSecurity()))
|
||||
if (HasPermission(RBAC_PERM_OPCODE_WHOIS))
|
||||
{
|
||||
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user