コード例 #1
0
 /**
  * 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);
         }
     }
 }