From b65e19cfb6c8961a311cbce63fd29108a6af37e7 Mon Sep 17 00:00:00 2001 From: James O'Toole Date: Wed, 9 Feb 2022 11:13:10 -0800 Subject: [PATCH] Update to break roles into separate module Need to ensure roles are enabled after pieces are in place --- .../config/install/user.role.super_user.yml | 0 ubc_vpr_roles/ubc_vpr_roles.info.yml | 15 + ubc_vpr_roles/ubc_vpr_roles.install | 166 ++++++++++ .../ubc_vpr_shared_config.install | 283 ------------------ 4 files changed, 181 insertions(+), 283 deletions(-) rename {ubc_vpr_shared_config => ubc_vpr_roles}/config/install/user.role.super_user.yml (100%) create mode 100755 ubc_vpr_roles/ubc_vpr_roles.info.yml create mode 100755 ubc_vpr_roles/ubc_vpr_roles.install diff --git a/ubc_vpr_shared_config/config/install/user.role.super_user.yml b/ubc_vpr_roles/config/install/user.role.super_user.yml similarity index 100% rename from ubc_vpr_shared_config/config/install/user.role.super_user.yml rename to ubc_vpr_roles/config/install/user.role.super_user.yml diff --git a/ubc_vpr_roles/ubc_vpr_roles.info.yml b/ubc_vpr_roles/ubc_vpr_roles.info.yml new file mode 100755 index 0000000..79a5b45 --- /dev/null +++ b/ubc_vpr_roles/ubc_vpr_roles.info.yml @@ -0,0 +1,15 @@ +name: UBC VPR Roles +type: module +description: This module manages user roles for VPR suite of sites. +package: UBC Web Services +dependencies: + - ubc_vpr_homepage_extend:ubc_vpr_homepage_extend + - ubc_vpr_announcement_extend:ubc_vpr_announcement_extend + - ubc_vpr_event_extend:ubc_vpr_event_extend + - ubc_vpr_landing_page_extend:ubc_vpr_landing_page_extend + - ubc_vpr_page_extend:ubc_vpr_page_extend + - ubc_vpr_profile_extend:ubc_vpr_profile_extend + - ubc_vpr_webform_extend:ubc_vpr_webform_extend + - ubc_vpr_shared_config:ubc_vpr_shared_config +core: '8.x' +core_version_requirement: ^8 || ^9 diff --git a/ubc_vpr_roles/ubc_vpr_roles.install b/ubc_vpr_roles/ubc_vpr_roles.install new file mode 100755 index 0000000..ec09880 --- /dev/null +++ b/ubc_vpr_roles/ubc_vpr_roles.install @@ -0,0 +1,166 @@ +getEditable('user.role.content_creator') + ->set('dependencies.config', [ + 'filter.format.filtered_text', + 'media.type.file', + 'media.type.image', + 'media.type.private_file', + 'media.type.remote_video', + 'media.type.svg_icon', + 'media.type.video', + 'node.type.ubc_announcement', + 'node.type.ubc_event', + 'node.type.ubc_page', + 'node.type.ubc_profile', + 'taxonomy.vocabulary.event_category', + ]) + ->set('dependencies.module', [ + 'dropzonejs', + 'file', + 'filter', + 'media', + 'media_bulk_upload', + 'node', + 'scheduler', + 'system', + 'taxonomy', + 'toolbar', + 'tour', + 'ubc_content_items', + 'webform', + ]) + ->set('permissions', [ + 'access taxonomy overview', + 'view unpublished content item entities', + ]) + ->save(); + $config->getEditable('user.role.editor') + ->set('dependencies.config', [ + 'filter.format.filtered_text', + 'media.type.file', + 'media.type.image', + 'media.type.private_file', + 'media.type.remote_video', + 'media.type.svg_icon', + 'media.type.video', + 'node.type.homepage', + 'node.type.ubc_announcement', + 'node.type.ubc_event', + 'node.type.ubc_landing_page', + 'node.type.ubc_page', + 'node.type.ubc_profile', + 'node.type.webform', + 'taxonomy.vocabulary.announcement_type', + 'taxonomy.vocabulary.department_or_unit', + 'taxonomy.vocabulary.event_category', + 'taxonomy.vocabulary.profile_affiliated_institution', + 'taxonomy.vocabulary.profile_category', + 'taxonomy.vocabulary.profile_faculty', + 'taxonomy.vocabulary.profile_role', + 'taxonomy.vocabulary.research_theme', + 'taxonomy.vocabulary.tags', + ]) + ->set('dependencies.module', [ + 'block', + 'contextual', + 'dropzonejs', + 'file', + 'file_delete', + 'filter', + 'google_analytics', + 'media', + 'media_bulk_upload', + 'metatag', + 'node', + 'paragraphs', + 'path', + 'redirect', + 'role_delegation', + 'scheduler', + 'system', + 'taxonomy', + 'toolbar', + 'tour', + 'ubc_content_items', + 'webform', + 'webform_node', + ]) + ->set('permissions', [ + 'access webform help', + 'access webform overview', + 'access webform submission user', + 'add content item entities', + 'administer taxonomy', + 'administer webform', + 'administer webform submission', + 'create terms in announcement_type', + 'create terms in profile_affiliated_institution', + 'create terms in profile_category', + 'create terms in profile_faculty', + 'create terms in profile_role', + 'create terms in research_theme', + 'create webform content', + 'delete all content item revisions', + 'delete any webform content', + 'delete content item entities', + 'delete own webform content', + 'delete terms in announcement_type', + 'delete terms in profile_affiliated_institution', + 'delete terms in profile_category', + 'delete terms in profile_faculty', + 'delete terms in profile_role', + 'delete terms in research_theme', + 'delete webform revisions', + 'delete webform submissions any node', + 'delete webform submissions own node', + 'edit any ubc_landing_page content', + 'edit content item entities', + 'edit own webform content', + 'edit own webform submission', + 'edit terms in announcement_type', + 'edit terms in profile_affiliated_institution', + 'edit terms in profile_category', + 'edit terms in profile_faculty', + 'edit terms in profile_role', + 'edit terms in research_theme', + 'edit webform submissions any node', + 'edit webform submissions own node', + 'revert all content item revisions', + 'revert ubc_landing_page revisions', + 'revert webform revisions', + 'view all content item revisions', + 'view ubc_profile revisions', + 'view unpublished content item entities', + 'view unpublished paragraphs', + 'view webform revisions', + 'view webform submissions any node', + 'view webform submissions own node', + ]) + ->save(); +} + +/** + * Implements hook_uninstall(). + * + * @ingroup ubc_vpr_shared_config + */ +function ubc_vpr_shared_config_uninstall() { +} + +/** + * sample update. + */ +/* +function ubc_vpr_shared_config_update_9001() { +} +*/ + + diff --git a/ubc_vpr_shared_config/ubc_vpr_shared_config.install b/ubc_vpr_shared_config/ubc_vpr_shared_config.install index b58ee7b..93038cb 100755 --- a/ubc_vpr_shared_config/ubc_vpr_shared_config.install +++ b/ubc_vpr_shared_config/ubc_vpr_shared_config.install @@ -28,144 +28,6 @@ function ubc_vpr_shared_config_install() { ->set('display.default.display_options.header.area_text_custom.content', '

