@@ -25,63 +25,63 @@ |
||
25 | 25 | |
26 | 26 | class PublicCalendar extends Calendar { |
27 | 27 | |
28 | - /** |
|
29 | - * @param string $name |
|
30 | - * @throws NotFound |
|
31 | - * @return PublicCalendarObject |
|
32 | - */ |
|
33 | - public function getChild($name) { |
|
34 | - $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name); |
|
28 | + /** |
|
29 | + * @param string $name |
|
30 | + * @throws NotFound |
|
31 | + * @return PublicCalendarObject |
|
32 | + */ |
|
33 | + public function getChild($name) { |
|
34 | + $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name); |
|
35 | 35 | |
36 | - if (!$obj) { |
|
37 | - throw new NotFound('Calendar object not found'); |
|
38 | - } |
|
39 | - if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
40 | - throw new NotFound('Calendar object not found'); |
|
41 | - } |
|
42 | - $obj['acl'] = $this->getChildACL(); |
|
36 | + if (!$obj) { |
|
37 | + throw new NotFound('Calendar object not found'); |
|
38 | + } |
|
39 | + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
40 | + throw new NotFound('Calendar object not found'); |
|
41 | + } |
|
42 | + $obj['acl'] = $this->getChildACL(); |
|
43 | 43 | |
44 | - return new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
45 | - } |
|
44 | + return new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return PublicCalendarObject[] |
|
49 | - */ |
|
50 | - public function getChildren() { |
|
51 | - $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); |
|
52 | - $children = []; |
|
53 | - foreach ($objs as $obj) { |
|
54 | - if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
55 | - continue; |
|
56 | - } |
|
57 | - $obj['acl'] = $this->getChildACL(); |
|
58 | - $children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
59 | - } |
|
60 | - return $children; |
|
61 | - } |
|
47 | + /** |
|
48 | + * @return PublicCalendarObject[] |
|
49 | + */ |
|
50 | + public function getChildren() { |
|
51 | + $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); |
|
52 | + $children = []; |
|
53 | + foreach ($objs as $obj) { |
|
54 | + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
55 | + continue; |
|
56 | + } |
|
57 | + $obj['acl'] = $this->getChildACL(); |
|
58 | + $children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
59 | + } |
|
60 | + return $children; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @param string[] $paths |
|
65 | - * @return PublicCalendarObject[] |
|
66 | - */ |
|
67 | - public function getMultipleChildren(array $paths) { |
|
68 | - $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); |
|
69 | - $children = []; |
|
70 | - foreach ($objs as $obj) { |
|
71 | - if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
72 | - continue; |
|
73 | - } |
|
74 | - $obj['acl'] = $this->getChildACL(); |
|
75 | - $children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
76 | - } |
|
77 | - return $children; |
|
78 | - } |
|
63 | + /** |
|
64 | + * @param string[] $paths |
|
65 | + * @return PublicCalendarObject[] |
|
66 | + */ |
|
67 | + public function getMultipleChildren(array $paths) { |
|
68 | + $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); |
|
69 | + $children = []; |
|
70 | + foreach ($objs as $obj) { |
|
71 | + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
72 | + continue; |
|
73 | + } |
|
74 | + $obj['acl'] = $this->getChildACL(); |
|
75 | + $children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
76 | + } |
|
77 | + return $children; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * public calendars are always shared |
|
82 | - * @return bool |
|
83 | - */ |
|
84 | - protected function isShared() { |
|
85 | - return true; |
|
86 | - } |
|
80 | + /** |
|
81 | + * public calendars are always shared |
|
82 | + * @return bool |
|
83 | + */ |
|
84 | + protected function isShared() { |
|
85 | + return true; |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | \ No newline at end of file |
@@ -29,10 +29,10 @@ |
||
29 | 29 | */ |
30 | 30 | interface IProvider { |
31 | 31 | |
32 | - /** |
|
33 | - * @since 12.0 |
|
34 | - * @param IEntry $entry |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public function process(IEntry $entry); |
|
32 | + /** |
|
33 | + * @since 12.0 |
|
34 | + * @param IEntry $entry |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public function process(IEntry $entry); |
|
38 | 38 | } |
@@ -32,10 +32,10 @@ |
||
32 | 32 | */ |
33 | 33 | interface IShareHelper { |
34 | 34 | |
35 | - /** |
|
36 | - * @param Node $node |
|
37 | - * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]] |
|
38 | - * @since 12 |
|
39 | - */ |
|
40 | - public function getPathsForAccessList(Node $node); |
|
35 | + /** |
|
36 | + * @param Node $node |
|
37 | + * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]] |
|
38 | + * @since 12 |
|
39 | + */ |
|
40 | + public function getPathsForAccessList(Node $node); |
|
41 | 41 | } |
@@ -27,24 +27,24 @@ |
||
27 | 27 | |
28 | 28 | class Capabilities implements ICapability { |
29 | 29 | |
30 | - /** |
|
31 | - * Function an app uses to return the capabilities |
|
32 | - * |
|
33 | - * @return array Array containing the apps capabilities |
|
34 | - * @since 8.2.0 |
|
35 | - */ |
|
36 | - public function getCapabilities() { |
|
37 | - return [ |
|
38 | - 'files_sharing' => |
|
39 | - [ |
|
40 | - 'sharebymail' => |
|
41 | - [ |
|
42 | - 'enabled' => true, |
|
43 | - 'upload_files_drop' => ['enabled' => true], |
|
44 | - 'password' => ['enabled' => true], |
|
45 | - 'expire_date' => ['enabled' => true] |
|
46 | - ] |
|
47 | - ] |
|
48 | - ]; |
|
49 | - } |
|
30 | + /** |
|
31 | + * Function an app uses to return the capabilities |
|
32 | + * |
|
33 | + * @return array Array containing the apps capabilities |
|
34 | + * @since 8.2.0 |
|
35 | + */ |
|
36 | + public function getCapabilities() { |
|
37 | + return [ |
|
38 | + 'files_sharing' => |
|
39 | + [ |
|
40 | + 'sharebymail' => |
|
41 | + [ |
|
42 | + 'enabled' => true, |
|
43 | + 'upload_files_drop' => ['enabled' => true], |
|
44 | + 'password' => ['enabled' => true], |
|
45 | + 'expire_date' => ['enabled' => true] |
|
46 | + ] |
|
47 | + ] |
|
48 | + ]; |
|
49 | + } |
|
50 | 50 | } |
@@ -31,187 +31,187 @@ |
||
31 | 31 | |
32 | 32 | class ShareHelper implements IShareHelper { |
33 | 33 | |
34 | - /** @var IManager */ |
|
35 | - private $shareManager; |
|
36 | - |
|
37 | - public function __construct(IManager $shareManager) { |
|
38 | - $this->shareManager = $shareManager; |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * @param Node $node |
|
43 | - * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]] |
|
44 | - */ |
|
45 | - public function getPathsForAccessList(Node $node) { |
|
46 | - $result = [ |
|
47 | - 'users' => [], |
|
48 | - 'remotes' => [], |
|
49 | - ]; |
|
50 | - |
|
51 | - $accessList = $this->shareManager->getAccessList($node, true, true); |
|
52 | - if (!empty($accessList['users'])) { |
|
53 | - $result['users'] = $this->getPathsForUsers($node, $accessList['users']); |
|
54 | - } |
|
55 | - if (!empty($accessList['remote'])) { |
|
56 | - $result['remotes'] = $this->getPathsForRemotes($node, $accessList['remote']); |
|
57 | - } |
|
58 | - |
|
59 | - return $result; |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Sample: |
|
64 | - * $users = [ |
|
65 | - * 'test1' => ['node_id' => 16, 'node_path' => '/foo'], |
|
66 | - * 'test2' => ['node_id' => 23, 'node_path' => '/bar'], |
|
67 | - * 'test3' => ['node_id' => 42, 'node_path' => '/cat'], |
|
68 | - * 'test4' => ['node_id' => 48, 'node_path' => '/dog'], |
|
69 | - * ]; |
|
70 | - * |
|
71 | - * Node tree: |
|
72 | - * - SixTeen is the parent of TwentyThree |
|
73 | - * - TwentyThree is the parent of FortyTwo |
|
74 | - * - FortyEight does not exist |
|
75 | - * |
|
76 | - * $return = [ |
|
77 | - * 'test1' => '/foo/TwentyThree/FortyTwo', |
|
78 | - * 'test2' => '/bar/FortyTwo', |
|
79 | - * 'test3' => '/cat', |
|
80 | - * ], |
|
81 | - * |
|
82 | - * @param Node $node |
|
83 | - * @param array[] $users |
|
84 | - * @return array |
|
85 | - */ |
|
86 | - protected function getPathsForUsers(Node $node, array $users) { |
|
87 | - /** @var array[] $byId */ |
|
88 | - $byId = []; |
|
89 | - /** @var array[] $results */ |
|
90 | - $results = []; |
|
91 | - |
|
92 | - foreach ($users as $uid => $info) { |
|
93 | - if (!isset($byId[$info['node_id']])) { |
|
94 | - $byId[$info['node_id']] = []; |
|
95 | - } |
|
96 | - $byId[$info['node_id']][$uid] = $info['node_path']; |
|
97 | - } |
|
98 | - |
|
99 | - try { |
|
100 | - if (isset($byId[$node->getId()])) { |
|
101 | - foreach ($byId[$node->getId()] as $uid => $path) { |
|
102 | - $results[$uid] = $path; |
|
103 | - } |
|
104 | - unset($byId[$node->getId()]); |
|
105 | - } |
|
106 | - } catch (NotFoundException $e) { |
|
107 | - return $results; |
|
108 | - } catch (InvalidPathException $e) { |
|
109 | - return $results; |
|
110 | - } |
|
111 | - |
|
112 | - if (empty($byId)) { |
|
113 | - return $results; |
|
114 | - } |
|
115 | - |
|
116 | - $item = $node; |
|
117 | - $appendix = '/' . $node->getName(); |
|
118 | - while (!empty($byId)) { |
|
119 | - try { |
|
120 | - /** @var Node $item */ |
|
121 | - $item = $item->getParent(); |
|
122 | - |
|
123 | - if (!empty($byId[$item->getId()])) { |
|
124 | - foreach ($byId[$item->getId()] as $uid => $path) { |
|
125 | - $results[$uid] = $path . $appendix; |
|
126 | - } |
|
127 | - unset($byId[$item->getId()]); |
|
128 | - } |
|
129 | - |
|
130 | - $appendix = '/' . $item->getName() . $appendix; |
|
131 | - } catch (NotFoundException $e) { |
|
132 | - return $results; |
|
133 | - } catch (InvalidPathException $e) { |
|
134 | - return $results; |
|
135 | - } catch (NotPermittedException $e) { |
|
136 | - return $results; |
|
137 | - } |
|
138 | - } |
|
139 | - |
|
140 | - return $results; |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Sample: |
|
145 | - * $remotes = [ |
|
146 | - * 'test1' => ['node_id' => 16, 'token' => 't1'], |
|
147 | - * 'test2' => ['node_id' => 23, 'token' => 't2'], |
|
148 | - * 'test3' => ['node_id' => 42, 'token' => 't3'], |
|
149 | - * 'test4' => ['node_id' => 48, 'token' => 't4'], |
|
150 | - * ]; |
|
151 | - * |
|
152 | - * Node tree: |
|
153 | - * - SixTeen is the parent of TwentyThree |
|
154 | - * - TwentyThree is the parent of FortyTwo |
|
155 | - * - FortyEight does not exist |
|
156 | - * |
|
157 | - * $return = [ |
|
158 | - * 'test1' => ['token' => 't1', 'node_path' => '/SixTeen'], |
|
159 | - * 'test2' => ['token' => 't2', 'node_path' => '/SixTeen/TwentyThree'], |
|
160 | - * 'test3' => ['token' => 't3', 'node_path' => '/SixTeen/TwentyThree/FortyTwo'], |
|
161 | - * ], |
|
162 | - * |
|
163 | - * @param Node $node |
|
164 | - * @param array[] $remotes |
|
165 | - * @return array |
|
166 | - */ |
|
167 | - protected function getPathsForRemotes(Node $node, array $remotes) { |
|
168 | - /** @var array[] $byId */ |
|
169 | - $byId = []; |
|
170 | - /** @var array[] $results */ |
|
171 | - $results = []; |
|
172 | - |
|
173 | - foreach ($remotes as $cloudId => $info) { |
|
174 | - if (!isset($byId[$info['node_id']])) { |
|
175 | - $byId[$info['node_id']] = []; |
|
176 | - } |
|
177 | - $byId[$info['node_id']][$cloudId] = $info['token']; |
|
178 | - } |
|
179 | - |
|
180 | - $item = $node; |
|
181 | - while (!empty($byId)) { |
|
182 | - try { |
|
183 | - if (!empty($byId[$item->getId()])) { |
|
184 | - $path = $this->getMountedPath($item); |
|
185 | - foreach ($byId[$item->getId()] as $uid => $token) { |
|
186 | - $results[$uid] = [ |
|
187 | - 'node_path' => $path, |
|
188 | - 'token' => $token, |
|
189 | - ]; |
|
190 | - } |
|
191 | - unset($byId[$item->getId()]); |
|
192 | - } |
|
193 | - |
|
194 | - /** @var Node $item */ |
|
195 | - $item = $item->getParent(); |
|
196 | - } catch (NotFoundException $e) { |
|
197 | - return $results; |
|
198 | - } catch (InvalidPathException $e) { |
|
199 | - return $results; |
|
200 | - } catch (NotPermittedException $e) { |
|
201 | - return $results; |
|
202 | - } |
|
203 | - } |
|
204 | - |
|
205 | - return $results; |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * @param Node $node |
|
210 | - * @return string |
|
211 | - */ |
|
212 | - protected function getMountedPath(Node $node) { |
|
213 | - $path = $node->getPath(); |
|
214 | - $sections = explode('/', $path, 4); |
|
215 | - return '/' . $sections[3]; |
|
216 | - } |
|
34 | + /** @var IManager */ |
|
35 | + private $shareManager; |
|
36 | + |
|
37 | + public function __construct(IManager $shareManager) { |
|
38 | + $this->shareManager = $shareManager; |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * @param Node $node |
|
43 | + * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]] |
|
44 | + */ |
|
45 | + public function getPathsForAccessList(Node $node) { |
|
46 | + $result = [ |
|
47 | + 'users' => [], |
|
48 | + 'remotes' => [], |
|
49 | + ]; |
|
50 | + |
|
51 | + $accessList = $this->shareManager->getAccessList($node, true, true); |
|
52 | + if (!empty($accessList['users'])) { |
|
53 | + $result['users'] = $this->getPathsForUsers($node, $accessList['users']); |
|
54 | + } |
|
55 | + if (!empty($accessList['remote'])) { |
|
56 | + $result['remotes'] = $this->getPathsForRemotes($node, $accessList['remote']); |
|
57 | + } |
|
58 | + |
|
59 | + return $result; |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Sample: |
|
64 | + * $users = [ |
|
65 | + * 'test1' => ['node_id' => 16, 'node_path' => '/foo'], |
|
66 | + * 'test2' => ['node_id' => 23, 'node_path' => '/bar'], |
|
67 | + * 'test3' => ['node_id' => 42, 'node_path' => '/cat'], |
|
68 | + * 'test4' => ['node_id' => 48, 'node_path' => '/dog'], |
|
69 | + * ]; |
|
70 | + * |
|
71 | + * Node tree: |
|
72 | + * - SixTeen is the parent of TwentyThree |
|
73 | + * - TwentyThree is the parent of FortyTwo |
|
74 | + * - FortyEight does not exist |
|
75 | + * |
|
76 | + * $return = [ |
|
77 | + * 'test1' => '/foo/TwentyThree/FortyTwo', |
|
78 | + * 'test2' => '/bar/FortyTwo', |
|
79 | + * 'test3' => '/cat', |
|
80 | + * ], |
|
81 | + * |
|
82 | + * @param Node $node |
|
83 | + * @param array[] $users |
|
84 | + * @return array |
|
85 | + */ |
|
86 | + protected function getPathsForUsers(Node $node, array $users) { |
|
87 | + /** @var array[] $byId */ |
|
88 | + $byId = []; |
|
89 | + /** @var array[] $results */ |
|
90 | + $results = []; |
|
91 | + |
|
92 | + foreach ($users as $uid => $info) { |
|
93 | + if (!isset($byId[$info['node_id']])) { |
|
94 | + $byId[$info['node_id']] = []; |
|
95 | + } |
|
96 | + $byId[$info['node_id']][$uid] = $info['node_path']; |
|
97 | + } |
|
98 | + |
|
99 | + try { |
|
100 | + if (isset($byId[$node->getId()])) { |
|
101 | + foreach ($byId[$node->getId()] as $uid => $path) { |
|
102 | + $results[$uid] = $path; |
|
103 | + } |
|
104 | + unset($byId[$node->getId()]); |
|
105 | + } |
|
106 | + } catch (NotFoundException $e) { |
|
107 | + return $results; |
|
108 | + } catch (InvalidPathException $e) { |
|
109 | + return $results; |
|
110 | + } |
|
111 | + |
|
112 | + if (empty($byId)) { |
|
113 | + return $results; |
|
114 | + } |
|
115 | + |
|
116 | + $item = $node; |
|
117 | + $appendix = '/' . $node->getName(); |
|
118 | + while (!empty($byId)) { |
|
119 | + try { |
|
120 | + /** @var Node $item */ |
|
121 | + $item = $item->getParent(); |
|
122 | + |
|
123 | + if (!empty($byId[$item->getId()])) { |
|
124 | + foreach ($byId[$item->getId()] as $uid => $path) { |
|
125 | + $results[$uid] = $path . $appendix; |
|
126 | + } |
|
127 | + unset($byId[$item->getId()]); |
|
128 | + } |
|
129 | + |
|
130 | + $appendix = '/' . $item->getName() . $appendix; |
|
131 | + } catch (NotFoundException $e) { |
|
132 | + return $results; |
|
133 | + } catch (InvalidPathException $e) { |
|
134 | + return $results; |
|
135 | + } catch (NotPermittedException $e) { |
|
136 | + return $results; |
|
137 | + } |
|
138 | + } |
|
139 | + |
|
140 | + return $results; |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Sample: |
|
145 | + * $remotes = [ |
|
146 | + * 'test1' => ['node_id' => 16, 'token' => 't1'], |
|
147 | + * 'test2' => ['node_id' => 23, 'token' => 't2'], |
|
148 | + * 'test3' => ['node_id' => 42, 'token' => 't3'], |
|
149 | + * 'test4' => ['node_id' => 48, 'token' => 't4'], |
|
150 | + * ]; |
|
151 | + * |
|
152 | + * Node tree: |
|
153 | + * - SixTeen is the parent of TwentyThree |
|
154 | + * - TwentyThree is the parent of FortyTwo |
|
155 | + * - FortyEight does not exist |
|
156 | + * |
|
157 | + * $return = [ |
|
158 | + * 'test1' => ['token' => 't1', 'node_path' => '/SixTeen'], |
|
159 | + * 'test2' => ['token' => 't2', 'node_path' => '/SixTeen/TwentyThree'], |
|
160 | + * 'test3' => ['token' => 't3', 'node_path' => '/SixTeen/TwentyThree/FortyTwo'], |
|
161 | + * ], |
|
162 | + * |
|
163 | + * @param Node $node |
|
164 | + * @param array[] $remotes |
|
165 | + * @return array |
|
166 | + */ |
|
167 | + protected function getPathsForRemotes(Node $node, array $remotes) { |
|
168 | + /** @var array[] $byId */ |
|
169 | + $byId = []; |
|
170 | + /** @var array[] $results */ |
|
171 | + $results = []; |
|
172 | + |
|
173 | + foreach ($remotes as $cloudId => $info) { |
|
174 | + if (!isset($byId[$info['node_id']])) { |
|
175 | + $byId[$info['node_id']] = []; |
|
176 | + } |
|
177 | + $byId[$info['node_id']][$cloudId] = $info['token']; |
|
178 | + } |
|
179 | + |
|
180 | + $item = $node; |
|
181 | + while (!empty($byId)) { |
|
182 | + try { |
|
183 | + if (!empty($byId[$item->getId()])) { |
|
184 | + $path = $this->getMountedPath($item); |
|
185 | + foreach ($byId[$item->getId()] as $uid => $token) { |
|
186 | + $results[$uid] = [ |
|
187 | + 'node_path' => $path, |
|
188 | + 'token' => $token, |
|
189 | + ]; |
|
190 | + } |
|
191 | + unset($byId[$item->getId()]); |
|
192 | + } |
|
193 | + |
|
194 | + /** @var Node $item */ |
|
195 | + $item = $item->getParent(); |
|
196 | + } catch (NotFoundException $e) { |
|
197 | + return $results; |
|
198 | + } catch (InvalidPathException $e) { |
|
199 | + return $results; |
|
200 | + } catch (NotPermittedException $e) { |
|
201 | + return $results; |
|
202 | + } |
|
203 | + } |
|
204 | + |
|
205 | + return $results; |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * @param Node $node |
|
210 | + * @return string |
|
211 | + */ |
|
212 | + protected function getMountedPath(Node $node) { |
|
213 | + $path = $node->getPath(); |
|
214 | + $sections = explode('/', $path, 4); |
|
215 | + return '/' . $sections[3]; |
|
216 | + } |
|
217 | 217 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | $item = $node; |
117 | - $appendix = '/' . $node->getName(); |
|
117 | + $appendix = '/'.$node->getName(); |
|
118 | 118 | while (!empty($byId)) { |
119 | 119 | try { |
120 | 120 | /** @var Node $item */ |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | |
123 | 123 | if (!empty($byId[$item->getId()])) { |
124 | 124 | foreach ($byId[$item->getId()] as $uid => $path) { |
125 | - $results[$uid] = $path . $appendix; |
|
125 | + $results[$uid] = $path.$appendix; |
|
126 | 126 | } |
127 | 127 | unset($byId[$item->getId()]); |
128 | 128 | } |
129 | 129 | |
130 | - $appendix = '/' . $item->getName() . $appendix; |
|
130 | + $appendix = '/'.$item->getName().$appendix; |
|
131 | 131 | } catch (NotFoundException $e) { |
132 | 132 | return $results; |
133 | 133 | } catch (InvalidPathException $e) { |
@@ -212,6 +212,6 @@ discard block |
||
212 | 212 | protected function getMountedPath(Node $node) { |
213 | 213 | $path = $node->getPath(); |
214 | 214 | $sections = explode('/', $path, 4); |
215 | - return '/' . $sections[3]; |
|
215 | + return '/'.$sections[3]; |
|
216 | 216 | } |
217 | 217 | } |
@@ -27,35 +27,35 @@ |
||
27 | 27 | |
28 | 28 | class SettingsManager { |
29 | 29 | |
30 | - /** @var IConfig */ |
|
31 | - private $config; |
|
32 | - |
|
33 | - private $sendPasswordByMailDefault = 'yes'; |
|
34 | - |
|
35 | - private $enforcePasswordProtectionDefault = 'no'; |
|
36 | - |
|
37 | - public function __construct(IConfig $config) { |
|
38 | - $this->config = $config; |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * should the password for a mail share be send to the recipient |
|
43 | - * |
|
44 | - * @return bool |
|
45 | - */ |
|
46 | - public function sendPasswordByMail() { |
|
47 | - $sendPasswordByMail = $this->config->getAppValue('sharebymail', 'sendpasswordmail', $this->sendPasswordByMailDefault); |
|
48 | - return $sendPasswordByMail === 'yes'; |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * do we require a share by mail to be password protected |
|
53 | - * |
|
54 | - * @return bool |
|
55 | - */ |
|
56 | - public function enforcePasswordProtection() { |
|
57 | - $enforcePassword = $this->config->getAppValue('sharebymail', 'enforcePasswordProtection', $this->enforcePasswordProtectionDefault); |
|
58 | - return $enforcePassword === 'yes'; |
|
59 | - } |
|
30 | + /** @var IConfig */ |
|
31 | + private $config; |
|
32 | + |
|
33 | + private $sendPasswordByMailDefault = 'yes'; |
|
34 | + |
|
35 | + private $enforcePasswordProtectionDefault = 'no'; |
|
36 | + |
|
37 | + public function __construct(IConfig $config) { |
|
38 | + $this->config = $config; |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * should the password for a mail share be send to the recipient |
|
43 | + * |
|
44 | + * @return bool |
|
45 | + */ |
|
46 | + public function sendPasswordByMail() { |
|
47 | + $sendPasswordByMail = $this->config->getAppValue('sharebymail', 'sendpasswordmail', $this->sendPasswordByMailDefault); |
|
48 | + return $sendPasswordByMail === 'yes'; |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * do we require a share by mail to be password protected |
|
53 | + * |
|
54 | + * @return bool |
|
55 | + */ |
|
56 | + public function enforcePasswordProtection() { |
|
57 | + $enforcePassword = $this->config->getAppValue('sharebymail', 'enforcePasswordProtection', $this->enforcePasswordProtectionDefault); |
|
58 | + return $enforcePassword === 'yes'; |
|
59 | + } |
|
60 | 60 | |
61 | 61 | } |
@@ -27,42 +27,42 @@ |
||
27 | 27 | |
28 | 28 | class Admin implements ISettings { |
29 | 29 | |
30 | - /** @var SettingsManager */ |
|
31 | - private $settingsManager; |
|
30 | + /** @var SettingsManager */ |
|
31 | + private $settingsManager; |
|
32 | 32 | |
33 | - public function __construct(SettingsManager $settingsManager) { |
|
34 | - $this->settingsManager = $settingsManager; |
|
35 | - } |
|
33 | + public function __construct(SettingsManager $settingsManager) { |
|
34 | + $this->settingsManager = $settingsManager; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @return TemplateResponse |
|
39 | - */ |
|
40 | - public function getForm() { |
|
37 | + /** |
|
38 | + * @return TemplateResponse |
|
39 | + */ |
|
40 | + public function getForm() { |
|
41 | 41 | |
42 | - $parameters = [ |
|
43 | - 'sendPasswordMail' => $this->settingsManager->sendPasswordByMail(), |
|
44 | - 'enforcePasswordProtection' => $this->settingsManager->enforcePasswordProtection() |
|
45 | - ]; |
|
42 | + $parameters = [ |
|
43 | + 'sendPasswordMail' => $this->settingsManager->sendPasswordByMail(), |
|
44 | + 'enforcePasswordProtection' => $this->settingsManager->enforcePasswordProtection() |
|
45 | + ]; |
|
46 | 46 | |
47 | - return new TemplateResponse('sharebymail', 'settings-admin', $parameters, ''); |
|
48 | - } |
|
47 | + return new TemplateResponse('sharebymail', 'settings-admin', $parameters, ''); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @return string the section ID, e.g. 'sharing' |
|
52 | - */ |
|
53 | - public function getSection() { |
|
54 | - return 'sharing'; |
|
55 | - } |
|
50 | + /** |
|
51 | + * @return string the section ID, e.g. 'sharing' |
|
52 | + */ |
|
53 | + public function getSection() { |
|
54 | + return 'sharing'; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return int whether the form should be rather on the top or bottom of |
|
59 | - * the admin section. The forms are arranged in ascending order of the |
|
60 | - * priority values. It is required to return a value between 0 and 100. |
|
61 | - * |
|
62 | - * E.g.: 70 |
|
63 | - */ |
|
64 | - public function getPriority() { |
|
65 | - return 40; |
|
66 | - } |
|
57 | + /** |
|
58 | + * @return int whether the form should be rather on the top or bottom of |
|
59 | + * the admin section. The forms are arranged in ascending order of the |
|
60 | + * priority values. It is required to return a value between 0 and 100. |
|
61 | + * |
|
62 | + * E.g.: 70 |
|
63 | + */ |
|
64 | + public function getPriority() { |
|
65 | + return 40; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | } |
@@ -27,27 +27,27 @@ |
||
27 | 27 | |
28 | 28 | class Settings { |
29 | 29 | |
30 | - /** @var SettingsManager */ |
|
31 | - private $settingsManager; |
|
32 | - |
|
33 | - public function __construct(SettingsManager $settingsManager) { |
|
34 | - $this->settingsManager = $settingsManager; |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * announce that the share-by-mail share provider is enabled |
|
39 | - * |
|
40 | - * @param array $settings |
|
41 | - */ |
|
42 | - public function announceShareProvider(array $settings) { |
|
43 | - $array = json_decode($settings['array']['oc_appconfig'], true); |
|
44 | - $array['shareByMailEnabled'] = true; |
|
45 | - $settings['array']['oc_appconfig'] = json_encode($array); |
|
46 | - } |
|
47 | - |
|
48 | - public function announceShareByMailSettings(array $settings) { |
|
49 | - $array = json_decode($settings['array']['oc_appconfig'], true); |
|
50 | - $array['shareByMail']['enforcePasswordProtection'] = $this->settingsManager->enforcePasswordProtection(); |
|
51 | - $settings['array']['oc_appconfig'] = json_encode($array); |
|
52 | - } |
|
30 | + /** @var SettingsManager */ |
|
31 | + private $settingsManager; |
|
32 | + |
|
33 | + public function __construct(SettingsManager $settingsManager) { |
|
34 | + $this->settingsManager = $settingsManager; |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * announce that the share-by-mail share provider is enabled |
|
39 | + * |
|
40 | + * @param array $settings |
|
41 | + */ |
|
42 | + public function announceShareProvider(array $settings) { |
|
43 | + $array = json_decode($settings['array']['oc_appconfig'], true); |
|
44 | + $array['shareByMailEnabled'] = true; |
|
45 | + $settings['array']['oc_appconfig'] = json_encode($array); |
|
46 | + } |
|
47 | + |
|
48 | + public function announceShareByMailSettings(array $settings) { |
|
49 | + $array = json_decode($settings['array']['oc_appconfig'], true); |
|
50 | + $array['shareByMail']['enforcePasswordProtection'] = $this->settingsManager->enforcePasswordProtection(); |
|
51 | + $settings['array']['oc_appconfig'] = json_encode($array); |
|
52 | + } |
|
53 | 53 | } |
@@ -28,13 +28,13 @@ |
||
28 | 28 | * @brief wraps around static Nextcloud core methods |
29 | 29 | */ |
30 | 30 | class LogWrapper { |
31 | - protected $app = 'user_ldap'; |
|
31 | + protected $app = 'user_ldap'; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @brief states whether the filesystem was loaded |
|
35 | - * @return bool |
|
36 | - */ |
|
37 | - public function log($msg, $level) { |
|
38 | - \OCP\Util::writeLog($this->app, $msg, $level); |
|
39 | - } |
|
33 | + /** |
|
34 | + * @brief states whether the filesystem was loaded |
|
35 | + * @return bool |
|
36 | + */ |
|
37 | + public function log($msg, $level) { |
|
38 | + \OCP\Util::writeLog($this->app, $msg, $level); |
|
39 | + } |
|
40 | 40 | } |