PHP 클래스 BookStack\Services\PermissionService

파일 보기 프로젝트 열기: ssddanbrown/bookstack 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$book
$chapter
$page

보호된 프로퍼티들

프로퍼티 타입 설명
$currentAction
$currentUserModel
$entityCache
$isAdminUser
$jointPermission
$role
$userRoles

공개 메소드들

메소드 설명
__construct ( JointPermission $jointPermission, Book $book, Chapter $chapter, Page $page, Role $role ) PermissionService constructor.
buildJointPermissionForRole ( Role $role ) Build the entity jointPermissions for a particular role.
buildJointPermissions ( ) Re-generate all entity permission from scratch.
buildJointPermissionsForEntities ( Collection $entities ) Rebuild the entity jointPermissions for a collection of entities.
buildJointPermissionsForEntity ( Entity $entity ) Rebuild the entity jointPermissions for a particular entity.
checkIfRestrictionsSet ( Entity $entity, $action ) : boolean | mixed Check if an entity has restrictions set on itself or its parent tree.
checkOwnableUserAccess ( Ownable $ownable, $permission ) : boolean Checks if an entity has a restriction set upon it.
deleteJointPermissionsForEntity ( Entity $entity ) Delete the entity jointPermissions for a particular entity.
deleteJointPermissionsForRole ( Role $role ) 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.

보호된 메소드들

메소드 설명
createJointPermissionData ( Entity $entity, Role $role, $action ) : array Create entity permission data for an entity and role for a particular action.
createJointPermissionDataArray ( Entity $entity, Role $role, $action, $permissionAll, $permissionOwn ) : array Create an array of data with the information of an entity jointPermissions.
createManyJointPermissions ( Collection $entities, Collection $roles ) Create & Save entity jointPermissions for many entities and jointPermissions.
deleteManyJointPermissionsForEntities ( Entity[] $entities ) Delete all of the entity jointPermissions for a list of entities.
deleteManyJointPermissionsForRoles ( Role[] $roles ) 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 ) : Book Get a book via ID, Checks local cache
getChapter ( $chapterId ) : Book 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

비공개 메소드들

메소드 설명
clean ( ) Clean the cached user elements.
currentUser ( ) : User Get the current user
isAdmin ( ) : boolean Check if the current user is an admin.

메소드 상세

__construct() 공개 메소드

PermissionService constructor.
public __construct ( JointPermission $jointPermission, Book $book, Chapter $chapter, Page $page, Role $role )
$jointPermission BookStack\JointPermission
$book BookStack\Book
$chapter BookStack\Chapter
$page BookStack\Page
$role BookStack\Role

buildJointPermissionForRole() 공개 메소드

Build the entity jointPermissions for a particular role.
public buildJointPermissionForRole ( Role $role )
$role BookStack\Role

buildJointPermissions() 공개 메소드

Re-generate all entity permission from scratch.

buildJointPermissionsForEntities() 공개 메소드

Rebuild the entity jointPermissions for a collection of entities.
public buildJointPermissionsForEntities ( Collection $entities )
$entities Illuminate\Support\Collection

buildJointPermissionsForEntity() 공개 메소드

Rebuild the entity jointPermissions for a particular entity.
public buildJointPermissionsForEntity ( Entity $entity )
$entity BookStack\Entity

checkIfRestrictionsSet() 공개 메소드

Check if an entity has restrictions set on itself or its parent tree.
public checkIfRestrictionsSet ( Entity $entity, $action ) : boolean | mixed
$entity BookStack\Entity
$action
리턴 boolean | mixed

checkOwnableUserAccess() 공개 메소드

Checks if an entity has a restriction set upon it.
public checkOwnableUserAccess ( Ownable $ownable, $permission ) : boolean
$ownable BookStack\Ownable
$permission
리턴 boolean

createJointPermissionData() 보호된 메소드

Create entity permission data for an entity and role for a particular action.
protected createJointPermissionData ( Entity $entity, Role $role, $action ) : array
$entity BookStack\Entity
$role BookStack\Role
$action
리턴 array

createJointPermissionDataArray() 보호된 메소드

