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) |
Static Private Attributes |
static | $_m |
static | $_a |
Detailed Description
Rights helper class file.
Provides static functions for interaction with Rights from outside of the module.
- Author
- Christoffer Niska cnisk.nosp@m.a@li.nosp@m.ve.co.nosp@m.m
- Copyright
- Copyright © 2010 Christoffer Niska
- Since
- 0.9.1
Definition at line 12 of file Rights.php.
Member Function Documentation
static Rights::assign |
( |
|
$itemName, |
|
|
|
$userId, |
|
|
|
$bizRule = null , |
|
|
|
$data = null |
|
) |
| |
|
static |
Assigns an authorization item to a specific user.
- Parameters
-
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. |
- Returns
- CAuthItem the authorization item
Definition at line 32 of file Rights.php.
static Rights::findModule |
( |
CModule |
$module = null | ) |
|
|
staticprivate |
Searches for the Rights module among all installed modules. The module will be found even if it's nested within another module.
- Parameters
-
CModule | $module | the module to find the module in. Defaults to null, meaning that the application will be used. |
- Returns
- the Rights module.
Definition at line 298 of file Rights.php.
static Rights::generateAuthItemSelectOptions |
( |
|
$items, |
|
|
|
$type |
|
) |
| |
|
staticprotected |
Generates the authorization item select options.
- Parameters
-
array | $items | the authorization items. |
mixed | $type | the item type (0: operation, 1: task, 2: role). |
- Returns
- array the select options.
Definition at line 216 of file Rights.php.
static Rights::getAssignedRoles |
( |
|
$userId = null , |
|
|
|
$sort = true |
|
) |
| |
|
static |
Returns the roles assigned to a specific user. If no user id is provided the logged in user will be used.
- Parameters
-
integer | $userId | the user id of the user for which roles to get. |
boolean | $sort | whether to sort the items by their weights. |
- Returns
- array the roles.
Definition at line 63 of file Rights.php.
static Rights::getAuthItemOptions |
( |
| ) |
|
|
static |
Returns the list of authorization item types.
- Returns
- array the list of types.
Definition at line 92 of file Rights.php.
static Rights::getAuthItemRoute |
( |
|
$type | ) |
|
|
static |
Returns the route to a specific authorization item list view.
- Parameters
-
integer | $type | the item type (0: operation, 1: task, 2: role). |
- Returns
- array the route.
Definition at line 142 of file Rights.php.
static Rights::getAuthItemSelectOptions |
( |
|
$type = null , |
|
|
|
$exclude = array() |
|
) |
| |
|
static |
Returns the authorization item select options.
- Parameters
-
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. |
- Returns
- array the select options.
Definition at line 182 of file Rights.php.
static Rights::getAuthItemTypeName |
( |
|
$type | ) |
|
|
static |
Returns the name of a specific authorization item.
- Parameters
-
integer | $type | the item type (0: operation, 1: task, 2: role). |
- Returns
- string the authorization item type name.
Definition at line 108 of file Rights.php.
static Rights::getAuthItemTypeNamePlural |
( |
|
$type | ) |
|
|
static |
Returns the name of a specific authorization item in plural.
- Parameters
-
integer | $type | the item type (0: operation, 1: task, 2: role). |
- Returns
- string the authorization item type name.
Definition at line 125 of file Rights.php.
static Rights::getAuthorizer |
( |
| ) |
|
|
static |
static Rights::getBaseUrl |
( |
| ) |
|
|
static |
static Rights::getCsrfParam |
( |
| ) |
|
|
static |
Returns the cross-site request forgery parameter for Ajax-requests. Null is returned if csrf-validation is disabled.
- Returns
- string the csrf parameter.
Definition at line 254 of file Rights.php.
static Rights::getDataCsrf |
( |
| ) |
|
|
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.
- Returns
- string the csrf parameter.
Definition at line 243 of file Rights.php.
static Rights::getParentAuthItemSelectOptions |
( |
CAuthItem |
$parent, |
|
|
|
$type = null , |
|
|
|
$exclude = array() |
|
) |
| |
|
static |
Returns the valid authorization item select options for a model.
- Parameters
-
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. |
- Returns
- array the select options.
Definition at line 200 of file Rights.php.
static Rights::getValidChildTypes |
( |
|
$type | ) |
|
|
static |
Returns the valid child item types for a specific type.
- Parameters
-
string | $type | the item type (0: operation, 1: task, 2: role). |
- Returns
- array the valid types.
Definition at line 159 of file Rights.php.
static Rights::module |
( |
| ) |
|
|
static |
static Rights::powered |
( |
| ) |
|
|
static |
- Returns
- string a string that can be displayed on your Web page showing Powered-by-Rights information.
Definition at line 270 of file Rights.php.
static Rights::revoke |
( |
|
$itemName, |
|
|
|
$userId |
|
) |
| |
|
static |
Revokes an authorization item from a specific user.
- Parameters
-
string | $itemName | the name of the item to revoke. |
integer | $userId | the user id of the user for which to revoke the item. |
- Returns
- boolean whether the item was removed.
Definition at line 47 of file Rights.php.
static Rights::t |
( |
|
$category, |
|
|
|
$message, |
|
|
|
$params = array() , |
|
|
|
$source = null , |
|
|
|
$language = null |
|
) |
| |
|
static |
Translates a message to the specified language. Wrapper class for setting the category correctly.
- Parameters
-
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. |
- Returns
- string the translated message.
Definition at line 341 of file Rights.php.
Member Data Documentation
const Rights::PERM_DIRECT = 1 |
const Rights::PERM_INHERITED = 2 |
const Rights::PERM_NONE = 0 |
The documentation for this class was generated from the following file:
- app/protected/modules/rights/components/Rights.php