Commit a19e64c6 authored by Liam Morland's avatar Liam Morland
Browse files

Merge branch 'feature/ISTWCMS-4529-l26yan-Add-and-configure-roleassign-module' into '8.x-3.x'

ISTWCMS 4529: Add and configure roleassign module

See merge request !61
parents 98fd4053 262f7571
......@@ -874,14 +874,38 @@ class UwWcmsBasicTest extends BrowserTestBase {
* Tests permissions.
*
* Site owner role has administer users permission.
* Site owner role has assign roles permission.
* Configure the role assign to allow assigning
* all roles except admin and site owner.
*/
private function permissionsTest() {
// Only administer can access.
// Only administer can access permissions and roleassign pages.
$this->drupalLogin($this->drupalUsers['administrator']);
// Check admin/people/roleassign page.
$this->drupalGet('admin/people/roleassign');
$this->assertSession()->statusCodeEquals(200);
// Configure the role assign to allow assigning
// all roles except admin and site owner.
$this->assertSession()->checkboxNotChecked('edit-roleassign-roles-administrator');
$this->assertSession()->checkboxNotChecked('edit-roleassign-roles-uw-role-site-owner');
$this->assertSession()->checkboxChecked('edit-roleassign-roles-uw-role-site-manager');
$this->assertSession()->checkboxChecked('edit-roleassign-roles-uw-role-content-editor');
$this->assertSession()->checkboxChecked('edit-roleassign-roles-uw-role-content-author');
$this->assertSession()->checkboxChecked('edit-roleassign-roles-uw-role-form-editor');
$this->assertSession()->checkboxChecked('edit-roleassign-roles-uw-role-form-results-access');
// Check admin/people/permissions page.
$this->drupalGet('admin/people/permissions');
$this->assertSession()->statusCodeEquals(200);
$this->assertFieldChecked('edit-uw-role-site-owner-administer-users');
// The other users do not have access.
// Site owner role has administer users.
$this->assertSession()->checkboxChecked('edit-uw-role-site-owner-administer-users');
// Only the site owner role assign roles permissions.
$this->assertSession()->checkboxChecked('edit-uw-role-site-owner-assign-roles');
$this->assertSession()->checkboxNotChecked('edit-uw-role-site-manager-assign-roles');
$this->assertSession()->checkboxNotChecked('edit-uw-role-content-editor-assign-roles');
$this->assertSession()->checkboxNotChecked('edit-uw-role-content-author-assign-roles');
$this->assertSession()->checkboxNotChecked('edit-uw-role-form-editor-assign-roles');
$this->assertSession()->checkboxNotChecked('edit-uw-role-form-results-access-assign-roles');
// The other users do not have access permissions and roleassign pages.
$roles = [
'authenticated user',
'uw_role_site_manager',
......@@ -894,6 +918,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->drupalLogin($this->drupalUsers[$role]);
$this->drupalGet('admin/people/permissions');
$this->assertSession()->statusCodeEquals(403);
$this->drupalGet('admin/people/roleassign');
$this->assertSession()->statusCodeEquals(403);
}
}
......
Supports Markdown
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