interface PermissionTemplateRepositoryInterface (View source)

Persistence for permission templates and the permission items they bundle.

Methods

int
addPermissionTemplate(array $details)

Add a permission template. Write through PermissionTemplateWriteService; it carries the content guard.

array
getPermissionsByTemplateId(int $templ_id = 0, bool $return_name_only = false)

Permissions available (template id 0) or assigned to one template.

bool
updatePermissionTemplateDetails(array $details)

Update permission template details. Write through PermissionTemplateWriteService; it carries the content guard.

array|false
getPermissionTemplateDetails(int $templ_id)

Name, description and type of a template.

bool
validateTemplateType(int $templ_id, string $expected_type)

Whether the template exists and has the expected type.

array
listPermissionTemplates(string|null $filter_type = null)

Every permission template, optionally filtered by type.

int|null
getMinimalPermissionTemplateId(string|null $templateType = null)

The template with the fewest permissions, excluding superuser templates.

PermissionTemplateDeleteResult
deletePermissionTemplate(int $id)

Delete a permission template and its items, unless a user or group still holds it.

Details

int addPermissionTemplate(array $details)

Add a permission template. Write through PermissionTemplateWriteService; it carries the content guard.

Parameters

array $details

Permission template details [templ_name,templ_descr,template_type,perm_id]

Return Value

int

The new template's id

array getPermissionsByTemplateId(int $templ_id = 0, bool $return_name_only = false)

Permissions available (template id 0) or assigned to one template.

Parameters

int $templ_id

Template ID, 0 for every permission

bool $return_name_only

Return names only instead of [id,name,descr] rows

Return Value

array

array of permissions [id,name,descr] or permission names [name]

bool updatePermissionTemplateDetails(array $details)

Update permission template details. Write through PermissionTemplateWriteService; it carries the content guard.

Parameters

array $details

Permission template details; an absent perm_id key leaves the permissions untouched

Return Value

bool

true on success, false otherwise

array|false getPermissionTemplateDetails(int $templ_id)

Name, description and type of a template.

Parameters

int $templ_id

Return Value

array|false

Template details or false if not found

bool validateTemplateType(int $templ_id, string $expected_type)

Whether the template exists and has the expected type.

Parameters

int $templ_id
string $expected_type

Return Value

bool

array listPermissionTemplates(string|null $filter_type = null)

Every permission template, optionally filtered by type.

Parameters

string|null $filter_type

Filter by template type ('user', 'group', or null for all)

Return Value

array

array of templates [id, name, descr, template_type]

int|null getMinimalPermissionTemplateId(string|null $templateType = null)

The template with the fewest permissions, excluding superuser templates.

Parameters

string|null $templateType

Restrict to 'user' or 'group' templates; null = no filter

Return Value

int|null

Template ID with minimal permissions, or null if none qualify

PermissionTemplateDeleteResult deletePermissionTemplate(int $id)

Delete a permission template and its items, unless a user or group still holds it.

Parameters

int $id

Return Value

PermissionTemplateDeleteResult