Core/RBAC: Create new permissions 'Allow to use CMSG_WORLD_TELEPORT opcode' and 'Allow to use CMSG_WHOIS opcode'

This commit is contained in:
Spp
2013-02-25 12:55:37 +01:00
parent e99dd15915
commit ea2e6052b2
3 changed files with 25 additions and 2 deletions

View 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);

View File

@@ -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
};

View File

@@ -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;