PHP Trait Artesaos\Defender\Traits\HasDefender

Inheritance: use trait Artesaos\Defender\Traits\Users\HasRoles, use trait Artesaos\Defender\Traits\Users\HasPermissions
Afficher le fichier Open project: artesaos/defender

Méthodes publiques

Méthode Description
canDo ( string $permission, boolean $force = false ) : boolean Checks for permission If has superuser group automatically passes.
findById ( integer $id ) : Artesaos\Defender\Contracts\User Find a user by its id.
getAllPermissions ( boolean $force = false ) : Collection Retrieve all user permissions.
getRolesPermissions ( boolean $force = false ) : Collection Get permissions from database based on roles.
hasPermission ( string $permission, boolean $force = false ) : boolean Returns if the current user has the given permission.
hasPermissions ( array $permissions, boolean $strict = true, boolean $force = false ) : boolean Returns if the current user has all or one permission of the given array.
isSuperUser ( ) : boolean check has superuser role.
roleHasPermission ( string $permission, boolean $force = false ) : boolean Check if the user has the given permission using only his roles.

Méthodes protégées

Méthode Description
getFreshAllPermissions ( ) : Collection Get fresh permissions from database.
getFreshRolesPermissions ( ) : Collection Get fresh permissions from database based on roles.

Method Details

canDo() public méthode

Checks for permission If has superuser group automatically passes.
public canDo ( string $permission, boolean $force = false ) : boolean
$permission string
$force boolean
Résultat boolean

findById() public méthode

Find a user by its id.
public findById ( integer $id ) : Artesaos\Defender\Contracts\User
$id integer
Résultat Artesaos\Defender\Contracts\User

getAllPermissions() public méthode

Retrieve all user permissions.
public getAllPermissions ( boolean $force = false ) : Collection
$force boolean
Résultat Illuminate\Support\Collection

getFreshAllPermissions() protected méthode

Get fresh permissions from database.
protected getFreshAllPermissions ( ) : Collection
Résultat Illuminate\Support\Collection

getFreshRolesPermissions() protected méthode

Get fresh permissions from database based on roles.
protected getFreshRolesPermissions ( ) : Collection
Résultat Illuminate\Support\Collection

getRolesPermissions() public méthode

Get permissions from database based on roles.
public getRolesPermissions ( boolean $force = false ) : Collection
$force boolean
Résultat Illuminate\Support\Collection

hasPermission() public méthode

User permissions override role permissions.
public hasPermission ( string $permission, boolean $force = false ) : boolean
$permission string
$force boolean
Résultat boolean

hasPermissions() public méthode

User permissions override role permissions.
public hasPermissions ( array $permissions, boolean $strict = true, boolean $force = false ) : boolean
$permissions array Array of permissions
$strict boolean Check if has all permissions from array or one of them
$force boolean
Résultat boolean

isSuperUser() public méthode

check has superuser role.
public isSuperUser ( ) : boolean
Résultat boolean

roleHasPermission() public méthode

Check if the user has the given permission using only his roles.
public roleHasPermission ( string $permission, boolean $force = false ) : boolean
$permission string
$force boolean
Résultat boolean