PHP Class BookStack\Repos\PermissionsRepo

Datei anzeigen Open project: ssddanbrown/bookstack

Protected Properties

Property Type Description
$permission
$permissionService
$role
$systemRoles

Public Methods

Method Description
__construct ( RolePermission $permission, Role $role, PermissionService $permissionService ) PermissionsRepo constructor.
assignRolePermissions ( Role $role, array $permissionNameArray = [] ) Assign an list of permission names to an role.
deleteRole ( $roleId, $migrateRoleId ) Delete a role from the system.
getAllRoles ( ) : Illuminate\Database\Eloquent\Collection | static[] Get all the user roles from the system.
getAllRolesExcept ( Role $role ) : mixed Get all the roles except for the provided one.
getRoleById ( $id ) : mixed Get a role via its ID.
saveNewRole ( array $roleData ) : Role Save a new role into the system.
updateRole ( $roleId, $roleData ) Updates an existing role.

Method Details

__construct() public method

PermissionsRepo constructor.
public __construct ( RolePermission $permission, Role $role, PermissionService $permissionService )
$permission BookStack\RolePermission
$role BookStack\Role
$permissionService BookStack\Services\PermissionService

assignRolePermissions() public method

Assign an list of permission names to an role.
public assignRolePermissions ( Role $role, array $permissionNameArray = [] )
$role BookStack\Role
$permissionNameArray array

deleteRole() public method

Check it's not an admin role or set as default before deleting. If an migration Role ID is specified the users assign to the current role will be added to the role of the specified id.
public deleteRole ( $roleId, $migrateRoleId )
$roleId
$migrateRoleId

getAllRoles() public method

Get all the user roles from the system.
public getAllRoles ( ) : Illuminate\Database\Eloquent\Collection | static[]
return Illuminate\Database\Eloquent\Collection | static[]

getAllRolesExcept() public method

Get all the roles except for the provided one.
public getAllRolesExcept ( Role $role ) : mixed
$role BookStack\Role
return mixed

getRoleById() public method

Get a role via its ID.
public getRoleById ( $id ) : mixed
$id
return mixed

saveNewRole() public method

Save a new role into the system.
public saveNewRole ( array $roleData ) : Role
$roleData array
return BookStack\Role

updateRole() public method

Ensure Admin role always has all permissions.
public updateRole ( $roleId, $roleData )
$roleId
$roleData

Property Details

$permission protected_oe property

protected $permission

$permissionService protected_oe property

protected $permissionService

$role protected_oe property

protected $role

$systemRoles protected_oe property

protected $systemRoles