You are here

function signup_plugin_access_user_signup_list::access in Signup 6

Same name and namespace in other branches
  1. 6.2 views/plugins/signup_plugin_access_user_signup_list.inc \signup_plugin_access_user_signup_list::access()
  2. 7 views/plugins/signup_plugin_access_user_signup_list.inc \signup_plugin_access_user_signup_list::access()

See if the given user should have access outside of the menu system.

This is used for block displays, for example. If the given account has the 'view all signups' permission, we always grant access. Otherwise, we only grant access if the user the view is listing (from a given argument) matches the given account.

File

views/plugins/signup_plugin_access_user_signup_list.inc, line 16

Class

signup_plugin_access_user_signup_list
Validate whether an argument is a user who has permission to view signups.

Code

function access($account) {
  if (user_access('view all signups', $account)) {
    return TRUE;
  }
  $this->view
    ->set_display($this->display->id);
  $this->view
    ->init_handlers();
  $user_arg = $this->options['signup_user_argument'];
  $argument = $this->view->argument[$user_arg];
  return $account->uid == $argument
    ->get_value();
}