public function GNodeWebTestBase::createRole in Group 7
Create a global group role
Parameters
string $machine_name:
string $group_type: (optional) Bundle name for the group to attach the role to. Leave blank to make this a global role.
string $label: (optional) Leave blank to have this the same as the machine_name.
Return value
8 calls to GNodeWebTestBase::createRole()
- GNodeDeleteAccessTests::testMemberWithGlobalRoleDeleteAccess in modules/
gnode/ tests/ gnode.test - Test member with global role user's delete access to nodes in a group. This checks via several permissions: the delete any node, delete own node and administer group.
- GNodeDeleteAccessTests::testMemberWithGroupRoleDeleteAccess in modules/
gnode/ tests/ gnode.test - Test member with group role user's delete access to nodes in a group. This checks via several permissions: the delete any node, delete own node and administer group.
- GNodeEditAccessTests::testMemberWithGlobalRoleEditAccess in modules/
gnode/ tests/ gnode.test - Test member with global role user's edit access to nodes in a group. This checks via several permissions: the update any node, update own node and administer group.
- GNodeEditAccessTests::testMemberWithGroupRoleEditAccess in modules/
gnode/ tests/ gnode.test - Test member with group role user's edit access to nodes in a group. This checks via several permissions: the update any node, update own node and administer group.
- GNodeViewAccessTests::testAnonymousPermissionBuildUp in modules/
gnode/ tests/ gnode.test - Test the anonymous user does not receive access until their role has access even when higher roles do have access.
File
- modules/
gnode/ tests/ gnode.test, line 151 - Tests for the gnode module.
Class
- GNodeWebTestBase
- Base class provides a number of helper functions.
Code
public function createRole($machine_name, $group_type = '', $label = '') {
$label = empty($label) ? $machine_name : $label;
$role = new GroupRole(array(
'type' => empty($group_type) ? '' : $group_type,
'name' => $machine_name,
'label' => $label,
'global' => empty($group_type) ? 1 : 0,
'permissions' => array(),
'weight' => 1,
'status' => 1,
'module' => NULL,
), 'group_role');
$role
->save();
return $role;
}