You are here

public function Group::userPermissions in Group 7

Retrieve a user's permissions for a group.

Parameters

int $uid: The uid of the user to retrieve the permissions for.

Return value

array An array of group permission names.

1 call to Group::userPermissions()
Group::userHasPermission in classes/group.inc
Check if a given user has a certain group permission.

File

classes/group.inc, line 403
Defines the Entity API class for groups.

Class

Group
Main class for groups.

Code

public function userPermissions($uid) {
  $group_membership = $this
    ->getMember($uid);
  if ($group_membership) {
    $info = group_membership_status_info();
    if (!empty($info[$group_membership->status]['active'])) {
      return $group_membership
        ->getPermissions();
    }
  }
  return user_is_logged_in() ? group_type_load($this->type)->outsider_permissions : group_type_load($this->type)->anonymous_permissions;
}