You are here

function access_object_realms in Access Control Kit 7

Returns a list of an object's realm memberships.

Parameters

string $object_type: The type of access-controlled object (e.g., node, menu_link).

mixed $object: The access-controlled object.

array $schemes: (optional) An array of access schemes, used to limit the list of returned realm memberships. If omitted, the returned list will include realm memberships for all schemes that apply to the object type.

Return value

array An array indexed by scheme machine name where each value is an array of realm values. If the object is not a member of any realm in a scheme, the value returned for that scheme will be array().

1 call to access_object_realms()
access_user_object_access in ./access.module
Determines whether a user has a permission on an object via an access grant.

File

./access.module, line 810
The access control kit module.

Code

function access_object_realms($object_type, $object, $schemes = NULL) {
  if (!isset($schemes)) {
    $schemes = access_object_schemes($object_type);
  }
  $realms = array();
  foreach ($schemes as $scheme) {
    $realms[$scheme->machine_name] = isset($scheme->handlers[$object_type]) ? $scheme->handlers[$object_type]
      ->objectRealms($object_type, $object) : array();
  }
  return $realms;
}