TrustLevelService
in package
Trust Level Service.
Manages user trust levels for access control.
Table of Contents
Methods
- canDownload() : bool
- Check if user can download.
- canViewRestricted() : bool
- Check if user can view restricted content.
- create() : int
- Create a new trust level.
- delete() : bool
- Delete trust level.
- getAllLevels() : Collection
- Get all trust levels.
- getByCode() : object|null
- Get trust level by code.
- getById() : object|null
- Get trust level by ID.
- getUserLevel() : int
- Get user's trust level numeric value.
- getUserTrustLevel() : object|null
- Get user's effective trust level.
- hasMinLevel() : bool
- Check if user has minimum trust level.
- update() : bool
- Update trust level.
Methods
canDownload()
Check if user can download.
public
canDownload(int $userId[, int|null $institutionId = null ]) : bool
Parameters
- $userId : int
- $institutionId : int|null = null
Return values
boolcanViewRestricted()
Check if user can view restricted content.
public
canViewRestricted(int $userId[, int|null $institutionId = null ]) : bool
Parameters
- $userId : int
- $institutionId : int|null = null
Return values
boolcreate()
Create a new trust level.
public
create(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
Return values
intdelete()
Delete trust level.
public
delete(int $id) : bool
Parameters
- $id : int
Return values
boolgetAllLevels()
Get all trust levels.
public
getAllLevels() : Collection
Return values
CollectiongetByCode()
Get trust level by code.
public
getByCode(string $code) : object|null
Parameters
- $code : string
Return values
object|nullgetById()
Get trust level by ID.
public
getById(int $id) : object|null
Parameters
- $id : int
Return values
object|nullgetUserLevel()
Get user's trust level numeric value.
public
getUserLevel(int $userId[, int|null $institutionId = null ]) : int
Parameters
- $userId : int
- $institutionId : int|null = null
Return values
intgetUserTrustLevel()
Get user's effective trust level.
public
getUserTrustLevel(int $userId[, int|null $institutionId = null ]) : object|null
Parameters
- $userId : int
- $institutionId : int|null = null
Return values
object|nullhasMinLevel()
Check if user has minimum trust level.
public
hasMinLevel(int $userId, int $minLevel[, int|null $institutionId = null ]) : bool
Parameters
- $userId : int
- $minLevel : int
- $institutionId : int|null = null
Return values
boolupdate()
Update trust level.
public
update(int $id, array<string|int, mixed> $data) : bool
Parameters
- $id : int
- $data : array<string|int, mixed>