Commit 14196d85 authored by Igor Biki's avatar Igor Biki
Browse files

ISTWCMS-4916 Adding module dependency and update hook with logic to grant...

ISTWCMS-4916 Adding module dependency and update hook with logic to grant permission for some roles.
parent 159032da
......@@ -161,6 +161,7 @@ dependencies:
- drupal:webform_ui
- drupal:workbench_access
- drupal:workflows
- override_node_options:override_node_options
- uw_ckeditor_plugins:uw_ckeditor_plugins
- uw_ws_ofis:uw_ws_ofis
......@@ -5,6 +5,8 @@
* Install, update and uninstall for UW Sites all.
use Drupal\user\Entity\Role;
* Implements hook_install().
......@@ -83,3 +85,62 @@ function uw_sites_all_update_8103() {
$config = \Drupal::service('config.factory')->getEditable('webform.settings');
$config->set('third_party_settings.honeypot.honeypot', TRUE)->save();
* Enable Override Node Options module and assigns permissions to roles.
function uw_sites_all_update_8104() {
// List of permissions needed to be applied to roles.
$permissions = [
'enter uw_ct_blog revision log entry',
'enter uw_ct_catalog_item revision log entry',
'enter uw_ct_contact revision log entry',
'enter uw_ct_event revision log entry',
'enter uw_ct_news_item revision log entry',
'enter uw_ct_profile revision log entry',
'enter uw_ct_web_page revision log entry',
'override uw_ct_blog promote to front page option',
'override uw_ct_blog published option',
'override uw_ct_blog revision option',
'override uw_ct_blog sticky option',
'override uw_ct_catalog_item published option',
'override uw_ct_catalog_item revision option',
'override uw_ct_contact published option',
'override uw_ct_contact revision option',
'override uw_ct_event promote to front page option',
'override uw_ct_event published option',
'override uw_ct_event revision option',
'override uw_ct_event sticky option',
'override uw_ct_news_item promote to front page option',
'override uw_ct_news_item published option',
'override uw_ct_news_item revision option',
'override uw_ct_news_item sticky option',
'override uw_ct_profile published option',
'override uw_ct_profile revision option',
'override uw_ct_web_page published option',
'override uw_ct_web_page revision option',
// Roles that require updated permissions.
$role_ids = [
$roles = Role::loadMultiple($role_ids);
// Grant all all roles.
foreach ($permissions as $permission) {
// Save role with new permissions.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment