Lines Matching +full:fetch +full:- +full:depth

23  * In addition it also provides support for the {DAV:}current-user-principal
24 * property, defined in RFC5397 and the {DAV:}expand-property report, as
50 * This checks every parentnode in the tree, but not leaf-nodes.
73 * in directory listings (PROPFIND on parent with Depth: 1)
84 * the {DAV:}principal-property-search report.
92 '{http://sabredav.org/ns}email-address' => 'Email address',
125 return ['access-control', 'calendarserver-principal-property-search'];
158 * This will be used in the {DAV:}supported-report-set property.
168 '{DAV:}expand-property',
169 '{DAV:}principal-match',
170 '{DAV:}principal-property-search',
171 '{DAV:}principal-search-property-set',
196 $acl = $this->getCurrentUserPrivilegeSet($uri);
208 if ($this->allowUnauthenticatedAccess && is_null($this->getCurrentUserPrincipal())) {
210 $authPlugin = $this->server->getPlugin('auth');
211 $reasons = $authPlugin->getLoginFailedReasons();
212 $authPlugin->challenge(
213 $this->server->httpRequest,
214 $this->server->httpResponse
240 $authPlugin = $this->server->getPlugin('auth');
244 return $authPlugin->getCurrentPrincipal();
257 $currentUser = $this->getCurrentUserPrincipal();
263 $this->getPrincipalMembership($currentUser)
278 $this->defaultAcl = $acl;
291 return $this->defaultAcl;
330 if (isset($this->principalMembershipCache[$mainPrincipal])) {
331 return $this->principalMembershipCache[$mainPrincipal];
341 $node = $this->server->tree->getNodeForPath($principal);
343 foreach ($node->getGroupMembership() as $groupMember) {
359 $this->principalMembershipCache[$mainPrincipal] = $principals;
389 $currentPrincipal = $this->getCurrentUserPrincipal();
396 $this->getPrincipalMembership($currentPrincipal)
417 * sub-privileges will automatically be granted.
430 * 'privilege' => '{DAV:}read-acl',
444 $node = $this->server->tree->getNodeForPath($node);
449 $supportedPrivileges = $node->getSupportedPrivilegeSet();
459 '{DAV:}read-acl' => [
463 '{DAV:}read-current-user-privilege-set' => [
472 '{DAV:}write-properties' => [
476 '{DAV:}write-content' => [
498 $supportedPrivileges['{DAV:}write']['aggregates']['{DAV:}write-acl'] = [
506 $this->server->emit(
522 * - aggregates
523 * - abstract
524 * - concrete
533 'aggregates' => $this->getSupportedPrivilegeSet($node)
590 $node = $this->server->tree->getNodeForPath($node);
593 return $this->getDefaultAcl();
595 $acl = $node->getACL();
596 foreach ($this->adminPrincipals as $adminPrincipal) {
621 $node = $this->server->tree->getNodeForPath($node);
624 $acl = $this->getACL($node);
628 $isAuthenticated = $this->getCurrentUserPrincipal() !== null;
637 $owner = $node->getOwner();
638 if ($owner && $this->principalMatchesPrincipal($owner)) {
664 if ($this->principalMatchesPrincipal($ace['principal'])) {
675 $flat = $this->getFlatPrivilegeSet($node);
684 // Ignoring privileges that are not in the supported-privileges list.
685 …$this->server->getLogger()->debug('A node has the "' . $current['privilege'] . '" in its ACL list,…
711 $collections = $this->principalCollectionSet;
715 $principalCollection = $this->server->tree->getNodeForPath($collection);
727 $result = $principalCollection->findByUri($uri);
745 * key-value list. The keys are property
752 * principal collection-set will be used.
764 $uris = $this->principalCollectionSet;
770 $principalCollection = $this->server->tree->getNodeForPath($uri);
777 $results = $principalCollection->searchPrincipals($searchProperties, $test);
788 … list($matches[]) = $this->server->getPropertiesForPath($lookupResult, $requestedProperties, 0);
806 if ($this->allowUnauthenticatedAccess) {
807 $authPlugin = $server->getPlugin('auth');
811 $authPlugin->autoRequireLogin = false;
814 $this->server = $server;
815 $server->on('propFind', [$this, 'propFind'], 20);
816 $server->on('beforeMethod', [$this, 'beforeMethod'], 20);
817 $server->on('beforeBind', [$this, 'beforeBind'], 20);
818 $server->on('beforeUnbind', [$this, 'beforeUnbind'], 20);
819 $server->on('propPatch', [$this, 'propPatch']);
820 $server->on('beforeUnlock', [$this, 'beforeUnlock'], 20);
821 $server->on('report', [$this, 'report']);
822 $server->on('method:ACL', [$this, 'httpAcl']);
823 $server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel']);
824 $server->on('getPrincipalByUri', function($principal, &$uri) {
826 $uri = $this->getPrincipalByUri($principal);
833 array_push($server->protectedProperties,
834 '{DAV:}alternate-URI-set',
835 '{DAV:}principal-URL',
836 '{DAV:}group-membership',
837 '{DAV:}principal-collection-set',
838 '{DAV:}current-user-principal',
839 '{DAV:}supported-privilege-set',
840 '{DAV:}current-user-privilege-set',
842 '{DAV:}acl-restrictions',
843 '{DAV:}inherited-acl-set',
850 $server->resourceTypeMapping['Sabre\\DAVACL\\IPrincipal'] = '{DAV:}principal';
852 // Mapping the group-member-set property to the HrefList property
854 $server->xml->elementMap['{DAV:}group-member-set'] = 'Sabre\\DAV\\Xml\\Property\\Href';
855 $server->xml->elementMap['{DAV:}acl'] = 'Sabre\\DAVACL\\Xml\\Property\\Acl';
856 …$server->xml->elementMap['{DAV:}acl-principal-prop-set'] = 'Sabre\\DAVACL\\Xml\\Request\\AclPrinci…
857 …$server->xml->elementMap['{DAV:}expand-property'] = 'Sabre\\DAVACL\\Xml\\Request\\ExpandPropertyRe…
858 …$server->xml->elementMap['{DAV:}principal-property-search'] = 'Sabre\\DAVACL\\Xml\\Request\\Princi…
859 …$server->xml->elementMap['{DAV:}principal-search-property-set'] = 'Sabre\\DAVACL\\Xml\\Request\\Pr…
860 …$server->xml->elementMap['{DAV:}principal-match'] = 'Sabre\\DAVACL\\Xml\\Request\\PrincipalMatchRe…
875 $method = $request->getMethod();
876 $path = $request->getPath();
878 $exists = $this->server->tree->nodeExists($path);
889 $this->checkPrivileges($path, '{DAV:}read');
894 // This method requires the write-content priv if the node
898 $this->checkPrivileges($path, '{DAV:}write-content');
906 $this->checkPrivileges($path, '{DAV:}write-properties');
910 $this->checkPrivileges($path, '{DAV:}write-acl');
916 // If the target exists write-content normally needs to be
926 $this->checkPrivileges($path, '{DAV:}read', self::R_RECURSIVE);
945 $this->checkPrivileges($parentUri, '{DAV:}bind');
961 $this->checkPrivileges($parentUri, '{DAV:}unbind', self::R_RECURSIVEPARENTS);
988 $path = $propFind->getPath();
991 if (!$this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false)) {
994 // Returning false causes the property-fetching system to pretend
997 if ($this->hideNodesFromListings) {
1002 foreach ($propFind->getRequestedProperties() as $requestedProperty) {
1003 $propFind->set($requestedProperty, null, 403);
1013 $propFind->handle('{DAV:}alternate-URI-set', function() use ($node) {
1014 return new Href($node->getAlternateUriSet());
1016 $propFind->handle('{DAV:}principal-URL', function() use ($node) {
1017 return new Href($node->getPrincipalUrl() . '/');
1019 $propFind->handle('{DAV:}group-member-set', function() use ($node) {
1020 $members = $node->getGroupMemberSet();
1026 $propFind->handle('{DAV:}group-membership', function() use ($node) {
1027 $members = $node->getGroupMembership();
1033 $propFind->handle('{DAV:}displayname', [$node, 'getDisplayName']);
1037 $propFind->handle('{DAV:}principal-collection-set', function() {
1039 $val = $this->principalCollectionSet;
1045 $propFind->handle('{DAV:}current-user-principal', function() {
1046 if ($url = $this->getCurrentUserPrincipal()) {
1052 $propFind->handle('{DAV:}supported-privilege-set', function() use ($node) {
1053 return new Xml\Property\SupportedPrivilegeSet($this->getSupportedPrivilegeSet($node));
1055 … $propFind->handle('{DAV:}current-user-privilege-set', function() use ($node, $propFind, $path) {
1056 …if (!$this->checkPrivileges($path, '{DAV:}read-current-user-privilege-set', self::R_PARENT, false)…
1057 $propFind->set('{DAV:}current-user-privilege-set', null, 403);
1059 $val = $this->getCurrentUserPrivilegeSet($node);
1063 $propFind->handle('{DAV:}acl', function() use ($node, $propFind, $path) {
1065 if (!$this->checkPrivileges($path, '{DAV:}read-acl', self::R_PARENT, false)) {
1066 $propFind->set('{DAV:}acl', null, 403);
1068 $acl = $this->getACL($node);
1069 return new Xml\Property\Acl($this->getACL($node));
1072 $propFind->handle('{DAV:}acl-restrictions', function() {
1078 $propFind->handle('{DAV:}owner', function() use ($node) {
1079 return new Href($node->getOwner() . '/');
1087 * group-member-set is updated correctly.
1095 $propPatch->handle('{DAV:}group-member-set', function($value) use ($path) {
1100 [$this->server, 'calculateUri'],
1101 $value->getHrefs()
1104 …throw new DAV\Exception('The group-member-set property MUST be an instance of Sabre\DAV\Property\H…
1106 $node = $this->server->tree->getNodeForPath($path);
1112 $node->setGroupMemberSet($memberSet);
1115 $this->principalMembershipCache = [];
1134 case '{DAV:}principal-property-search' :
1135 $this->server->transactionType = 'report-principal-property-search';
1136 $this->principalPropertySearchReport($path, $report);
1138 case '{DAV:}principal-search-property-set' :
1139 $this->server->transactionType = 'report-principal-search-property-set';
1140 $this->principalSearchPropertySetReport($path, $report);
1142 case '{DAV:}expand-property' :
1143 $this->server->transactionType = 'report-expand-property';
1144 $this->expandPropertyReport($path, $report);
1146 case '{DAV:}principal-match' :
1147 $this->server->transactionType = 'report-principal-match';
1148 $this->principalMatchReport($path, $report);
1150 case '{DAV:}acl-principal-prop-set' :
1151 $this->server->transactionType = 'acl-principal-prop-set';
1152 $this->aclPrincipalPropSetReport($path, $report);
1168 $path = $request->getPath();
1169 $body = $request->getBodyAsString();
1175 $acl = $this->server->xml->expect('{DAV:}acl', $body);
1176 $newAcl = $acl->getPrivileges();
1180 $newAcl[$k]['principal'] = $this->server->calculateUri($newAce['principal']);
1182 $node = $this->server->tree->getNodeForPath($path);
1188 $oldAcl = $this->getACL($node);
1190 $supportedPrivileges = $this->getFlatPrivilegeSet($node);
1226 $principal = $this->server->tree->getNodeForPath($newAce['principal']);
1235 $node->setACL($newAcl);
1237 $response->setStatus(200);
1249 * The principal-match report is defined in RFC3744, section 9.3.
1261 $depth = $this->server->getHTTPDepth(0);
1262 if ($depth !== 0) {
1263 throw new BadRequest('The principal-match report is only defined on Depth: 0');
1266 $currentPrincipals = $this->getCurrentUserPrincipals();
1270 if ($report->type === Xml\Request\PrincipalMatchReport::SELF) {
1286 $candidates = $this->server->getPropertiesForPath(
1288 [$report->principalProperty],
1294 if (!isset($candidate[200][$report->principalProperty])) {
1298 $hrefs = $candidate[200][$report->principalProperty];
1304 foreach ($hrefs->getHrefs() as $href) {
1320 if ($report->properties) {
1322 $foo = $this->server->getPropertiesForPath($item, $report->properties);
1338 $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
1339 $this->server->httpResponse->setStatus(207);
1340 $this->server->httpResponse->setBody(
1341 $this->server->xml->write(
1344 $this->server->getBaseUri()
1352 * The expand-property report is defined in RFC3253 section 3.8.
1368 $depth = $this->server->getHTTPDepth(0);
1370 $result = $this->expandProperties($path, $report->properties, $depth);
1372 $xml = $this->server->xml->write(
1375 $this->server->getBaseUri()
1377 $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
1378 $this->server->httpResponse->setStatus(207);
1379 $this->server->httpResponse->setBody($xml);
1389 * @param int $depth
1392 protected function expandProperties($path, array $requestedProperties, $depth) { argument
1394 …$foundProperties = $this->server->getPropertiesForPath($path, array_keys($requestedProperties), $d…
1402 // We're only traversing if sub-properties were requested
1413 $childHrefs = $node[200][$propertyName]->getHrefs();
1420 'value' => $this->expandProperties($href, $childRequestedProperties, 0)[0]
1440 * {DAV:}principal-search-property-set report. This report returns a list
1442 * {DAV:}principal-property-search report.
1450 $httpDepth = $this->server->getHTTPDepth(0);
1452 throw new DAV\Exception\BadRequest('This report is only defined when Depth: 0');
1455 $writer = $this->server->xml->getWriter();
1456 $writer->openMemory();
1457 $writer->startDocument();
1459 $writer->startElement('{DAV:}principal-search-property-set');
1461 foreach ($this->principalSearchPropertySet as $propertyName => $description) {
1463 $writer->startElement('{DAV:}principal-search-property');
1464 $writer->startElement('{DAV:}prop');
1466 $writer->writeElement($propertyName);
1468 $writer->endElement(); // prop
1471 $writer->write([[
1478 $writer->endElement(); // principal-search-property
1483 $writer->endElement(); // principal-search-property-set
1485 $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
1486 $this->server->httpResponse->setStatus(200);
1487 $this->server->httpResponse->setBody($writer->outputMemory());
1495 * {DAV:}principal-property-search report. This report can be used for
1505 if ($report->applyToPrincipalCollectionSet) {
1508 if ($this->server->getHttpDepth('0') !== 0) {
1509 throw new BadRequest('Depth must be 0');
1511 $result = $this->principalSearch(
1512 $report->searchProperties,
1513 $report->properties,
1515 $report->test
1518 $prefer = $this->server->getHTTPPrefer();
1520 $this->server->httpResponse->setStatus(207);
1521 $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
1522 $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
1523 …$this->server->httpResponse->setBody($this->server->generateMultiStatus($result, $prefer['return']…
1530 * This method is responsible for handling the {DAV:}acl-principal-prop-set
1533 * https://tools.ietf.org/html/rfc3744#section-9.2
1535 * This REPORT allows a user to quickly fetch information about all
1546 if ($this->server->getHTTPDepth(0) !== 0) {
1547 throw new BadRequest('The {DAV:}acl-principal-prop-set REPORT only supports Depth 0');
1553 $acl = $this->server->getProperties($path, '{DAV:}acl');
1556 throw new Forbidden('Could not fetch ACL rules for this path');
1560 foreach ($acl['{DAV:}acl']->getPrivileges() as $ace) {
1571 $properties = $this->server->getPropertiesForMultiplePaths(
1573 $report->properties
1576 $this->server->httpResponse->setStatus(207);
1577 $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
1578 $this->server->httpResponse->setBody(
1579 $this->server->generateMultiStatus($properties)
1607 …Email address:</label> <input type="text" name="{http://sabredav*DOT*org/ns}email-address" /><br />
1617 * Returns a bunch of meta-data about the plugin.
1630 'name' => $this->getPluginName(),