Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

[SDPAP-8375]grant permission to approver to create/update terms in sites #144

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tide_site.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Install file for tide_site.
*/

use Drupal\user\Entity\Role;

/**
* Implements hook_install().
*/
Expand All @@ -17,3 +19,20 @@ function tide_site_install() {
}
}
}

/**
* Approver should have permission to create/edit terms in sites.
*/
function tide_site_update_10000() {
$approver = Role::load('approver');
$permissions = [
'create terms in sites',
'edit terms in sites',
];
if ($approver) {
foreach ($permissions as $permission) {
$approver->grantPermission($permission);
}
$approver->save();
}
}