![]() |
AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "RBAC.h"
Public Member Functions | |||||
| RBACData (uint32 id, std::string const &name, int32 realmId, uint8 secLevel=255) | |||||
| std::string const & | GetName () const | ||||
| Gets the Name of the Object. | |||||
| uint32 | GetId () const | ||||
| Gets the Id of the Object. | |||||
HasPermission | |||||
Checks if certain action is allowed
| |||||
| bool | HasPermission (uint32 permission) const | ||||
| RBACPermissionContainer const & | GetPermissions () const | ||||
| Returns all the granted permissions (after computation) | |||||
| RBACPermissionContainer const & | GetGrantedPermissions () const | ||||
| Returns all the granted permissions. | |||||
| RBACPermissionContainer const & | GetDeniedPermissions () const | ||||
| Returns all the denied permissions. | |||||
GrantPermission | |||||
Grants a permission
| |||||
| RBACCommandResult | GrantPermission (uint32 permissionId, int32 realmId=0) | ||||
DenyPermission | |||||
Denies a permission
| |||||
| RBACCommandResult | DenyPermission (uint32 permissionId, int32 realmId=0) | ||||
Private Member Functions | |
CalculateNewPermissions | |
Calculates new permissions Calculates new permissions after some change The calculation is done Granted - Denied:
| |
| void | CalculateNewPermissions () |
| int32 | GetRealmId () const |
| bool | HasGrantedPermission (uint32 permissionId) const |
| Checks if a permission is granted. | |
| bool | HasDeniedPermission (uint32 permissionId) const |
| Checks if a permission is denied. | |
| void | AddGrantedPermission (uint32 permissionId) |
| Adds a new granted permission. | |
| void | RemoveGrantedPermission (uint32 permissionId) |
| Removes a granted permission. | |
| void | AddDeniedPermission (uint32 permissionId) |
| Adds a new denied permission. | |
| void | RemoveDeniedPermission (uint32 permissionId) |
| Removes a denied permission. | |
| void | AddPermissions (RBACPermissionContainer const &permsFrom, RBACPermissionContainer &permsTo) |
| Adds a list of permissions to another list. | |
| void | RemovePermissions (RBACPermissionContainer &permsFrom, RBACPermissionContainer const &permsToRemove) |
| Removes a list of permissions from another list. | |
ExpandPermissions | |||
Adds the list of linked permissions to the original list
| |||
| uint32 | _id | ||
| std::string | _name | ||
| |||
| int32 | _realmId | ||
| |||
| uint8 | _secLevel | ||
| |||
| RBACPermissionContainer | _grantedPerms | ||
| |||
| RBACPermissionContainer | _deniedPerms | ||
| |||
| RBACPermissionContainer | _globalPerms | ||
| |||
| void | ExpandPermissions (RBACPermissionContainer &permissions) | ||
RevokePermission | |||||
Removes a permission
| |||||
| RBACCommandResult | RevokePermission (uint32 permissionId, int32 realmId=0) | ||||
| void | LoadFromDB () | ||||
| Loads all permissions assigned to current account. | |||||
| QueryCallback | LoadFromDBAsync () | ||||
| void | LoadFromDBCallback (PreparedQueryResult result) | ||||
| void | SetSecurityLevel (uint8 id) | ||||
| Sets security level. | |||||
| uint8 | GetSecurityLevel () const | ||||
| Returns the security level assigned. | |||||
| void | RecalculatePermissions () | ||||
| For unit testing - forces permission recalculation without database. | |||||
| void | SetSecurityLevelForTest (uint8 id) | ||||
| For unit testing - sets security level without database reload. | |||||
| void | SavePermission (uint32 role, bool granted, int32 realm) | ||||
| Saves a permission to DB, Granted or Denied. | |||||
| void | ClearData () | ||||
| Clears roles, groups and permissions - Used for reload. | |||||
|
inline |
|
inlineprivate |
Adds a new denied permission.
Referenced by DenyPermission().
|
inlineprivate |
Adds a new granted permission.
Referenced by GrantPermission().
|
private |
|
private |
References _globalPerms, ExpandPermissions(), GetDeniedPermissions(), GetGrantedPermissions(), GetId(), GetName(), LOG_TRACE, and RemovePermissions().
Referenced by DenyPermission(), GrantPermission(), LoadFromDBCallback(), and RevokePermission().
|
private |
Clears roles, groups and permissions - Used for reload.
References _deniedPerms, _globalPerms, and _grantedPerms.
Referenced by LoadFromDB(), and LoadFromDBAsync().
| RBACCommandResult rbac::RBACData::DenyPermission | ( | uint32 | permissionId, |
| int32 | realmId = 0 |
||
| ) |
References AddDeniedPermission(), CalculateNewPermissions(), GetId(), GetName(), HasDeniedPermission(), HasGrantedPermission(), LOG_TRACE, rbac::RBAC_CANT_ADD_ALREADY_ADDED, rbac::RBAC_ID_DOES_NOT_EXISTS, rbac::RBAC_IN_GRANTED_LIST, rbac::RBAC_OK, sAccountMgr, and SavePermission().
Referenced by rbac_commandscript::HandleRBACPermDenyCommand(), and LoadFromDBCallback().
|
private |
References rbac::GetDebugPermissionString(), rbac::RBACPermission::GetLinkedPermissions(), LOG_DEBUG, and sAccountMgr.
Referenced by CalculateNewPermissions().
|
inline |
Returns all the denied permissions.
Referenced by CalculateNewPermissions(), and rbac_commandscript::HandleRBACPermListCommand().
|
inline |
Returns all the granted permissions.
Referenced by CalculateNewPermissions(), and rbac_commandscript::HandleRBACPermListCommand().
|
inline |
|
inline |
Gets the Name of the Object.
Referenced by CalculateNewPermissions(), DenyPermission(), GrantPermission(), rbac_commandscript::HandleRBACPermListCommand(), WorldSession::HasPermission(), WorldSession::InvalidateRBACData(), LoadFromDB(), LoadFromDBAsync(), and RevokePermission().
|
inline |
Returns all the granted permissions (after computation)
|
inlineprivate |
Referenced by LoadFromDB(), and LoadFromDBAsync().
|
inline |
| RBACCommandResult rbac::RBACData::GrantPermission | ( | uint32 | permissionId, |
| int32 | realmId = 0 |
||
| ) |
References AddGrantedPermission(), CalculateNewPermissions(), GetId(), GetName(), HasDeniedPermission(), HasGrantedPermission(), LOG_TRACE, rbac::RBAC_CANT_ADD_ALREADY_ADDED, rbac::RBAC_ID_DOES_NOT_EXISTS, rbac::RBAC_IN_DENIED_LIST, rbac::RBAC_OK, sAccountMgr, and SavePermission().
Referenced by rbac_commandscript::HandleRBACPermGrantCommand(), and LoadFromDBCallback().
|
inlineprivate |
Checks if a permission is denied.
Referenced by DenyPermission(), GrantPermission(), and RevokePermission().
|
inlineprivate |
Checks if a permission is granted.
Referenced by DenyPermission(), GrantPermission(), and RevokePermission().
|
inline |
Referenced by WorldSession::HasPermission().
| void rbac::RBACData::LoadFromDB | ( | ) |
Loads all permissions assigned to current account.
References ClearData(), GetId(), GetName(), GetRealmId(), LoadFromDBCallback(), LOG_DEBUG, LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS, LoginDatabase, and PreparedStatementBase::SetData().
Referenced by WorldSession::LoadPermissions().
| QueryCallback rbac::RBACData::LoadFromDBAsync | ( | ) |
References ClearData(), GetId(), GetName(), GetRealmId(), LOG_DEBUG, LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS, LoginDatabase, and PreparedStatementBase::SetData().
Referenced by WorldSession::LoadPermissionsAsync().
| void rbac::RBACData::LoadFromDBCallback | ( | PreparedQueryResult | result | ) |
References _secLevel, CalculateNewPermissions(), DenyPermission(), GrantPermission(), and sAccountMgr.
Referenced by WorldSession::InitRBACDataForTest(), and LoadFromDB().
|
inline |
For unit testing - forces permission recalculation without database.
|
inlineprivate |
Removes a denied permission.
Referenced by RevokePermission().
|
inlineprivate |
Removes a granted permission.
Referenced by RevokePermission().
|
private |
Removes a list of permissions from another list.
Referenced by CalculateNewPermissions().
| RBACCommandResult rbac::RBACData::RevokePermission | ( | uint32 | permissionId, |
| int32 | realmId = 0 |
||
| ) |
References CalculateNewPermissions(), GetId(), GetName(), HasDeniedPermission(), HasGrantedPermission(), LOG_TRACE, LOGIN_DEL_RBAC_ACCOUNT_PERMISSION, LoginDatabase, rbac::RBAC_CANT_REVOKE_NOT_IN_LIST, rbac::RBAC_OK, RemoveDeniedPermission(), RemoveGrantedPermission(), and PreparedStatementBase::SetData().
Referenced by rbac_commandscript::HandleRBACPermRevokeCommand().
Saves a permission to DB, Granted or Denied.
References GetId(), LOGIN_INS_RBAC_ACCOUNT_PERMISSION, LoginDatabase, and PreparedStatementBase::SetData().
Referenced by DenyPermission(), and GrantPermission().
|
inline |
Sets security level.
|
inline |
For unit testing - sets security level without database reload.
|
private |
Granted permissions
Referenced by ClearData().
|
private |
Denied permissions
Referenced by CalculateNewPermissions(), and ClearData().
|
private |
Account SecurityLevel
Referenced by ClearData().
|
private |
|
private |
Account id
|
private |
Account name
|
private |
RealmId Affected
Referenced by LoadFromDBCallback().