@@ -49,17 +49,17 @@ |
||
49 | 49 | * @param \DOMElement $errorNode |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { |
|
52 | + public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { |
|
53 | 53 | |
54 | 54 | // set ownCloud namespace |
55 | 55 | $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
56 | 56 | |
57 | 57 | // adding the retry node |
58 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); |
|
58 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true)); |
|
59 | 59 | $errorNode->appendChild($error); |
60 | 60 | |
61 | 61 | // adding the message node |
62 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); |
|
62 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage()); |
|
63 | 63 | $errorNode->appendChild($error); |
64 | 64 | } |
65 | 65 | } |
@@ -23,42 +23,42 @@ |
||
23 | 23 | namespace OCA\DAV\Connector\Sabre\Exception; |
24 | 24 | |
25 | 25 | class Forbidden extends \Sabre\DAV\Exception\Forbidden { |
26 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
26 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @var bool |
|
30 | - */ |
|
31 | - private $retry; |
|
28 | + /** |
|
29 | + * @var bool |
|
30 | + */ |
|
31 | + private $retry; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param string $message |
|
35 | - * @param bool $retry |
|
36 | - * @param \Exception $previous |
|
37 | - */ |
|
38 | - public function __construct($message, $retry = false, \Exception $previous = null) { |
|
39 | - parent::__construct($message, 0, $previous); |
|
40 | - $this->retry = $retry; |
|
41 | - } |
|
33 | + /** |
|
34 | + * @param string $message |
|
35 | + * @param bool $retry |
|
36 | + * @param \Exception $previous |
|
37 | + */ |
|
38 | + public function __construct($message, $retry = false, \Exception $previous = null) { |
|
39 | + parent::__construct($message, 0, $previous); |
|
40 | + $this->retry = $retry; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * This method allows the exception to include additional information |
|
45 | - * into the WebDAV error response |
|
46 | - * |
|
47 | - * @param \Sabre\DAV\Server $server |
|
48 | - * @param \DOMElement $errorNode |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { |
|
43 | + /** |
|
44 | + * This method allows the exception to include additional information |
|
45 | + * into the WebDAV error response |
|
46 | + * |
|
47 | + * @param \Sabre\DAV\Server $server |
|
48 | + * @param \DOMElement $errorNode |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { |
|
52 | 52 | |
53 | - // set ownCloud namespace |
|
54 | - $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
|
53 | + // set ownCloud namespace |
|
54 | + $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
|
55 | 55 | |
56 | - // adding the retry node |
|
57 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); |
|
58 | - $errorNode->appendChild($error); |
|
56 | + // adding the retry node |
|
57 | + $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); |
|
58 | + $errorNode->appendChild($error); |
|
59 | 59 | |
60 | - // adding the message node |
|
61 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); |
|
62 | - $errorNode->appendChild($error); |
|
63 | - } |
|
60 | + // adding the message node |
|
61 | + $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); |
|
62 | + $errorNode->appendChild($error); |
|
63 | + } |
|
64 | 64 | } |
@@ -60,9 +60,9 @@ |
||
60 | 60 | |
61 | 61 | public function propFind(PropFind $propFind, INode $node) { |
62 | 62 | /* Overload current-user-principal */ |
63 | - $propFind->handle('{DAV:}current-user-principal', function () { |
|
63 | + $propFind->handle('{DAV:}current-user-principal', function() { |
|
64 | 64 | if ($url = parent::getCurrentUserPrincipal()) { |
65 | - return new Principal(Principal::HREF, $url . '/'); |
|
65 | + return new Principal(Principal::HREF, $url.'/'); |
|
66 | 66 | } else { |
67 | 67 | return new Principal(Principal::UNAUTHENTICATED); |
68 | 68 | } |
@@ -33,44 +33,44 @@ |
||
33 | 33 | |
34 | 34 | class LegacyDAVACL extends DavAclPlugin { |
35 | 35 | |
36 | - /** |
|
37 | - * @inheritdoc |
|
38 | - */ |
|
39 | - public function getCurrentUserPrincipals() { |
|
40 | - $principalV2 = $this->getCurrentUserPrincipal(); |
|
36 | + /** |
|
37 | + * @inheritdoc |
|
38 | + */ |
|
39 | + public function getCurrentUserPrincipals() { |
|
40 | + $principalV2 = $this->getCurrentUserPrincipal(); |
|
41 | 41 | |
42 | - if (is_null($principalV2)) { |
|
43 | - return []; |
|
44 | - } |
|
42 | + if (is_null($principalV2)) { |
|
43 | + return []; |
|
44 | + } |
|
45 | 45 | |
46 | - $principalV1 = $this->convertPrincipal($principalV2, false); |
|
47 | - return array_merge( |
|
48 | - [ |
|
49 | - $principalV2, |
|
50 | - $principalV1 |
|
51 | - ], |
|
52 | - $this->getPrincipalMembership($principalV1) |
|
53 | - ); |
|
54 | - } |
|
46 | + $principalV1 = $this->convertPrincipal($principalV2, false); |
|
47 | + return array_merge( |
|
48 | + [ |
|
49 | + $principalV2, |
|
50 | + $principalV1 |
|
51 | + ], |
|
52 | + $this->getPrincipalMembership($principalV1) |
|
53 | + ); |
|
54 | + } |
|
55 | 55 | |
56 | - private function convertPrincipal($principal, $toV2) { |
|
57 | - [, $name] = \Sabre\Uri\split($principal); |
|
58 | - if ($toV2) { |
|
59 | - return "principals/users/$name"; |
|
60 | - } |
|
61 | - return "principals/$name"; |
|
62 | - } |
|
56 | + private function convertPrincipal($principal, $toV2) { |
|
57 | + [, $name] = \Sabre\Uri\split($principal); |
|
58 | + if ($toV2) { |
|
59 | + return "principals/users/$name"; |
|
60 | + } |
|
61 | + return "principals/$name"; |
|
62 | + } |
|
63 | 63 | |
64 | - public function propFind(PropFind $propFind, INode $node) { |
|
65 | - /* Overload current-user-principal */ |
|
66 | - $propFind->handle('{DAV:}current-user-principal', function () { |
|
67 | - if ($url = parent::getCurrentUserPrincipal()) { |
|
68 | - return new Principal(Principal::HREF, $url . '/'); |
|
69 | - } else { |
|
70 | - return new Principal(Principal::UNAUTHENTICATED); |
|
71 | - } |
|
72 | - }); |
|
64 | + public function propFind(PropFind $propFind, INode $node) { |
|
65 | + /* Overload current-user-principal */ |
|
66 | + $propFind->handle('{DAV:}current-user-principal', function () { |
|
67 | + if ($url = parent::getCurrentUserPrincipal()) { |
|
68 | + return new Principal(Principal::HREF, $url . '/'); |
|
69 | + } else { |
|
70 | + return new Principal(Principal::UNAUTHENTICATED); |
|
71 | + } |
|
72 | + }); |
|
73 | 73 | |
74 | - return parent::propFind($propFind, $node); |
|
75 | - } |
|
74 | + return parent::propFind($propFind, $node); |
|
75 | + } |
|
76 | 76 | } |
@@ -156,15 +156,15 @@ |
||
156 | 156 | public function delete() { |
157 | 157 | try { |
158 | 158 | if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) { |
159 | - throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found'); |
|
159 | + throw new NotFound('Tag with id '.$this->tag->getId().' not found'); |
|
160 | 160 | } |
161 | 161 | if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) { |
162 | - throw new Forbidden('No permission to unassign tag ' . $this->tag->getId()); |
|
162 | + throw new Forbidden('No permission to unassign tag '.$this->tag->getId()); |
|
163 | 163 | } |
164 | 164 | $this->tagMapper->unassignTags($this->objectId, $this->objectType, $this->tag->getId()); |
165 | 165 | } catch (TagNotFoundException $e) { |
166 | 166 | // can happen if concurrent deletion occurred |
167 | - throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found', 0, $e); |
|
167 | + throw new NotFound('Tag with id '.$this->tag->getId().' not found', 0, $e); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | } |
@@ -37,139 +37,139 @@ |
||
37 | 37 | * Mapping node for system tag to object id |
38 | 38 | */ |
39 | 39 | class SystemTagMappingNode implements \Sabre\DAV\INode { |
40 | - /** |
|
41 | - * @var ISystemTag |
|
42 | - */ |
|
43 | - protected $tag; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var string |
|
47 | - */ |
|
48 | - private $objectId; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var string |
|
52 | - */ |
|
53 | - private $objectType; |
|
54 | - |
|
55 | - /** |
|
56 | - * User |
|
57 | - * |
|
58 | - * @var IUser |
|
59 | - */ |
|
60 | - protected $user; |
|
61 | - |
|
62 | - /** |
|
63 | - * @var ISystemTagManager |
|
64 | - */ |
|
65 | - protected $tagManager; |
|
66 | - |
|
67 | - /** |
|
68 | - * @var ISystemTagObjectMapper |
|
69 | - */ |
|
70 | - private $tagMapper; |
|
71 | - |
|
72 | - /** |
|
73 | - * Sets up the node, expects a full path name |
|
74 | - * |
|
75 | - * @param ISystemTag $tag system tag |
|
76 | - * @param string $objectId |
|
77 | - * @param string $objectType |
|
78 | - * @param IUser $user user |
|
79 | - * @param ISystemTagManager $tagManager |
|
80 | - * @param ISystemTagObjectMapper $tagMapper |
|
81 | - */ |
|
82 | - public function __construct( |
|
83 | - ISystemTag $tag, |
|
84 | - $objectId, |
|
85 | - $objectType, |
|
86 | - IUser $user, |
|
87 | - ISystemTagManager $tagManager, |
|
88 | - ISystemTagObjectMapper $tagMapper |
|
89 | - ) { |
|
90 | - $this->tag = $tag; |
|
91 | - $this->objectId = $objectId; |
|
92 | - $this->objectType = $objectType; |
|
93 | - $this->user = $user; |
|
94 | - $this->tagManager = $tagManager; |
|
95 | - $this->tagMapper = $tagMapper; |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Returns the object id of the relationship |
|
100 | - * |
|
101 | - * @return string object id |
|
102 | - */ |
|
103 | - public function getObjectId() { |
|
104 | - return $this->objectId; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Returns the object type of the relationship |
|
109 | - * |
|
110 | - * @return string object type |
|
111 | - */ |
|
112 | - public function getObjectType() { |
|
113 | - return $this->objectType; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * Returns the system tag represented by this node |
|
118 | - * |
|
119 | - * @return ISystemTag system tag |
|
120 | - */ |
|
121 | - public function getSystemTag() { |
|
122 | - return $this->tag; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Returns the id of the tag |
|
127 | - * |
|
128 | - * @return string |
|
129 | - */ |
|
130 | - public function getName() { |
|
131 | - return $this->tag->getId(); |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * Renames the node |
|
136 | - * |
|
137 | - * @param string $name The new name |
|
138 | - * |
|
139 | - * @throws MethodNotAllowed not allowed to rename node |
|
140 | - * |
|
141 | - * @return never |
|
142 | - */ |
|
143 | - public function setName($name) { |
|
144 | - throw new MethodNotAllowed(); |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * Returns null, not supported |
|
149 | - * |
|
150 | - * @return null |
|
151 | - */ |
|
152 | - public function getLastModified() { |
|
153 | - return null; |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * Delete tag to object association |
|
158 | - * |
|
159 | - * @return void |
|
160 | - */ |
|
161 | - public function delete() { |
|
162 | - try { |
|
163 | - if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) { |
|
164 | - throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found'); |
|
165 | - } |
|
166 | - if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) { |
|
167 | - throw new Forbidden('No permission to unassign tag ' . $this->tag->getId()); |
|
168 | - } |
|
169 | - $this->tagMapper->unassignTags($this->objectId, $this->objectType, $this->tag->getId()); |
|
170 | - } catch (TagNotFoundException $e) { |
|
171 | - // can happen if concurrent deletion occurred |
|
172 | - throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found', 0, $e); |
|
173 | - } |
|
174 | - } |
|
40 | + /** |
|
41 | + * @var ISystemTag |
|
42 | + */ |
|
43 | + protected $tag; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var string |
|
47 | + */ |
|
48 | + private $objectId; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + */ |
|
53 | + private $objectType; |
|
54 | + |
|
55 | + /** |
|
56 | + * User |
|
57 | + * |
|
58 | + * @var IUser |
|
59 | + */ |
|
60 | + protected $user; |
|
61 | + |
|
62 | + /** |
|
63 | + * @var ISystemTagManager |
|
64 | + */ |
|
65 | + protected $tagManager; |
|
66 | + |
|
67 | + /** |
|
68 | + * @var ISystemTagObjectMapper |
|
69 | + */ |
|
70 | + private $tagMapper; |
|
71 | + |
|
72 | + /** |
|
73 | + * Sets up the node, expects a full path name |
|
74 | + * |
|
75 | + * @param ISystemTag $tag system tag |
|
76 | + * @param string $objectId |
|
77 | + * @param string $objectType |
|
78 | + * @param IUser $user user |
|
79 | + * @param ISystemTagManager $tagManager |
|
80 | + * @param ISystemTagObjectMapper $tagMapper |
|
81 | + */ |
|
82 | + public function __construct( |
|
83 | + ISystemTag $tag, |
|
84 | + $objectId, |
|
85 | + $objectType, |
|
86 | + IUser $user, |
|
87 | + ISystemTagManager $tagManager, |
|
88 | + ISystemTagObjectMapper $tagMapper |
|
89 | + ) { |
|
90 | + $this->tag = $tag; |
|
91 | + $this->objectId = $objectId; |
|
92 | + $this->objectType = $objectType; |
|
93 | + $this->user = $user; |
|
94 | + $this->tagManager = $tagManager; |
|
95 | + $this->tagMapper = $tagMapper; |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Returns the object id of the relationship |
|
100 | + * |
|
101 | + * @return string object id |
|
102 | + */ |
|
103 | + public function getObjectId() { |
|
104 | + return $this->objectId; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Returns the object type of the relationship |
|
109 | + * |
|
110 | + * @return string object type |
|
111 | + */ |
|
112 | + public function getObjectType() { |
|
113 | + return $this->objectType; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * Returns the system tag represented by this node |
|
118 | + * |
|
119 | + * @return ISystemTag system tag |
|
120 | + */ |
|
121 | + public function getSystemTag() { |
|
122 | + return $this->tag; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Returns the id of the tag |
|
127 | + * |
|
128 | + * @return string |
|
129 | + */ |
|
130 | + public function getName() { |
|
131 | + return $this->tag->getId(); |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * Renames the node |
|
136 | + * |
|
137 | + * @param string $name The new name |
|
138 | + * |
|
139 | + * @throws MethodNotAllowed not allowed to rename node |
|
140 | + * |
|
141 | + * @return never |
|
142 | + */ |
|
143 | + public function setName($name) { |
|
144 | + throw new MethodNotAllowed(); |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * Returns null, not supported |
|
149 | + * |
|
150 | + * @return null |
|
151 | + */ |
|
152 | + public function getLastModified() { |
|
153 | + return null; |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * Delete tag to object association |
|
158 | + * |
|
159 | + * @return void |
|
160 | + */ |
|
161 | + public function delete() { |
|
162 | + try { |
|
163 | + if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) { |
|
164 | + throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found'); |
|
165 | + } |
|
166 | + if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) { |
|
167 | + throw new Forbidden('No permission to unassign tag ' . $this->tag->getId()); |
|
168 | + } |
|
169 | + $this->tagMapper->unassignTags($this->objectId, $this->objectType, $this->tag->getId()); |
|
170 | + } catch (TagNotFoundException $e) { |
|
171 | + // can happen if concurrent deletion occurred |
|
172 | + throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found', 0, $e); |
|
173 | + } |
|
174 | + } |
|
175 | 175 | } |
@@ -28,15 +28,15 @@ |
||
28 | 28 | * @since 11.0.0 |
29 | 29 | */ |
30 | 30 | interface IProvider { |
31 | - /** |
|
32 | - * @param string $language The language which should be used for translating, e.g. "en" |
|
33 | - * @param IEvent $event The current event which should be parsed |
|
34 | - * @param IEvent|null $previousEvent A potential previous event which you can combine with the current one. |
|
35 | - * To do so, simply use setChildEvent($previousEvent) after setting the |
|
36 | - * combined subject on the current event. |
|
37 | - * @return IEvent |
|
38 | - * @throws \InvalidArgumentException Should be thrown if your provider does not know this event |
|
39 | - * @since 11.0.0 |
|
40 | - */ |
|
41 | - public function parse($language, IEvent $event, IEvent $previousEvent = null); |
|
31 | + /** |
|
32 | + * @param string $language The language which should be used for translating, e.g. "en" |
|
33 | + * @param IEvent $event The current event which should be parsed |
|
34 | + * @param IEvent|null $previousEvent A potential previous event which you can combine with the current one. |
|
35 | + * To do so, simply use setChildEvent($previousEvent) after setting the |
|
36 | + * combined subject on the current event. |
|
37 | + * @return IEvent |
|
38 | + * @throws \InvalidArgumentException Should be thrown if your provider does not know this event |
|
39 | + * @since 11.0.0 |
|
40 | + */ |
|
41 | + public function parse($language, IEvent $event, IEvent $previousEvent = null); |
|
42 | 42 | } |
@@ -38,12 +38,12 @@ |
||
38 | 38 | * @since 6.0.0 |
39 | 39 | */ |
40 | 40 | interface IConsumer { |
41 | - /** |
|
42 | - * @param IEvent $event |
|
43 | - * @return null |
|
44 | - * @since 6.0.0 |
|
45 | - * @since 8.2.0 Replaced the parameters with an IEvent object |
|
46 | - */ |
|
47 | - public function receive(IEvent $event); |
|
41 | + /** |
|
42 | + * @param IEvent $event |
|
43 | + * @return null |
|
44 | + * @since 6.0.0 |
|
45 | + * @since 8.2.0 Replaced the parameters with an IEvent object |
|
46 | + */ |
|
47 | + public function receive(IEvent $event); |
|
48 | 48 | } |
49 | 49 |
@@ -29,12 +29,12 @@ |
||
29 | 29 | * @since 8.2.2 |
30 | 30 | */ |
31 | 31 | interface IMemcacheTTL extends IMemcache { |
32 | - /** |
|
33 | - * Set the ttl for an existing value |
|
34 | - * |
|
35 | - * @param string $key |
|
36 | - * @param int $ttl time to live in seconds |
|
37 | - * @since 8.2.2 |
|
38 | - */ |
|
39 | - public function setTTL($key, $ttl); |
|
32 | + /** |
|
33 | + * Set the ttl for an existing value |
|
34 | + * |
|
35 | + * @param string $key |
|
36 | + * @param int $ttl time to live in seconds |
|
37 | + * @since 8.2.2 |
|
38 | + */ |
|
39 | + public function setTTL($key, $ttl); |
|
40 | 40 | } |
@@ -30,10 +30,10 @@ |
||
30 | 30 | * @since 8.0.0 |
31 | 31 | */ |
32 | 32 | interface IDateTimeZone { |
33 | - /** |
|
34 | - * @param bool|int $timestamp |
|
35 | - * @return \DateTimeZone |
|
36 | - * @since 8.0.0 - parameter $timestamp was added in 8.1.0 |
|
37 | - */ |
|
38 | - public function getTimeZone($timestamp = false); |
|
33 | + /** |
|
34 | + * @param bool|int $timestamp |
|
35 | + * @return \DateTimeZone |
|
36 | + * @since 8.0.0 - parameter $timestamp was added in 8.1.0 |
|
37 | + */ |
|
38 | + public function getTimeZone($timestamp = false); |
|
39 | 39 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | * remove all user backends |
69 | 69 | * @since 8.0.0 |
70 | 70 | */ |
71 | - public function clearBackends() ; |
|
71 | + public function clearBackends(); |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * get a user by user id |
@@ -46,183 +46,183 @@ |
||
46 | 46 | * @since 8.0.0 |
47 | 47 | */ |
48 | 48 | interface IUserManager { |
49 | - /** |
|
50 | - * @since 26.0.0 |
|
51 | - */ |
|
52 | - public const MAX_PASSWORD_LENGTH = 469; |
|
53 | - |
|
54 | - /** |
|
55 | - * register a user backend |
|
56 | - * |
|
57 | - * @param \OCP\UserInterface $backend |
|
58 | - * @since 8.0.0 |
|
59 | - */ |
|
60 | - public function registerBackend($backend); |
|
61 | - |
|
62 | - /** |
|
63 | - * Get the active backends |
|
64 | - * @return \OCP\UserInterface[] |
|
65 | - * @since 8.0.0 |
|
66 | - */ |
|
67 | - public function getBackends(); |
|
68 | - |
|
69 | - /** |
|
70 | - * remove a user backend |
|
71 | - * |
|
72 | - * @param \OCP\UserInterface $backend |
|
73 | - * @since 8.0.0 |
|
74 | - */ |
|
75 | - public function removeBackend($backend); |
|
76 | - |
|
77 | - /** |
|
78 | - * remove all user backends |
|
79 | - * @since 8.0.0 |
|
80 | - */ |
|
81 | - public function clearBackends() ; |
|
82 | - |
|
83 | - /** |
|
84 | - * get a user by user id |
|
85 | - * |
|
86 | - * @param string $uid |
|
87 | - * @return \OCP\IUser|null Either the user or null if the specified user does not exist |
|
88 | - * @since 8.0.0 |
|
89 | - */ |
|
90 | - public function get($uid); |
|
91 | - |
|
92 | - /** |
|
93 | - * Get the display name of a user |
|
94 | - * |
|
95 | - * @param string $uid |
|
96 | - * @return string|null |
|
97 | - * @since 25.0.0 |
|
98 | - */ |
|
99 | - public function getDisplayName(string $uid): ?string; |
|
100 | - |
|
101 | - /** |
|
102 | - * check if a user exists |
|
103 | - * |
|
104 | - * @param string $uid |
|
105 | - * @return bool |
|
106 | - * @since 8.0.0 |
|
107 | - */ |
|
108 | - public function userExists($uid); |
|
109 | - |
|
110 | - /** |
|
111 | - * Check if the password is valid for the user |
|
112 | - * |
|
113 | - * @param string $loginName |
|
114 | - * @param string $password |
|
115 | - * @return IUser|false the User object on success, false otherwise |
|
116 | - * @since 8.0.0 |
|
117 | - */ |
|
118 | - public function checkPassword($loginName, $password); |
|
119 | - |
|
120 | - /** |
|
121 | - * search by user id |
|
122 | - * |
|
123 | - * @param string $pattern |
|
124 | - * @param int $limit |
|
125 | - * @param int $offset |
|
126 | - * @return \OCP\IUser[] |
|
127 | - * @since 8.0.0 |
|
128 | - */ |
|
129 | - public function search($pattern, $limit = null, $offset = null); |
|
130 | - |
|
131 | - /** |
|
132 | - * search by displayName |
|
133 | - * |
|
134 | - * @param string $pattern |
|
135 | - * @param int $limit |
|
136 | - * @param int $offset |
|
137 | - * @return \OCP\IUser[] |
|
138 | - * @since 8.0.0 |
|
139 | - */ |
|
140 | - public function searchDisplayName($pattern, $limit = null, $offset = null); |
|
141 | - |
|
142 | - /** |
|
143 | - * Search known users (from phonebook sync) by displayName |
|
144 | - * |
|
145 | - * @param string $searcher |
|
146 | - * @param string $pattern |
|
147 | - * @param int|null $limit |
|
148 | - * @param int|null $offset |
|
149 | - * @return IUser[] |
|
150 | - * @since 21.0.1 |
|
151 | - */ |
|
152 | - public function searchKnownUsersByDisplayName(string $searcher, string $pattern, ?int $limit = null, ?int $offset = null): array; |
|
153 | - |
|
154 | - /** |
|
155 | - * @param string $uid |
|
156 | - * @param string $password |
|
157 | - * @throws \InvalidArgumentException |
|
158 | - * @return false|\OCP\IUser the created user or false |
|
159 | - * @since 8.0.0 |
|
160 | - */ |
|
161 | - public function createUser($uid, $password); |
|
162 | - |
|
163 | - /** |
|
164 | - * @param string $uid |
|
165 | - * @param string $password |
|
166 | - * @param UserInterface $backend |
|
167 | - * @return IUser|null |
|
168 | - * @throws \InvalidArgumentException |
|
169 | - * @since 12.0.0 |
|
170 | - */ |
|
171 | - public function createUserFromBackend($uid, $password, UserInterface $backend); |
|
172 | - |
|
173 | - /** |
|
174 | - * Get how many users per backend exist (if supported by backend) |
|
175 | - * |
|
176 | - * @return array<string, int> an array of backend class name as key and count number as value |
|
177 | - * @since 8.0.0 |
|
178 | - */ |
|
179 | - public function countUsers(); |
|
180 | - |
|
181 | - /** |
|
182 | - * @param \Closure $callback |
|
183 | - * @psalm-param \Closure(\OCP\IUser):void $callback |
|
184 | - * @param string $search |
|
185 | - * @since 9.0.0 |
|
186 | - */ |
|
187 | - public function callForAllUsers(\Closure $callback, $search = ''); |
|
188 | - |
|
189 | - /** |
|
190 | - * returns how many users have logged in once |
|
191 | - * |
|
192 | - * @return int |
|
193 | - * @since 11.0.0 |
|
194 | - */ |
|
195 | - public function countDisabledUsers(); |
|
196 | - |
|
197 | - /** |
|
198 | - * returns how many users have logged in once |
|
199 | - * |
|
200 | - * @return int |
|
201 | - * @since 11.0.0 |
|
202 | - */ |
|
203 | - public function countSeenUsers(); |
|
204 | - |
|
205 | - /** |
|
206 | - * @param \Closure $callback |
|
207 | - * @psalm-param \Closure(\OCP\IUser):?bool $callback |
|
208 | - * @since 11.0.0 |
|
209 | - */ |
|
210 | - public function callForSeenUsers(\Closure $callback); |
|
211 | - |
|
212 | - /** |
|
213 | - * returns all users having the provided email set as system email address |
|
214 | - * |
|
215 | - * @param string $email |
|
216 | - * @return IUser[] |
|
217 | - * @since 9.1.0 |
|
218 | - */ |
|
219 | - public function getByEmail($email); |
|
220 | - |
|
221 | - /** |
|
222 | - * @param string $uid The user ID to validate |
|
223 | - * @param bool $checkDataDirectory Whether it should be checked if files for the ID exist inside the data directory |
|
224 | - * @throws \InvalidArgumentException Message is an already translated string with a reason why the ID is not valid |
|
225 | - * @since 26.0.0 |
|
226 | - */ |
|
227 | - public function validateUserId(string $uid, bool $checkDataDirectory = false): void; |
|
49 | + /** |
|
50 | + * @since 26.0.0 |
|
51 | + */ |
|
52 | + public const MAX_PASSWORD_LENGTH = 469; |
|
53 | + |
|
54 | + /** |
|
55 | + * register a user backend |
|
56 | + * |
|
57 | + * @param \OCP\UserInterface $backend |
|
58 | + * @since 8.0.0 |
|
59 | + */ |
|
60 | + public function registerBackend($backend); |
|
61 | + |
|
62 | + /** |
|
63 | + * Get the active backends |
|
64 | + * @return \OCP\UserInterface[] |
|
65 | + * @since 8.0.0 |
|
66 | + */ |
|
67 | + public function getBackends(); |
|
68 | + |
|
69 | + /** |
|
70 | + * remove a user backend |
|
71 | + * |
|
72 | + * @param \OCP\UserInterface $backend |
|
73 | + * @since 8.0.0 |
|
74 | + */ |
|
75 | + public function removeBackend($backend); |
|
76 | + |
|
77 | + /** |
|
78 | + * remove all user backends |
|
79 | + * @since 8.0.0 |
|
80 | + */ |
|
81 | + public function clearBackends() ; |
|
82 | + |
|
83 | + /** |
|
84 | + * get a user by user id |
|
85 | + * |
|
86 | + * @param string $uid |
|
87 | + * @return \OCP\IUser|null Either the user or null if the specified user does not exist |
|
88 | + * @since 8.0.0 |
|
89 | + */ |
|
90 | + public function get($uid); |
|
91 | + |
|
92 | + /** |
|
93 | + * Get the display name of a user |
|
94 | + * |
|
95 | + * @param string $uid |
|
96 | + * @return string|null |
|
97 | + * @since 25.0.0 |
|
98 | + */ |
|
99 | + public function getDisplayName(string $uid): ?string; |
|
100 | + |
|
101 | + /** |
|
102 | + * check if a user exists |
|
103 | + * |
|
104 | + * @param string $uid |
|
105 | + * @return bool |
|
106 | + * @since 8.0.0 |
|
107 | + */ |
|
108 | + public function userExists($uid); |
|
109 | + |
|
110 | + /** |
|
111 | + * Check if the password is valid for the user |
|
112 | + * |
|
113 | + * @param string $loginName |
|
114 | + * @param string $password |
|
115 | + * @return IUser|false the User object on success, false otherwise |
|
116 | + * @since 8.0.0 |
|
117 | + */ |
|
118 | + public function checkPassword($loginName, $password); |
|
119 | + |
|
120 | + /** |
|
121 | + * search by user id |
|
122 | + * |
|
123 | + * @param string $pattern |
|
124 | + * @param int $limit |
|
125 | + * @param int $offset |
|
126 | + * @return \OCP\IUser[] |
|
127 | + * @since 8.0.0 |
|
128 | + */ |
|
129 | + public function search($pattern, $limit = null, $offset = null); |
|
130 | + |
|
131 | + /** |
|
132 | + * search by displayName |
|
133 | + * |
|
134 | + * @param string $pattern |
|
135 | + * @param int $limit |
|
136 | + * @param int $offset |
|
137 | + * @return \OCP\IUser[] |
|
138 | + * @since 8.0.0 |
|
139 | + */ |
|
140 | + public function searchDisplayName($pattern, $limit = null, $offset = null); |
|
141 | + |
|
142 | + /** |
|
143 | + * Search known users (from phonebook sync) by displayName |
|
144 | + * |
|
145 | + * @param string $searcher |
|
146 | + * @param string $pattern |
|
147 | + * @param int|null $limit |
|
148 | + * @param int|null $offset |
|
149 | + * @return IUser[] |
|
150 | + * @since 21.0.1 |
|
151 | + */ |
|
152 | + public function searchKnownUsersByDisplayName(string $searcher, string $pattern, ?int $limit = null, ?int $offset = null): array; |
|
153 | + |
|
154 | + /** |
|
155 | + * @param string $uid |
|
156 | + * @param string $password |
|
157 | + * @throws \InvalidArgumentException |
|
158 | + * @return false|\OCP\IUser the created user or false |
|
159 | + * @since 8.0.0 |
|
160 | + */ |
|
161 | + public function createUser($uid, $password); |
|
162 | + |
|
163 | + /** |
|
164 | + * @param string $uid |
|
165 | + * @param string $password |
|
166 | + * @param UserInterface $backend |
|
167 | + * @return IUser|null |
|
168 | + * @throws \InvalidArgumentException |
|
169 | + * @since 12.0.0 |
|
170 | + */ |
|
171 | + public function createUserFromBackend($uid, $password, UserInterface $backend); |
|
172 | + |
|
173 | + /** |
|
174 | + * Get how many users per backend exist (if supported by backend) |
|
175 | + * |
|
176 | + * @return array<string, int> an array of backend class name as key and count number as value |
|
177 | + * @since 8.0.0 |
|
178 | + */ |
|
179 | + public function countUsers(); |
|
180 | + |
|
181 | + /** |
|
182 | + * @param \Closure $callback |
|
183 | + * @psalm-param \Closure(\OCP\IUser):void $callback |
|
184 | + * @param string $search |
|
185 | + * @since 9.0.0 |
|
186 | + */ |
|
187 | + public function callForAllUsers(\Closure $callback, $search = ''); |
|
188 | + |
|
189 | + /** |
|
190 | + * returns how many users have logged in once |
|
191 | + * |
|
192 | + * @return int |
|
193 | + * @since 11.0.0 |
|
194 | + */ |
|
195 | + public function countDisabledUsers(); |
|
196 | + |
|
197 | + /** |
|
198 | + * returns how many users have logged in once |
|
199 | + * |
|
200 | + * @return int |
|
201 | + * @since 11.0.0 |
|
202 | + */ |
|
203 | + public function countSeenUsers(); |
|
204 | + |
|
205 | + /** |
|
206 | + * @param \Closure $callback |
|
207 | + * @psalm-param \Closure(\OCP\IUser):?bool $callback |
|
208 | + * @since 11.0.0 |
|
209 | + */ |
|
210 | + public function callForSeenUsers(\Closure $callback); |
|
211 | + |
|
212 | + /** |
|
213 | + * returns all users having the provided email set as system email address |
|
214 | + * |
|
215 | + * @param string $email |
|
216 | + * @return IUser[] |
|
217 | + * @since 9.1.0 |
|
218 | + */ |
|
219 | + public function getByEmail($email); |
|
220 | + |
|
221 | + /** |
|
222 | + * @param string $uid The user ID to validate |
|
223 | + * @param bool $checkDataDirectory Whether it should be checked if files for the ID exist inside the data directory |
|
224 | + * @throws \InvalidArgumentException Message is an already translated string with a reason why the ID is not valid |
|
225 | + * @since 26.0.0 |
|
226 | + */ |
|
227 | + public function validateUserId(string $uid, bool $checkDataDirectory = false): void; |
|
228 | 228 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | */ |
62 | 62 | public function addEntityCollection($name, \Closure $entityExistsFunction) { |
63 | 63 | if (isset($this->collections[$name])) { |
64 | - throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); |
|
64 | + throw new \OutOfBoundsException('Duplicate entity name "'.$name.'"'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $this->collections[$name] = $entityExistsFunction; |
@@ -32,49 +32,49 @@ |
||
32 | 32 | * @since 9.1.0 |
33 | 33 | */ |
34 | 34 | class CommentsEntityEvent extends Event { |
35 | - /** |
|
36 | - * @deprecated 22.0.0 |
|
37 | - */ |
|
38 | - public const EVENT_ENTITY = 'OCP\Comments\ICommentsManager::registerEntity'; |
|
35 | + /** |
|
36 | + * @deprecated 22.0.0 |
|
37 | + */ |
|
38 | + public const EVENT_ENTITY = 'OCP\Comments\ICommentsManager::registerEntity'; |
|
39 | 39 | |
40 | - /** @var string */ |
|
41 | - protected $event; |
|
42 | - /** @var \Closure[] */ |
|
43 | - protected $collections; |
|
40 | + /** @var string */ |
|
41 | + protected $event; |
|
42 | + /** @var \Closure[] */ |
|
43 | + protected $collections; |
|
44 | 44 | |
45 | - /** |
|
46 | - * DispatcherEvent constructor. |
|
47 | - * |
|
48 | - * @param string $event |
|
49 | - * @since 9.1.0 |
|
50 | - */ |
|
51 | - public function __construct($event) { |
|
52 | - $this->event = $event; |
|
53 | - $this->collections = []; |
|
54 | - } |
|
45 | + /** |
|
46 | + * DispatcherEvent constructor. |
|
47 | + * |
|
48 | + * @param string $event |
|
49 | + * @since 9.1.0 |
|
50 | + */ |
|
51 | + public function __construct($event) { |
|
52 | + $this->event = $event; |
|
53 | + $this->collections = []; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param string $name |
|
58 | - * @param \Closure $entityExistsFunction The closure should take one |
|
59 | - * argument, which is the id of the entity, that comments |
|
60 | - * should be handled for. The return should then be bool, |
|
61 | - * depending on whether comments are allowed (true) or not. |
|
62 | - * @throws \OutOfBoundsException when the entity name is already taken |
|
63 | - * @since 9.1.0 |
|
64 | - */ |
|
65 | - public function addEntityCollection($name, \Closure $entityExistsFunction) { |
|
66 | - if (isset($this->collections[$name])) { |
|
67 | - throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); |
|
68 | - } |
|
56 | + /** |
|
57 | + * @param string $name |
|
58 | + * @param \Closure $entityExistsFunction The closure should take one |
|
59 | + * argument, which is the id of the entity, that comments |
|
60 | + * should be handled for. The return should then be bool, |
|
61 | + * depending on whether comments are allowed (true) or not. |
|
62 | + * @throws \OutOfBoundsException when the entity name is already taken |
|
63 | + * @since 9.1.0 |
|
64 | + */ |
|
65 | + public function addEntityCollection($name, \Closure $entityExistsFunction) { |
|
66 | + if (isset($this->collections[$name])) { |
|
67 | + throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); |
|
68 | + } |
|
69 | 69 | |
70 | - $this->collections[$name] = $entityExistsFunction; |
|
71 | - } |
|
70 | + $this->collections[$name] = $entityExistsFunction; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @return \Closure[] |
|
75 | - * @since 9.1.0 |
|
76 | - */ |
|
77 | - public function getEntityCollections() { |
|
78 | - return $this->collections; |
|
79 | - } |
|
73 | + /** |
|
74 | + * @return \Closure[] |
|
75 | + * @since 9.1.0 |
|
76 | + */ |
|
77 | + public function getEntityCollections() { |
|
78 | + return $this->collections; |
|
79 | + } |
|
80 | 80 | } |