Static Public Member Functions | |
static | assign ($itemName, $userId, $bizRule=null, $data=null) |
static | revoke ($itemName, $userId) |
static | getAssignedRoles ($userId=null, $sort=true) |
static | getBaseUrl () |
static | getAuthItemOptions () |
static | getAuthItemTypeName ($type) |
static | getAuthItemTypeNamePlural ($type) |
static | getAuthItemRoute ($type) |
static | getValidChildTypes ($type) |
static | getAuthItemSelectOptions ($type=null, $exclude=array()) |
static | getParentAuthItemSelectOptions (CAuthItem $parent, $type=null, $exclude=array()) |
static | getDataCsrf () |
static | getCsrfParam () |
static | powered () |
static | module () |
static | getAuthorizer () |
static | t ($category, $message, $params=array(), $source=null, $language=null) |
Public Attributes | |
const | PERM_NONE = 0 |
const | PERM_DIRECT = 1 |
const | PERM_INHERITED = 2 |
Static Protected Member Functions | |
static | generateAuthItemSelectOptions ($items, $type) |
Rights helper class file.
Provides static functions for interaction with Rights from outside of the module.
Definition at line 11 of file Rights.php.
|
static |
Assigns an authorization item to a specific user.
string | $itemName | the name of the item to assign. |
integer | $userId | the user id of the user for which to assign the item. |
string | $bizRule | business rule associated with the item. This is a piece of PHP code that will be executed when checkAccess is called for the item. |
mixed | $data | additional data associated with the item. |
Definition at line 29 of file Rights.php.
References getAuthorizer().
|
staticprotected |
Generates the authorization item select options.
array | $items | the authorization items. |
mixed | $type | the item type (0: operation, 1: task, 2: role). |
Definition at line 188 of file Rights.php.
References getAuthItemTypeNamePlural().
Referenced by getAuthItemSelectOptions(), and getParentAuthItemSelectOptions().
|
static |
Returns the roles assigned to a specific user. If no user id is provided the logged in user will be used.
integer | $userId | the user id of the user for which roles to get. |
boolean | $sort | whether to sort the items by their weights. |
Definition at line 54 of file Rights.php.
References getAuthorizer().
|
static |
Returns the list of authorization item types.
Definition at line 78 of file Rights.php.
References t().
Referenced by getAuthItemTypeName().
|
static |
Returns the route to a specific authorization item list view.
integer | $type | the item type (0: operation, 1: task, 2: role). |
Definition at line 122 of file Rights.php.
References t().
|
static |
Returns the authorization item select options.
mixed | $type | the item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type. |
array | $exclude | the items to be excluded. |
Definition at line 160 of file Rights.php.
References generateAuthItemSelectOptions(), and getAuthorizer().
Referenced by AssignmentController\actionUser().
|
static |
Returns the name of a specific authorization item.
integer | $type | the item type (0: operation, 1: task, 2: role). |
Definition at line 92 of file Rights.php.
References getAuthItemOptions(), and t().
Referenced by RAuthItemBehavior\getTypeText().
|
static |
Returns the name of a specific authorization item in plural.
integer | $type | the item type (0: operation, 1: task, 2: role). |
Definition at line 106 of file Rights.php.
References t().
Referenced by generateAuthItemSelectOptions().
|
static |
Definition at line 284 of file Rights.php.
References module().
Referenced by RWebUser\afterLogin(), assign(), RAuthItemParentDataProvider\fetchData(), RAuthItemChildDataProvider\fetchData(), RAuthItemDataProvider\fetchData(), getAssignedRoles(), RUserBehavior\getAssignments(), getAuthItemSelectOptions(), RDbAuthManager\getItemChildren(), getParentAuthItemSelectOptions(), RPermissionDataProvider\init(), AuthItemForm\nameIsAvailable(), and revoke().
|
static |
Returns the base url to Rights.
Definition at line 68 of file Rights.php.
References module().
|
static |
Returns the cross-site request forgery parameter for Ajax-requests. Null is returned if csrf-validation is disabled.
Definition at line 224 of file Rights.php.
|
static |
Returns the cross-site request forgery parameter to be placed in the data of Ajax-requests. An empty string is returned if csrf-validation is disabled.
Definition at line 214 of file Rights.php.
Referenced by RAuthItemBehavior\getAssignPermissionLink(), and RAuthItemBehavior\getRevokePermissionLink().
|
static |
Returns the valid authorization item select options for a model.
mixed | $parent | the item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type. |
CAuthItem | $type | the item for which to get the select options. |
array | $exclude | the items to be excluded. |
Definition at line 175 of file Rights.php.
References generateAuthItemSelectOptions(), and getAuthorizer().
Referenced by AuthItemController\actionUpdate().
|
static |
Returns the valid child item types for a specific type.
string | $type | the item type (0: operation, 1: task, 2: role). |
Definition at line 138 of file Rights.php.
References t().
Referenced by AuthItemController\actionUpdate().
|
static |
Definition at line 251 of file Rights.php.
Referenced by RAssignmentDataProvider\__construct(), RAuthorizer\attachUserBehavior(), getAuthorizer(), getBaseUrl(), RAuthItemBehavior\getDeleteRoleLink(), RUserBehavior\getId(), RUserBehavior\getName(), RAuthItemBehavior\getNameText(), RAuthorizer\getSuperusers(), AuthItemForm\isSuperuser(), and powered().
|
static |
Definition at line 242 of file Rights.php.
References module().
|
static |
Revokes an authorization item from a specific user.
string | $itemName | the name of the item to revoke. |
integer | $userId | the user id of the user for which to revoke the item. |
Definition at line 41 of file Rights.php.
References getAuthorizer().
|
static |
Translates a message to the specified language. Wrapper class for setting the category correctly.
string | $category | message category. |
string | $message | the original message. |
array | $params | parameters to be applied to the message using strtr . |
string | $source | which message source application component to use. |
string | $language | the target language. |
Definition at line 302 of file Rights.php.
Referenced by RController\accessDenied(), AuthItemController\actionAssign(), AuthItemController\actionCreate(), AuthItemController\actionDelete(), AuthItemController\actionGenerate(), AuthItemController\actionPermissions(), AuthItemController\actionRemoveChild(), AssignmentController\actionRevoke(), AuthItemController\actionRevoke(), InstallController\actionRun(), AuthItemController\actionSortable(), AuthItemController\actionUpdate(), AssignmentController\actionUser(), AuthChildForm\attributeLabels(), AssignmentForm\attributeLabels(), AuthItemForm\attributeLabels(), AuthItemForm\bizRuleNotEmpty(), RAuthItemBehavior\getAssignPermissionLink(), getAuthItemOptions(), getAuthItemRoute(), getAuthItemTypeName(), getAuthItemTypeNamePlural(), RAuthItemBehavior\getDeleteOperationLink(), RAuthItemBehavior\getDeleteRoleLink(), RAuthItemBehavior\getDeleteTaskLink(), RAuthItemBehavior\getInheritedPermissionText(), RAuthItemBehavior\getRemoveChildLink(), RAuthItemBehavior\getRemoveParentLink(), RAuthItemBehavior\getRevokeAssignmentLink(), RAuthItemBehavior\getRevokePermissionLink(), RAuthorizer\getSuperusers(), AuthItemController\getType(), getValidChildTypes(), RInstaller\init(), AuthItemForm\isSuperuser(), AuthItemController\loadModel(), and AuthItemForm\nameIsAvailable().