You are here

function fasttoggle_user_role_access in Fasttoggle 7

Check access to toggle a particular role.

Parameters

object $obj: Unused object parameter.

string $type: Unused object type parameter.

string $group: Unused setting group parameter.

string $instance: The instance of the setting group (the role).

Return value

int Access check result.

1 string reference to 'fasttoggle_user_role_access'
fasttoggle_user_fasttoggle_available_links in module/fasttoggle_user/fasttoggle_user.module
Implements hook_fasttoggle_available_links().

File

module/fasttoggle_user/fasttoggle_user.module, line 63

Code

function fasttoggle_user_role_access($obj, $type, $group, $instance) {
  static $available_roles = array();
  if (empty($available_roles)) {
    $available_roles = fasttoggle_sitewide_toggleable_roles();
  }
  if (!isset($available_roles[$instance])) {
    return FALSE;
  }
  return fasttoggle_allow_access_if(user_access("Toggle role {$available_roles[$instance]}"));
}