Nos\User\
Permission
¶This class checks the permissions for the current logged in user.
When multiple roles are enable, if any role has the requested permission, it means the user is authorised to do it.
Nos\User\Permission::
check
($permission_name, $category_key = null, $allow_empty = false)¶Alias to Nos\User\Permission::exists
Nos\User\Permission::
exists
($permission_name, $category_key = null, $allow_empty = false)¶Check whether a permissions exists (against all the roles of the current logged in user).
Parameters: |
|
---|---|
Returns bool: |
|
Nos\User\Permission::
existsOrEmpty
($permission_name, $category_key = null, $allow_empty = false)¶Alias to Nos\User\Permission::exists
with the optional parameter $alowEmpty = true
.
Parameters: |
|
---|---|
Returns bool: |
|
Nos\User\Permission::
isAllowed
($permission_name, $allow_empty = false)¶Check against a binary permission (without categories) against all the roles of the current logged in user.
Parameters: |
|
---|---|
Returns bool: |
|
Nos\User\Permission::
atLeast
($permission_name, $threshold, $value_when_empty = 0)¶Check against a numeric / range permission (for all the roles of the current logged in user).
You can use string
for the 2nd and 3rd parameters, they will be casted to (int)
. i.e. '2_write' === 2
.
Parameters: |
|
---|---|
Returns bool: |
|
Nos\User\Permission::
atMost
($permission_name, $threshold, $value_when_empty = 0)¶Check against a numeric / range permission (for all the roles of the current logged in user).
You can use string
for the 2nd and 3rd parameters, they will be casted to (int)
. i.e. '2_write' === 2
.
Parameters: |
|
---|---|
Returns bool: |
|
Nos\User\Permission::
listPermissionCategories
($permission_name)¶List all the categories of a given permission name (merged values from all the roles of the current logged in user).
Returns an array of string or false
when access is denied, or the permission name does not exists.
Parameters: |
|
---|---|
Returns array|false: | |
An array containing the list of categories (values) for the requested permission name |
Nos\User\Permission::
isApplicationAuthorised
($application_name)¶Check whether a user can access a particular application
Parameters: |
|
---|
Nos\User\Permission::
contexts
¶See also
Returns an array of all the contexts the user can access.
Nos\User\Permission::
locales
¶See also
Returns an array of all the locales the user can access.
Nos\User\Permission::
sites
¶See also
Returns an array of all the sites the user can access.