DbPermissionTemplateRepository
final class DbPermissionTemplateRepository implements PermissionTemplateRepositoryInterface (View source)
SQL persistence for permission templates in perm_templ and their perm_items links in perm_templ_items.
Methods
Add a Permission Template
Get List of Permissions
Update permission template details
Get name and description of template from Template ID
Validate that a template has the expected type
Get a list of all available permission templates
Get the permission template with the fewest permissions assigned.
Delete a permission template and its items, unless a user or group still holds it.
Details
__construct($db, ConfigurationInterface $config)
No description
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)
Get List of Permissions
Get a list of permissions that are available. If first argument is "0", it should return all available permissions. If the first argument is > "0", it should return the permissions assigned to that particular template only. If second argument is true, only the permission names are returned.
bool
updatePermissionTemplateDetails(array $details)
Update permission template details
Write through PermissionTemplateWriteService; it carries the content guard.
array|false
getPermissionTemplateDetails(int $templ_id)
Get name and description of template from Template ID
bool
validateTemplateType(int $templ_id, string $expected_type)
Validate that a template has the expected type
array
listPermissionTemplates(string|null $filter_type = null)
Get a list of all available permission templates
int|null
getMinimalPermissionTemplateId(string|null $templateType = null)
Get the permission template with the fewest permissions assigned.
Useful for setting a secure default when creating new users or groups.
Superuser templates are excluded outright: user_is_ueberuser is a single row, so the bundled Administrator template ranks as one of the smallest and would otherwise win this query whenever an emptier template (such as the bundled Guest) is renamed or removed.
PermissionTemplateDeleteResult
deletePermissionTemplate(int $id)
Delete a permission template and its items, unless a user or group still holds it.