/** * Get a property in XML format * @see DAV_Resource::prop() * @param string $propname the name of the property to be returned, * eg. "mynamespace: myprop" * @return string XML or NULL if the property is not defined. */ public function prop($propname) { if ($method = @DAV::$ACL_PROPERTIES[$propname] or $this instanceof DAVACL_Principal && ($method = @DAV::$PRINCIPAL_PROPERTIES[$propname])) { return call_user_func(array($this, "prop_{$method}")); } return parent::prop($propname); }
/** * Handles a DAV:acl-principal-prop-set REPORT request * * @param DAV_Resource $resource The resource to perform the request on * @return void */ private function handle_acl_principal_prop_set($resource) { $ppr = $resource->property_priv_read(array(DAV::PROP_ACL)); if (!$ppr[DAV::PROP_ACL]) { throw DAV::forbidden(); } $principals = array(); foreach ($resource->user_prop_acl() as $ace) { if ('/' === $ace->principal[0]) { $principals[$ace->principal] = true; } elseif (isset(DAVACL::$PRINCIPALS[$ace->principal])) { continue; } else { $href = $resource->prop($ace->principal); if ($href instanceof DAV_Element_href) { $principals[$href->URIs[0]] = true; } } } $multistatus = DAV_Multistatus::inst(); foreach (array_keys($principals) as $href) { if ($href && ($principal = DAV::$REGISTRY->resource($href))) { $response = new DAV_Element_response($href); foreach ($this->entity as $property) { try { $response->setProperty($property, $principal->prop($property)); } catch (DAV_Status $e) { $response->setStatus($property, $e); } } $multistatus->addResponse($response); } } }
/** * Called by {@link method_PROPFIND()} * @param string $path * @param DAV_Resource $resource * @param array $props */ private function handle3($resource, $props) { $propprivs = $resource->property_priv_read($props); $response = new DAV_Element_response($resource->path); foreach ($props as $prop) { if (array_key_exists($prop, $propprivs) && !$propprivs[$prop]) { $response->setStatus($prop, DAV::forbidden()); } else { try { $value = $resource->prop($prop); if (!is_null($value)) { $response->setProperty($prop, $value); } else { $response->setStatus($prop, DAV_Status::$NOT_FOUND); } } catch (DAV_Status $e) { $response->setStatus($prop, $e); } } } DAV_Multistatus::inst()->addResponse($response); }