Property | Type | Description | |
---|---|---|---|
$book | |||
$chapter | |||
$page |
Property | Type | Description | |
---|---|---|---|
$currentAction | |||
$currentUserModel | |||
$entityCache | |||
$isAdminUser | |||
$jointPermission | |||
$role | |||
$userRoles |
Method | Description | |
---|---|---|
__construct ( |
PermissionService constructor. | |
buildJointPermissionForRole ( |
Build the entity jointPermissions for a particular role. | |
buildJointPermissions ( ) | Re-generate all entity permission from scratch. | |
buildJointPermissionsForEntities ( |
Rebuild the entity jointPermissions for a collection of entities. | |
buildJointPermissionsForEntity ( |
Rebuild the entity jointPermissions for a particular entity. | |
checkIfRestrictionsSet ( |
Check if an entity has restrictions set on itself or its parent tree. | |
checkOwnableUserAccess ( |
Checks if an entity has a restriction set upon it. | |
deleteJointPermissionsForEntity ( |
Delete the entity jointPermissions for a particular entity. | |
deleteJointPermissionsForRole ( |
Delete the entity jointPermissions attached to a particular role. | |
enforceBookRestrictions ( $query, string $action = 'view' ) : mixed | Add restrictions to a book query. | |
enforceChapterRestrictions ( $query, string $action = 'view' ) : mixed | Add on permission restrictions to a chapter query. | |
enforceEntityRestrictions ( $query, string $action = 'view' ) : mixed | Add restrictions for a generic entity | |
enforcePageRestrictions ( $query, string $action = 'view' ) : mixed | Add restrictions for a page query | |
filterRelatedPages ( $query, $tableName, $entityIdColumn ) : mixed | Filters pages that are a direct relation to another item. | |
filterRestrictedEntityRelations ( $query, string $tableName, string $entityIdColumn, string $entityTypeColumn ) : mixed | Filter items that have entities set a a polymorphic relation. |
Method | Description | |
---|---|---|
createJointPermissionData ( |
Create entity permission data for an entity and role for a particular action. | |
createJointPermissionDataArray ( |
Create an array of data with the information of an entity jointPermissions. | |
createManyJointPermissions ( |
Create & Save entity jointPermissions for many entities and jointPermissions. | |
deleteManyJointPermissionsForEntities ( |
Delete all of the entity jointPermissions for a list of entities. | |
deleteManyJointPermissionsForRoles ( |
Delete all of the entity jointPermissions for a list of entities. | |
entityRestrictionQuery ( $query ) : mixed | The general query filter to remove all entities that the current user does not have access to. | |
getActions ( $entity ) : array | Get the actions related to an entity. | |
getBook ( $bookId ) : |
Get a book via ID, Checks local cache | |
getChapter ( $chapterId ) : |
Get a chapter via ID, Checks local cache | |
getRoles ( ) : array | boolean | Get the roles for the current user; | |
readyEntityCache ( ) | Prepare the local entity cache and ensure it's empty |
Method | Description | |
---|---|---|
clean ( ) | Clean the cached user elements. | |
currentUser ( ) : |
Get the current user | |
isAdmin ( ) : boolean | Check if the current user is an admin. |
public __construct ( |
||
$jointPermission | ||
$book | ||
$chapter | ||
$page | ||
$role |
public buildJointPermissionForRole ( |
||
$role |
public buildJointPermissions ( ) |
public buildJointPermissionsForEntities ( |
||
$entities |
public buildJointPermissionsForEntity ( |
||
$entity |
public checkIfRestrictionsSet ( |
||
$entity | ||
$action | ||
return | boolean | mixed |
public checkOwnableUserAccess ( |
||
$ownable | ||
$permission | ||
return | boolean |
protected createJointPermissionData ( |
||
$entity | ||
$role | ||
$action | ||
return | array |
protected createJointPermissionDataArray ( |
||
$entity | ||
$role | ||
$action | ||
$permissionAll | ||
$permissionOwn | ||
return | array |
protected createManyJointPermissions ( |
||
$entities | ||
$roles |
public deleteJointPermissionsForEntity ( |
||
$entity |
public deleteJointPermissionsForRole ( |
||
$role |
protected deleteManyJointPermissionsForEntities ( |
||
$entities |
protected deleteManyJointPermissionsForRoles ( |
||
$roles |
public enforceBookRestrictions ( $query, string $action = 'view' ) : mixed | ||
$query | ||
$action | string | |
return | mixed |
public enforceChapterRestrictions ( $query, string $action = 'view' ) : mixed | ||
$query | ||
$action | string | |
return | mixed |
public enforceEntityRestrictions ( $query, string $action = 'view' ) : mixed | ||
$query | ||
$action | string | |
return | mixed |
public enforcePageRestrictions ( $query, string $action = 'view' ) : mixed | ||
$query | ||
$action | string | |
return | mixed |
protected entityRestrictionQuery ( $query ) : mixed | ||
$query | ||
return | mixed |
public filterRelatedPages ( $query, $tableName, $entityIdColumn ) : mixed | ||
$query | ||
$tableName | ||
$entityIdColumn | ||
return | mixed |
protected getActions ( $entity ) : array | ||
$entity | ||
return | array |
protected getBook ( $bookId ) : |
||
$bookId | ||
return |
protected getChapter ( $chapterId ) : |
||
$chapterId | ||
return |
protected readyEntityCache ( ) |