MetaFox

PermissionRegistrar
in package
implements PermissionRegistrar

Table of Contents

Interfaces

PermissionRegistrar
Interface PermissionRegistrar.

Properties

$cacheExpirationTime  : DateInterval|int
$cacheKey  : string
$pivotPermission  : string
$pivotRole  : string
$teams  : bool
$teamsKey  : string
$cache  : Repository
$cacheManager  : CacheManager
$permisionWildcards  : array<string, mixed>
$permissionClass  : string
$permissions  : Collection
$permissionValues  : array<string, mixed>
$permissionViaRole  : array<int, array<string, bool>>
[ 1 => [ 'feed.view' => true, 'feed.create' => true, ] ].
$roleClass  : string
$teamId  : int|string
$alias  : array<string|int, mixed>
$cachedRoles  : array<string|int, mixed>
$except  : array<string|int, mixed>
$userRoleMap  : array<string|int, mixed>

Methods

__construct()  : mixed
PermissionRegistrar constructor.
clearClassPermissions()  : mixed
Clear class permissions.
forgetCachedPermissions()  : mixed
Flush the cache.
getCacheRepository()  : Repository
getCacheStore()  : Store
getPermission()  : Permission|null
Get the permission based on name.
getPermissionClass()  : Permission
Get an instance of the permission class.
getPermissions()  : Collection
Get the permissions based on the passed params.
getPermissionsTeamId()  : int|string
getPermissionViaRole()  : bool|null
getRoleClass()  : Role
Get an instance of the role class.
initializeCache()  : mixed
loadPermissionsViaRole()  : mixed
registerPermissions()  : bool
Register the permission check method on the gate.
setPermissionClass()  : mixed
setPermissionsTeamId()  : mixed
Set the team id for teams/groups support, this id is used when querying permissions/roles.
setPermissionViaRole()  : void
setRoleClass()  : mixed
getCacheStoreFromConfig()  : Repository
getPermissionsWithRoles()  : Collection
readPermisionFromDb()  : mixed
aliasedArray()  : array<string|int, mixed>
Changes array keys with alias.
aliasModelFields()  : void
Array for cache alias.
getHydratedPermissionCollection()  : mixed
getHydratedRoleCollection()  : mixed
getSerializedPermissionsForCache()  : mixed
getSerializedRoleRelation()  : mixed
hydrateRolesCache()  : mixed
loadPermissions()  : mixed
Load permissions from cache This get cache and turns array into \Illuminate\Database\Eloquent\Collection.

Properties

$permissionViaRole

[ 1 => [ 'feed.view' => true, 'feed.create' => true, ] ].

protected array<int, array<string, bool>> $permissionViaRole = []

Methods

__construct()

PermissionRegistrar constructor.

public __construct(CacheManager $cacheManager) : mixed
Parameters
$cacheManager : CacheManager

clearClassPermissions()

Clear class permissions.

public clearClassPermissions() : mixed

This is only intended to be called by the PermissionServiceProvider on boot, so that long-running instances like Swoole don't keep old data in memory.

forgetCachedPermissions()

Flush the cache.

public forgetCachedPermissions() : mixed

getCacheRepository()

public getCacheRepository() : Repository
Return values
Repository

getPermission()

Get the permission based on name.

public getPermission(string $name) : Permission|null
Parameters
$name : string
Return values
Permission|null

getPermissionClass()

Get an instance of the permission class.

public getPermissionClass() : Permission
Return values
Permission

getPermissions()

Get the permissions based on the passed params.

public getPermissions([array<string|int, mixed> $params = [] ][, bool $onlyOne = false ]) : Collection
Parameters
$params : array<string|int, mixed> = []
$onlyOne : bool = false
Return values
Collection

getPermissionsTeamId()

public getPermissionsTeamId() : int|string
Return values
int|string

getPermissionViaRole()

public getPermissionViaRole(User $user, string $permission) : bool|null
Parameters
$user : User
$permission : string
Return values
bool|null

getRoleClass()

Get an instance of the role class.

public getRoleClass() : Role
Return values
Role

registerPermissions()

Register the permission check method on the gate.

public registerPermissions() : bool

We resolve the Gate fresh here, for benefit of long-running instances.

Return values
bool

setPermissionClass()

public setPermissionClass(mixed $permissionClass) : mixed
Parameters
$permissionClass : mixed

setPermissionsTeamId()

Set the team id for teams/groups support, this id is used when querying permissions/roles.

public setPermissionsTeamId(int|string|Model $id) : mixed
Parameters
$id : int|string|Model

setPermissionViaRole()

public setPermissionViaRole(User $user, string $permission, bool $value) : void
Parameters
$user : User
$permission : string
$value : bool

setRoleClass()

public setRoleClass(mixed $roleClass) : mixed
Parameters
$roleClass : mixed

getCacheStoreFromConfig()

protected getCacheStoreFromConfig() : Repository
Return values
Repository

getPermissionsWithRoles()

protected getPermissionsWithRoles() : Collection
Return values
Collection

aliasedArray()

Changes array keys with alias.

private aliasedArray(mixed $model) : array<string|int, mixed>
Parameters
$model : mixed
Return values
array<string|int, mixed>

aliasModelFields()

Array for cache alias.

private aliasModelFields([mixed $newKeys = [] ]) : void
Parameters
$newKeys : mixed = []

getHydratedPermissionCollection()

private getHydratedPermissionCollection() : mixed

getHydratedRoleCollection()

private getHydratedRoleCollection(array<string|int, mixed> $roles) : mixed
Parameters
$roles : array<string|int, mixed>

getSerializedPermissionsForCache()

private getSerializedPermissionsForCache() : mixed

getSerializedRoleRelation()

private getSerializedRoleRelation(mixed $permission) : mixed
Parameters
$permission : mixed

loadPermissions()

Load permissions from cache This get cache and turns array into \Illuminate\Database\Eloquent\Collection.

private loadPermissions() : mixed

        
On this page

Search results