@@ -32,7 +32,7 @@ |
||
32 | 32 | * @package OC\AppFramework\Middleware\Security\Exceptions |
33 | 33 | */ |
34 | 34 | class StrictCookieMissingException extends SecurityException { |
35 | - public function __construct() { |
|
36 | - parent::__construct('Strict Cookie has not been found in request.', Http::STATUS_PRECONDITION_FAILED); |
|
37 | - } |
|
35 | + public function __construct() { |
|
36 | + parent::__construct('Strict Cookie has not been found in request.', Http::STATUS_PRECONDITION_FAILED); |
|
37 | + } |
|
38 | 38 | } |
@@ -147,7 +147,7 @@ |
||
147 | 147 | if (isset($this->entityTypeCollections[$name])) { |
148 | 148 | return $this->entityTypeCollections[$name]; |
149 | 149 | } |
150 | - throw new NotFound('Entity type "' . $name . '" not found."'); |
|
150 | + throw new NotFound('Entity type "'.$name.'" not found."'); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -37,176 +37,176 @@ |
||
37 | 37 | |
38 | 38 | class RootCollection implements ICollection { |
39 | 39 | |
40 | - /** @var EntityTypeCollection[]|null */ |
|
41 | - private $entityTypeCollections; |
|
42 | - |
|
43 | - /** @var ICommentsManager */ |
|
44 | - protected $commentsManager; |
|
45 | - |
|
46 | - /** @var string */ |
|
47 | - protected $name = 'comments'; |
|
48 | - |
|
49 | - /** @var ILogger */ |
|
50 | - protected $logger; |
|
51 | - |
|
52 | - /** @var IUserManager */ |
|
53 | - protected $userManager; |
|
54 | - |
|
55 | - /** @var IUserSession */ |
|
56 | - protected $userSession; |
|
57 | - |
|
58 | - /** @var EventDispatcherInterface */ |
|
59 | - protected $dispatcher; |
|
60 | - |
|
61 | - /** |
|
62 | - * @param ICommentsManager $commentsManager |
|
63 | - * @param IUserManager $userManager |
|
64 | - * @param IUserSession $userSession |
|
65 | - * @param EventDispatcherInterface $dispatcher |
|
66 | - * @param ILogger $logger |
|
67 | - */ |
|
68 | - public function __construct( |
|
69 | - ICommentsManager $commentsManager, |
|
70 | - IUserManager $userManager, |
|
71 | - IUserSession $userSession, |
|
72 | - EventDispatcherInterface $dispatcher, |
|
73 | - ILogger $logger) { |
|
74 | - $this->commentsManager = $commentsManager; |
|
75 | - $this->logger = $logger; |
|
76 | - $this->userManager = $userManager; |
|
77 | - $this->userSession = $userSession; |
|
78 | - $this->dispatcher = $dispatcher; |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * initializes the collection. At this point of time, we need the logged in |
|
83 | - * user. Since it is not the case when the instance is created, we cannot |
|
84 | - * have this in the constructor. |
|
85 | - * |
|
86 | - * @throws NotAuthenticated |
|
87 | - */ |
|
88 | - protected function initCollections() { |
|
89 | - if ($this->entityTypeCollections !== null) { |
|
90 | - return; |
|
91 | - } |
|
92 | - $user = $this->userSession->getUser(); |
|
93 | - if (is_null($user)) { |
|
94 | - throw new NotAuthenticated(); |
|
95 | - } |
|
96 | - |
|
97 | - $event = new CommentsEntityEvent(CommentsEntityEvent::EVENT_ENTITY); |
|
98 | - $this->dispatcher->dispatch(CommentsEntityEvent::EVENT_ENTITY, $event); |
|
99 | - |
|
100 | - $this->entityTypeCollections = []; |
|
101 | - foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) { |
|
102 | - $this->entityTypeCollections[$entity] = new EntityTypeCollection( |
|
103 | - $entity, |
|
104 | - $this->commentsManager, |
|
105 | - $this->userManager, |
|
106 | - $this->userSession, |
|
107 | - $this->logger, |
|
108 | - $entityExistsFunction |
|
109 | - ); |
|
110 | - } |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * Creates a new file in the directory |
|
115 | - * |
|
116 | - * @param string $name Name of the file |
|
117 | - * @param resource|string $data Initial payload |
|
118 | - * @return null|string |
|
119 | - * @throws Forbidden |
|
120 | - */ |
|
121 | - public function createFile($name, $data = null) { |
|
122 | - throw new Forbidden('Cannot create comments by id'); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Creates a new subdirectory |
|
127 | - * |
|
128 | - * @param string $name |
|
129 | - * @throws Forbidden |
|
130 | - */ |
|
131 | - public function createDirectory($name) { |
|
132 | - throw new Forbidden('Permission denied to create collections'); |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Returns a specific child node, referenced by its name |
|
137 | - * |
|
138 | - * This method must throw Sabre\DAV\Exception\NotFound if the node does not |
|
139 | - * exist. |
|
140 | - * |
|
141 | - * @param string $name |
|
142 | - * @return \Sabre\DAV\INode |
|
143 | - * @throws NotFound |
|
144 | - */ |
|
145 | - public function getChild($name) { |
|
146 | - $this->initCollections(); |
|
147 | - if (isset($this->entityTypeCollections[$name])) { |
|
148 | - return $this->entityTypeCollections[$name]; |
|
149 | - } |
|
150 | - throw new NotFound('Entity type "' . $name . '" not found."'); |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Returns an array with all the child nodes |
|
155 | - * |
|
156 | - * @return \Sabre\DAV\INode[] |
|
157 | - */ |
|
158 | - public function getChildren() { |
|
159 | - $this->initCollections(); |
|
160 | - return $this->entityTypeCollections; |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Checks if a child-node with the specified name exists |
|
165 | - * |
|
166 | - * @param string $name |
|
167 | - * @return bool |
|
168 | - */ |
|
169 | - public function childExists($name) { |
|
170 | - $this->initCollections(); |
|
171 | - return isset($this->entityTypeCollections[$name]); |
|
172 | - } |
|
173 | - |
|
174 | - /** |
|
175 | - * Deleted the current node |
|
176 | - * |
|
177 | - * @throws Forbidden |
|
178 | - */ |
|
179 | - public function delete() { |
|
180 | - throw new Forbidden('Permission denied to delete this collection'); |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * Returns the name of the node. |
|
185 | - * |
|
186 | - * This is used to generate the url. |
|
187 | - * |
|
188 | - * @return string |
|
189 | - */ |
|
190 | - public function getName() { |
|
191 | - return $this->name; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Renames the node |
|
196 | - * |
|
197 | - * @param string $name The new name |
|
198 | - * @throws Forbidden |
|
199 | - */ |
|
200 | - public function setName($name) { |
|
201 | - throw new Forbidden('Permission denied to rename this collection'); |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * Returns the last modification time, as a unix timestamp |
|
206 | - * |
|
207 | - * @return int |
|
208 | - */ |
|
209 | - public function getLastModified() { |
|
210 | - return null; |
|
211 | - } |
|
40 | + /** @var EntityTypeCollection[]|null */ |
|
41 | + private $entityTypeCollections; |
|
42 | + |
|
43 | + /** @var ICommentsManager */ |
|
44 | + protected $commentsManager; |
|
45 | + |
|
46 | + /** @var string */ |
|
47 | + protected $name = 'comments'; |
|
48 | + |
|
49 | + /** @var ILogger */ |
|
50 | + protected $logger; |
|
51 | + |
|
52 | + /** @var IUserManager */ |
|
53 | + protected $userManager; |
|
54 | + |
|
55 | + /** @var IUserSession */ |
|
56 | + protected $userSession; |
|
57 | + |
|
58 | + /** @var EventDispatcherInterface */ |
|
59 | + protected $dispatcher; |
|
60 | + |
|
61 | + /** |
|
62 | + * @param ICommentsManager $commentsManager |
|
63 | + * @param IUserManager $userManager |
|
64 | + * @param IUserSession $userSession |
|
65 | + * @param EventDispatcherInterface $dispatcher |
|
66 | + * @param ILogger $logger |
|
67 | + */ |
|
68 | + public function __construct( |
|
69 | + ICommentsManager $commentsManager, |
|
70 | + IUserManager $userManager, |
|
71 | + IUserSession $userSession, |
|
72 | + EventDispatcherInterface $dispatcher, |
|
73 | + ILogger $logger) { |
|
74 | + $this->commentsManager = $commentsManager; |
|
75 | + $this->logger = $logger; |
|
76 | + $this->userManager = $userManager; |
|
77 | + $this->userSession = $userSession; |
|
78 | + $this->dispatcher = $dispatcher; |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * initializes the collection. At this point of time, we need the logged in |
|
83 | + * user. Since it is not the case when the instance is created, we cannot |
|
84 | + * have this in the constructor. |
|
85 | + * |
|
86 | + * @throws NotAuthenticated |
|
87 | + */ |
|
88 | + protected function initCollections() { |
|
89 | + if ($this->entityTypeCollections !== null) { |
|
90 | + return; |
|
91 | + } |
|
92 | + $user = $this->userSession->getUser(); |
|
93 | + if (is_null($user)) { |
|
94 | + throw new NotAuthenticated(); |
|
95 | + } |
|
96 | + |
|
97 | + $event = new CommentsEntityEvent(CommentsEntityEvent::EVENT_ENTITY); |
|
98 | + $this->dispatcher->dispatch(CommentsEntityEvent::EVENT_ENTITY, $event); |
|
99 | + |
|
100 | + $this->entityTypeCollections = []; |
|
101 | + foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) { |
|
102 | + $this->entityTypeCollections[$entity] = new EntityTypeCollection( |
|
103 | + $entity, |
|
104 | + $this->commentsManager, |
|
105 | + $this->userManager, |
|
106 | + $this->userSession, |
|
107 | + $this->logger, |
|
108 | + $entityExistsFunction |
|
109 | + ); |
|
110 | + } |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * Creates a new file in the directory |
|
115 | + * |
|
116 | + * @param string $name Name of the file |
|
117 | + * @param resource|string $data Initial payload |
|
118 | + * @return null|string |
|
119 | + * @throws Forbidden |
|
120 | + */ |
|
121 | + public function createFile($name, $data = null) { |
|
122 | + throw new Forbidden('Cannot create comments by id'); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Creates a new subdirectory |
|
127 | + * |
|
128 | + * @param string $name |
|
129 | + * @throws Forbidden |
|
130 | + */ |
|
131 | + public function createDirectory($name) { |
|
132 | + throw new Forbidden('Permission denied to create collections'); |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Returns a specific child node, referenced by its name |
|
137 | + * |
|
138 | + * This method must throw Sabre\DAV\Exception\NotFound if the node does not |
|
139 | + * exist. |
|
140 | + * |
|
141 | + * @param string $name |
|
142 | + * @return \Sabre\DAV\INode |
|
143 | + * @throws NotFound |
|
144 | + */ |
|
145 | + public function getChild($name) { |
|
146 | + $this->initCollections(); |
|
147 | + if (isset($this->entityTypeCollections[$name])) { |
|
148 | + return $this->entityTypeCollections[$name]; |
|
149 | + } |
|
150 | + throw new NotFound('Entity type "' . $name . '" not found."'); |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Returns an array with all the child nodes |
|
155 | + * |
|
156 | + * @return \Sabre\DAV\INode[] |
|
157 | + */ |
|
158 | + public function getChildren() { |
|
159 | + $this->initCollections(); |
|
160 | + return $this->entityTypeCollections; |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Checks if a child-node with the specified name exists |
|
165 | + * |
|
166 | + * @param string $name |
|
167 | + * @return bool |
|
168 | + */ |
|
169 | + public function childExists($name) { |
|
170 | + $this->initCollections(); |
|
171 | + return isset($this->entityTypeCollections[$name]); |
|
172 | + } |
|
173 | + |
|
174 | + /** |
|
175 | + * Deleted the current node |
|
176 | + * |
|
177 | + * @throws Forbidden |
|
178 | + */ |
|
179 | + public function delete() { |
|
180 | + throw new Forbidden('Permission denied to delete this collection'); |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * Returns the name of the node. |
|
185 | + * |
|
186 | + * This is used to generate the url. |
|
187 | + * |
|
188 | + * @return string |
|
189 | + */ |
|
190 | + public function getName() { |
|
191 | + return $this->name; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * Renames the node |
|
196 | + * |
|
197 | + * @param string $name The new name |
|
198 | + * @throws Forbidden |
|
199 | + */ |
|
200 | + public function setName($name) { |
|
201 | + throw new Forbidden('Permission denied to rename this collection'); |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * Returns the last modification time, as a unix timestamp |
|
206 | + * |
|
207 | + * @return int |
|
208 | + */ |
|
209 | + public function getLastModified() { |
|
210 | + return null; |
|
211 | + } |
|
212 | 212 | } |
@@ -43,84 +43,84 @@ |
||
43 | 43 | */ |
44 | 44 | class EntityTypeCollection extends RootCollection { |
45 | 45 | |
46 | - /** @var ILogger */ |
|
47 | - protected $logger; |
|
46 | + /** @var ILogger */ |
|
47 | + protected $logger; |
|
48 | 48 | |
49 | - /** @var IUserManager */ |
|
50 | - protected $userManager; |
|
49 | + /** @var IUserManager */ |
|
50 | + protected $userManager; |
|
51 | 51 | |
52 | - /** @var \Closure */ |
|
53 | - protected $childExistsFunction; |
|
52 | + /** @var \Closure */ |
|
53 | + protected $childExistsFunction; |
|
54 | 54 | |
55 | - /** |
|
56 | - * @param string $name |
|
57 | - * @param ICommentsManager $commentsManager |
|
58 | - * @param IUserManager $userManager |
|
59 | - * @param IUserSession $userSession |
|
60 | - * @param ILogger $logger |
|
61 | - * @param \Closure $childExistsFunction |
|
62 | - */ |
|
63 | - public function __construct( |
|
64 | - $name, |
|
65 | - ICommentsManager $commentsManager, |
|
66 | - IUserManager $userManager, |
|
67 | - IUserSession $userSession, |
|
68 | - ILogger $logger, |
|
69 | - \Closure $childExistsFunction |
|
70 | - ) { |
|
71 | - $name = trim($name); |
|
72 | - if (empty($name) || !is_string($name)) { |
|
73 | - throw new \InvalidArgumentException('"name" parameter must be non-empty string'); |
|
74 | - } |
|
75 | - $this->name = $name; |
|
76 | - $this->commentsManager = $commentsManager; |
|
77 | - $this->logger = $logger; |
|
78 | - $this->userManager = $userManager; |
|
79 | - $this->userSession = $userSession; |
|
80 | - $this->childExistsFunction = $childExistsFunction; |
|
81 | - } |
|
55 | + /** |
|
56 | + * @param string $name |
|
57 | + * @param ICommentsManager $commentsManager |
|
58 | + * @param IUserManager $userManager |
|
59 | + * @param IUserSession $userSession |
|
60 | + * @param ILogger $logger |
|
61 | + * @param \Closure $childExistsFunction |
|
62 | + */ |
|
63 | + public function __construct( |
|
64 | + $name, |
|
65 | + ICommentsManager $commentsManager, |
|
66 | + IUserManager $userManager, |
|
67 | + IUserSession $userSession, |
|
68 | + ILogger $logger, |
|
69 | + \Closure $childExistsFunction |
|
70 | + ) { |
|
71 | + $name = trim($name); |
|
72 | + if (empty($name) || !is_string($name)) { |
|
73 | + throw new \InvalidArgumentException('"name" parameter must be non-empty string'); |
|
74 | + } |
|
75 | + $this->name = $name; |
|
76 | + $this->commentsManager = $commentsManager; |
|
77 | + $this->logger = $logger; |
|
78 | + $this->userManager = $userManager; |
|
79 | + $this->userSession = $userSession; |
|
80 | + $this->childExistsFunction = $childExistsFunction; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Returns a specific child node, referenced by its name |
|
85 | - * |
|
86 | - * This method must throw Sabre\DAV\Exception\NotFound if the node does not |
|
87 | - * exist. |
|
88 | - * |
|
89 | - * @param string $name |
|
90 | - * @return \Sabre\DAV\INode |
|
91 | - * @throws NotFound |
|
92 | - */ |
|
93 | - public function getChild($name) { |
|
94 | - if (!$this->childExists($name)) { |
|
95 | - throw new NotFound('Entity does not exist or is not available'); |
|
96 | - } |
|
97 | - return new EntityCollection( |
|
98 | - $name, |
|
99 | - $this->name, |
|
100 | - $this->commentsManager, |
|
101 | - $this->userManager, |
|
102 | - $this->userSession, |
|
103 | - $this->logger |
|
104 | - ); |
|
105 | - } |
|
83 | + /** |
|
84 | + * Returns a specific child node, referenced by its name |
|
85 | + * |
|
86 | + * This method must throw Sabre\DAV\Exception\NotFound if the node does not |
|
87 | + * exist. |
|
88 | + * |
|
89 | + * @param string $name |
|
90 | + * @return \Sabre\DAV\INode |
|
91 | + * @throws NotFound |
|
92 | + */ |
|
93 | + public function getChild($name) { |
|
94 | + if (!$this->childExists($name)) { |
|
95 | + throw new NotFound('Entity does not exist or is not available'); |
|
96 | + } |
|
97 | + return new EntityCollection( |
|
98 | + $name, |
|
99 | + $this->name, |
|
100 | + $this->commentsManager, |
|
101 | + $this->userManager, |
|
102 | + $this->userSession, |
|
103 | + $this->logger |
|
104 | + ); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Returns an array with all the child nodes |
|
109 | - * |
|
110 | - * @return \Sabre\DAV\INode[] |
|
111 | - * @throws MethodNotAllowed |
|
112 | - */ |
|
113 | - public function getChildren() { |
|
114 | - throw new MethodNotAllowed('No permission to list folder contents'); |
|
115 | - } |
|
107 | + /** |
|
108 | + * Returns an array with all the child nodes |
|
109 | + * |
|
110 | + * @return \Sabre\DAV\INode[] |
|
111 | + * @throws MethodNotAllowed |
|
112 | + */ |
|
113 | + public function getChildren() { |
|
114 | + throw new MethodNotAllowed('No permission to list folder contents'); |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Checks if a child-node with the specified name exists |
|
119 | - * |
|
120 | - * @param string $name |
|
121 | - * @return bool |
|
122 | - */ |
|
123 | - public function childExists($name) { |
|
124 | - return call_user_func($this->childExistsFunction, $name); |
|
125 | - } |
|
117 | + /** |
|
118 | + * Checks if a child-node with the specified name exists |
|
119 | + * |
|
120 | + * @param string $name |
|
121 | + * @return bool |
|
122 | + */ |
|
123 | + public function childExists($name) { |
|
124 | + return call_user_func($this->childExistsFunction, $name); |
|
125 | + } |
|
126 | 126 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | $path = array_pop($path); |
78 | 78 | |
79 | 79 | $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view); |
80 | - $url = $request->getBaseUrl() . $newName; |
|
80 | + $url = $request->getBaseUrl().$newName; |
|
81 | 81 | $request->setUrl($url); |
82 | 82 | } |
83 | 83 | } |
@@ -35,51 +35,51 @@ |
||
35 | 35 | */ |
36 | 36 | class FilesDropPlugin extends ServerPlugin { |
37 | 37 | |
38 | - /** @var View */ |
|
39 | - private $view; |
|
38 | + /** @var View */ |
|
39 | + private $view; |
|
40 | 40 | |
41 | - /** @var bool */ |
|
42 | - private $enabled = false; |
|
41 | + /** @var bool */ |
|
42 | + private $enabled = false; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param View $view |
|
46 | - */ |
|
47 | - public function setView($view) { |
|
48 | - $this->view = $view; |
|
49 | - } |
|
44 | + /** |
|
45 | + * @param View $view |
|
46 | + */ |
|
47 | + public function setView($view) { |
|
48 | + $this->view = $view; |
|
49 | + } |
|
50 | 50 | |
51 | - public function enable() { |
|
52 | - $this->enabled = true; |
|
53 | - } |
|
51 | + public function enable() { |
|
52 | + $this->enabled = true; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * This initializes the plugin. |
|
58 | - * |
|
59 | - * @param \Sabre\DAV\Server $server Sabre server |
|
60 | - * |
|
61 | - * @return void |
|
62 | - * @throws MethodNotAllowed |
|
63 | - */ |
|
64 | - public function initialize(\Sabre\DAV\Server $server) { |
|
65 | - $server->on('beforeMethod:*', [$this, 'beforeMethod'], 999); |
|
66 | - $this->enabled = false; |
|
67 | - } |
|
56 | + /** |
|
57 | + * This initializes the plugin. |
|
58 | + * |
|
59 | + * @param \Sabre\DAV\Server $server Sabre server |
|
60 | + * |
|
61 | + * @return void |
|
62 | + * @throws MethodNotAllowed |
|
63 | + */ |
|
64 | + public function initialize(\Sabre\DAV\Server $server) { |
|
65 | + $server->on('beforeMethod:*', [$this, 'beforeMethod'], 999); |
|
66 | + $this->enabled = false; |
|
67 | + } |
|
68 | 68 | |
69 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
70 | - if (!$this->enabled) { |
|
71 | - return; |
|
72 | - } |
|
69 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
70 | + if (!$this->enabled) { |
|
71 | + return; |
|
72 | + } |
|
73 | 73 | |
74 | - if ($request->getMethod() !== 'PUT') { |
|
75 | - throw new MethodNotAllowed('Only PUT is allowed on files drop'); |
|
76 | - } |
|
74 | + if ($request->getMethod() !== 'PUT') { |
|
75 | + throw new MethodNotAllowed('Only PUT is allowed on files drop'); |
|
76 | + } |
|
77 | 77 | |
78 | - $path = explode('/', $request->getPath()); |
|
79 | - $path = array_pop($path); |
|
78 | + $path = explode('/', $request->getPath()); |
|
79 | + $path = array_pop($path); |
|
80 | 80 | |
81 | - $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view); |
|
82 | - $url = $request->getBaseUrl() . $newName; |
|
83 | - $request->setUrl($url); |
|
84 | - } |
|
81 | + $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view); |
|
82 | + $url = $request->getBaseUrl() . $newName; |
|
83 | + $request->setUrl($url); |
|
84 | + } |
|
85 | 85 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $output->writeln('Syncing users ...'); |
55 | 55 | $progress = new ProgressBar($output); |
56 | 56 | $progress->start(); |
57 | - $this->syncService->syncInstance(function () use ($progress) { |
|
57 | + $this->syncService->syncInstance(function() use ($progress) { |
|
58 | 58 | $progress->advance(); |
59 | 59 | }); |
60 | 60 |
@@ -32,37 +32,37 @@ |
||
32 | 32 | |
33 | 33 | class SyncSystemAddressBook extends Command { |
34 | 34 | |
35 | - /** @var SyncService */ |
|
36 | - private $syncService; |
|
35 | + /** @var SyncService */ |
|
36 | + private $syncService; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param SyncService $syncService |
|
40 | - */ |
|
41 | - public function __construct(SyncService $syncService) { |
|
42 | - parent::__construct(); |
|
43 | - $this->syncService = $syncService; |
|
44 | - } |
|
38 | + /** |
|
39 | + * @param SyncService $syncService |
|
40 | + */ |
|
41 | + public function __construct(SyncService $syncService) { |
|
42 | + parent::__construct(); |
|
43 | + $this->syncService = $syncService; |
|
44 | + } |
|
45 | 45 | |
46 | - protected function configure() { |
|
47 | - $this |
|
48 | - ->setName('dav:sync-system-addressbook') |
|
49 | - ->setDescription('Synchronizes users to the system addressbook'); |
|
50 | - } |
|
46 | + protected function configure() { |
|
47 | + $this |
|
48 | + ->setName('dav:sync-system-addressbook') |
|
49 | + ->setDescription('Synchronizes users to the system addressbook'); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param InputInterface $input |
|
54 | - * @param OutputInterface $output |
|
55 | - */ |
|
56 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
57 | - $output->writeln('Syncing users ...'); |
|
58 | - $progress = new ProgressBar($output); |
|
59 | - $progress->start(); |
|
60 | - $this->syncService->syncInstance(function () use ($progress) { |
|
61 | - $progress->advance(); |
|
62 | - }); |
|
52 | + /** |
|
53 | + * @param InputInterface $input |
|
54 | + * @param OutputInterface $output |
|
55 | + */ |
|
56 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
57 | + $output->writeln('Syncing users ...'); |
|
58 | + $progress = new ProgressBar($output); |
|
59 | + $progress->start(); |
|
60 | + $this->syncService->syncInstance(function () use ($progress) { |
|
61 | + $progress->advance(); |
|
62 | + }); |
|
63 | 63 | |
64 | - $progress->finish(); |
|
65 | - $output->writeln(''); |
|
66 | - return 0; |
|
67 | - } |
|
64 | + $progress->finish(); |
|
65 | + $output->writeln(''); |
|
66 | + return 0; |
|
67 | + } |
|
68 | 68 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | public function getChild($name) { |
59 | 59 | $elements = pathinfo($name); |
60 | 60 | $ext = isset($elements['extension']) ? $elements['extension'] : ''; |
61 | - $size = (int)(isset($elements['filename']) ? $elements['filename'] : '64'); |
|
61 | + $size = (int) (isset($elements['filename']) ? $elements['filename'] : '64'); |
|
62 | 62 | if (!in_array($ext, ['jpeg', 'png'], true)) { |
63 | 63 | throw new MethodNotAllowed('File format not allowed'); |
64 | 64 | } |
@@ -33,87 +33,87 @@ |
||
33 | 33 | |
34 | 34 | class AvatarHome implements ICollection { |
35 | 35 | |
36 | - /** @var array */ |
|
37 | - private $principalInfo; |
|
38 | - /** @var IAvatarManager */ |
|
39 | - private $avatarManager; |
|
36 | + /** @var array */ |
|
37 | + private $principalInfo; |
|
38 | + /** @var IAvatarManager */ |
|
39 | + private $avatarManager; |
|
40 | 40 | |
41 | - /** |
|
42 | - * AvatarHome constructor. |
|
43 | - * |
|
44 | - * @param array $principalInfo |
|
45 | - * @param IAvatarManager $avatarManager |
|
46 | - */ |
|
47 | - public function __construct($principalInfo, IAvatarManager $avatarManager) { |
|
48 | - $this->principalInfo = $principalInfo; |
|
49 | - $this->avatarManager = $avatarManager; |
|
50 | - } |
|
41 | + /** |
|
42 | + * AvatarHome constructor. |
|
43 | + * |
|
44 | + * @param array $principalInfo |
|
45 | + * @param IAvatarManager $avatarManager |
|
46 | + */ |
|
47 | + public function __construct($principalInfo, IAvatarManager $avatarManager) { |
|
48 | + $this->principalInfo = $principalInfo; |
|
49 | + $this->avatarManager = $avatarManager; |
|
50 | + } |
|
51 | 51 | |
52 | - public function createFile($name, $data = null) { |
|
53 | - throw new Forbidden('Permission denied to create a file'); |
|
54 | - } |
|
52 | + public function createFile($name, $data = null) { |
|
53 | + throw new Forbidden('Permission denied to create a file'); |
|
54 | + } |
|
55 | 55 | |
56 | - public function createDirectory($name) { |
|
57 | - throw new Forbidden('Permission denied to create a folder'); |
|
58 | - } |
|
56 | + public function createDirectory($name) { |
|
57 | + throw new Forbidden('Permission denied to create a folder'); |
|
58 | + } |
|
59 | 59 | |
60 | - public function getChild($name) { |
|
61 | - $elements = pathinfo($name); |
|
62 | - $ext = isset($elements['extension']) ? $elements['extension'] : ''; |
|
63 | - $size = (int)(isset($elements['filename']) ? $elements['filename'] : '64'); |
|
64 | - if (!in_array($ext, ['jpeg', 'png'], true)) { |
|
65 | - throw new MethodNotAllowed('File format not allowed'); |
|
66 | - } |
|
67 | - if ($size <= 0 || $size > 1024) { |
|
68 | - throw new MethodNotAllowed('Invalid image size'); |
|
69 | - } |
|
70 | - $avatar = $this->avatarManager->getAvatar($this->getName()); |
|
71 | - if (!$avatar->exists()) { |
|
72 | - throw new NotFound(); |
|
73 | - } |
|
74 | - return new AvatarNode($size, $ext, $avatar); |
|
75 | - } |
|
60 | + public function getChild($name) { |
|
61 | + $elements = pathinfo($name); |
|
62 | + $ext = isset($elements['extension']) ? $elements['extension'] : ''; |
|
63 | + $size = (int)(isset($elements['filename']) ? $elements['filename'] : '64'); |
|
64 | + if (!in_array($ext, ['jpeg', 'png'], true)) { |
|
65 | + throw new MethodNotAllowed('File format not allowed'); |
|
66 | + } |
|
67 | + if ($size <= 0 || $size > 1024) { |
|
68 | + throw new MethodNotAllowed('Invalid image size'); |
|
69 | + } |
|
70 | + $avatar = $this->avatarManager->getAvatar($this->getName()); |
|
71 | + if (!$avatar->exists()) { |
|
72 | + throw new NotFound(); |
|
73 | + } |
|
74 | + return new AvatarNode($size, $ext, $avatar); |
|
75 | + } |
|
76 | 76 | |
77 | - public function getChildren() { |
|
78 | - try { |
|
79 | - return [ |
|
80 | - $this->getChild('96.jpeg') |
|
81 | - ]; |
|
82 | - } catch (NotFound $exception) { |
|
83 | - return []; |
|
84 | - } |
|
85 | - } |
|
77 | + public function getChildren() { |
|
78 | + try { |
|
79 | + return [ |
|
80 | + $this->getChild('96.jpeg') |
|
81 | + ]; |
|
82 | + } catch (NotFound $exception) { |
|
83 | + return []; |
|
84 | + } |
|
85 | + } |
|
86 | 86 | |
87 | - public function childExists($name) { |
|
88 | - try { |
|
89 | - $ret = $this->getChild($name); |
|
90 | - return $ret !== null; |
|
91 | - } catch (NotFound $ex) { |
|
92 | - return false; |
|
93 | - } catch (MethodNotAllowed $ex) { |
|
94 | - return false; |
|
95 | - } |
|
96 | - } |
|
87 | + public function childExists($name) { |
|
88 | + try { |
|
89 | + $ret = $this->getChild($name); |
|
90 | + return $ret !== null; |
|
91 | + } catch (NotFound $ex) { |
|
92 | + return false; |
|
93 | + } catch (MethodNotAllowed $ex) { |
|
94 | + return false; |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - public function delete() { |
|
99 | - throw new Forbidden('Permission denied to delete this folder'); |
|
100 | - } |
|
98 | + public function delete() { |
|
99 | + throw new Forbidden('Permission denied to delete this folder'); |
|
100 | + } |
|
101 | 101 | |
102 | - public function getName() { |
|
103 | - list(,$name) = Uri\split($this->principalInfo['uri']); |
|
104 | - return $name; |
|
105 | - } |
|
102 | + public function getName() { |
|
103 | + list(,$name) = Uri\split($this->principalInfo['uri']); |
|
104 | + return $name; |
|
105 | + } |
|
106 | 106 | |
107 | - public function setName($name) { |
|
108 | - throw new Forbidden('Permission denied to rename this folder'); |
|
109 | - } |
|
107 | + public function setName($name) { |
|
108 | + throw new Forbidden('Permission denied to rename this folder'); |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Returns the last modification time, as a unix timestamp |
|
113 | - * |
|
114 | - * @return int|null |
|
115 | - */ |
|
116 | - public function getLastModified() { |
|
117 | - return null; |
|
118 | - } |
|
111 | + /** |
|
112 | + * Returns the last modification time, as a unix timestamp |
|
113 | + * |
|
114 | + * @return int|null |
|
115 | + */ |
|
116 | + public function getLastModified() { |
|
117 | + return null; |
|
118 | + } |
|
119 | 119 | } |
@@ -26,71 +26,71 @@ |
||
26 | 26 | use Sabre\DAV\File; |
27 | 27 | |
28 | 28 | class AvatarNode extends File { |
29 | - private $ext; |
|
30 | - private $size; |
|
31 | - private $avatar; |
|
29 | + private $ext; |
|
30 | + private $size; |
|
31 | + private $avatar; |
|
32 | 32 | |
33 | - /** |
|
34 | - * AvatarNode constructor. |
|
35 | - * |
|
36 | - * @param integer $size |
|
37 | - * @param string $ext |
|
38 | - * @param IAvatar $avatar |
|
39 | - */ |
|
40 | - public function __construct($size, $ext, $avatar) { |
|
41 | - $this->size = $size; |
|
42 | - $this->ext = $ext; |
|
43 | - $this->avatar = $avatar; |
|
44 | - } |
|
33 | + /** |
|
34 | + * AvatarNode constructor. |
|
35 | + * |
|
36 | + * @param integer $size |
|
37 | + * @param string $ext |
|
38 | + * @param IAvatar $avatar |
|
39 | + */ |
|
40 | + public function __construct($size, $ext, $avatar) { |
|
41 | + $this->size = $size; |
|
42 | + $this->ext = $ext; |
|
43 | + $this->avatar = $avatar; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Returns the name of the node. |
|
48 | - * |
|
49 | - * This is used to generate the url. |
|
50 | - * |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function getName() { |
|
54 | - return "$this->size.$this->ext"; |
|
55 | - } |
|
46 | + /** |
|
47 | + * Returns the name of the node. |
|
48 | + * |
|
49 | + * This is used to generate the url. |
|
50 | + * |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function getName() { |
|
54 | + return "$this->size.$this->ext"; |
|
55 | + } |
|
56 | 56 | |
57 | - public function get() { |
|
58 | - $image = $this->avatar->get($this->size); |
|
59 | - $res = $image->resource(); |
|
57 | + public function get() { |
|
58 | + $image = $this->avatar->get($this->size); |
|
59 | + $res = $image->resource(); |
|
60 | 60 | |
61 | - ob_start(); |
|
62 | - if ($this->ext === 'png') { |
|
63 | - imagepng($res); |
|
64 | - } else { |
|
65 | - imagejpeg($res); |
|
66 | - } |
|
61 | + ob_start(); |
|
62 | + if ($this->ext === 'png') { |
|
63 | + imagepng($res); |
|
64 | + } else { |
|
65 | + imagejpeg($res); |
|
66 | + } |
|
67 | 67 | |
68 | - return ob_get_clean(); |
|
69 | - } |
|
68 | + return ob_get_clean(); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Returns the mime-type for a file |
|
73 | - * |
|
74 | - * If null is returned, we'll assume application/octet-stream |
|
75 | - * |
|
76 | - * @return string|null |
|
77 | - */ |
|
78 | - public function getContentType() { |
|
79 | - if ($this->ext === 'png') { |
|
80 | - return 'image/png'; |
|
81 | - } |
|
82 | - return 'image/jpeg'; |
|
83 | - } |
|
71 | + /** |
|
72 | + * Returns the mime-type for a file |
|
73 | + * |
|
74 | + * If null is returned, we'll assume application/octet-stream |
|
75 | + * |
|
76 | + * @return string|null |
|
77 | + */ |
|
78 | + public function getContentType() { |
|
79 | + if ($this->ext === 'png') { |
|
80 | + return 'image/png'; |
|
81 | + } |
|
82 | + return 'image/jpeg'; |
|
83 | + } |
|
84 | 84 | |
85 | - public function getETag() { |
|
86 | - return $this->avatar->getFile($this->size)->getEtag(); |
|
87 | - } |
|
85 | + public function getETag() { |
|
86 | + return $this->avatar->getFile($this->size)->getEtag(); |
|
87 | + } |
|
88 | 88 | |
89 | - public function getLastModified() { |
|
90 | - $timestamp = $this->avatar->getFile($this->size)->getMTime(); |
|
91 | - if (!empty($timestamp)) { |
|
92 | - return (int)$timestamp; |
|
93 | - } |
|
94 | - return $timestamp; |
|
95 | - } |
|
89 | + public function getLastModified() { |
|
90 | + $timestamp = $this->avatar->getFile($this->size)->getMTime(); |
|
91 | + if (!empty($timestamp)) { |
|
92 | + return (int)$timestamp; |
|
93 | + } |
|
94 | + return $timestamp; |
|
95 | + } |
|
96 | 96 | } |
@@ -89,7 +89,7 @@ |
||
89 | 89 | public function getLastModified() { |
90 | 90 | $timestamp = $this->avatar->getFile($this->size)->getMTime(); |
91 | 91 | if (!empty($timestamp)) { |
92 | - return (int)$timestamp; |
|
92 | + return (int) $timestamp; |
|
93 | 93 | } |
94 | 94 | return $timestamp; |
95 | 95 | } |
@@ -32,84 +32,84 @@ |
||
32 | 32 | |
33 | 33 | class ImageExportPlugin extends ServerPlugin { |
34 | 34 | |
35 | - /** @var Server */ |
|
36 | - protected $server; |
|
37 | - /** @var PhotoCache */ |
|
38 | - private $cache; |
|
39 | - |
|
40 | - /** |
|
41 | - * ImageExportPlugin constructor. |
|
42 | - * |
|
43 | - * @param PhotoCache $cache |
|
44 | - */ |
|
45 | - public function __construct(PhotoCache $cache) { |
|
46 | - $this->cache = $cache; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Initializes the plugin and registers event handlers |
|
51 | - * |
|
52 | - * @param Server $server |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - public function initialize(Server $server) { |
|
56 | - $this->server = $server; |
|
57 | - $this->server->on('method:GET', [$this, 'httpGet'], 90); |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Intercepts GET requests on addressbook urls ending with ?photo. |
|
62 | - * |
|
63 | - * @param RequestInterface $request |
|
64 | - * @param ResponseInterface $response |
|
65 | - * @return bool |
|
66 | - */ |
|
67 | - public function httpGet(RequestInterface $request, ResponseInterface $response) { |
|
68 | - $queryParams = $request->getQueryParameters(); |
|
69 | - // TODO: in addition to photo we should also add logo some point in time |
|
70 | - if (!array_key_exists('photo', $queryParams)) { |
|
71 | - return true; |
|
72 | - } |
|
73 | - |
|
74 | - $size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1; |
|
75 | - |
|
76 | - $path = $request->getPath(); |
|
77 | - $node = $this->server->tree->getNodeForPath($path); |
|
78 | - |
|
79 | - if (!($node instanceof Card)) { |
|
80 | - return true; |
|
81 | - } |
|
82 | - |
|
83 | - $this->server->transactionType = 'carddav-image-export'; |
|
84 | - |
|
85 | - // Checking ACL, if available. |
|
86 | - if ($aclPlugin = $this->server->getPlugin('acl')) { |
|
87 | - /** @var \Sabre\DAVACL\Plugin $aclPlugin */ |
|
88 | - $aclPlugin->checkPrivileges($path, '{DAV:}read'); |
|
89 | - } |
|
90 | - |
|
91 | - // Fetch addressbook |
|
92 | - $addressbookpath = explode('/', $path); |
|
93 | - array_pop($addressbookpath); |
|
94 | - $addressbookpath = implode('/', $addressbookpath); |
|
95 | - /** @var AddressBook $addressbook */ |
|
96 | - $addressbook = $this->server->tree->getNodeForPath($addressbookpath); |
|
97 | - |
|
98 | - $response->setHeader('Cache-Control', 'private, max-age=3600, must-revalidate'); |
|
99 | - $response->setHeader('Etag', $node->getETag()); |
|
100 | - $response->setHeader('Pragma', 'public'); |
|
101 | - |
|
102 | - try { |
|
103 | - $file = $this->cache->get($addressbook->getResourceId(), $node->getName(), $size, $node); |
|
104 | - $response->setHeader('Content-Type', $file->getMimeType()); |
|
105 | - $response->setHeader('Content-Disposition', 'attachment'); |
|
106 | - $response->setStatus(200); |
|
107 | - |
|
108 | - $response->setBody($file->getContent()); |
|
109 | - } catch (NotFoundException $e) { |
|
110 | - $response->setStatus(404); |
|
111 | - } |
|
112 | - |
|
113 | - return false; |
|
114 | - } |
|
35 | + /** @var Server */ |
|
36 | + protected $server; |
|
37 | + /** @var PhotoCache */ |
|
38 | + private $cache; |
|
39 | + |
|
40 | + /** |
|
41 | + * ImageExportPlugin constructor. |
|
42 | + * |
|
43 | + * @param PhotoCache $cache |
|
44 | + */ |
|
45 | + public function __construct(PhotoCache $cache) { |
|
46 | + $this->cache = $cache; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Initializes the plugin and registers event handlers |
|
51 | + * |
|
52 | + * @param Server $server |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + public function initialize(Server $server) { |
|
56 | + $this->server = $server; |
|
57 | + $this->server->on('method:GET', [$this, 'httpGet'], 90); |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Intercepts GET requests on addressbook urls ending with ?photo. |
|
62 | + * |
|
63 | + * @param RequestInterface $request |
|
64 | + * @param ResponseInterface $response |
|
65 | + * @return bool |
|
66 | + */ |
|
67 | + public function httpGet(RequestInterface $request, ResponseInterface $response) { |
|
68 | + $queryParams = $request->getQueryParameters(); |
|
69 | + // TODO: in addition to photo we should also add logo some point in time |
|
70 | + if (!array_key_exists('photo', $queryParams)) { |
|
71 | + return true; |
|
72 | + } |
|
73 | + |
|
74 | + $size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1; |
|
75 | + |
|
76 | + $path = $request->getPath(); |
|
77 | + $node = $this->server->tree->getNodeForPath($path); |
|
78 | + |
|
79 | + if (!($node instanceof Card)) { |
|
80 | + return true; |
|
81 | + } |
|
82 | + |
|
83 | + $this->server->transactionType = 'carddav-image-export'; |
|
84 | + |
|
85 | + // Checking ACL, if available. |
|
86 | + if ($aclPlugin = $this->server->getPlugin('acl')) { |
|
87 | + /** @var \Sabre\DAVACL\Plugin $aclPlugin */ |
|
88 | + $aclPlugin->checkPrivileges($path, '{DAV:}read'); |
|
89 | + } |
|
90 | + |
|
91 | + // Fetch addressbook |
|
92 | + $addressbookpath = explode('/', $path); |
|
93 | + array_pop($addressbookpath); |
|
94 | + $addressbookpath = implode('/', $addressbookpath); |
|
95 | + /** @var AddressBook $addressbook */ |
|
96 | + $addressbook = $this->server->tree->getNodeForPath($addressbookpath); |
|
97 | + |
|
98 | + $response->setHeader('Cache-Control', 'private, max-age=3600, must-revalidate'); |
|
99 | + $response->setHeader('Etag', $node->getETag()); |
|
100 | + $response->setHeader('Pragma', 'public'); |
|
101 | + |
|
102 | + try { |
|
103 | + $file = $this->cache->get($addressbook->getResourceId(), $node->getName(), $size, $node); |
|
104 | + $response->setHeader('Content-Type', $file->getMimeType()); |
|
105 | + $response->setHeader('Content-Disposition', 'attachment'); |
|
106 | + $response->setStatus(200); |
|
107 | + |
|
108 | + $response->setBody($file->getContent()); |
|
109 | + } catch (NotFoundException $e) { |
|
110 | + $response->setStatus(404); |
|
111 | + } |
|
112 | + |
|
113 | + return false; |
|
114 | + } |
|
115 | 115 | } |
@@ -71,7 +71,7 @@ |
||
71 | 71 | return true; |
72 | 72 | } |
73 | 73 | |
74 | - $size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1; |
|
74 | + $size = isset($queryParams['size']) ? (int) $queryParams['size'] : -1; |
|
75 | 75 | |
76 | 76 | $path = $request->getPath(); |
77 | 77 | $node = $this->server->tree->getNodeForPath($path); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | public function xmlSerialize(Writer $writer) { |
41 | 41 | foreach ($this->groups as $group) { |
42 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group); |
|
42 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}group', $group); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
@@ -27,21 +27,21 @@ |
||
27 | 27 | use Sabre\Xml\XmlSerializable; |
28 | 28 | |
29 | 29 | class Groups implements XmlSerializable { |
30 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
30 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
31 | 31 | |
32 | - /** @var string[] of TYPE:CHECKSUM */ |
|
33 | - private $groups; |
|
32 | + /** @var string[] of TYPE:CHECKSUM */ |
|
33 | + private $groups; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param string $groups |
|
37 | - */ |
|
38 | - public function __construct($groups) { |
|
39 | - $this->groups = $groups; |
|
40 | - } |
|
35 | + /** |
|
36 | + * @param string $groups |
|
37 | + */ |
|
38 | + public function __construct($groups) { |
|
39 | + $this->groups = $groups; |
|
40 | + } |
|
41 | 41 | |
42 | - public function xmlSerialize(Writer $writer) { |
|
43 | - foreach ($this->groups as $group) { |
|
44 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group); |
|
45 | - } |
|
46 | - } |
|
42 | + public function xmlSerialize(Writer $writer) { |
|
43 | + foreach ($this->groups as $group) { |
|
44 | + $writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |