function notifications_object_access in Notifications 6.4
Check access to an object for user account
Parameters
$type: Object type
$object: Object or object id
$account: User account to check access to the object
2 calls to notifications_object_access()
- notifications_content_comment_access in notifications_content/
notifications_content.module - Notifications object access callback. Determine whether the specified user may view the specified comment.
- notifications_user_allowed in ./
notifications.module - Check access to objects
File
- includes/
object.inc, line 48 - Notifications object and fields
Code
function notifications_object_access($type, $object, $account) {
$object = notifications_object_load($type, $object);
// If object not properly loaded, always false
if (!$object) {
return FALSE;
}
elseif (($info = notifications_object_type($type)) && ($key = $info['key_field']) && isset($object->{$key})) {
$access =& messaging_static(__FUNCTION__);
if (!isset($access[$type][$account->uid][$object->{$key}])) {
if (isset($info['access callback'])) {
$access[$type][$account->uid][$object->{$key}] = _notifications_object_callback($type, 'access callback', $object, $account);
}
elseif (isset($info['access'])) {
$access[$type][$account->uid][$object->{$key}] = user_access($info['access'], $account);
}
else {
// Not defined, so we allow user access
$access[$type][$account->uid][$object->{$key}] = TRUE;
}
}
return $access[$type][$account->uid][$object->{$key}];
}
// If not object information we cannot determine anything
}