/** * This call wraps the original get_by_guid call to provide access control. * The calling sequence is as with the corresponding constructor. * * @param midcom_core_dbaobject &$object The DBA object we're working on * @param string $guid The guid of the object to load from the database. * @return bool Indicating Success */ public static function get_by_guid(midcom_core_dbaobject &$object, $guid) { $object->__exec_get_by_guid((string) $guid); if ($object->id != 0 && $object->action != 'delete') { if (!$object->can_do('midgard:read')) { debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$object->guid} not granted for the current user.", MIDCOM_LOG_ERROR); self::_clear_object($object); return false; } $object->_on_loaded(); return true; } else { debug_add("Failed to load the record identified by {$guid}, last Midgard error was: " . midcom_connection::get_error_string(), MIDCOM_LOG_INFO); return false; } }