function ack_menu_realm_access in Access Control Kit 7
Access callback for managing realm links.
Parameters
object $scheme: An access scheme.
int $realm: A realm value.
object $account: (optional) A user account. Defaults to the currently logged-in user.
Return value
bool TRUE if the user account has access to manage links in the given realm.
1 call to ack_menu_realm_access()
- _ack_menu_user_realms in ack_menu/
ack_menu.module - Helper function to find the realms where the user is allowed to manage links.
1 string reference to 'ack_menu_realm_access'
- ack_menu_menu in ack_menu/
ack_menu.module - Implements hook_menu().
File
- ack_menu/
ack_menu.module, line 238 - The ACK menu module.
Code
function ack_menu_realm_access($scheme, $realm, $account = NULL) {
// Validate the scheme.
if (isset($scheme->handlers['menu_link'])) {
// Validate the realm value.
if (is_numeric($realm) && isset($scheme->realms[$realm])) {
// Admin access trumps any realm-level access.
if (ack_menu_admin_access($account)) {
return TRUE;
}
// Check realm access and that manageable links exist.
if (ack_menu_access($account)) {
$allowed_realms = access_user_permission_realms('ack manage menu links', $account, array(
$scheme,
));
if (in_array($realm, $allowed_realms[$scheme->machine_name])) {
$links = ack_menu_realm_links($scheme, $realm);
return !empty($links);
}
}
}
}
return FALSE;
}