Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_sites_all
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_sites_all
Commits
f794cb44
Commit
f794cb44
authored
5 months ago
by
Chris Shantz
Browse files
Options
Downloads
Plain Diff
Merge branch '1.1.x' into prod/1.1.x
parents
309a7a4e
6cbca8fd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uw_sites_all.install
+43
-0
43 additions, 0 deletions
uw_sites_all.install
with
43 additions
and
0 deletions
uw_sites_all.install
+
43
−
0
View file @
f794cb44
...
...
@@ -1989,3 +1989,46 @@ function uw_sites_all_update_9164() {
function
uw_sites_all_update_9165
(
&
$sandbox
)
{
\Drupal
::
service
(
'module_installer'
)
->
install
([
'multilingual_exclude'
]);
}
/**
* Add project role and topic permissions.
*/
function
uw_sites_all_update_9166
(
&
$sandbox
)
{
// List of permissions needed to be applied to roles.
$permissions
=
[
'create terms in uw_vocab_project_role'
,
'create terms in uw_vocab_project_topic'
,
'edit terms in uw_vocab_project_role'
,
'edit terms in uw_vocab_project_topic'
,
];
$only_site_manager_permissions
=
[
'delete terms in uw_vocab_project_role'
,
'delete terms in uw_vocab_project_topic'
,
];
// Roles that require updated permissions.
$role_ids
=
[
'uw_role_site_manager'
,
'uw_role_content_editor'
,
'uw_role_content_author'
,
];
$roles
=
Role
::
loadMultiple
(
$role_ids
);
// Grant all all roles.
foreach
(
$permissions
as
$permission
)
{
$roles
[
'uw_role_site_manager'
]
->
grantPermission
(
$permission
);
$roles
[
'uw_role_content_editor'
]
->
grantPermission
(
$permission
);
$roles
[
'uw_role_content_author'
]
->
grantPermission
(
$permission
);
}
foreach
(
$only_site_manager_permissions
as
$only_site_manager_permission
)
{
$roles
[
'uw_role_site_manager'
]
->
grantPermission
(
$only_site_manager_permission
);
}
// Save role with new permissions.
$roles
[
'uw_role_site_manager'
]
->
save
();
$roles
[
'uw_role_content_editor'
]
->
save
();
$roles
[
'uw_role_content_author'
]
->
save
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment