Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
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_cfg_common
Commits
96265bc8
Commit
96265bc8
authored
3 years ago
by
Eric Bremner
Committed by
Kevin Paxman
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4954: adding role creation and permission setting to install hook
parent
b9f50792
No related branches found
No related tags found
1 merge request
!133
Feature/istwcms 4954 ebremner features
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uw_cfg_common.install
+39
-0
39 additions, 0 deletions
uw_cfg_common.install
with
39 additions
and
0 deletions
uw_cfg_common.install
+
39
−
0
View file @
96265bc8
...
...
@@ -10,11 +10,50 @@ use Drupal\node\Entity\Node;
use
Drupal\uw_cfg_common
\UwPermissions\UwPermissions
;
use
Drupal\user\Entity\Role
;
use
Drupal\Core\Config\FileStorage
;
use
Drupal\uw_cfg_common
\UwRoles\UwRoles
;
/**
* Implements hook_install().
*/
function
uw_cfg_common_install
()
{
// Get the role ids for UW roles.
$uw_rids
=
UwRoles
::
getUwRoleIds
();
// Step through each of the rids and create
// role and set permissions.
foreach
(
$uw_rids
as
$uw_rid
)
{
// Create the role.
$role
=
Role
::
create
(
[
'id'
=>
$uw_rid
,
'label'
=>
UwRoles
::
getUwRoleLabel
(
$uw_rid
),
]
);
$role
->
save
();
// Get the info about the role.
$uw_role
=
UwRoles
::
getUwRole
(
$uw_rid
);
// Set the permissions for the role.
UwRoles
::
setUwPermissions
(
$uw_role
);
}
// Get the role ids for Drupal roles.
$drupal_rids
=
UwRoles
::
getDrupalRoleIds
();
// Step through each of the Drupal roles and
// set the permissions.
foreach
(
$drupal_rids
as
$drupal_rid
)
{
// Get the info about the role.
$uw_role
=
UwRoles
::
getUwRole
(
$drupal_rid
);
// Set the permissions for the role.
UwRoles
::
setUwPermissions
(
$uw_role
);
}
$permissions_to_process
=
[
'Blog'
=>
[
'Use content type'
=>
[
...
...
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