function domain_ctools_domain_access_check in Domain CTools 7
Same name and namespace in other branches
- 6 plugins/access/domain.inc \domain_ctools_domain_access_check()
Check for access based on the currently active domain.
1 string reference to 'domain_ctools_domain_access_check'
- domain_ctools_domain_ctools_access in plugins/
access/ domain.inc - Implement hook_ctools_access().
File
- plugins/
access/ domain.inc, line 88 - Plugin to provide access control based upon active domain.
Code
function domain_ctools_domain_access_check($conf, $context, $plugin) {
$_domain = domain_get_domain();
if (!empty($conf['domain_site'])) {
return TRUE;
}
if (empty($conf['domains'])) {
return FALSE;
}
$domain_list = array_filter($conf['domains']);
// On 7.x.2, the domain_id is a number, and 0 is stored as -1.
// Here we check if the install is DA 7.x.2 or if the ctools export was done
// using numeric keys.
if (domain_ctools_api_version() < 3 || isset($conf['domains'][-1])) {
$id = $_domain['domain_id'];
if ($id == 0) {
$id = -1;
}
if (isset($domain_list[$id])) {
return TRUE;
}
}
else {
// In some cases, Ctools gives us an imcomplete domain, which is odd.
// TODO: figure out why this is the case.
if (isset($_domain['machine_name'])) {
$machine_name = $_domain['machine_name'];
}
else {
$machine_name = domain_load_machine_name($_domain['domain_id']);
}
if (isset($domain_list[$machine_name])) {
return TRUE;
}
}
return FALSE;
}