@@ -18,77 +18,77 @@ |
||
18 | 18 | */ |
19 | 19 | trait ACLTrait |
20 | 20 | { |
21 | - /** |
|
22 | - * Returns the owner principal. |
|
23 | - * |
|
24 | - * This must be a url to a principal, or null if there's no owner |
|
25 | - * |
|
26 | - * @return string|null |
|
27 | - */ |
|
28 | - public function getOwner() |
|
29 | - { |
|
30 | - return null; |
|
31 | - } |
|
21 | + /** |
|
22 | + * Returns the owner principal. |
|
23 | + * |
|
24 | + * This must be a url to a principal, or null if there's no owner |
|
25 | + * |
|
26 | + * @return string|null |
|
27 | + */ |
|
28 | + public function getOwner() |
|
29 | + { |
|
30 | + return null; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Returns a group principal. |
|
35 | - * |
|
36 | - * This must be a url to a principal, or null if there's no owner |
|
37 | - * |
|
38 | - * @return string|null |
|
39 | - */ |
|
40 | - public function getGroup() |
|
41 | - { |
|
42 | - return null; |
|
43 | - } |
|
33 | + /** |
|
34 | + * Returns a group principal. |
|
35 | + * |
|
36 | + * This must be a url to a principal, or null if there's no owner |
|
37 | + * |
|
38 | + * @return string|null |
|
39 | + */ |
|
40 | + public function getGroup() |
|
41 | + { |
|
42 | + return null; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Returns a list of ACE's for this node. |
|
47 | - * |
|
48 | - * Each ACE has the following properties: |
|
49 | - * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
50 | - * currently the only supported privileges |
|
51 | - * * 'principal', a url to the principal who owns the node |
|
52 | - * * 'protected' (optional), indicating that this ACE is not allowed to |
|
53 | - * be updated. |
|
54 | - * |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public function getACL() |
|
58 | - { |
|
59 | - return [ |
|
60 | - [ |
|
61 | - 'privilege' => '{DAV:}all', |
|
62 | - 'principal' => '{DAV:}owner', |
|
63 | - 'protected' => true, |
|
64 | - ], |
|
65 | - ]; |
|
66 | - } |
|
45 | + /** |
|
46 | + * Returns a list of ACE's for this node. |
|
47 | + * |
|
48 | + * Each ACE has the following properties: |
|
49 | + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
50 | + * currently the only supported privileges |
|
51 | + * * 'principal', a url to the principal who owns the node |
|
52 | + * * 'protected' (optional), indicating that this ACE is not allowed to |
|
53 | + * be updated. |
|
54 | + * |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public function getACL() |
|
58 | + { |
|
59 | + return [ |
|
60 | + [ |
|
61 | + 'privilege' => '{DAV:}all', |
|
62 | + 'principal' => '{DAV:}owner', |
|
63 | + 'protected' => true, |
|
64 | + ], |
|
65 | + ]; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Updates the ACL. |
|
70 | - * |
|
71 | - * This method will receive a list of new ACE's as an array argument. |
|
72 | - */ |
|
73 | - public function setACL(array $acl) |
|
74 | - { |
|
75 | - throw new \Sabre\DAV\Exception\Forbidden('Setting ACL is not supported on this node'); |
|
76 | - } |
|
68 | + /** |
|
69 | + * Updates the ACL. |
|
70 | + * |
|
71 | + * This method will receive a list of new ACE's as an array argument. |
|
72 | + */ |
|
73 | + public function setACL(array $acl) |
|
74 | + { |
|
75 | + throw new \Sabre\DAV\Exception\Forbidden('Setting ACL is not supported on this node'); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Returns the list of supported privileges for this node. |
|
80 | - * |
|
81 | - * The returned data structure is a list of nested privileges. |
|
82 | - * See Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple |
|
83 | - * standard structure. |
|
84 | - * |
|
85 | - * If null is returned from this method, the default privilege set is used, |
|
86 | - * which is fine for most common usecases. |
|
87 | - * |
|
88 | - * @return array|null |
|
89 | - */ |
|
90 | - public function getSupportedPrivilegeSet() |
|
91 | - { |
|
92 | - return null; |
|
93 | - } |
|
78 | + /** |
|
79 | + * Returns the list of supported privileges for this node. |
|
80 | + * |
|
81 | + * The returned data structure is a list of nested privileges. |
|
82 | + * See Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple |
|
83 | + * standard structure. |
|
84 | + * |
|
85 | + * If null is returned from this method, the default privilege set is used, |
|
86 | + * which is fine for most common usecases. |
|
87 | + * |
|
88 | + * @return array|null |
|
89 | + */ |
|
90 | + public function getSupportedPrivilegeSet() |
|
91 | + { |
|
92 | + return null; |
|
93 | + } |
|
94 | 94 | } |
@@ -16,16 +16,16 @@ |
||
16 | 16 | */ |
17 | 17 | class AceConflict extends DAV\Exception\Conflict |
18 | 18 | { |
19 | - /** |
|
20 | - * Adds in extra information in the xml response. |
|
21 | - * |
|
22 | - * This method adds the {DAV:}no-ace-conflict element as defined in rfc3744 |
|
23 | - */ |
|
24 | - public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | - { |
|
26 | - $doc = $errorNode->ownerDocument; |
|
19 | + /** |
|
20 | + * Adds in extra information in the xml response. |
|
21 | + * |
|
22 | + * This method adds the {DAV:}no-ace-conflict element as defined in rfc3744 |
|
23 | + */ |
|
24 | + public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | + { |
|
26 | + $doc = $errorNode->ownerDocument; |
|
27 | 27 | |
28 | - $np = $doc->createElementNS('DAV:', 'd:no-ace-conflict'); |
|
29 | - $errorNode->appendChild($np); |
|
30 | - } |
|
28 | + $np = $doc->createElementNS('DAV:', 'd:no-ace-conflict'); |
|
29 | + $errorNode->appendChild($np); |
|
30 | + } |
|
31 | 31 | } |
@@ -16,16 +16,16 @@ |
||
16 | 16 | */ |
17 | 17 | class NotRecognizedPrincipal extends DAV\Exception\PreconditionFailed |
18 | 18 | { |
19 | - /** |
|
20 | - * Adds in extra information in the xml response. |
|
21 | - * |
|
22 | - * This method adds the {DAV:}recognized-principal element as defined in rfc3744 |
|
23 | - */ |
|
24 | - public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | - { |
|
26 | - $doc = $errorNode->ownerDocument; |
|
19 | + /** |
|
20 | + * Adds in extra information in the xml response. |
|
21 | + * |
|
22 | + * This method adds the {DAV:}recognized-principal element as defined in rfc3744 |
|
23 | + */ |
|
24 | + public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | + { |
|
26 | + $doc = $errorNode->ownerDocument; |
|
27 | 27 | |
28 | - $np = $doc->createElementNS('DAV:', 'd:recognized-principal'); |
|
29 | - $errorNode->appendChild($np); |
|
30 | - } |
|
28 | + $np = $doc->createElementNS('DAV:', 'd:recognized-principal'); |
|
29 | + $errorNode->appendChild($np); |
|
30 | + } |
|
31 | 31 | } |
@@ -16,16 +16,16 @@ |
||
16 | 16 | */ |
17 | 17 | class NoAbstract extends DAV\Exception\PreconditionFailed |
18 | 18 | { |
19 | - /** |
|
20 | - * Adds in extra information in the xml response. |
|
21 | - * |
|
22 | - * This method adds the {DAV:}no-abstract element as defined in rfc3744 |
|
23 | - */ |
|
24 | - public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | - { |
|
26 | - $doc = $errorNode->ownerDocument; |
|
19 | + /** |
|
20 | + * Adds in extra information in the xml response. |
|
21 | + * |
|
22 | + * This method adds the {DAV:}no-abstract element as defined in rfc3744 |
|
23 | + */ |
|
24 | + public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | + { |
|
26 | + $doc = $errorNode->ownerDocument; |
|
27 | 27 | |
28 | - $np = $doc->createElementNS('DAV:', 'd:no-abstract'); |
|
29 | - $errorNode->appendChild($np); |
|
30 | - } |
|
28 | + $np = $doc->createElementNS('DAV:', 'd:no-abstract'); |
|
29 | + $errorNode->appendChild($np); |
|
30 | + } |
|
31 | 31 | } |
@@ -16,16 +16,16 @@ |
||
16 | 16 | */ |
17 | 17 | class NotSupportedPrivilege extends DAV\Exception\PreconditionFailed |
18 | 18 | { |
19 | - /** |
|
20 | - * Adds in extra information in the xml response. |
|
21 | - * |
|
22 | - * This method adds the {DAV:}not-supported-privilege element as defined in rfc3744 |
|
23 | - */ |
|
24 | - public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | - { |
|
26 | - $doc = $errorNode->ownerDocument; |
|
19 | + /** |
|
20 | + * Adds in extra information in the xml response. |
|
21 | + * |
|
22 | + * This method adds the {DAV:}not-supported-privilege element as defined in rfc3744 |
|
23 | + */ |
|
24 | + public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
25 | + { |
|
26 | + $doc = $errorNode->ownerDocument; |
|
27 | 27 | |
28 | - $np = $doc->createElementNS('DAV:', 'd:not-supported-privilege'); |
|
29 | - $errorNode->appendChild($np); |
|
30 | - } |
|
28 | + $np = $doc->createElementNS('DAV:', 'd:not-supported-privilege'); |
|
29 | + $errorNode->appendChild($np); |
|
30 | + } |
|
31 | 31 | } |
@@ -18,56 +18,56 @@ |
||
18 | 18 | */ |
19 | 19 | class NeedPrivileges extends DAV\Exception\Forbidden |
20 | 20 | { |
21 | - /** |
|
22 | - * The relevant uri. |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $uri; |
|
21 | + /** |
|
22 | + * The relevant uri. |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $uri; |
|
27 | 27 | |
28 | - /** |
|
29 | - * The privileges the user didn't have. |
|
30 | - * |
|
31 | - * @var array |
|
32 | - */ |
|
33 | - protected $privileges; |
|
28 | + /** |
|
29 | + * The privileges the user didn't have. |
|
30 | + * |
|
31 | + * @var array |
|
32 | + */ |
|
33 | + protected $privileges; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Constructor. |
|
37 | - * |
|
38 | - * @param string $uri |
|
39 | - */ |
|
40 | - public function __construct($uri, array $privileges) |
|
41 | - { |
|
42 | - $this->uri = $uri; |
|
43 | - $this->privileges = $privileges; |
|
35 | + /** |
|
36 | + * Constructor. |
|
37 | + * |
|
38 | + * @param string $uri |
|
39 | + */ |
|
40 | + public function __construct($uri, array $privileges) |
|
41 | + { |
|
42 | + $this->uri = $uri; |
|
43 | + $this->privileges = $privileges; |
|
44 | 44 | |
45 | - parent::__construct('User did not have the required privileges ('.implode(',', $privileges).') for path "'.$uri.'"'); |
|
46 | - } |
|
45 | + parent::__construct('User did not have the required privileges ('.implode(',', $privileges).') for path "'.$uri.'"'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Adds in extra information in the xml response. |
|
50 | - * |
|
51 | - * This method adds the {DAV:}need-privileges element as defined in rfc3744 |
|
52 | - */ |
|
53 | - public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
54 | - { |
|
55 | - $doc = $errorNode->ownerDocument; |
|
48 | + /** |
|
49 | + * Adds in extra information in the xml response. |
|
50 | + * |
|
51 | + * This method adds the {DAV:}need-privileges element as defined in rfc3744 |
|
52 | + */ |
|
53 | + public function serialize(DAV\Server $server, \DOMElement $errorNode) |
|
54 | + { |
|
55 | + $doc = $errorNode->ownerDocument; |
|
56 | 56 | |
57 | - $np = $doc->createElementNS('DAV:', 'd:need-privileges'); |
|
58 | - $errorNode->appendChild($np); |
|
57 | + $np = $doc->createElementNS('DAV:', 'd:need-privileges'); |
|
58 | + $errorNode->appendChild($np); |
|
59 | 59 | |
60 | - foreach ($this->privileges as $privilege) { |
|
61 | - $resource = $doc->createElementNS('DAV:', 'd:resource'); |
|
62 | - $np->appendChild($resource); |
|
60 | + foreach ($this->privileges as $privilege) { |
|
61 | + $resource = $doc->createElementNS('DAV:', 'd:resource'); |
|
62 | + $np->appendChild($resource); |
|
63 | 63 | |
64 | - $resource->appendChild($doc->createElementNS('DAV:', 'd:href', $server->getBaseUri().$this->uri)); |
|
64 | + $resource->appendChild($doc->createElementNS('DAV:', 'd:href', $server->getBaseUri().$this->uri)); |
|
65 | 65 | |
66 | - $priv = $doc->createElementNS('DAV:', 'd:privilege'); |
|
67 | - $resource->appendChild($priv); |
|
66 | + $priv = $doc->createElementNS('DAV:', 'd:privilege'); |
|
67 | + $resource->appendChild($priv); |
|
68 | 68 | |
69 | - preg_match('/^{([^}]*)}(.*)$/', $privilege, $privilegeParts); |
|
70 | - $priv->appendChild($doc->createElementNS($privilegeParts[1], 'd:'.$privilegeParts[2])); |
|
71 | - } |
|
72 | - } |
|
69 | + preg_match('/^{([^}]*)}(.*)$/', $privilege, $privilegeParts); |
|
70 | + $priv->appendChild($doc->createElementNS($privilegeParts[1], 'd:'.$privilegeParts[2])); |
|
71 | + } |
|
72 | + } |
|
73 | 73 | } |
@@ -18,47 +18,47 @@ |
||
18 | 18 | */ |
19 | 19 | interface IPrincipalCollection extends DAV\ICollection |
20 | 20 | { |
21 | - /** |
|
22 | - * This method is used to search for principals matching a set of |
|
23 | - * properties. |
|
24 | - * |
|
25 | - * This search is specifically used by RFC3744's principal-property-search |
|
26 | - * REPORT. You should at least allow searching on |
|
27 | - * http://sabredav.org/ns}email-address. |
|
28 | - * |
|
29 | - * The actual search should be a unicode-non-case-sensitive search. The |
|
30 | - * keys in searchProperties are the WebDAV property names, while the values |
|
31 | - * are the property values to search on. |
|
32 | - * |
|
33 | - * By default, if multiple properties are submitted to this method, the |
|
34 | - * various properties should be combined with 'AND'. If $test is set to |
|
35 | - * 'anyof', it should be combined using 'OR'. |
|
36 | - * |
|
37 | - * This method should simply return a list of 'child names', which may be |
|
38 | - * used to call $this->getChild in the future. |
|
39 | - * |
|
40 | - * @param string $test |
|
41 | - * |
|
42 | - * @return array |
|
43 | - */ |
|
44 | - public function searchPrincipals(array $searchProperties, $test = 'allof'); |
|
21 | + /** |
|
22 | + * This method is used to search for principals matching a set of |
|
23 | + * properties. |
|
24 | + * |
|
25 | + * This search is specifically used by RFC3744's principal-property-search |
|
26 | + * REPORT. You should at least allow searching on |
|
27 | + * http://sabredav.org/ns}email-address. |
|
28 | + * |
|
29 | + * The actual search should be a unicode-non-case-sensitive search. The |
|
30 | + * keys in searchProperties are the WebDAV property names, while the values |
|
31 | + * are the property values to search on. |
|
32 | + * |
|
33 | + * By default, if multiple properties are submitted to this method, the |
|
34 | + * various properties should be combined with 'AND'. If $test is set to |
|
35 | + * 'anyof', it should be combined using 'OR'. |
|
36 | + * |
|
37 | + * This method should simply return a list of 'child names', which may be |
|
38 | + * used to call $this->getChild in the future. |
|
39 | + * |
|
40 | + * @param string $test |
|
41 | + * |
|
42 | + * @return array |
|
43 | + */ |
|
44 | + public function searchPrincipals(array $searchProperties, $test = 'allof'); |
|
45 | 45 | |
46 | - /** |
|
47 | - * Finds a principal by its URI. |
|
48 | - * |
|
49 | - * This method may receive any type of uri, but mailto: addresses will be |
|
50 | - * the most common. |
|
51 | - * |
|
52 | - * Implementation of this API is optional. It is currently used by the |
|
53 | - * CalDAV system to find principals based on their email addresses. If this |
|
54 | - * API is not implemented, some features may not work correctly. |
|
55 | - * |
|
56 | - * This method must return a relative principal path, or null, if the |
|
57 | - * principal was not found or you refuse to find it. |
|
58 | - * |
|
59 | - * @param string $uri |
|
60 | - * |
|
61 | - * @return string |
|
62 | - */ |
|
63 | - public function findByUri($uri); |
|
46 | + /** |
|
47 | + * Finds a principal by its URI. |
|
48 | + * |
|
49 | + * This method may receive any type of uri, but mailto: addresses will be |
|
50 | + * the most common. |
|
51 | + * |
|
52 | + * Implementation of this API is optional. It is currently used by the |
|
53 | + * CalDAV system to find principals based on their email addresses. If this |
|
54 | + * API is not implemented, some features may not work correctly. |
|
55 | + * |
|
56 | + * This method must return a relative principal path, or null, if the |
|
57 | + * principal was not found or you refuse to find it. |
|
58 | + * |
|
59 | + * @param string $uri |
|
60 | + * |
|
61 | + * @return string |
|
62 | + */ |
|
63 | + public function findByUri($uri); |
|
64 | 64 | } |
@@ -16,14 +16,14 @@ |
||
16 | 16 | */ |
17 | 17 | interface CreatePrincipalSupport extends BackendInterface |
18 | 18 | { |
19 | - /** |
|
20 | - * Creates a new principal. |
|
21 | - * |
|
22 | - * This method receives a full path for the new principal. The mkCol object |
|
23 | - * contains any additional webdav properties specified during the creation |
|
24 | - * of the principal. |
|
25 | - * |
|
26 | - * @param string $path |
|
27 | - */ |
|
28 | - public function createPrincipal($path, MkCol $mkCol); |
|
19 | + /** |
|
20 | + * Creates a new principal. |
|
21 | + * |
|
22 | + * This method receives a full path for the new principal. The mkCol object |
|
23 | + * contains any additional webdav properties specified during the creation |
|
24 | + * of the principal. |
|
25 | + * |
|
26 | + * @param string $path |
|
27 | + */ |
|
28 | + public function createPrincipal($path, MkCol $mkCol); |
|
29 | 29 | } |
@@ -17,38 +17,38 @@ |
||
17 | 17 | */ |
18 | 18 | abstract class AbstractBackend implements BackendInterface |
19 | 19 | { |
20 | - /** |
|
21 | - * Finds a principal by its URI. |
|
22 | - * |
|
23 | - * This method may receive any type of uri, but mailto: addresses will be |
|
24 | - * the most common. |
|
25 | - * |
|
26 | - * Implementation of this API is optional. It is currently used by the |
|
27 | - * CalDAV system to find principals based on their email addresses. If this |
|
28 | - * API is not implemented, some features may not work correctly. |
|
29 | - * |
|
30 | - * This method must return a relative principal path, or null, if the |
|
31 | - * principal was not found or you refuse to find it. |
|
32 | - * |
|
33 | - * @param string $uri |
|
34 | - * @param string $principalPrefix |
|
35 | - * |
|
36 | - * @return string|null |
|
37 | - */ |
|
38 | - public function findByUri($uri, $principalPrefix) |
|
39 | - { |
|
40 | - // Note that the default implementation here is a bit slow and could |
|
41 | - // likely be optimized. |
|
42 | - if ('mailto:' !== substr($uri, 0, 7)) { |
|
43 | - return; |
|
44 | - } |
|
45 | - $result = $this->searchPrincipals( |
|
46 | - $principalPrefix, |
|
47 | - ['{http://sabredav.org/ns}email-address' => substr($uri, 7)] |
|
48 | - ); |
|
20 | + /** |
|
21 | + * Finds a principal by its URI. |
|
22 | + * |
|
23 | + * This method may receive any type of uri, but mailto: addresses will be |
|
24 | + * the most common. |
|
25 | + * |
|
26 | + * Implementation of this API is optional. It is currently used by the |
|
27 | + * CalDAV system to find principals based on their email addresses. If this |
|
28 | + * API is not implemented, some features may not work correctly. |
|
29 | + * |
|
30 | + * This method must return a relative principal path, or null, if the |
|
31 | + * principal was not found or you refuse to find it. |
|
32 | + * |
|
33 | + * @param string $uri |
|
34 | + * @param string $principalPrefix |
|
35 | + * |
|
36 | + * @return string|null |
|
37 | + */ |
|
38 | + public function findByUri($uri, $principalPrefix) |
|
39 | + { |
|
40 | + // Note that the default implementation here is a bit slow and could |
|
41 | + // likely be optimized. |
|
42 | + if ('mailto:' !== substr($uri, 0, 7)) { |
|
43 | + return; |
|
44 | + } |
|
45 | + $result = $this->searchPrincipals( |
|
46 | + $principalPrefix, |
|
47 | + ['{http://sabredav.org/ns}email-address' => substr($uri, 7)] |
|
48 | + ); |
|
49 | 49 | |
50 | - if ($result) { |
|
51 | - return $result[0]; |
|
52 | - } |
|
53 | - } |
|
50 | + if ($result) { |
|
51 | + return $result[0]; |
|
52 | + } |
|
53 | + } |
|
54 | 54 | } |