@@ -48,90 +48,90 @@ |
||
48 | 48 | */ |
49 | 49 | interface IWidgetRequest { |
50 | 50 | |
51 | - /** |
|
52 | - * Get the widgetId. |
|
53 | - * |
|
54 | - * @since 15.0.0 |
|
55 | - * |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function getWidgetId(): string; |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * Get the WidgetClass. |
|
63 | - * |
|
64 | - * @since 15.0.0 |
|
65 | - * |
|
66 | - * @return IDashboardWidget |
|
67 | - */ |
|
68 | - public function getWidget(): IDashboardWidget; |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * Get the 'request' string sent by the request from the front-end with |
|
73 | - * the format: |
|
74 | - * |
|
75 | - * net.requestWidget( |
|
76 | - * { |
|
77 | - * widget: widgetId, |
|
78 | - * request: request, |
|
79 | - * value: value |
|
80 | - * }, |
|
81 | - * callback); |
|
82 | - * |
|
83 | - * @since 15.0.0 |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function getRequest(): string; |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * Get the 'value' string sent by the request from the front-end. |
|
92 | - * |
|
93 | - * @see getRequest |
|
94 | - * |
|
95 | - * @since 15.0.0 |
|
96 | - * |
|
97 | - * @return string |
|
98 | - */ |
|
99 | - public function getValue(): string; |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * Returns the result. |
|
104 | - * |
|
105 | - * @since 15.0.0 |
|
106 | - * |
|
107 | - * @return array |
|
108 | - */ |
|
109 | - public function getResult(): array; |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * add a result (as string) |
|
114 | - * |
|
115 | - * @since 15.0.0 |
|
116 | - * |
|
117 | - * @param string $key |
|
118 | - * @param string $result |
|
119 | - * |
|
120 | - * @return $this |
|
121 | - */ |
|
122 | - public function addResult(string $key, string $result): IWidgetRequest; |
|
123 | - |
|
124 | - /** |
|
125 | - * add a result (as array) |
|
126 | - * |
|
127 | - * @since 15.0.0 |
|
128 | - * |
|
129 | - * @param string $key |
|
130 | - * @param array $result |
|
131 | - * |
|
132 | - * @return $this |
|
133 | - */ |
|
134 | - public function addResultArray(string $key, array $result): IWidgetRequest; |
|
51 | + /** |
|
52 | + * Get the widgetId. |
|
53 | + * |
|
54 | + * @since 15.0.0 |
|
55 | + * |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function getWidgetId(): string; |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * Get the WidgetClass. |
|
63 | + * |
|
64 | + * @since 15.0.0 |
|
65 | + * |
|
66 | + * @return IDashboardWidget |
|
67 | + */ |
|
68 | + public function getWidget(): IDashboardWidget; |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * Get the 'request' string sent by the request from the front-end with |
|
73 | + * the format: |
|
74 | + * |
|
75 | + * net.requestWidget( |
|
76 | + * { |
|
77 | + * widget: widgetId, |
|
78 | + * request: request, |
|
79 | + * value: value |
|
80 | + * }, |
|
81 | + * callback); |
|
82 | + * |
|
83 | + * @since 15.0.0 |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function getRequest(): string; |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * Get the 'value' string sent by the request from the front-end. |
|
92 | + * |
|
93 | + * @see getRequest |
|
94 | + * |
|
95 | + * @since 15.0.0 |
|
96 | + * |
|
97 | + * @return string |
|
98 | + */ |
|
99 | + public function getValue(): string; |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * Returns the result. |
|
104 | + * |
|
105 | + * @since 15.0.0 |
|
106 | + * |
|
107 | + * @return array |
|
108 | + */ |
|
109 | + public function getResult(): array; |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * add a result (as string) |
|
114 | + * |
|
115 | + * @since 15.0.0 |
|
116 | + * |
|
117 | + * @param string $key |
|
118 | + * @param string $result |
|
119 | + * |
|
120 | + * @return $this |
|
121 | + */ |
|
122 | + public function addResult(string $key, string $result): IWidgetRequest; |
|
123 | + |
|
124 | + /** |
|
125 | + * add a result (as array) |
|
126 | + * |
|
127 | + * @since 15.0.0 |
|
128 | + * |
|
129 | + * @param string $key |
|
130 | + * @param array $result |
|
131 | + * |
|
132 | + * @return $this |
|
133 | + */ |
|
134 | + public function addResultArray(string $key, array $result): IWidgetRequest; |
|
135 | 135 | |
136 | 136 | } |
137 | 137 |
@@ -48,271 +48,271 @@ |
||
48 | 48 | final class WidgetTemplate implements JsonSerializable { |
49 | 49 | |
50 | 50 | |
51 | - /** @var string */ |
|
52 | - private $icon = ''; |
|
53 | - |
|
54 | - /** @var array */ |
|
55 | - private $css = []; |
|
56 | - |
|
57 | - /** @var array */ |
|
58 | - private $js = []; |
|
59 | - |
|
60 | - /** @var string */ |
|
61 | - private $content = ''; |
|
62 | - |
|
63 | - /** @var string */ |
|
64 | - private $function = ''; |
|
65 | - |
|
66 | - /** @var WidgetSetting[] */ |
|
67 | - private $settings = []; |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * Get the icon class of the widget. |
|
72 | - * |
|
73 | - * @since 15.0.0 |
|
74 | - * |
|
75 | - * @return string |
|
76 | - */ |
|
77 | - public function getIcon(): string { |
|
78 | - return $this->icon; |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * Set the icon class of the widget. |
|
83 | - * This class must be defined in one of the CSS file used by the widget. |
|
84 | - * |
|
85 | - * @see addCss |
|
86 | - * |
|
87 | - * @since 15.0.0 |
|
88 | - * |
|
89 | - * @param string $icon |
|
90 | - * |
|
91 | - * @return WidgetTemplate |
|
92 | - */ |
|
93 | - public function setIcon(string $icon): WidgetTemplate { |
|
94 | - $this->icon = $icon; |
|
95 | - |
|
96 | - return $this; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Get CSS files to be included when displaying a widget |
|
101 | - * |
|
102 | - * @since 15.0.0 |
|
103 | - * |
|
104 | - * @return array |
|
105 | - */ |
|
106 | - public function getCss(): array { |
|
107 | - return $this->css; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * path and name of CSS files |
|
112 | - * |
|
113 | - * @since 15.0.0 |
|
114 | - * |
|
115 | - * @param array $css |
|
116 | - * |
|
117 | - * @return WidgetTemplate |
|
118 | - */ |
|
119 | - public function setCss(array $css): WidgetTemplate { |
|
120 | - $this->css = $css; |
|
121 | - |
|
122 | - return $this; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Add a CSS file to be included when displaying a widget. |
|
127 | - * |
|
128 | - * @since 15.0.0 |
|
129 | - * |
|
130 | - * @param string $css |
|
131 | - * |
|
132 | - * @return WidgetTemplate |
|
133 | - */ |
|
134 | - public function addCss(string $css): WidgetTemplate { |
|
135 | - $this->css[] = $css; |
|
136 | - |
|
137 | - return $this; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Get JS files to be included when loading a widget |
|
142 | - * |
|
143 | - * @since 15.0.0 |
|
144 | - * |
|
145 | - * @return array |
|
146 | - */ |
|
147 | - public function getJs(): array { |
|
148 | - return $this->js; |
|
149 | - } |
|
150 | - |
|
151 | - /** |
|
152 | - * Set an array of JS files to be included when loading a widget. |
|
153 | - * |
|
154 | - * @since 15.0.0 |
|
155 | - * |
|
156 | - * @param array $js |
|
157 | - * |
|
158 | - * @return WidgetTemplate |
|
159 | - */ |
|
160 | - public function setJs(array $js): WidgetTemplate { |
|
161 | - $this->js = $js; |
|
162 | - |
|
163 | - return $this; |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * Add a JS file to be included when loading a widget. |
|
168 | - * |
|
169 | - * @since 15.0.0 |
|
170 | - * |
|
171 | - * @param string $js |
|
172 | - * |
|
173 | - * @return WidgetTemplate |
|
174 | - */ |
|
175 | - public function addJs(string $js): WidgetTemplate { |
|
176 | - $this->js[] = $js; |
|
177 | - |
|
178 | - return $this; |
|
179 | - } |
|
180 | - |
|
181 | - /** |
|
182 | - * Get the HTML file that contains the content of the widget. |
|
183 | - * |
|
184 | - * @since 15.0.0 |
|
185 | - * |
|
186 | - * @return string |
|
187 | - */ |
|
188 | - public function getContent(): string { |
|
189 | - return $this->content; |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * Set the HTML file that contains the content of the widget. |
|
194 | - * |
|
195 | - * @since 15.0.0 |
|
196 | - * |
|
197 | - * @param string $content |
|
198 | - * |
|
199 | - * @return WidgetTemplate |
|
200 | - */ |
|
201 | - public function setContent(string $content): WidgetTemplate { |
|
202 | - $this->content = $content; |
|
203 | - |
|
204 | - return $this; |
|
205 | - } |
|
206 | - |
|
207 | - /** |
|
208 | - * Get the JS function to be called when loading the widget. |
|
209 | - * |
|
210 | - * @since 15.0.0 |
|
211 | - * |
|
212 | - * @return string |
|
213 | - */ |
|
214 | - public function getInitFunction(): string { |
|
215 | - return $this->function; |
|
216 | - } |
|
217 | - |
|
218 | - /** |
|
219 | - * JavaScript function to be called when loading the widget on the |
|
220 | - * dashboard |
|
221 | - * |
|
222 | - * @since 15.0.0 |
|
223 | - * |
|
224 | - * @param string $function |
|
225 | - * |
|
226 | - * @return WidgetTemplate |
|
227 | - */ |
|
228 | - public function setInitFunction(string $function): WidgetTemplate { |
|
229 | - $this->function = $function; |
|
230 | - |
|
231 | - return $this; |
|
232 | - } |
|
233 | - |
|
234 | - /** |
|
235 | - * Get all WidgetSetting defined for the widget. |
|
236 | - * |
|
237 | - * @see WidgetSetting |
|
238 | - * |
|
239 | - * @since 15.0.0 |
|
240 | - * |
|
241 | - * @return WidgetSetting[] |
|
242 | - */ |
|
243 | - public function getSettings(): array { |
|
244 | - return $this->settings; |
|
245 | - } |
|
246 | - |
|
247 | - /** |
|
248 | - * Define all WidgetSetting for the widget. |
|
249 | - * |
|
250 | - * @since 15.0.0 |
|
251 | - * |
|
252 | - * @see WidgetSetting |
|
253 | - * |
|
254 | - * @param WidgetSetting[] $settings |
|
255 | - * |
|
256 | - * @return WidgetTemplate |
|
257 | - */ |
|
258 | - public function setSettings(array $settings): WidgetTemplate { |
|
259 | - $this->settings = $settings; |
|
260 | - |
|
261 | - return $this; |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * Add a WidgetSetting. |
|
266 | - * |
|
267 | - * @see WidgetSetting |
|
268 | - * |
|
269 | - * @since 15.0.0 |
|
270 | - * |
|
271 | - * @param WidgetSetting $setting |
|
272 | - * |
|
273 | - * @return WidgetTemplate |
|
274 | - */ |
|
275 | - public function addSetting(WidgetSetting $setting): WidgetTemplate { |
|
276 | - $this->settings[] = $setting; |
|
277 | - |
|
278 | - return $this; |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * Get a WidgetSetting by its name |
|
283 | - * |
|
284 | - * @see WidgetSetting::setName |
|
285 | - * |
|
286 | - * @since 15.0.0 |
|
287 | - * |
|
288 | - * @param string $key |
|
289 | - * |
|
290 | - * @return WidgetSetting |
|
291 | - */ |
|
292 | - public function getSetting(string $key): WidgetSetting { |
|
293 | - if (!array_key_exists($key, $this->settings)) { |
|
294 | - return null; |
|
295 | - } |
|
296 | - |
|
297 | - return $this->settings[$key]; |
|
298 | - } |
|
299 | - |
|
300 | - |
|
301 | - /** |
|
302 | - * @since 15.0.0 |
|
303 | - * |
|
304 | - * @return array |
|
305 | - */ |
|
306 | - public function jsonSerialize() { |
|
307 | - return [ |
|
308 | - 'icon' => $this->getIcon(), |
|
309 | - 'css' => $this->getCss(), |
|
310 | - 'js' => $this->getJs(), |
|
311 | - 'content' => $this->getContent(), |
|
312 | - 'function' => $this->getInitFunction(), |
|
313 | - 'settings' => $this->getSettings() |
|
314 | - ]; |
|
315 | - } |
|
51 | + /** @var string */ |
|
52 | + private $icon = ''; |
|
53 | + |
|
54 | + /** @var array */ |
|
55 | + private $css = []; |
|
56 | + |
|
57 | + /** @var array */ |
|
58 | + private $js = []; |
|
59 | + |
|
60 | + /** @var string */ |
|
61 | + private $content = ''; |
|
62 | + |
|
63 | + /** @var string */ |
|
64 | + private $function = ''; |
|
65 | + |
|
66 | + /** @var WidgetSetting[] */ |
|
67 | + private $settings = []; |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * Get the icon class of the widget. |
|
72 | + * |
|
73 | + * @since 15.0.0 |
|
74 | + * |
|
75 | + * @return string |
|
76 | + */ |
|
77 | + public function getIcon(): string { |
|
78 | + return $this->icon; |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * Set the icon class of the widget. |
|
83 | + * This class must be defined in one of the CSS file used by the widget. |
|
84 | + * |
|
85 | + * @see addCss |
|
86 | + * |
|
87 | + * @since 15.0.0 |
|
88 | + * |
|
89 | + * @param string $icon |
|
90 | + * |
|
91 | + * @return WidgetTemplate |
|
92 | + */ |
|
93 | + public function setIcon(string $icon): WidgetTemplate { |
|
94 | + $this->icon = $icon; |
|
95 | + |
|
96 | + return $this; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Get CSS files to be included when displaying a widget |
|
101 | + * |
|
102 | + * @since 15.0.0 |
|
103 | + * |
|
104 | + * @return array |
|
105 | + */ |
|
106 | + public function getCss(): array { |
|
107 | + return $this->css; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * path and name of CSS files |
|
112 | + * |
|
113 | + * @since 15.0.0 |
|
114 | + * |
|
115 | + * @param array $css |
|
116 | + * |
|
117 | + * @return WidgetTemplate |
|
118 | + */ |
|
119 | + public function setCss(array $css): WidgetTemplate { |
|
120 | + $this->css = $css; |
|
121 | + |
|
122 | + return $this; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Add a CSS file to be included when displaying a widget. |
|
127 | + * |
|
128 | + * @since 15.0.0 |
|
129 | + * |
|
130 | + * @param string $css |
|
131 | + * |
|
132 | + * @return WidgetTemplate |
|
133 | + */ |
|
134 | + public function addCss(string $css): WidgetTemplate { |
|
135 | + $this->css[] = $css; |
|
136 | + |
|
137 | + return $this; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Get JS files to be included when loading a widget |
|
142 | + * |
|
143 | + * @since 15.0.0 |
|
144 | + * |
|
145 | + * @return array |
|
146 | + */ |
|
147 | + public function getJs(): array { |
|
148 | + return $this->js; |
|
149 | + } |
|
150 | + |
|
151 | + /** |
|
152 | + * Set an array of JS files to be included when loading a widget. |
|
153 | + * |
|
154 | + * @since 15.0.0 |
|
155 | + * |
|
156 | + * @param array $js |
|
157 | + * |
|
158 | + * @return WidgetTemplate |
|
159 | + */ |
|
160 | + public function setJs(array $js): WidgetTemplate { |
|
161 | + $this->js = $js; |
|
162 | + |
|
163 | + return $this; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Add a JS file to be included when loading a widget. |
|
168 | + * |
|
169 | + * @since 15.0.0 |
|
170 | + * |
|
171 | + * @param string $js |
|
172 | + * |
|
173 | + * @return WidgetTemplate |
|
174 | + */ |
|
175 | + public function addJs(string $js): WidgetTemplate { |
|
176 | + $this->js[] = $js; |
|
177 | + |
|
178 | + return $this; |
|
179 | + } |
|
180 | + |
|
181 | + /** |
|
182 | + * Get the HTML file that contains the content of the widget. |
|
183 | + * |
|
184 | + * @since 15.0.0 |
|
185 | + * |
|
186 | + * @return string |
|
187 | + */ |
|
188 | + public function getContent(): string { |
|
189 | + return $this->content; |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * Set the HTML file that contains the content of the widget. |
|
194 | + * |
|
195 | + * @since 15.0.0 |
|
196 | + * |
|
197 | + * @param string $content |
|
198 | + * |
|
199 | + * @return WidgetTemplate |
|
200 | + */ |
|
201 | + public function setContent(string $content): WidgetTemplate { |
|
202 | + $this->content = $content; |
|
203 | + |
|
204 | + return $this; |
|
205 | + } |
|
206 | + |
|
207 | + /** |
|
208 | + * Get the JS function to be called when loading the widget. |
|
209 | + * |
|
210 | + * @since 15.0.0 |
|
211 | + * |
|
212 | + * @return string |
|
213 | + */ |
|
214 | + public function getInitFunction(): string { |
|
215 | + return $this->function; |
|
216 | + } |
|
217 | + |
|
218 | + /** |
|
219 | + * JavaScript function to be called when loading the widget on the |
|
220 | + * dashboard |
|
221 | + * |
|
222 | + * @since 15.0.0 |
|
223 | + * |
|
224 | + * @param string $function |
|
225 | + * |
|
226 | + * @return WidgetTemplate |
|
227 | + */ |
|
228 | + public function setInitFunction(string $function): WidgetTemplate { |
|
229 | + $this->function = $function; |
|
230 | + |
|
231 | + return $this; |
|
232 | + } |
|
233 | + |
|
234 | + /** |
|
235 | + * Get all WidgetSetting defined for the widget. |
|
236 | + * |
|
237 | + * @see WidgetSetting |
|
238 | + * |
|
239 | + * @since 15.0.0 |
|
240 | + * |
|
241 | + * @return WidgetSetting[] |
|
242 | + */ |
|
243 | + public function getSettings(): array { |
|
244 | + return $this->settings; |
|
245 | + } |
|
246 | + |
|
247 | + /** |
|
248 | + * Define all WidgetSetting for the widget. |
|
249 | + * |
|
250 | + * @since 15.0.0 |
|
251 | + * |
|
252 | + * @see WidgetSetting |
|
253 | + * |
|
254 | + * @param WidgetSetting[] $settings |
|
255 | + * |
|
256 | + * @return WidgetTemplate |
|
257 | + */ |
|
258 | + public function setSettings(array $settings): WidgetTemplate { |
|
259 | + $this->settings = $settings; |
|
260 | + |
|
261 | + return $this; |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * Add a WidgetSetting. |
|
266 | + * |
|
267 | + * @see WidgetSetting |
|
268 | + * |
|
269 | + * @since 15.0.0 |
|
270 | + * |
|
271 | + * @param WidgetSetting $setting |
|
272 | + * |
|
273 | + * @return WidgetTemplate |
|
274 | + */ |
|
275 | + public function addSetting(WidgetSetting $setting): WidgetTemplate { |
|
276 | + $this->settings[] = $setting; |
|
277 | + |
|
278 | + return $this; |
|
279 | + } |
|
280 | + |
|
281 | + /** |
|
282 | + * Get a WidgetSetting by its name |
|
283 | + * |
|
284 | + * @see WidgetSetting::setName |
|
285 | + * |
|
286 | + * @since 15.0.0 |
|
287 | + * |
|
288 | + * @param string $key |
|
289 | + * |
|
290 | + * @return WidgetSetting |
|
291 | + */ |
|
292 | + public function getSetting(string $key): WidgetSetting { |
|
293 | + if (!array_key_exists($key, $this->settings)) { |
|
294 | + return null; |
|
295 | + } |
|
296 | + |
|
297 | + return $this->settings[$key]; |
|
298 | + } |
|
299 | + |
|
300 | + |
|
301 | + /** |
|
302 | + * @since 15.0.0 |
|
303 | + * |
|
304 | + * @return array |
|
305 | + */ |
|
306 | + public function jsonSerialize() { |
|
307 | + return [ |
|
308 | + 'icon' => $this->getIcon(), |
|
309 | + 'css' => $this->getCss(), |
|
310 | + 'js' => $this->getJs(), |
|
311 | + 'content' => $this->getContent(), |
|
312 | + 'function' => $this->getInitFunction(), |
|
313 | + 'settings' => $this->getSettings() |
|
314 | + ]; |
|
315 | + } |
|
316 | 316 | |
317 | 317 | |
318 | 318 | } |
@@ -49,89 +49,89 @@ |
||
49 | 49 | interface IDashboardManager { |
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Register a IWidgetsService. |
|
54 | - * |
|
55 | - * @since 15.0.0 |
|
56 | - * |
|
57 | - * @param IWidgetsService $widgetsService |
|
58 | - */ |
|
59 | - public function registerWidgetsService(IWidgetsService $widgetsService); |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * Register a IEventsService. |
|
64 | - * |
|
65 | - * @since 15.0.0 |
|
66 | - * |
|
67 | - * @param IEventsService $eventsService |
|
68 | - */ |
|
69 | - public function registerEventsService(IEventsService $eventsService); |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * returns the OCP\Dashboard\Model\IWidgetConfig for a widgetId and userId. |
|
74 | - * |
|
75 | - * @see IWidgetConfig |
|
76 | - * |
|
77 | - * @since 15.0.0 |
|
78 | - * |
|
79 | - * @param string $widgetId |
|
80 | - * @param string $userId |
|
81 | - * |
|
82 | - * @throws DashboardAppNotAvailableException |
|
83 | - * @return IWidgetConfig |
|
84 | - */ |
|
85 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * Create push notifications for users. |
|
90 | - * $payload is an array that will be send to the Javascript method |
|
91 | - * called on push. |
|
92 | - * $uniqueId needs to be used if you send the push to multiples users |
|
93 | - * and multiples groups so that one user does not have duplicate |
|
94 | - * notifications. |
|
95 | - * |
|
96 | - * Push notifications are created in database and broadcast to user |
|
97 | - * that are running dashboard. |
|
98 | - * |
|
99 | - * @since 15.0.0 |
|
100 | - * |
|
101 | - * @param string $widgetId |
|
102 | - * @param array $users |
|
103 | - * @param array $payload |
|
104 | - * @param string $uniqueId |
|
105 | - * @throws DashboardAppNotAvailableException |
|
106 | - */ |
|
107 | - public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = ''); |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Create push notifications for groups. (ie. createUsersEvent()) |
|
112 | - * |
|
113 | - * @since 15.0.0 |
|
114 | - * |
|
115 | - * @param string $widgetId |
|
116 | - * @param array $groups |
|
117 | - * @param array $payload |
|
118 | - * @param string $uniqueId |
|
119 | - * @throws DashboardAppNotAvailableException |
|
120 | - */ |
|
121 | - public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = ''); |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * Create push notifications for everyone. (ie. createUsersEvent()) |
|
126 | - * |
|
127 | - * @since 15.0.0 |
|
128 | - * |
|
129 | - * @param string $widgetId |
|
130 | - * @param array $payload |
|
131 | - * @param string $uniqueId |
|
132 | - * @throws DashboardAppNotAvailableException |
|
133 | - */ |
|
134 | - public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = ''); |
|
52 | + /** |
|
53 | + * Register a IWidgetsService. |
|
54 | + * |
|
55 | + * @since 15.0.0 |
|
56 | + * |
|
57 | + * @param IWidgetsService $widgetsService |
|
58 | + */ |
|
59 | + public function registerWidgetsService(IWidgetsService $widgetsService); |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * Register a IEventsService. |
|
64 | + * |
|
65 | + * @since 15.0.0 |
|
66 | + * |
|
67 | + * @param IEventsService $eventsService |
|
68 | + */ |
|
69 | + public function registerEventsService(IEventsService $eventsService); |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * returns the OCP\Dashboard\Model\IWidgetConfig for a widgetId and userId. |
|
74 | + * |
|
75 | + * @see IWidgetConfig |
|
76 | + * |
|
77 | + * @since 15.0.0 |
|
78 | + * |
|
79 | + * @param string $widgetId |
|
80 | + * @param string $userId |
|
81 | + * |
|
82 | + * @throws DashboardAppNotAvailableException |
|
83 | + * @return IWidgetConfig |
|
84 | + */ |
|
85 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * Create push notifications for users. |
|
90 | + * $payload is an array that will be send to the Javascript method |
|
91 | + * called on push. |
|
92 | + * $uniqueId needs to be used if you send the push to multiples users |
|
93 | + * and multiples groups so that one user does not have duplicate |
|
94 | + * notifications. |
|
95 | + * |
|
96 | + * Push notifications are created in database and broadcast to user |
|
97 | + * that are running dashboard. |
|
98 | + * |
|
99 | + * @since 15.0.0 |
|
100 | + * |
|
101 | + * @param string $widgetId |
|
102 | + * @param array $users |
|
103 | + * @param array $payload |
|
104 | + * @param string $uniqueId |
|
105 | + * @throws DashboardAppNotAvailableException |
|
106 | + */ |
|
107 | + public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = ''); |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Create push notifications for groups. (ie. createUsersEvent()) |
|
112 | + * |
|
113 | + * @since 15.0.0 |
|
114 | + * |
|
115 | + * @param string $widgetId |
|
116 | + * @param array $groups |
|
117 | + * @param array $payload |
|
118 | + * @param string $uniqueId |
|
119 | + * @throws DashboardAppNotAvailableException |
|
120 | + */ |
|
121 | + public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = ''); |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * Create push notifications for everyone. (ie. createUsersEvent()) |
|
126 | + * |
|
127 | + * @since 15.0.0 |
|
128 | + * |
|
129 | + * @param string $widgetId |
|
130 | + * @param array $payload |
|
131 | + * @param string $uniqueId |
|
132 | + * @throws DashboardAppNotAvailableException |
|
133 | + */ |
|
134 | + public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = ''); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 |
@@ -46,17 +46,17 @@ |
||
46 | 46 | */ |
47 | 47 | interface IWidgetsService { |
48 | 48 | |
49 | - /** |
|
50 | - * Returns the IWidgetConfig for a widgetId and userId |
|
51 | - * |
|
52 | - * @since 15.0.0 |
|
53 | - * |
|
54 | - * @param string $widgetId |
|
55 | - * @param string $userId |
|
56 | - * |
|
57 | - * @return IWidgetConfig |
|
58 | - */ |
|
59 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
49 | + /** |
|
50 | + * Returns the IWidgetConfig for a widgetId and userId |
|
51 | + * |
|
52 | + * @since 15.0.0 |
|
53 | + * |
|
54 | + * @param string $widgetId |
|
55 | + * @param string $userId |
|
56 | + * |
|
57 | + * @return IWidgetConfig |
|
58 | + */ |
|
59 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
60 | 60 | |
61 | 61 | } |
62 | 62 |
@@ -34,71 +34,71 @@ |
||
34 | 34 | */ |
35 | 35 | interface IAccountProperty extends \JsonSerializable { |
36 | 36 | |
37 | - /** |
|
38 | - * Set the value of a property |
|
39 | - * |
|
40 | - * @since 15.0.0 |
|
41 | - * |
|
42 | - * @param string $value |
|
43 | - * @return IAccountProperty |
|
44 | - */ |
|
45 | - public function setValue(string $value): IAccountProperty; |
|
37 | + /** |
|
38 | + * Set the value of a property |
|
39 | + * |
|
40 | + * @since 15.0.0 |
|
41 | + * |
|
42 | + * @param string $value |
|
43 | + * @return IAccountProperty |
|
44 | + */ |
|
45 | + public function setValue(string $value): IAccountProperty; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Set the scope of a property |
|
49 | - * |
|
50 | - * @since 15.0.0 |
|
51 | - * |
|
52 | - * @param string $scope |
|
53 | - * @return IAccountProperty |
|
54 | - */ |
|
55 | - public function setScope(string $scope): IAccountProperty; |
|
47 | + /** |
|
48 | + * Set the scope of a property |
|
49 | + * |
|
50 | + * @since 15.0.0 |
|
51 | + * |
|
52 | + * @param string $scope |
|
53 | + * @return IAccountProperty |
|
54 | + */ |
|
55 | + public function setScope(string $scope): IAccountProperty; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Set the verification status of a property |
|
59 | - * |
|
60 | - * @since 15.0.0 |
|
61 | - * |
|
62 | - * @param string $verified |
|
63 | - * @return IAccountProperty |
|
64 | - */ |
|
65 | - public function setVerified(string $verified): IAccountProperty; |
|
57 | + /** |
|
58 | + * Set the verification status of a property |
|
59 | + * |
|
60 | + * @since 15.0.0 |
|
61 | + * |
|
62 | + * @param string $verified |
|
63 | + * @return IAccountProperty |
|
64 | + */ |
|
65 | + public function setVerified(string $verified): IAccountProperty; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Get the name of a property |
|
69 | - * |
|
70 | - * @since 15.0.0 |
|
71 | - * |
|
72 | - * @return string |
|
73 | - */ |
|
74 | - public function getName(): string; |
|
67 | + /** |
|
68 | + * Get the name of a property |
|
69 | + * |
|
70 | + * @since 15.0.0 |
|
71 | + * |
|
72 | + * @return string |
|
73 | + */ |
|
74 | + public function getName(): string; |
|
75 | 75 | |
76 | - /** |
|
77 | - * Get the value of a property |
|
78 | - * |
|
79 | - * @since 15.0.0 |
|
80 | - * |
|
81 | - * @return string |
|
82 | - */ |
|
83 | - public function getValue(): string; |
|
76 | + /** |
|
77 | + * Get the value of a property |
|
78 | + * |
|
79 | + * @since 15.0.0 |
|
80 | + * |
|
81 | + * @return string |
|
82 | + */ |
|
83 | + public function getValue(): string; |
|
84 | 84 | |
85 | - /** |
|
86 | - * Get the scope of a property |
|
87 | - * |
|
88 | - * @since 15.0.0 |
|
89 | - * |
|
90 | - * @return string |
|
91 | - */ |
|
92 | - public function getScope(): string; |
|
85 | + /** |
|
86 | + * Get the scope of a property |
|
87 | + * |
|
88 | + * @since 15.0.0 |
|
89 | + * |
|
90 | + * @return string |
|
91 | + */ |
|
92 | + public function getScope(): string; |
|
93 | 93 | |
94 | - /** |
|
95 | - * Get the verification status of a property |
|
96 | - * |
|
97 | - * @since 15.0.0 |
|
98 | - * |
|
99 | - * @return string |
|
100 | - */ |
|
101 | - public function getVerified(): string; |
|
94 | + /** |
|
95 | + * Get the verification status of a property |
|
96 | + * |
|
97 | + * @since 15.0.0 |
|
98 | + * |
|
99 | + * @return string |
|
100 | + */ |
|
101 | + public function getVerified(): string; |
|
102 | 102 | |
103 | 103 | } |
104 | 104 |
@@ -30,111 +30,111 @@ |
||
30 | 30 | |
31 | 31 | class AccountProperty implements IAccountProperty { |
32 | 32 | |
33 | - /** @var string */ |
|
34 | - private $name; |
|
35 | - /** @var string */ |
|
36 | - private $value; |
|
37 | - /** @var string */ |
|
38 | - private $scope; |
|
39 | - /** @var string */ |
|
40 | - private $verified; |
|
33 | + /** @var string */ |
|
34 | + private $name; |
|
35 | + /** @var string */ |
|
36 | + private $value; |
|
37 | + /** @var string */ |
|
38 | + private $scope; |
|
39 | + /** @var string */ |
|
40 | + private $verified; |
|
41 | 41 | |
42 | - public function __construct(string $name, string $value, string $scope, string $verified) { |
|
43 | - $this->name = $name; |
|
44 | - $this->value = $value; |
|
45 | - $this->scope = $scope; |
|
46 | - $this->verified = $verified; |
|
47 | - } |
|
42 | + public function __construct(string $name, string $value, string $scope, string $verified) { |
|
43 | + $this->name = $name; |
|
44 | + $this->value = $value; |
|
45 | + $this->scope = $scope; |
|
46 | + $this->verified = $verified; |
|
47 | + } |
|
48 | 48 | |
49 | - public function jsonSerialize() { |
|
50 | - return [ |
|
51 | - 'name' => $this->getName(), |
|
52 | - 'value' => $this->getValue(), |
|
53 | - 'scope' => $this->getScope(), |
|
54 | - 'verified' => $this->getVerified() |
|
55 | - ]; |
|
56 | - } |
|
49 | + public function jsonSerialize() { |
|
50 | + return [ |
|
51 | + 'name' => $this->getName(), |
|
52 | + 'value' => $this->getValue(), |
|
53 | + 'scope' => $this->getScope(), |
|
54 | + 'verified' => $this->getVerified() |
|
55 | + ]; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Set the value of a property |
|
60 | - * |
|
61 | - * @since 15.0.0 |
|
62 | - * |
|
63 | - * @param string $value |
|
64 | - * @return IAccountProperty |
|
65 | - */ |
|
66 | - public function setValue(string $value): IAccountProperty { |
|
67 | - $this->value = $value; |
|
68 | - return $this; |
|
69 | - } |
|
58 | + /** |
|
59 | + * Set the value of a property |
|
60 | + * |
|
61 | + * @since 15.0.0 |
|
62 | + * |
|
63 | + * @param string $value |
|
64 | + * @return IAccountProperty |
|
65 | + */ |
|
66 | + public function setValue(string $value): IAccountProperty { |
|
67 | + $this->value = $value; |
|
68 | + return $this; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Set the scope of a property |
|
73 | - * |
|
74 | - * @since 15.0.0 |
|
75 | - * |
|
76 | - * @param string $scope |
|
77 | - * @return IAccountProperty |
|
78 | - */ |
|
79 | - public function setScope(string $scope): IAccountProperty { |
|
80 | - $this->scope = $scope; |
|
81 | - return $this; |
|
82 | - } |
|
71 | + /** |
|
72 | + * Set the scope of a property |
|
73 | + * |
|
74 | + * @since 15.0.0 |
|
75 | + * |
|
76 | + * @param string $scope |
|
77 | + * @return IAccountProperty |
|
78 | + */ |
|
79 | + public function setScope(string $scope): IAccountProperty { |
|
80 | + $this->scope = $scope; |
|
81 | + return $this; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Set the verification status of a property |
|
86 | - * |
|
87 | - * @since 15.0.0 |
|
88 | - * |
|
89 | - * @param string $verified |
|
90 | - * @return IAccountProperty |
|
91 | - */ |
|
92 | - public function setVerified(string $verified): IAccountProperty { |
|
93 | - $this->verified = $verified; |
|
94 | - return $this; |
|
95 | - } |
|
84 | + /** |
|
85 | + * Set the verification status of a property |
|
86 | + * |
|
87 | + * @since 15.0.0 |
|
88 | + * |
|
89 | + * @param string $verified |
|
90 | + * @return IAccountProperty |
|
91 | + */ |
|
92 | + public function setVerified(string $verified): IAccountProperty { |
|
93 | + $this->verified = $verified; |
|
94 | + return $this; |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Get the name of a property |
|
99 | - * |
|
100 | - * @since 15.0.0 |
|
101 | - * |
|
102 | - * @return string |
|
103 | - */ |
|
104 | - public function getName(): string { |
|
105 | - return $this->name; |
|
106 | - } |
|
97 | + /** |
|
98 | + * Get the name of a property |
|
99 | + * |
|
100 | + * @since 15.0.0 |
|
101 | + * |
|
102 | + * @return string |
|
103 | + */ |
|
104 | + public function getName(): string { |
|
105 | + return $this->name; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Get the value of a property |
|
110 | - * |
|
111 | - * @since 15.0.0 |
|
112 | - * |
|
113 | - * @return string |
|
114 | - */ |
|
115 | - public function getValue(): string { |
|
116 | - return $this->value; |
|
117 | - } |
|
108 | + /** |
|
109 | + * Get the value of a property |
|
110 | + * |
|
111 | + * @since 15.0.0 |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
115 | + public function getValue(): string { |
|
116 | + return $this->value; |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Get the scope of a property |
|
121 | - * |
|
122 | - * @since 15.0.0 |
|
123 | - * |
|
124 | - * @return string |
|
125 | - */ |
|
126 | - public function getScope(): string { |
|
127 | - return $this->scope; |
|
128 | - } |
|
119 | + /** |
|
120 | + * Get the scope of a property |
|
121 | + * |
|
122 | + * @since 15.0.0 |
|
123 | + * |
|
124 | + * @return string |
|
125 | + */ |
|
126 | + public function getScope(): string { |
|
127 | + return $this->scope; |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Get the verification status of a property |
|
132 | - * |
|
133 | - * @since 15.0.0 |
|
134 | - * |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - public function getVerified(): string { |
|
138 | - return $this->verified; |
|
139 | - } |
|
130 | + /** |
|
131 | + * Get the verification status of a property |
|
132 | + * |
|
133 | + * @since 15.0.0 |
|
134 | + * |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + public function getVerified(): string { |
|
138 | + return $this->verified; |
|
139 | + } |
|
140 | 140 | } |
@@ -70,9 +70,9 @@ |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | $query = $this->db->getQueryBuilder(); |
73 | - $query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')')) |
|
73 | + $query->select($query->createFunction('MAX('.$query->getColumnName('id').')')) |
|
74 | 74 | ->from('calendarobjects'); |
75 | - $maxId = (int)$query->execute()->fetchColumn(); |
|
75 | + $maxId = (int) $query->execute()->fetchColumn(); |
|
76 | 76 | |
77 | 77 | $output->info('Add background job'); |
78 | 78 | $this->jobList->add(BuildCalendarSearchIndexBackgroundJob::class, [ |
@@ -31,57 +31,57 @@ |
||
31 | 31 | |
32 | 32 | class BuildCalendarSearchIndex implements IRepairStep { |
33 | 33 | |
34 | - /** @var IDBConnection */ |
|
35 | - private $db; |
|
34 | + /** @var IDBConnection */ |
|
35 | + private $db; |
|
36 | 36 | |
37 | - /** @var IJobList */ |
|
38 | - private $jobList; |
|
37 | + /** @var IJobList */ |
|
38 | + private $jobList; |
|
39 | 39 | |
40 | - /** @var IConfig */ |
|
41 | - private $config; |
|
40 | + /** @var IConfig */ |
|
41 | + private $config; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param IDBConnection $db |
|
45 | - * @param IJobList $jobList |
|
46 | - * @param IConfig $config |
|
47 | - */ |
|
48 | - public function __construct(IDBConnection $db, |
|
49 | - IJobList $jobList, |
|
50 | - IConfig $config) { |
|
51 | - $this->db = $db; |
|
52 | - $this->jobList = $jobList; |
|
53 | - $this->config = $config; |
|
54 | - } |
|
43 | + /** |
|
44 | + * @param IDBConnection $db |
|
45 | + * @param IJobList $jobList |
|
46 | + * @param IConfig $config |
|
47 | + */ |
|
48 | + public function __construct(IDBConnection $db, |
|
49 | + IJobList $jobList, |
|
50 | + IConfig $config) { |
|
51 | + $this->db = $db; |
|
52 | + $this->jobList = $jobList; |
|
53 | + $this->config = $config; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getName() { |
|
60 | - return 'Registering building of calendar search index as background job'; |
|
61 | - } |
|
56 | + /** |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getName() { |
|
60 | + return 'Registering building of calendar search index as background job'; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @param IOutput $output |
|
65 | - */ |
|
66 | - public function run(IOutput $output) { |
|
67 | - // only run once |
|
68 | - if ($this->config->getAppValue('dav', 'buildCalendarSearchIndex') === 'yes') { |
|
69 | - $output->info('Repair step already executed'); |
|
70 | - return; |
|
71 | - } |
|
63 | + /** |
|
64 | + * @param IOutput $output |
|
65 | + */ |
|
66 | + public function run(IOutput $output) { |
|
67 | + // only run once |
|
68 | + if ($this->config->getAppValue('dav', 'buildCalendarSearchIndex') === 'yes') { |
|
69 | + $output->info('Repair step already executed'); |
|
70 | + return; |
|
71 | + } |
|
72 | 72 | |
73 | - $query = $this->db->getQueryBuilder(); |
|
74 | - $query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')')) |
|
75 | - ->from('calendarobjects'); |
|
76 | - $maxId = (int)$query->execute()->fetchColumn(); |
|
73 | + $query = $this->db->getQueryBuilder(); |
|
74 | + $query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')')) |
|
75 | + ->from('calendarobjects'); |
|
76 | + $maxId = (int)$query->execute()->fetchColumn(); |
|
77 | 77 | |
78 | - $output->info('Add background job'); |
|
79 | - $this->jobList->add(BuildCalendarSearchIndexBackgroundJob::class, [ |
|
80 | - 'offset' => 0, |
|
81 | - 'stopAt' => $maxId |
|
82 | - ]); |
|
78 | + $output->info('Add background job'); |
|
79 | + $this->jobList->add(BuildCalendarSearchIndexBackgroundJob::class, [ |
|
80 | + 'offset' => 0, |
|
81 | + 'stopAt' => $maxId |
|
82 | + ]); |
|
83 | 83 | |
84 | - // if all were done, no need to redo the repair during next upgrade |
|
85 | - $this->config->setAppValue('dav', 'buildCalendarSearchIndex', 'yes'); |
|
86 | - } |
|
84 | + // if all were done, no need to redo the repair during next upgrade |
|
85 | + $this->config->setAppValue('dav', 'buildCalendarSearchIndex', 'yes'); |
|
86 | + } |
|
87 | 87 | } |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | ], |
75 | 75 | [ |
76 | 76 | 'privilege' => '{DAV:}read', |
77 | - 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
77 | + 'principal' => $this->getOwner().'/calendar-proxy-read', |
|
78 | 78 | 'protected' => true, |
79 | 79 | ], |
80 | 80 | [ |
81 | 81 | 'privilege' => '{DAV:}read', |
82 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
82 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
83 | 83 | 'protected' => true, |
84 | 84 | ], |
85 | 85 | ]; |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | if ($this->disableFreeBusy) { |
95 | 95 | return array_merge($commonAcl, [ |
96 | 96 | [ |
97 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
97 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send-invite', |
|
98 | 98 | 'principal' => $this->getOwner(), |
99 | 99 | 'protected' => true, |
100 | 100 | ], |
101 | 101 | [ |
102 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
103 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
102 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send-invite', |
|
103 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
104 | 104 | 'protected' => true, |
105 | 105 | ], |
106 | 106 | [ |
107 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
107 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send-reply', |
|
108 | 108 | 'principal' => $this->getOwner(), |
109 | 109 | 'protected' => true, |
110 | 110 | ], |
111 | 111 | [ |
112 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
113 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
112 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send-reply', |
|
113 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
114 | 114 | 'protected' => true, |
115 | 115 | ], |
116 | 116 | ]); |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | |
119 | 119 | return array_merge($commonAcl, [ |
120 | 120 | [ |
121 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
121 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send', |
|
122 | 122 | 'principal' => $this->getOwner(), |
123 | 123 | 'protected' => true, |
124 | 124 | ], |
125 | 125 | [ |
126 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
127 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
126 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send', |
|
127 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
128 | 128 | 'protected' => true, |
129 | 129 | ], |
130 | 130 | ]); |
@@ -34,102 +34,102 @@ |
||
34 | 34 | */ |
35 | 35 | class Outbox extends \Sabre\CalDAV\Schedule\Outbox { |
36 | 36 | |
37 | - /** @var IConfig */ |
|
38 | - private $config; |
|
37 | + /** @var IConfig */ |
|
38 | + private $config; |
|
39 | 39 | |
40 | - /** @var null|bool */ |
|
41 | - private $disableFreeBusy = null; |
|
40 | + /** @var null|bool */ |
|
41 | + private $disableFreeBusy = null; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Outbox constructor. |
|
45 | - * |
|
46 | - * @param IConfig $config |
|
47 | - * @param string $principalUri |
|
48 | - */ |
|
49 | - public function __construct(IConfig $config, string $principalUri) { |
|
50 | - parent::__construct($principalUri); |
|
51 | - $this->config = $config; |
|
52 | - } |
|
43 | + /** |
|
44 | + * Outbox constructor. |
|
45 | + * |
|
46 | + * @param IConfig $config |
|
47 | + * @param string $principalUri |
|
48 | + */ |
|
49 | + public function __construct(IConfig $config, string $principalUri) { |
|
50 | + parent::__construct($principalUri); |
|
51 | + $this->config = $config; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Returns a list of ACE's for this node. |
|
56 | - * |
|
57 | - * Each ACE has the following properties: |
|
58 | - * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
59 | - * currently the only supported privileges |
|
60 | - * * 'principal', a url to the principal who owns the node |
|
61 | - * * 'protected' (optional), indicating that this ACE is not allowed to |
|
62 | - * be updated. |
|
63 | - * |
|
64 | - * @return array |
|
65 | - */ |
|
66 | - public function getACL() { |
|
67 | - // getACL is called so frequently that we cache the config result |
|
68 | - if ($this->disableFreeBusy === null) { |
|
69 | - $this->disableFreeBusy = ($this->config->getAppValue('dav', 'disableFreeBusy', 'no') === 'yes'); |
|
70 | - } |
|
54 | + /** |
|
55 | + * Returns a list of ACE's for this node. |
|
56 | + * |
|
57 | + * Each ACE has the following properties: |
|
58 | + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
59 | + * currently the only supported privileges |
|
60 | + * * 'principal', a url to the principal who owns the node |
|
61 | + * * 'protected' (optional), indicating that this ACE is not allowed to |
|
62 | + * be updated. |
|
63 | + * |
|
64 | + * @return array |
|
65 | + */ |
|
66 | + public function getACL() { |
|
67 | + // getACL is called so frequently that we cache the config result |
|
68 | + if ($this->disableFreeBusy === null) { |
|
69 | + $this->disableFreeBusy = ($this->config->getAppValue('dav', 'disableFreeBusy', 'no') === 'yes'); |
|
70 | + } |
|
71 | 71 | |
72 | - $commonAcl = [ |
|
73 | - [ |
|
74 | - 'privilege' => '{DAV:}read', |
|
75 | - 'principal' => $this->getOwner(), |
|
76 | - 'protected' => true, |
|
77 | - ], |
|
78 | - [ |
|
79 | - 'privilege' => '{DAV:}read', |
|
80 | - 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
81 | - 'protected' => true, |
|
82 | - ], |
|
83 | - [ |
|
84 | - 'privilege' => '{DAV:}read', |
|
85 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
86 | - 'protected' => true, |
|
87 | - ], |
|
88 | - ]; |
|
72 | + $commonAcl = [ |
|
73 | + [ |
|
74 | + 'privilege' => '{DAV:}read', |
|
75 | + 'principal' => $this->getOwner(), |
|
76 | + 'protected' => true, |
|
77 | + ], |
|
78 | + [ |
|
79 | + 'privilege' => '{DAV:}read', |
|
80 | + 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
81 | + 'protected' => true, |
|
82 | + ], |
|
83 | + [ |
|
84 | + 'privilege' => '{DAV:}read', |
|
85 | + 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
86 | + 'protected' => true, |
|
87 | + ], |
|
88 | + ]; |
|
89 | 89 | |
90 | - // schedule-send is an aggregate privilege for: |
|
91 | - // - schedule-send-invite |
|
92 | - // - schedule-send-reply |
|
93 | - // - schedule-send-freebusy |
|
94 | - // |
|
95 | - // If FreeBusy is disabled, we have to remove the latter privilege |
|
90 | + // schedule-send is an aggregate privilege for: |
|
91 | + // - schedule-send-invite |
|
92 | + // - schedule-send-reply |
|
93 | + // - schedule-send-freebusy |
|
94 | + // |
|
95 | + // If FreeBusy is disabled, we have to remove the latter privilege |
|
96 | 96 | |
97 | - if ($this->disableFreeBusy) { |
|
98 | - return array_merge($commonAcl, [ |
|
99 | - [ |
|
100 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
101 | - 'principal' => $this->getOwner(), |
|
102 | - 'protected' => true, |
|
103 | - ], |
|
104 | - [ |
|
105 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
106 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
107 | - 'protected' => true, |
|
108 | - ], |
|
109 | - [ |
|
110 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
111 | - 'principal' => $this->getOwner(), |
|
112 | - 'protected' => true, |
|
113 | - ], |
|
114 | - [ |
|
115 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
116 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
117 | - 'protected' => true, |
|
118 | - ], |
|
119 | - ]); |
|
120 | - } |
|
97 | + if ($this->disableFreeBusy) { |
|
98 | + return array_merge($commonAcl, [ |
|
99 | + [ |
|
100 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
101 | + 'principal' => $this->getOwner(), |
|
102 | + 'protected' => true, |
|
103 | + ], |
|
104 | + [ |
|
105 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
106 | + 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
107 | + 'protected' => true, |
|
108 | + ], |
|
109 | + [ |
|
110 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
111 | + 'principal' => $this->getOwner(), |
|
112 | + 'protected' => true, |
|
113 | + ], |
|
114 | + [ |
|
115 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
116 | + 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
117 | + 'protected' => true, |
|
118 | + ], |
|
119 | + ]); |
|
120 | + } |
|
121 | 121 | |
122 | - return array_merge($commonAcl, [ |
|
123 | - [ |
|
124 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
125 | - 'principal' => $this->getOwner(), |
|
126 | - 'protected' => true, |
|
127 | - ], |
|
128 | - [ |
|
129 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
130 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
131 | - 'protected' => true, |
|
132 | - ], |
|
133 | - ]); |
|
134 | - } |
|
122 | + return array_merge($commonAcl, [ |
|
123 | + [ |
|
124 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
125 | + 'principal' => $this->getOwner(), |
|
126 | + 'protected' => true, |
|
127 | + ], |
|
128 | + [ |
|
129 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
130 | + 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
131 | + 'protected' => true, |
|
132 | + ], |
|
133 | + ]); |
|
134 | + } |
|
135 | 135 | } |
@@ -73,17 +73,17 @@ |
||
73 | 73 | |
74 | 74 | try { |
75 | 75 | $jobStartTime = $this->time->getTime(); |
76 | - $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
76 | + $logger->debug('Run '.get_class($this).' job with ID '.$this->getId(), ['app' => 'cron']); |
|
77 | 77 | $this->run($this->argument); |
78 | 78 | $timeTaken = $this->time->getTime() - $jobStartTime; |
79 | 79 | |
80 | - $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
80 | + $logger->debug('Finished '.get_class($this).' job with ID '.$this->getId().' in '.$timeTaken.' seconds', ['app' => 'cron']); |
|
81 | 81 | $jobList->setExecutionTime($this, $timeTaken); |
82 | 82 | } catch (\Exception $e) { |
83 | 83 | if ($logger) { |
84 | 84 | $logger->logException($e, [ |
85 | 85 | 'app' => 'core', |
86 | - 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
86 | + 'message' => 'Error while running background job (class: '.get_class($this).', arguments: '.print_r($this->argument, true).')' |
|
87 | 87 | ]); |
88 | 88 | } |
89 | 89 | } |
@@ -39,107 +39,107 @@ |
||
39 | 39 | */ |
40 | 40 | abstract class Job implements IJob { |
41 | 41 | |
42 | - /** @var int $id */ |
|
43 | - protected $id; |
|
44 | - |
|
45 | - /** @var int $lastRun */ |
|
46 | - protected $lastRun; |
|
47 | - |
|
48 | - /** @var mixed $argument */ |
|
49 | - protected $argument; |
|
50 | - |
|
51 | - /** @var ITimeFactory */ |
|
52 | - protected $time; |
|
53 | - |
|
54 | - /** |
|
55 | - * @since 15.0.0 |
|
56 | - */ |
|
57 | - public function __construct(ITimeFactory $time) { |
|
58 | - $this->time = $time; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * The function to prepare the execution of the job. |
|
63 | - * |
|
64 | - * |
|
65 | - * @param IJobList $jobList |
|
66 | - * @param ILogger|null $logger |
|
67 | - * |
|
68 | - * @since 15.0.0 |
|
69 | - */ |
|
70 | - public function execute($jobList, ILogger $logger = null) { |
|
71 | - $jobList->setLastRun($this); |
|
72 | - if ($logger === null) { |
|
73 | - $logger = \OC::$server->getLogger(); |
|
74 | - } |
|
75 | - |
|
76 | - try { |
|
77 | - $jobStartTime = $this->time->getTime(); |
|
78 | - $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
79 | - $this->run($this->argument); |
|
80 | - $timeTaken = $this->time->getTime() - $jobStartTime; |
|
81 | - |
|
82 | - $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
83 | - $jobList->setExecutionTime($this, $timeTaken); |
|
84 | - } catch (\Exception $e) { |
|
85 | - if ($logger) { |
|
86 | - $logger->logException($e, [ |
|
87 | - 'app' => 'core', |
|
88 | - 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
89 | - ]); |
|
90 | - } |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @since 15.0.0 |
|
96 | - */ |
|
97 | - final public function setId($id) { |
|
98 | - $this->id = $id; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @since 15.0.0 |
|
103 | - */ |
|
104 | - final public function setLastRun($lastRun) { |
|
105 | - $this->lastRun = $lastRun; |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * @since 15.0.0 |
|
110 | - */ |
|
111 | - public function setArgument($argument) { |
|
112 | - $this->argument = $argument; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * @since 15.0.0 |
|
117 | - */ |
|
118 | - final public function getId(): int { |
|
119 | - return $this->id; |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * @since 15.0.0 |
|
124 | - */ |
|
125 | - final public function getLastRun(): int { |
|
126 | - return $this->lastRun; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @since 15.0.0 |
|
131 | - */ |
|
132 | - public function getArgument() { |
|
133 | - return $this->argument; |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * The actual function that is called to run the job |
|
138 | - * |
|
139 | - * @param $argument |
|
140 | - * @return mixed |
|
141 | - * |
|
142 | - * @since 15.0.0 |
|
143 | - */ |
|
144 | - abstract protected function run($argument); |
|
42 | + /** @var int $id */ |
|
43 | + protected $id; |
|
44 | + |
|
45 | + /** @var int $lastRun */ |
|
46 | + protected $lastRun; |
|
47 | + |
|
48 | + /** @var mixed $argument */ |
|
49 | + protected $argument; |
|
50 | + |
|
51 | + /** @var ITimeFactory */ |
|
52 | + protected $time; |
|
53 | + |
|
54 | + /** |
|
55 | + * @since 15.0.0 |
|
56 | + */ |
|
57 | + public function __construct(ITimeFactory $time) { |
|
58 | + $this->time = $time; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * The function to prepare the execution of the job. |
|
63 | + * |
|
64 | + * |
|
65 | + * @param IJobList $jobList |
|
66 | + * @param ILogger|null $logger |
|
67 | + * |
|
68 | + * @since 15.0.0 |
|
69 | + */ |
|
70 | + public function execute($jobList, ILogger $logger = null) { |
|
71 | + $jobList->setLastRun($this); |
|
72 | + if ($logger === null) { |
|
73 | + $logger = \OC::$server->getLogger(); |
|
74 | + } |
|
75 | + |
|
76 | + try { |
|
77 | + $jobStartTime = $this->time->getTime(); |
|
78 | + $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
79 | + $this->run($this->argument); |
|
80 | + $timeTaken = $this->time->getTime() - $jobStartTime; |
|
81 | + |
|
82 | + $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
83 | + $jobList->setExecutionTime($this, $timeTaken); |
|
84 | + } catch (\Exception $e) { |
|
85 | + if ($logger) { |
|
86 | + $logger->logException($e, [ |
|
87 | + 'app' => 'core', |
|
88 | + 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
89 | + ]); |
|
90 | + } |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @since 15.0.0 |
|
96 | + */ |
|
97 | + final public function setId($id) { |
|
98 | + $this->id = $id; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @since 15.0.0 |
|
103 | + */ |
|
104 | + final public function setLastRun($lastRun) { |
|
105 | + $this->lastRun = $lastRun; |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * @since 15.0.0 |
|
110 | + */ |
|
111 | + public function setArgument($argument) { |
|
112 | + $this->argument = $argument; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * @since 15.0.0 |
|
117 | + */ |
|
118 | + final public function getId(): int { |
|
119 | + return $this->id; |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * @since 15.0.0 |
|
124 | + */ |
|
125 | + final public function getLastRun(): int { |
|
126 | + return $this->lastRun; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @since 15.0.0 |
|
131 | + */ |
|
132 | + public function getArgument() { |
|
133 | + return $this->argument; |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * The actual function that is called to run the job |
|
138 | + * |
|
139 | + * @param $argument |
|
140 | + * @return mixed |
|
141 | + * |
|
142 | + * @since 15.0.0 |
|
143 | + */ |
|
144 | + abstract protected function run($argument); |
|
145 | 145 | } |