Core/RBAC: Create new permissions 'Notify if a command was not found' and 'Enables lower security than target check'
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
-- Add new permission
|
||||
DELETE FROM `rbac_permissions` WHERE `id` = 27;
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES (27, 'Send mail to other faction');
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES (27, 'Two side mail interaction');
|
||||
|
||||
-- Add new role
|
||||
DELETE FROM `rbac_roles` WHERE `id` = 19;
|
||||
INSERT INTO `rbac_roles` (`id`, `name`) VALUES (19, 'Send mail to other faction');
|
||||
INSERT INTO `rbac_roles` (`id`, `name`) VALUES (19, 'Two side mail interaction');
|
||||
|
||||
-- Add the permission to the role
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` = 19;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
-- Add new permissions
|
||||
DELETE FROM `rbac_permissions` WHERE `id` IN (33, 47);
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
|
||||
(33, 'Notify if a command was not found'),
|
||||
(47, 'Enables lower security than target check');
|
||||
|
||||
-- Add new role
|
||||
DELETE FROM `rbac_roles` WHERE `id` IN (20, 21);
|
||||
INSERT INTO `rbac_roles` (`id`, `name`) VALUES
|
||||
(20, 'Notify if a command was not found'),
|
||||
(21, 'Enables lower security than target check');
|
||||
|
||||
-- Add the permission to the role
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (20, 21);
|
||||
INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
|
||||
(20, 33),
|
||||
(21, 47);
|
||||
|
||||
-- Add it to all GM+ groups
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (20, 21);
|
||||
INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES
|
||||
(2, 20),
|
||||
(3, 20),
|
||||
(4, 20),
|
||||
(2, 21),
|
||||
(3, 21),
|
||||
(4, 21);
|
||||
@@ -48,29 +48,31 @@
|
||||
|
||||
enum RBACPermissions
|
||||
{
|
||||
RBAC_PERM_INSTANT_LOGOUT = 1,
|
||||
RBAC_PERM_SKIP_QUEUE = 2,
|
||||
RBAC_PERM_JOIN_NORMAL_BG = 3,
|
||||
RBAC_PERM_JOIN_RANDOM_BG = 4,
|
||||
RBAC_PERM_JOIN_ARENAS = 5,
|
||||
RBAC_PERM_JOIN_DUNGEON_FINDER = 6,
|
||||
RBAC_PERM_PLAYER_COMMANDS = 7,
|
||||
RBAC_PERM_MODERATOR_COMMANDS = 8,
|
||||
RBAC_PERM_GAMEMASTER_COMMANDS = 9,
|
||||
RBAC_PERM_ADMINISTRATOR_COMMANDS = 10,
|
||||
RBAC_PERM_LOG_GM_TRADE = 11,
|
||||
RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES = 13,
|
||||
RBAC_PERM_SKIP_CHECK_OVERSPEED_PING = 23,
|
||||
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_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_INSTANT_LOGOUT = 1,
|
||||
RBAC_PERM_SKIP_QUEUE = 2,
|
||||
RBAC_PERM_JOIN_NORMAL_BG = 3,
|
||||
RBAC_PERM_JOIN_RANDOM_BG = 4,
|
||||
RBAC_PERM_JOIN_ARENAS = 5,
|
||||
RBAC_PERM_JOIN_DUNGEON_FINDER = 6,
|
||||
RBAC_PERM_PLAYER_COMMANDS = 7,
|
||||
RBAC_PERM_MODERATOR_COMMANDS = 8,
|
||||
RBAC_PERM_GAMEMASTER_COMMANDS = 9,
|
||||
RBAC_PERM_ADMINISTRATOR_COMMANDS = 10,
|
||||
RBAC_PERM_LOG_GM_TRADE = 11,
|
||||
RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES = 13,
|
||||
RBAC_PERM_SKIP_CHECK_OVERSPEED_PING = 23,
|
||||
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_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_CHECK_FOR_LOWER_SECURITY = 47,
|
||||
RBAC_PERM_MAX
|
||||
};
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
|
||||
return false;
|
||||
|
||||
// ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
|
||||
if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !strong && !sWorld->getBoolConfig(CONFIG_GM_LOWER_SECURITY))
|
||||
if (m_session->HasPermission(RBAC_PERM_CHECK_FOR_LOWER_SECURITY) && !strong && !sWorld->getBoolConfig(CONFIG_GM_LOWER_SECURITY))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
@@ -361,6 +361,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, co
|
||||
// table[i].Name == "" is special case: send original command to handler
|
||||
if ((table[i].Handler)(this, table[i].Name[0] != '\0' ? text : oldtext))
|
||||
{
|
||||
// FIXME: When Command system is moved to RBAC this check must be changed
|
||||
if (!AccountMgr::IsPlayerAccount(table[i].SecurityLevel))
|
||||
{
|
||||
// chat case
|
||||
@@ -476,7 +477,7 @@ bool ChatHandler::ParseCommands(char const* text)
|
||||
|
||||
if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
|
||||
{
|
||||
if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
|
||||
if (m_session && !m_session->HasPermission(RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR))
|
||||
return false;
|
||||
|
||||
SendSysMessage(LANG_NO_CMD);
|
||||
|
||||
Reference in New Issue
Block a user