Skip to content
Snippets Groups Projects
Commit 15ea3fd6 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch 'feature/ISTWCMS-5479-ebremner-auth-site-release' into '1.0.x'

ISTWCMS-5479: auth site release

See merge request !249
parents d58ca04b 85caa679
No related branches found
No related tags found
Loading
...@@ -105,11 +105,16 @@ class UwDrushCommands extends DrushCommands { ...@@ -105,11 +105,16 @@ class UwDrushCommands extends DrushCommands {
UwRoles::setUwPermissions($uw_role, $additional); UwRoles::setUwPermissions($uw_role, $additional);
// Set message for specific role setting permissions. // Set message for specific role setting permissions.
$this->logger()->success('Permissions set for ' . $uw_role['label'] . '.'); // The logger() may not exist if this is called outside of Drush.
if ($this->logger()) {
$this->logger()->success('Permissions set for ' . $uw_role['label'] . '.');
}
} }
// Set message for command completed. // Set message for command completed.
$this->logger()->success('All permissions set.'); if ($this->logger()) {
$this->logger()->success('All permissions set.');
}
} }
/** /**
......
...@@ -141,6 +141,23 @@ class UwRoles { ...@@ -141,6 +141,23 @@ class UwRoles {
// Parse the yml file to get the permissions. // Parse the yml file to get the permissions.
$permissions = Yaml::decode(file_get_contents($file)); $permissions = Yaml::decode(file_get_contents($file));
// Remove 'access content' permission from roles when uw_auth_site enabled.
$roles_to_remove_from = [
'anonymous',
'authenticated',
];
if (in_array($rid, $roles_to_remove_from, TRUE)) {
$config = \Drupal::config('uw_auth_site.auth_site')->get('auth_site');
if ($config['enabled'] ?? FALSE) {
$key = array_search('access content', $permissions['permissions'], TRUE);
// If the permission exists, remove it and reindex the array.
if ($key !== FALSE) {
unset($permissions['permissions'][$key]);
$permissions['permissions'] = array_values($permissions['permissions']);
}
}
}
// Return the permissions for the specific user. // Return the permissions for the specific user.
return $permissions['permissions']; return $permissions['permissions'];
} }
...@@ -168,6 +185,7 @@ class UwRoles { ...@@ -168,6 +185,7 @@ class UwRoles {
foreach ($remove_permissions as $permission) { foreach ($remove_permissions as $permission) {
$uw_role['object']->revokePermission($permission); $uw_role['object']->revokePermission($permission);
} }
$uw_role['object']->save(); $uw_role['object']->save();
} }
......
permissions: permissions:
- 'access administration pages' - 'access administration pages'
- 'access content'
- 'access content overview' - 'access content overview'
- 'access contextual links' - 'access contextual links'
- 'access draggableviews' - 'access draggableviews'
......
permissions: permissions:
- 'access administration pages' - 'access administration pages'
- 'access content'
- 'access content overview' - 'access content overview'
- 'access contextual links' - 'access contextual links'
- 'access draggableviews' - 'access draggableviews'
......
permissions: permissions:
- 'access any webform configuration' - 'access any webform configuration'
- 'access content'
- 'access draggableviews' - 'access draggableviews'
- 'access metatag advanced__image_src' - 'access metatag advanced__image_src'
- 'access metatag advanced__original_source' - 'access metatag advanced__original_source'
......
permissions: [] permissions:
- 'access content'
permissions: permissions:
- 'access administration pages' - 'access administration pages'
- 'access content'
- 'access content overview' - 'access content overview'
- 'access contextual links' - 'access contextual links'
- 'access draggableviews' - 'access draggableviews'
......
permissions: permissions:
- 'access administration pages' - 'access administration pages'
- 'access content'
- 'access content access form' - 'access content access form'
- 'access content overview' - 'access content overview'
- 'access contextual links' - 'access contextual links'
...@@ -43,6 +44,7 @@ permissions: ...@@ -43,6 +44,7 @@ permissions:
- 'assign roles' - 'assign roles'
- 'can override my_dashboard dashboard' - 'can override my_dashboard dashboard'
- 'can view my_dashboard dashboard' - 'can view my_dashboard dashboard'
- 'configure authenticated sites'
- 'create and edit custom blocks' - 'create and edit custom blocks'
- 'customize shortcut links' - 'customize shortcut links'
- 'edit users role expire' - 'edit users role expire'
......
...@@ -339,6 +339,11 @@ uw_content_management.global_vocabularies.audience.manage: ...@@ -339,6 +339,11 @@ uw_content_management.global_vocabularies.audience.manage:
url: internal:/admin/structure/taxonomy/manage/uw_vocab_audience url: internal:/admin/structure/taxonomy/manage/uw_vocab_audience
weight: 1 weight: 1
uw_site_management.authenticated_site_settings:
title: 'Authenticated site settings'
menu_name: uw-menu-site-management
url: internal:/admin/config/system/auth_site
weight: 0
uw_site_management.content_access: uw_site_management.content_access:
title: 'Content access' title: 'Content access'
menu_name: uw-menu-site-management menu_name: uw-menu-site-management
......
services: services:
uw_cfg_common.drush_commands:
class: Drupal\uw_cfg_common\Commands\UwDrushCommands
arguments: [ '@entity_type.manager', '@uw_cfg_common.missing_blocks', '@config.factory', '@module_handler', '@module_installer' ]
tags:
- { name: drush.command }
uw_cfg_common.uw_ldap: uw_cfg_common.uw_ldap:
class: Drupal\uw_cfg_common\Service\UWLdap class: Drupal\uw_cfg_common\Service\UWLdap
arguments: ['@config.factory', '@current_user'] arguments: ['@config.factory', '@current_user']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment