class DbPermissionTemplateRepository (View source)

Methods

__construct($db, ConfigurationInterface $config)

No description

bool
addPermissionTemplate(array $details)

Add a Permission Template

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

Get List of Permissions

bool
updatePermissionTemplateDetails(array $details)

Update permission template details

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.

bool
deletePermissionTemplate(int $id)

Delete Permission Template ID

Details

__construct($db, ConfigurationInterface $config)

No description

Parameters

$db
ConfigurationInterface $config

bool 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

bool

true on success, false otherwise

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.

Parameters

int $templ_id

Template ID (optional) [default=0]

bool $return_name_only

Return name only or all details (optional) [default=false]

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

Return Value

bool

true on success, false otherwise

array|false getPermissionTemplateDetails(int $templ_id)

Get name and description of template from Template ID

Parameters

int $templ_id

Template ID

Return Value

array|false

Template details or false if not found

bool validateTemplateType(int $templ_id, string $expected_type)

Validate that a template has the expected type

Parameters

int $templ_id

Template ID to validate

string $expected_type

Expected template type ('user' or 'group')

Return Value

bool

true if template exists and has expected type, false otherwise

array listPermissionTemplates(string|null $filter_type = null)

Get a list of all available permission templates

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)

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.

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

bool deletePermissionTemplate(int $id)

Delete Permission Template ID

Parameters

int $id

Permission template ID

Return Value

bool

true on success, false otherwise