33 RBACPermissionContainer::const_iterator itr = perms.begin();
35 for (++itr; itr != perms.end(); ++itr)
49 TC_LOG_TRACE(
"rbac",
"RBACData::GrantPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Permission does not exists",
57 TC_LOG_TRACE(
"rbac",
"RBACData::GrantPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Permission in deny list",
65 TC_LOG_TRACE(
"rbac",
"RBACData::GrantPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Permission already granted",
75 TC_LOG_TRACE(
"rbac",
"RBACData::GrantPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Ok and DB updated",
81 TC_LOG_TRACE(
"rbac",
"RBACData::GrantPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Ok",
93 TC_LOG_TRACE(
"rbac",
"RBACData::DenyPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Permission does not exists",
101 TC_LOG_TRACE(
"rbac",
"RBACData::DenyPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Permission in grant list",
109 TC_LOG_TRACE(
"rbac",
"RBACData::DenyPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Permission already denied",
119 TC_LOG_TRACE(
"rbac",
"RBACData::DenyPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Ok and DB updated",
125 TC_LOG_TRACE(
"rbac",
"RBACData::DenyPermission [Id: {} Name: {}] (Permission {}, RealmId {}). Ok",
146 TC_LOG_TRACE(
"rbac",
"RBACData::RevokePermission [Id: {} Name: {}] (Permission {}, RealmId {}). Not granted or revoked",
157 TC_LOG_TRACE(
"rbac",
"RBACData::RevokePermission [Id: {} Name: {}] (Permission {}, RealmId {}). Ok and DB updated",
168 TC_LOG_TRACE(
"rbac",
"RBACData::RevokePermission [Id: {} Name: {}] (Permission {}, RealmId {}). Ok",
206 Field* fields = result->Fetch();
207 if (fields[1].GetBool())
211 }
while (result->NextRow());
216 for (
uint32 permission : permissions)
237 for (
uint32 permission : permsFrom)
238 permsTo.insert(permission);
243 for (
uint32 permission: permsToRemove)
244 permsFrom.erase(permission);
252 while (!toCheck.empty())
255 uint32 permissionId = *toCheck.begin();
256 toCheck.erase(toCheck.begin());
263 permissions.insert(permissionId);
267 for (
uint32 linkedPerm : linkedPerms)
268 if (permissions.find(linkedPerm) == permissions.end())
269 toCheck.insert(linkedPerm);
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_TRACE(filterType__,...)
@ LOGIN_DEL_RBAC_ACCOUNT_PERMISSION
@ LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS
@ LOGIN_INS_RBAC_ACCOUNT_PERMISSION
Role Based Access Control related classes definition.
Class used to access individual fields of database query result.
void setInt32(const uint8 index, const int32 value)
void setBool(const uint8 index, const bool value)
void setUInt32(const uint8 index, const uint32 value)
RBACPermissionContainer const & GetDeniedPermissions() const
Returns all the denied permissions.
RBACCommandResult GrantPermission(uint32 permissionId, int32 realmId=0)
void AddDeniedPermission(uint32 permissionId)
Adds a new denied permission.
RBACPermissionContainer _grantedPerms
Account SecurityLevel
void AddGrantedPermission(uint32 permissionId)
Adds a new granted permission.
void ExpandPermissions(RBACPermissionContainer &permissions)
bool HasDeniedPermission(uint32 permissionId) const
Checks if a permission is denied.
uint32 GetId() const
Gets the Id of the Object.
void AddPermissions(RBACPermissionContainer const &permsFrom, RBACPermissionContainer &permsTo)
Adds a list of permissions to another list.
void SavePermission(uint32 role, bool granted, int32 realm)
Saves a permission to DB, Granted or Denied.
QueryCallback LoadFromDBAsync()
void ClearData()
Clears roles, groups and permissions - Used for reload.
RBACPermissionContainer _globalPerms
Denied permissions
RBACPermissionContainer const & GetGrantedPermissions() const
Returns all the granted permissions.
RBACPermissionContainer _deniedPerms
Granted permissions
void CalculateNewPermissions()
RBACCommandResult DenyPermission(uint32 permissionId, int32 realmId=0)
bool HasGrantedPermission(uint32 permissionId) const
Checks if a permission is granted.
uint8 _secLevel
RealmId Affected
std::string const & GetName() const
Gets the Name of the Object.
void RemoveDeniedPermission(uint32 permissionId)
Removes a denied permission.
void RemoveGrantedPermission(uint32 permissionId)
Removes a granted permission.
RBACCommandResult RevokePermission(uint32 permissionId, int32 realmId=0)
void LoadFromDB()
Loads all permissions assigned to current account.
void RemovePermissions(RBACPermissionContainer &permsFrom, RBACPermissionContainer const &permsToRemove)
Removes a list of permissions from another list.
void LoadFromDBCallback(PreparedQueryResult result)
RBACPermissionContainer const & GetLinkedPermissions() const
Gets the Permissions linked to this permission.
std::string GetDebugPermissionString(RBACPermissionContainer const &perms)
@ RBAC_CANT_ADD_ALREADY_ADDED
@ RBAC_ID_DOES_NOT_EXISTS
@ RBAC_CANT_REVOKE_NOT_IN_LIST
std::set< uint32 > RBACPermissionContainer