UserRolePrivilegeGridService
in package
implements
ServiceInterface
Data source of the flat privilege overview DataGrid.
The overview is read-only plus a group picker; group management lives in
PrivilegeGroupPresenter. Filtering, ordering and paging are delegated to
api/system/user-role-privilege/get-all, so SQL WHERE/ORDER/LIMIT/COUNT run in
UserRolePrivilegeMatrixManager::findPrivileges().
Tags
Table of Contents
Interfaces
- ServiceInterface
- Contract of the admin service layer.
Constants
- ENDPOINT : mixed = 'api/system/user-role-privilege'
Properties
- $bridge : ApiBridge
- $languageContext : LanguageContext
- $totalCount : int|null
Methods
- __construct() : mixed
- delete() : Result
- Defensive stub: the overview is read-only, so nothing calls delete.
- find() : T|null
- Finds one entity by id.
- findAll() : UserRolePrivilege>, 1: int}
- Finds all entities matching the criteria.
- findBy() : T|null
- Finds one entity by filters.
-
getGroupRows()
: array<int, array{id: int, key: string, branch: string, sort: int, name: string, relations: array
}> - Returns the Multiplier rows of the group form (`PrivilegeGroupPresenter`).
- getTotalCount() : int|null
-
saveGroupRows()
: array{ok: bool, error: ?string, ids: list
} - Saves the group Multiplier set-based and atomically (see the Api manager docblock).
- setGroup() : bool
- Moves the privilege to another group (picker).
- currentLangId() : int|null
- Same logic as `AdminFormHelpersTrait::currentLangId()`, outside a presenter.
- lastSegment() : string
- resolveOrder() : array{0: string, 1: string}
- rowToEntity() : UserRolePrivilege
- translateFilters() : array{branch?: string, key?: string, groupId?: false}
- Translates the grid's Core Filter objects into flat arrays for Api `findPrivileges()`.
Constants
ENDPOINT
private
mixed
ENDPOINT
= 'api/system/user-role-privilege'
Properties
$bridge read-only
private
ApiBridge
$bridge
$languageContext read-only
private
LanguageContext
$languageContext
$totalCount
private
int|null
$totalCount
= 0
Methods
__construct()
public
__construct(ApiBridge $bridge, LanguageContext $languageContext) : mixed
Parameters
- $bridge : ApiBridge
- $languageContext : LanguageContext
delete()
Defensive stub: the overview is read-only, so nothing calls delete.
public
delete(int|array<int, int> $id) : Result
Parameters
- $id : int|array<int, int>
Return values
Resultfind()
Finds one entity by id.
public
find(int $id[, string|array<int|string, mixed> $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
- $id : int
- $includes : string|array<int|string, mixed> = []
- $useCache : bool|null = null
Return values
T|nullfindAll()
Finds all entities matching the criteria.
public
findAll([array<int, mixed>|null $filters = [] ][, array<string, bool>|null $orderBys = null ][, int|null $offset = null ][, int|null $limit = null ][, array<int|string, mixed>|null $columns = null ][, bool $computeTotalCount = false ][, string|array<int|string, mixed> $includes = [] ][, bool|null $useCache = null ]) : UserRolePrivilege>, 1: int}
Parameters
- $filters : array<int, mixed>|null = []
-
Core Filter objects of the grid
- $orderBys : array<string, bool>|null = null
- $offset : int|null = null
- $limit : int|null = null
- $columns : array<int|string, mixed>|null = null
- $computeTotalCount : bool = false
- $includes : string|array<int|string, mixed> = []
- $useCache : bool|null = null
Return values
UserRolePrivilege>, 1: int} —[items, totalCount]
findBy()
Finds one entity by filters.
public
findBy([array<int, mixed>|null $filters = [] ][, string|array<int|string, mixed>|null $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
- $filters : array<int, mixed>|null = []
- $includes : string|array<int|string, mixed>|null = []
- $useCache : bool|null = null
Return values
T|nullgetGroupRows()
Returns the Multiplier rows of the group form (`PrivilegeGroupPresenter`).
public
getGroupRows(int|null $groupId) : array<int, array{id: int, key: string, branch: string, sort: int, name: string, relations: array}>
Parameters
- $groupId : int|null
Return values
array<int, array{id: int, key: string, branch: string, sort: int, name: string, relations: arraygetTotalCount()
public
getTotalCount() : int|null
Return values
int|nullsaveGroupRows()
Saves the group Multiplier set-based and atomically (see the Api manager docblock).
public
saveGroupRows(int|null $groupId, array<int, array{id: ?int, key: string, sort: int, roles: array}> $rows, array<int, int> $deleteIds, int|null $ownerRoleId) : array{ok: bool, error: ?string, ids: list}
Parameters
- $groupId : int|null
-
$rows
: array<int, array{id: ?int, key: string, sort: int, roles: array
}> - $deleteIds : array<int, int>
- $ownerRoleId : int|null
Return values
array{ok: bool, error: ?string, ids: listsetGroup()
Moves the privilege to another group (picker).
public
setGroup(int $id, int|null $groupId) : bool
Parameters
- $id : int
- $groupId : int|null
Return values
boolcurrentLangId()
Same logic as `AdminFormHelpersTrait::currentLangId()`, outside a presenter.
private
currentLangId() : int|null
Return values
int|nulllastSegment()
private
lastSegment(string $field) : string
Parameters
- $field : string
Return values
stringresolveOrder()
private
resolveOrder(array<string, bool> $orderBys) : array{0: string, 1: string}
Parameters
- $orderBys : array<string, bool>
Return values
array{0: string, 1: string}rowToEntity()
private
rowToEntity(array<string|int, mixed> $row) : UserRolePrivilege
Parameters
- $row : array<string|int, mixed>
Return values
UserRolePrivilegetranslateFilters()
Translates the grid's Core Filter objects into flat arrays for Api `findPrivileges()`.
private
translateFilters(array<int, mixed> $filters) : array{branch?: string, key?: string, groupId?: false}
Supports key (LIKE, also through the group; the Api handles the join on g.key),
branch (equality) and a synthetic unassigned (group_id IS NULL), which is all
the grid offers.
Parameters
- $filters : array<int, mixed>