Announcements

') ->set('display.block_2.display_options.header.area_text_custom.content', '

Announcements

') ->save(); - $config->getEditable('user.role.content_creator') - ->set('dependencies.config', [ - 'filter.format.filtered_text', - 'media.type.file', - 'media.type.image', - 'media.type.private_file', - 'media.type.remote_video', - 'media.type.svg_icon', - 'media.type.video', - 'node.type.ubc_announcement', - 'node.type.ubc_event', - 'node.type.ubc_page', - 'node.type.ubc_profile', - 'taxonomy.vocabulary.event_category', - ]) - ->set('dependencies.module', [ - 'dropzonejs', - 'file', - 'filter', - 'media', - 'media_bulk_upload', - 'node', - 'scheduler', - 'system', - 'taxonomy', - 'toolbar', - 'tour', - 'ubc_content_items', - 'webform', - ]) - ->set('permissions', [ - 'access taxonomy overview', - 'view unpublished content item entities', - ]) - ->save(); - $config->getEditable('user.role.editor') - ->set('dependencies.config', [ - 'filter.format.filtered_text', - 'media.type.file', - 'media.type.image', - 'media.type.private_file', - 'media.type.remote_video', - 'media.type.svg_icon', - 'media.type.video', - 'node.type.homepage', - 'node.type.ubc_announcement', - 'node.type.ubc_event', - 'node.type.ubc_landing_page', - 'node.type.ubc_page', - 'node.type.ubc_profile', - 'node.type.webform', - 'taxonomy.vocabulary.announcement_type', - 'taxonomy.vocabulary.department_or_unit', - 'taxonomy.vocabulary.event_category', - 'taxonomy.vocabulary.profile_affiliated_institution', - 'taxonomy.vocabulary.profile_category', - 'taxonomy.vocabulary.profile_faculty', - 'taxonomy.vocabulary.profile_role', - 'taxonomy.vocabulary.research_theme', - 'taxonomy.vocabulary.tags', - ]) - ->set('dependencies.module', [ - 'block', - 'contextual', - 'dropzonejs', - 'file', - 'file_delete', - 'filter', - 'google_analytics', - 'media', - 'media_bulk_upload', - 'metatag', - 'node', - 'paragraphs', - 'path', - 'redirect', - 'role_delegation', - 'scheduler', - 'system', - 'taxonomy', - 'toolbar', - 'tour', - 'ubc_content_items', - 'webform', - 'webform_node', - ]) - ->set('permissions', [ - 'access webform help', - 'access webform overview', - 'access webform submission user', - 'add content item entities', - 'administer taxonomy', - 'administer webform', - 'administer webform submission', - 'create terms in announcement_type', - 'create terms in profile_affiliated_institution', - 'create terms in profile_category', - 'create terms in profile_faculty', - 'create terms in profile_role', - 'create terms in research_theme', - 'create webform content', - 'delete all content item revisions', - 'delete any webform content', - 'delete content item entities', - 'delete own webform content', - 'delete terms in announcement_type', - 'delete terms in profile_affiliated_institution', - 'delete terms in profile_category', - 'delete terms in profile_faculty', - 'delete terms in profile_role', - 'delete terms in research_theme', - 'delete webform revisions', - 'delete webform submissions any node', - 'delete webform submissions own node', - 'edit any ubc_landing_page content', - 'edit content item entities', - 'edit own webform content', - 'edit own webform submission', - 'edit terms in announcement_type', - 'edit terms in profile_affiliated_institution', - 'edit terms in profile_category', - 'edit terms in profile_faculty', - 'edit terms in profile_role', - 'edit terms in research_theme', - 'edit webform submissions any node', - 'edit webform submissions own node', - 'revert all content item revisions', - 'revert ubc_landing_page revisions', - 'revert webform revisions', - 'view all content item revisions', - 'view ubc_profile revisions', - 'view unpublished content item entities', - 'view unpublished paragraphs', - 'view webform revisions', - 'view webform submissions any node', - 'view webform submissions own node', - ]) - ->save(); } /** @@ -247,148 +109,3 @@ function ubc_vpr_shared_config_update_9002() { ->set('display.block_2.display_options.header.area_text_custom.content', '

