You are here

function OgNodeAccess::testNoStrictAccessNodeCreate in Organic groups 7.2

Test non-strict access permissions for creating group node.

A member of a group who has no core node access create permission is allowed access.

File

./og.test, line 266

Class

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

Code

function testNoStrictAccessNodeCreate() {

  // Set Node access strict variable.
  variable_set('og_node_access_strict', FALSE);
  $this->group_editor_user = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this
    ->drupalLogin($this->group_editor_user);

  // Test OG's create permission for a group member.
  og_group('node', $this->group1, array(
    'entity' => $this->group_editor_user,
  ));
  $roles = array_flip(og_roles('node', 'page'));

  // Add create permission.
  $permissions = array(
    'create article content' => 1,
    'update own article content' => 0,
    'update any article content' => 0,
  );
  og_role_change_permissions($roles[OG_AUTHENTICATED_ROLE], $permissions);
  $this
    ->drupalGet('node/add/article');
  $this
    ->assertResponse('200', 'Group member can create node.');
}