You are here

function OgNodeAccess::testStrictAccessNodeUpdate in Organic groups 7.2

Test strict access permissions for updating group node. A non-member of a group who has core node access update permission is denied access.

File

./og.test, line 164

Class

OgNodeAccess
Test Group node access. This will test nodes that are groups and group content.

Code

function testStrictAccessNodeUpdate() {

  // Set Node access strict variable.
  variable_set('og_node_access_strict', TRUE);

  // Login as editor and try to change the group node and group content.
  $this
    ->drupalLogin($this->editor_user);
  $this
    ->drupalGet('node/' . $this->group1->nid . '/edit');
  $this
    ->assertResponse('403', t('A non-member with core node access permissions was denied access to edit group node.'));
  $this
    ->drupalGet('node/' . $this->group_content->nid . '/edit');
  $this
    ->assertResponse('403', t('A non-member with core node access permissions was denied access to edit group content node.'));

  // Login as a group manager and try to change group node.
  $this
    ->drupalLogin($this->group_manager);
  $this
    ->drupalGet('node/' . $this->group1->nid . '/edit');
  $this
    ->assertResponse('200', t('Group manager allowed to access to edit group node.'));
  $this
    ->drupalGet('node/' . $this->group_content->nid . '/edit');
  $this
    ->assertResponse('200', t('Group manager allowed to access to edit group content node.'));
}