We should also check that $object is an object, for cases where it doesn't get loaded and NULL is passed.

if (!user_access('administer islandora_xacml_editor') || !is_object($object) {