Skip to content
Snippets Groups Projects
Commit 8ccc7cac authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-3921: updating content access form to allow for custom permissions and...

ISTWCMS-3921: updating content access form to allow for custom permissions and updating special alert
parent d6f5ccef
No related branches found
No related tags found
No related merge requests found
...@@ -301,6 +301,35 @@ class UwContentAccessForm extends FormBase { ...@@ -301,6 +301,35 @@ class UwContentAccessForm extends FormBase {
return $uw_permissions; return $uw_permissions;
} }
/**
* Build role permissions list for a custom permission.
*
* @param string $permission_name
* The machine name of the taxonomy term.
* @return array
* An array of the uw permissions.
*/
private function uw_build_role_permissions_list_custom(string $permission_name): array {
// The roles used for the uw permissions.
$uw_roles = [
'Site manager',
'Content editor',
'Content author',
];
// Step through each role and add permission.
foreach ($uw_roles as $uw_role) {
// Set the permission.
$uw_permissions[$uw_role][] = [
$permission_name,
];
}
return $uw_permissions;
}
/** /**
* Get Uw content permissions array. * Get Uw content permissions array.
* *
...@@ -341,7 +370,7 @@ class UwContentAccessForm extends FormBase { ...@@ -341,7 +370,7 @@ class UwContentAccessForm extends FormBase {
// Special alert permissions. // Special alert permissions.
'Special alert' => [ 'Special alert' => [
'Use content type' => 'Use content type' =>
$this->uw_build_role_permissions_list_content_type('uw_ct_special_alert'), $this->uw_build_role_permissions_list_custom('administer special alert'),
], ],
// Web page permissions. // Web page permissions.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment