|
|
|
@ -1,7 +1,17 @@
|
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @file |
|
|
|
|
* Tests islandora permissions, and permission related funcitons. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
class IslandoraPermissionsTestCase extends IslandoraWebTestCase { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Gets info to display to describe this test. |
|
|
|
|
* |
|
|
|
|
* @see IslandoraWebTestCase::getInfo() |
|
|
|
|
*/ |
|
|
|
|
public static function getInfo() { |
|
|
|
|
return array( |
|
|
|
|
'name' => 'Islandora Manage Permissions', |
|
|
|
@ -10,69 +20,65 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Prepares enviroment for testing. |
|
|
|
|
* |
|
|
|
|
* @see IslandoraWebTestCase::setUp() |
|
|
|
|
*/ |
|
|
|
|
public function setUp() { |
|
|
|
|
parent::setUp(array('islandora')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Test manage permissions. |
|
|
|
|
*/ |
|
|
|
|
public function testManagePermissions() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// permission FEDORA_VIEW_OBJECTS |
|
|
|
|
// create a user with permission |
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS. |
|
|
|
|
// Create a user with permission. |
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS)); |
|
|
|
|
// log the user in |
|
|
|
|
// Log the user in. |
|
|
|
|
$this->drupalLogin($user); |
|
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
|
$this->assertNoLink('Manage', 'Manage tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// permission FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES |
|
|
|
|
|
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES. |
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES)); |
|
|
|
|
// log the user in |
|
|
|
|
$this->drupalLogin($user); |
|
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
|
|
$this->clickLink(t('Manage')); |
|
|
|
|
$this->assertLink('Properties', 0, 'Properties tab is on current page.'); |
|
|
|
|
$this->assertNoLink('Datastreams', 'Datastreams tab is not on current page.'); |
|
|
|
|
$this->assertNoLink('Collection','Collection tab is not on current page.'); |
|
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// permission FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS |
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS. |
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS)); |
|
|
|
|
// log the user in |
|
|
|
|
$this->drupalLogin($user); |
|
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
|
|
$this->clickLink(t('Manage')); |
|
|
|
|
$this->assertLink('Datastreams', 0, 'Datastreams tab is on current page.'); |
|
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
|
$this->assertNoLink('Collection','Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// permission FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT |
|
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT. |
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT)); |
|
|
|
|
// log the user in |
|
|
|
|
$this->drupalLogin($user); |
|
|
|
|
$this->drupalLogin($user); |
|
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
|
|
$this->clickLink(t('Manage')); |
|
|
|
|
$this->assertLink('Datastreams', 0, 'Datastreams tab is on current page.'); |
|
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
|
$this->assertNoLink('Collection','Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// permission FEDORA_VIEW_OBJECTS, FEDORA_PURGE |
|
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
// Test permission FEDORA_VIEW_OBJECTS, FEDORA_PURGE. |
|
|
|
|
$user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE)); |
|
|
|
|
// log the user in |
|
|
|
|
$this->drupalLogin($user); |
|
|
|
|
$this->clickLink(t('Islandora Repository')); |
|
|
|
|
$this->assertLink('Manage', 0, 'Manage tab is on current page.'); |
|
|
|
|
$this->clickLink(t('Manage')); |
|
|
|
|
$this->assertLink('Datastreams', 0, 'Datastreams tab is on current page.'); |
|
|
|
|
$this->assertNoLink('Properties', 'Properties tab is not on current page.'); |
|
|
|
|
$this->assertNoLink('Collection','Collection tab is not on current page.'); |
|
|
|
|
|
|
|
|
|
$this->assertNoLink('Collection', 'Collection tab is not on current page.'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|