function ctools_role_ctools_access_check in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 plugins/access/role.inc \ctools_role_ctools_access_check()
Check for access.
1 string reference to 'ctools_role_ctools_access_check'
File
- plugins/
access/ role.inc, line 47 - Plugin to provide access control based upon role membership.
Code
function ctools_role_ctools_access_check($conf, $context) {
// As far as I know there should always be a context at this point, but this
// is safe.
if (empty($context) || empty($context->data) || !isset($context->data->roles)) {
return FALSE;
}
$roles = array_keys($context->data->roles);
$roles[] = $context->data->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID;
return (bool) array_intersect($conf['rids'], $roles);
}