You are here

function simple_access_groups_check_user in Simple Access 7.2

Same name and namespace in other branches
  1. 8.3 simple_access.module \simple_access_groups_check_user()
  2. 6.2 simple_access.module \simple_access_groups_check_user()

Check if a user's role is in a group.

1 string reference to 'simple_access_groups_check_user'
simple_access_views_plugin_group::get_access_callback in views/simple_access_views_plugin_group.inc
Determine the access callback and arguments.

File

./simple_access.module, line 735
This module allows administrators to make nodes viewable by specific 'access groups'. Each access group can contain any number of roles. If a node is not assigned to any access groups, it will remain viewable by all users.

Code

function simple_access_groups_check_user($groups) {
  global $user;
  $roles = array_keys($user->roles);
  $roles[] = $user->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID;
  $user_groups = simple_access_groups_from_roles($roles);
  return array_intersect(array_filter($groups), $user_groups);
}