You are here

function view_profiles_perms_permission in View profiles permissions 7

Implements hook_permission().

Provide permissions per role to be viewed

File

./view_profiles_perms.module, line 13
Restricts viewing user profiles based on user roles

Code

function view_profiles_perms_permission() {
  $perms = array();
  $roles = user_roles(TRUE);

  // remove authenticated role
  unset($roles[DRUPAL_AUTHENTICATED_RID]);
  if (count($roles) > 0) {
    foreach ($roles as $rid => $role_name) {
      $perms += view_profiles_perms_permission_name($role_name);
    }
  }
  return $perms;
}