Trait Permissions
Trait for \MvcCore\Ext\Auths\Basics\User
and \MvcCore\Ext\Auths\Basics\Role
class. Trait contains:
- Instance property $permissions
with their public getters and setters to manipulate with permissions.
Methods summary
public
boolean
|
#
IsAllowed( string|string[] $permissionNameOrNames, boolean $allPermissionsRequired = TRUE )
Get TRUE if given permission string(s) is/are (all or some) allowed for user or user role.
FALSE otherwise. Permission name could contain asterisk char * in any place.
Get TRUE if given permission string(s) is/are (all or some) allowed for user or user role.
FALSE otherwise. Permission name could contain asterisk char * in any place.
Parameters
- $permissionNameOrNames
- $allPermissionsRequired
TRUE by default.
Returns
boolean
|
public
boolean
|
#
GetPermission( string $permissionName )
Get TRUE if given permission string is allowed for user or role. FALSE otherwise.
Get TRUE if given permission string is allowed for user or role. FALSE otherwise.
Parameters
Returns
boolean
|
public
MvcCore\Ext\Auths\Basics\User |MvcCore\Ext\Auths\Basics\Role
|
#
SetPermission( string $permissionName, boolean $allow = TRUE )
Set $permissionName string with $allow boolean to allow
or to disallow permission (with $allow = FALSE ) for user or role.
Set $permissionName string with $allow boolean to allow
or to disallow permission (with $allow = FALSE ) for user or role.
Parameters
- $permissionName
- Strings describing what is allowed/disallowed to do for user or role.
- $allow
TRUE by default.
Returns
|
public
string[]
&
|
#
GetPermissions( )
Get array of strings describing what is allowed to do for user or role.
Get array of strings describing what is allowed to do for user or role.
Returns
string[]
|
public
MvcCore\Ext\Auths\Basics\User |MvcCore\Ext\Auths\Basics\Role
|
#
SetPermissions( string|string[] $permissions )
Set array of strings describing what is allowed to do for user or role.
Set array of strings describing what is allowed to do for user or role.
Parameters
- $permissions
- The permissions string, separated by comma character or array of strings.
Returns
|