public static
CAuthItem
|
#
assign( string $itemName, integer $userId, string $bizRule = null, mixed $data = null )
Assigns an authorization item to a specific user.
Assigns an authorization item to a specific user.
Parameters
- $itemName
string $itemName the name of the item to assign.
- $userId
integer $userId the user id of the user for which to assign the item.
- $bizRule
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.
- $data
mixed $data additional data associated with the item.
Returns
CAuthItem the authorization item
|
public static
boolean
|
#
revoke( string $itemName, integer $userId )
Revokes an authorization item from a specific user.
Revokes an authorization item from a specific user.
Parameters
- $itemName
string $itemName the name of the item to revoke.
- $userId
integer $userId the user id of the user for which to revoke the item.
Returns
boolean whether the item was removed.
|
public static
array
|
#
getAssignedRoles( integer $userId = null, boolean $sort = true )
Returns the roles assigned to a specific user. If no user id is provided the
logged in user will be used.
Returns the roles assigned to a specific user. If no user id is provided the
logged in user will be used.
Parameters
- $userId
integer $userId the user id of the user for which roles to get.
- $sort
boolean $sort whether to sort the items by their weights.
Returns
array the roles.
|
public static
the
|
#
getBaseUrl( )
Returns the base url to Rights.
Returns the base url to Rights.
Returns
the url to Rights.
|
public static
array
|
#
getAuthItemOptions( )
Returns the list of authorization item types.
Returns the list of authorization item types.
Returns
array the list of types.
|
public static
string
|
#
getAuthItemTypeName( integer $type )
Returns the name of a specific authorization item.
Returns the name of a specific authorization item.
Parameters
- $type
integer $type the item type (0: operation, 1: task, 2: role).
Returns
string the authorization item type name.
|
public static
string
|
#
getAuthItemTypeNamePlural( integer $type )
Returns the name of a specific authorization item in plural.
Returns the name of a specific authorization item in plural.
Parameters
- $type
integer $type the item type (0: operation, 1: task, 2: role).
Returns
string the authorization item type name.
|
public static
array
|
#
getAuthItemRoute( integer $type )
Returns the route to a specific authorization item list view.
Returns the route to a specific authorization item list view.
Parameters
- $type
integer $type the item type (0: operation, 1: task, 2: role).
Returns
array the route.
|
public static
array
|
#
getValidChildTypes( string $type )
Returns the valid child item types for a specific type.
Returns the valid child item types for a specific type.
Parameters
- $type
string $type the item type (0: operation, 1: task, 2: role).
Returns
array the valid types.
|
public static
array
|
#
getAuthItemSelectOptions( mixed $type = null, array $exclude = array() )
Returns the authorization item select options.
Returns the authorization item select options.
Parameters
- $type
mixed $type the item type (0: operation, 1: task, 2: role). Defaults to null, meaning
returning all items regardless of their type.
- $exclude
array $exclude the items to be excluded.
Returns
array the select options.
|
public static
array
|
#
getParentAuthItemSelectOptions( CAuthItem $parent, CAuthItem $type = null, array $exclude = array() )
Returns the valid authorization item select options for a model.
Returns the valid authorization item select options for a model.
Parameters
- $parent
mixed $parent the item type (0: operation, 1: task, 2: role). Defaults to null,
meaning returning all items regardless of their type.
- $type
CAuthItem $type the item for which to get the select options.
- $exclude
array $exclude the items to be excluded.
Returns
array the select options.
|
protected static
array
|
#
generateAuthItemSelectOptions( array $items, mixed $type )
Generates the authorization item select options.
Generates the authorization item select options.
Parameters
- $items
array $items the authorization items.
- $type
mixed $type the item type (0: operation, 1: task, 2: role).
Returns
array the select options.
|
public static
string
|
#
getDataCsrf( )
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 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.
|
public static
string
|
#
getCsrfParam( )
Returns the cross-site request forgery parameter for Ajax-requests. Null is
returned if csrf-validation is disabled.
Returns the cross-site request forgery parameter for Ajax-requests. Null is
returned if csrf-validation is disabled.
Returns
string the csrf parameter.
|
public static
string
|
#
powered( )
Returns
string a string that can be displayed on your Web page showing Powered-by-Rights
information.
|
public static
RightsModule
|
|
public static
RAuthorizer
|
|
public static
string
|
#
t( string $category, string $message, array $params = array(), string $source = null, string $language = null )
Translates a message to the specified language. Wrapper class for setting the
category correctly.
Translates a message to the specified language. Wrapper class for setting the
category correctly.
Parameters
- $category
string $category message category.
- $message
string $message the original message.
- $params
array $params parameters to be applied to the message using <span
class="php-keyword2">strtr</span> .
- $source
string $source which message source application component to use.
- $language
string $language the target language.
Returns
string the translated message.
|