mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/RBAC: Create new permissions 'Use staff badge in chat' and 'Check if should appear in .gm ingame command'
This commit is contained in:
27
sql/updates/auth/2013_02_25_04_auth_misc.sql
Normal file
27
sql/updates/auth/2013_02_25_04_auth_misc.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- Add new permissions
|
||||
DELETE FROM `rbac_permissions` WHERE `id` IN (34, 37);
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
|
||||
(34, 'Check if shoul appear in list using .gm ingame command'),
|
||||
(37, 'Use staff badge in chat');
|
||||
|
||||
-- Add new role
|
||||
DELETE FROM `rbac_roles` WHERE `id` IN (14, 15);
|
||||
INSERT INTO `rbac_roles` (`id`, `name`) VALUES
|
||||
(14, 'Appear in GM ingame list'),
|
||||
(15, 'Use staff badge in chat');
|
||||
|
||||
-- Add the permission to the role
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (14, 15);
|
||||
INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
|
||||
(14, 34),
|
||||
(15, 37);
|
||||
|
||||
-- Add it to all GM+ groups
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (14, 15);
|
||||
INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES
|
||||
(2, 14),
|
||||
(3, 14),
|
||||
(4, 14),
|
||||
(2, 15),
|
||||
(3, 15),
|
||||
(4, 15);
|
||||
@@ -63,6 +63,8 @@ enum RBACPermissions
|
||||
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_MAX
|
||||
};
|
||||
|
||||
@@ -59,30 +59,32 @@ public:
|
||||
// Enables or disables hiding of the staff badge
|
||||
static bool HandleGMChatCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
if (WorldSession* session = handler->GetSession())
|
||||
{
|
||||
WorldSession* session = handler->GetSession();
|
||||
if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->isGMChat())
|
||||
if (!*args)
|
||||
{
|
||||
if (session->HasPermission(RBAC_PERM_CHAT_USE_STAFF_BADGE) && session->GetPlayer()->isGMChat())
|
||||
session->SendNotification(LANG_GM_CHAT_ON);
|
||||
else
|
||||
session->SendNotification(LANG_GM_CHAT_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string param = (char*)args;
|
||||
|
||||
if (param == "on")
|
||||
{
|
||||
session->GetPlayer()->SetGMChat(true);
|
||||
session->SendNotification(LANG_GM_CHAT_ON);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
if (param == "off")
|
||||
{
|
||||
session->GetPlayer()->SetGMChat(false);
|
||||
session->SendNotification(LANG_GM_CHAT_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string param = (char*)args;
|
||||
|
||||
if (param == "on")
|
||||
{
|
||||
handler->GetSession()->GetPlayer()->SetGMChat(true);
|
||||
handler->GetSession()->SendNotification(LANG_GM_CHAT_ON);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (param == "off")
|
||||
{
|
||||
handler->GetSession()->GetPlayer()->SetGMChat(false);
|
||||
handler->GetSession()->SendNotification(LANG_GM_CHAT_OFF);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_USE_BOL);
|
||||
@@ -126,7 +128,9 @@ public:
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
AccountTypes itrSec = itr->second->GetSession()->GetSecurity();
|
||||
if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itrSec) && itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
|
||||
if ((itr->second->isGameMaster() ||
|
||||
(itr->second->GetSession()->HasPermission(RBAC_PERM_COMMANDS_APPEAR_IN_GM_LIST) &&
|
||||
itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
|
||||
(!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer())))
|
||||
{
|
||||
if (first)
|
||||
|
||||
Reference in New Issue
Block a user