Announcements

') ->save(); } - - /** - * Update preinstalled roles from ubc_shared_config. - */ -function ubc_vpr_shared_config_update_9003() { - $config = \Drupal::service('config.factory'); - $config->getEditable('user.role.content_creator') - ->set('dependencies.config', [ - 'filter.format.filtered_text', - 'media.type.file', - 'media.type.image', - 'media.type.private_file', - 'media.type.remote_video', - 'media.type.svg_icon', - 'media.type.video', - 'node.type.ubc_announcement', - 'node.type.ubc_event', - 'node.type.ubc_page', - 'node.type.ubc_profile', - 'taxonomy.vocabulary.event_category', - ]) - ->set('dependencies.module', [ - 'dropzonejs', - 'file', - 'filter', - 'media', - 'media_bulk_upload', - 'node', - 'scheduler', - 'system', - 'taxonomy', - 'toolbar', - 'tour', - 'ubc_content_items', - 'webform', - ]) - ->set('permissions', [ - 'access taxonomy overview', - 'view unpublished content item entities', - ]) - ->save(); - $config->getEditable('user.role.editor') - ->set('dependencies.config', [ - 'filter.format.filtered_text', - 'media.type.file', - 'media.type.image', - 'media.type.private_file', - 'media.type.remote_video', - 'media.type.svg_icon', - 'media.type.video', - 'node.type.homepage', - 'node.type.ubc_announcement', - 'node.type.ubc_event', - 'node.type.ubc_landing_page', - 'node.type.ubc_page', - 'node.type.ubc_profile', - 'node.type.webform', - 'taxonomy.vocabulary.announcement_type', - 'taxonomy.vocabulary.department_or_unit', - 'taxonomy.vocabulary.event_category', - 'taxonomy.vocabulary.profile_affiliated_institution', - 'taxonomy.vocabulary.profile_category', - 'taxonomy.vocabulary.profile_faculty', - 'taxonomy.vocabulary.profile_role', - 'taxonomy.vocabulary.research_theme', - 'taxonomy.vocabulary.tags', - ]) - ->set('dependencies.module', [ - 'block', - 'contextual', - 'dropzonejs', - 'file', - 'file_delete', - 'filter', - 'google_analytics', - 'media', - 'media_bulk_upload', - 'metatag', - 'node', - 'paragraphs', - 'path', - 'redirect', - 'role_delegation', - 'scheduler', - 'system', - 'taxonomy', - 'toolbar', - 'tour', - 'ubc_content_items', - 'webform', - 'webform_node', - ]) - ->set('permissions', [ - 'access webform help', - 'access webform overview', - 'access webform submission user', - 'add content item entities', - 'administer taxonomy', - 'administer webform', - 'administer webform submission', - 'create terms in announcement_type', - 'create terms in profile_affiliated_institution', - 'create terms in profile_category', - 'create terms in profile_faculty', - 'create terms in profile_role', - 'create terms in research_theme', - 'create webform content', - 'delete all content item revisions', - 'delete any webform content', - 'delete content item entities', - 'delete own webform content', - 'delete terms in announcement_type', - 'delete terms in profile_affiliated_institution', - 'delete terms in profile_category', - 'delete terms in profile_faculty', - 'delete terms in profile_role', - 'delete terms in research_theme', - 'delete webform revisions', - 'delete webform submissions any node', - 'delete webform submissions own node', - 'edit any ubc_landing_page content', - 'edit content item entities', - 'edit own webform content', - 'edit own webform submission', - 'edit terms in announcement_type', - 'edit terms in profile_affiliated_institution', - 'edit terms in profile_category', - 'edit terms in profile_faculty', - 'edit terms in profile_role', - 'edit terms in research_theme', - 'edit webform submissions any node', - 'edit webform submissions own node', - 'revert all content item revisions', - 'revert ubc_landing_page revisions', - 'revert webform revisions', - 'view all content item revisions', - 'view ubc_profile revisions', - 'view unpublished content item entities', - 'view unpublished paragraphs', - 'view webform revisions', - 'view webform submissions any node', - 'view webform submissions own node', - ]) - ->save(); -}