public function GroupMembership::getPermissions in Group 7
Get all permissions for a group membership.
Return value
array An array of group permission names.
1 call to GroupMembership::getPermissions()
- GroupMembership::hasPermission in classes/
group_membership.inc - Checks if a membership has a certain group permission.
File
- classes/
group_membership.inc, line 135 - Defines the Entity API class for group memberships.
Class
- GroupMembership
- Main class for group memberships.
Code
public function getPermissions() {
// Get the member permissions for the related group type.
$wrapper = entity_metadata_wrapper('group_membership', $this);
$permissions = $wrapper->group->group_type->member_permissions
->value();
// Add the permissions that belong to the attached roles.
foreach ($this
->getRoles() as $group_role) {
$permissions = array_merge($permissions, $group_role->permissions);
}
return array_values(array_unique($permissions));
}