PHP Class Silber\Bouncer\Database\Queries\Abilities

Show file Open project: JosephSilber/bouncer

Public Methods

Method Description
getForAuthority ( Model $authority, boolean $allowed = true ) : Illuminate\Database\Eloquent\Collection Get a list of the authority's abilities.

Protected Methods

Method Description
addRoleInheritCondition ( Builder $query, Model $authority, string $roles ) : Closure Add the role inheritence "where" clause to the given query.
getAuthorityConstraint ( Model $authority, boolean $allowed ) : Closure Get a constraint for abilities that have been granted to the given authority.
getAuthorityRoleConstraint ( Model $authority ) : Closure Get a constraint for roles that are assigned to the given authority.
getRoleConstraint ( Model $authority, boolean $allowed ) : Closure Get a constraint for abilities that have been granted to the given authority through a role.

Method Details

addRoleInheritCondition() protected method

Add the role inheritence "where" clause to the given query.
protected addRoleInheritCondition ( Builder $query, Model $authority, string $roles ) : Closure
$query Illuminate\Database\Query\Builder
$authority Illuminate\Database\Eloquent\Model
$roles string
return Closure

getAuthorityConstraint() protected method

Get a constraint for abilities that have been granted to the given authority.
protected getAuthorityConstraint ( Model $authority, boolean $allowed ) : Closure
$authority Illuminate\Database\Eloquent\Model
$allowed boolean
return Closure

getAuthorityRoleConstraint() protected method

Get a constraint for roles that are assigned to the given authority.
protected getAuthorityRoleConstraint ( Model $authority ) : Closure
$authority Illuminate\Database\Eloquent\Model
return Closure

getForAuthority() public method

Get a list of the authority's abilities.
public getForAuthority ( Model $authority, boolean $allowed = true ) : Illuminate\Database\Eloquent\Collection
$authority Illuminate\Database\Eloquent\Model
$allowed boolean
return Illuminate\Database\Eloquent\Collection

getRoleConstraint() protected method

Get a constraint for abilities that have been granted to the given authority through a role.
protected getRoleConstraint ( Model $authority, boolean $allowed ) : Closure
$authority Illuminate\Database\Eloquent\Model
$allowed boolean
return Closure