protected function oa_sectionsNodeAccessBase::oaTestOaSectionAccess in Open Atrium Core 7.2
Tests access to section nodes.
Parameters
$text: Text to use for asserts.
$test_space: Space to add sections to
$space_admin: Administer of that space
$space_member: Member of that space
$space_member_2: A different member of that space.
$group_for_section: A group that space member is part of.
3 calls to oa_sectionsNodeAccessBase::oaTestOaSectionAccess()
- oa_sectionsNodePrivateAccess::test_oa_sectionsPrivateAccess in modules/
oa_sections/ tests/ oa_sectionsNodePrivateAccess.test - oa_sectionsNodePublicAccess::test_oa_sectionsPrivateAccess in modules/
oa_sections/ tests/ oa_sectionsNodePublicAccess.test - oa_sectionsNodePublicAccess::test_oa_sectionsPublicAccess in modules/
oa_sections/ tests/ oa_sectionsNodePublicAccess.test
File
- modules/
oa_sections/ tests/ oa_sectionsNodeAccessBase.test, line 26 - Base class for section access tests.
Class
- oa_sectionsNodeAccessBase
- @file Base class for section access tests.
Code
protected function oaTestOaSectionAccess($text, $test_space, $space_admin, $space_member, $space_member_2, $non_member, $group_for_section = NULL, $team_for_section = NULL) {
$this
->drupalLogin($space_admin);
$this
->drupalGet('node/' . $test_space->nid);
$anon = user_load(0);
$section_public = $this
->createNodeInOaSpace($test_space, array(
'type' => 'oa_section',
));
$section_space_member_only = $this
->createNodeInOaSpace($test_space, array(
'type' => 'oa_section',
'field_oa_user_ref' => array(
LANGUAGE_NONE => array(
array(
'target_id' => $space_member->uid,
),
),
),
));
if ($group_for_section) {
$section_space_group_only = $this
->createNodeInOaSpace($test_space, array(
'type' => 'oa_section',
'field_oa_group_ref' => array(
LANGUAGE_NONE => array(
array(
'target_id' => $group_for_section->nid,
),
),
),
));
}
if ($team_for_section) {
$section_space_team_only = $this
->createNodeInOaSpace($test_space, array(
'type' => 'oa_section',
'field_oa_team_ref' => array(
LANGUAGE_NONE => array(
array(
'target_id' => $team_for_section->nid,
),
),
),
));
}
// Test access to public section.
$this
->oaTestOaSectionAccessToSection($text, 'member', 'public', $test_space, $section_public, $space_member, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'member 2', 'public', $test_space, $section_public, $space_member_2, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'admin', 'public', $test_space, $section_public, $space_admin, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'anonymous', 'public', $test_space, $section_public, $anon, $this
->oaSpaceIsPublic($test_space));
$this
->oaTestOaSectionAccessToSection($text, 'non-member', 'public', $test_space, $section_public, $non_member, $this
->oaSpaceIsPublic($test_space));
// Test access to private sections done by specific user.
$this
->oaTestOaSectionAccessToSection($text, 'admin/author', 'private', $test_space, $section_space_member_only, $space_admin, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'member', 'private', $test_space, $section_space_member_only, $space_member, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'member 2', 'private', $test_space, $section_space_member_only, $space_member_2, FALSE);
$this
->oaTestOaSectionAccessToSection($text, 'anonymous', 'private', $test_space, $section_space_member_only, $anon, FALSE);
$this
->oaTestOaSectionAccessToSection($text, 'non-member', 'private', $test_space, $section_space_member_only, $non_member, FALSE);
// Test access to private sections done by group.
if ($group_for_section) {
$this
->oaTestOaSectionAccessToSection($text, 'admin', 'private by group', $test_space, $section_space_group_only, $space_admin, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'member', 'private by group', $test_space, $section_space_group_only, $space_member, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'member 2', 'private by group', $test_space, $section_space_group_only, $space_member_2, FALSE);
$this
->oaTestOaSectionAccessToSection($text, 'anonymous', 'private by group', $test_space, $section_space_group_only, $anon, FALSE);
$this
->oaTestOaSectionAccessToSection($text, 'non-member', 'private by group', $test_space, $section_space_group_only, $non_member, FALSE);
}
if ($team_for_section) {
$this
->oaTestOaSectionAccessToSection($text, 'admin', 'private by team', $test_space, $section_space_team_only, $space_admin, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'member', 'private by team', $test_space, $section_space_team_only, $space_member, TRUE);
$this
->oaTestOaSectionAccessToSection($text, 'member 2', 'private by team', $test_space, $section_space_team_only, $space_member_2, FALSE);
$this
->oaTestOaSectionAccessToSection($text, 'anonymous', 'private by team', $test_space, $section_space_team_only, $anon, FALSE);
$this
->oaTestOaSectionAccessToSection($text, 'non-member', 'private by team', $test_space, $section_space_team_only, $non_member, FALSE);
}
}