UserPermissionsService

Type
Class
Namespace
Craft
Inherits
Craft\UserPermissionsService » Craft\BaseApplicationComponent » CApplicationComponent » CComponent
Implements
IApplicationComponent
Since
1.0

Class UserPermissionsService

See also http://craftcms.com

View source

Public Properties

PropertyDescription
$behaviorsarray – The behaviors that should be attached to this component.

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__get()Returns a property value, an event handler list or a behavior based on its name.
__isset()Checks if a property value is null.
__set()Sets value of a component property.
__unset()Sets a component property to be null.
asa()Returns the named behavior object.
attachBehavior()Attaches a behavior to this component.
attachBehaviors()Attaches a list of behaviors to the component.
attachEventHandler()Attaches an event handler to an event.
canGetProperty()Determines whether a property can be read.
canSetProperty()Determines whether a property can be set.
detachBehavior()Detaches a behavior from the component.
detachBehaviors()Detaches all behaviors from the component.
detachEventHandler()Detaches an existing event handler.
disableBehavior()Disables an attached behavior.
disableBehaviors()Disables all behaviors attached to this component.
doesGroupHavePermission()Returns whether a given user group has a given permission.
doesUserHavePermission()Returns whether a given user has a given permission.
enableBehavior()Enables an attached behavior.
enableBehaviors()Enables all behaviors attached to this component.
evaluateExpression()Evaluates a PHP expression or callback under the context of this component.
getAllPermissions()Returns all of the known permissions, sorted by category.
getAssignablePermissions()Returns the permissions that the current user is allowed to assign to another user.
getEventHandlers()Returns the list of attached event handlers for an event.
getGroupPermissionsByUserId()Returns all of the group permissions a given user has.
getIsInitialized()Checks if this application component has been initialized.
getPermissionsByGroupId()Returns all of a given user group's permissions.
getPermissionsByUserId()Returns all of a given user's permissions.
hasEvent()Determines whether an event is defined.
hasEventHandler()Checks whether the named event has attached handlers.
hasProperty()Determines whether a property is defined.
init()Initializes the application component.
isInitialized()Checks if this application component has been initialized yet, or not.
raiseEvent()Raises an event.
saveGroupPermissions()Saves new permissions for a user group.
saveUserPermissions()Saves new permissions for a user.

doesGroupHavePermission()

Returns whether a given user group has a given permission.

View source

Arguments

Returns

boolean

Signature

public boolean doesGroupHavePermission ( $groupId, $checkPermission )

doesUserHavePermission()

Returns whether a given user has a given permission.

View source

Arguments

Returns

boolean

Signature

public boolean doesUserHavePermission ( $userId, $checkPermission )

getAllPermissions()

Returns all of the known permissions, sorted by category.

View source

Returns

array

Signature

public array getAllPermissions ( )

getAssignablePermissions()

Returns the permissions that the current user is allowed to assign to another user.

View source

Arguments

  • $user (Craft\UserModel, null) – The recipient of the permissions. If set, their current permissions will be included as well.

Returns

array

Signature

public array getAssignablePermissions ( Craft\UserModel $user = null )

getGroupPermissionsByUserId()

Returns all of the group permissions a given user has.

View source

Arguments

Returns

array

Signature

public array getGroupPermissionsByUserId ( $userId )

getPermissionsByGroupId()

Returns all of a given user group's permissions.

View source

Arguments

Returns

array

Signature

public array getPermissionsByGroupId ( $groupId )

getPermissionsByUserId()

Returns all of a given user's permissions.

View source

Arguments

Returns

array

Signature

public array getPermissionsByUserId ( $userId )

saveGroupPermissions()

Saves new permissions for a user group.

View source

Arguments

Returns

boolean

Signature

public boolean saveGroupPermissions ( $groupId, $permissions )

saveUserPermissions()

Saves new permissions for a user.

View source

Arguments

Returns

boolean

Signature

public boolean saveUserPermissions ( $userId, $permissions )