Used to build data for bulk insertion.
protected createJointPermissionDataArray ( Entity $entity, Role $role, $action, $permissionAll, $permissionOwn ) : array
$entity BookStack\Entity
$role BookStack\Role
$action
$permissionAll
$permissionOwn
리턴 array

createManyJointPermissions() 보호된 메소드

Create & Save entity jointPermissions for many entities and jointPermissions.
protected createManyJointPermissions ( Collection $entities, Collection $roles )
$entities Illuminate\Support\Collection
$roles Illuminate\Support\Collection

deleteJointPermissionsForEntity() 공개 메소드

Delete the entity jointPermissions for a particular entity.
public deleteJointPermissionsForEntity ( Entity $entity )
$entity BookStack\Entity

deleteJointPermissionsForRole() 공개 메소드

Delete the entity jointPermissions attached to a particular role.
public deleteJointPermissionsForRole ( Role $role )
$role BookStack\Role

deleteManyJointPermissionsForEntities() 보호된 메소드

Delete all of the entity jointPermissions for a list of entities.
protected deleteManyJointPermissionsForEntities ( Entity[] $entities )
$entities BookStack\Entity[]

deleteManyJointPermissionsForRoles() 보호된 메소드

Delete all of the entity jointPermissions for a list of entities.
protected deleteManyJointPermissionsForRoles ( Role[] $roles )
$roles BookStack\Role[]

enforceBookRestrictions() 공개 메소드

Add restrictions to a book query.
public enforceBookRestrictions ( $query, string $action = 'view' ) : mixed
$query
$action string
리턴 mixed

enforceChapterRestrictions() 공개 메소드

Add on permission restrictions to a chapter query.
public enforceChapterRestrictions ( $query, string $action = 'view' ) : mixed
$query
$action string
리턴 mixed

enforceEntityRestrictions() 공개 메소드

Add restrictions for a generic entity
public enforceEntityRestrictions ( $query, string $action = 'view' ) : mixed
$query
$action string
리턴 mixed

enforcePageRestrictions() 공개 메소드

Add restrictions for a page query
public enforcePageRestrictions ( $query, string $action = 'view' ) : mixed
$query
$action string
리턴 mixed

entityRestrictionQuery() 보호된 메소드

The general query filter to remove all entities that the current user does not have access to.
protected entityRestrictionQuery ( $query ) : mixed
$query
리턴 mixed

filterRelatedPages() 공개 메소드

Filters pages that are a direct relation to another item.
public filterRelatedPages ( $query, $tableName, $entityIdColumn ) : mixed
$query
$tableName
$entityIdColumn
리턴 mixed

filterRestrictedEntityRelations() 공개 메소드

Filter items that have entities set a a polymorphic relation.
public filterRestrictedEntityRelations ( $query, string $tableName, string $entityIdColumn, string $entityTypeColumn ) : mixed
$query
$tableName string
$entityIdColumn string
$entityTypeColumn string
리턴 mixed

getActions() 보호된 메소드

Get the actions related to an entity.
protected getActions ( $entity ) : array
$entity
리턴 array

getBook() 보호된 메소드

Get a book via ID, Checks local cache
protected getBook ( $bookId ) : Book
$bookId
리턴 BookStack\Book

getChapter() 보호된 메소드

Get a chapter via ID, Checks local cache
protected getChapter ( $chapterId ) : Book
$chapterId
리턴 BookStack\Book

getRoles() 보호된 메소드

Get the roles for the current user;
protected getRoles ( ) : array | boolean
리턴 array | boolean

readyEntityCache() 보호된 메소드

Prepare the local entity cache and ensure it's empty
protected readyEntityCache ( )

프로퍼티 상세

$book 공개적으로 프로퍼티

public $book

$chapter 공개적으로 프로퍼티

public $chapter

$currentAction 보호되어 있는 프로퍼티

protected $currentAction

$currentUserModel 보호되어 있는 프로퍼티

protected $currentUserModel

$entityCache 보호되어 있는 프로퍼티

protected $entityCache

$isAdminUser 보호되어 있는 프로퍼티

protected $isAdminUser

$jointPermission 보호되어 있는 프로퍼티

protected $jointPermission

$page 공개적으로 프로퍼티

public $page

$role 보호되어 있는 프로퍼티

protected $role

$userRoles 보호되어 있는 프로퍼티

protected $userRoles