1 | <?php |
||
37 | class Operation implements IOperation, IComplexOperation, ISpecificOperation { |
||
38 | /** @var IManager */ |
||
39 | protected $manager; |
||
40 | |||
41 | /** @var IL10N */ |
||
42 | protected $l; |
||
43 | |||
44 | /** @var IURLGenerator */ |
||
45 | protected $urlGenerator; |
||
46 | |||
47 | /** @var int */ |
||
48 | protected $nestingLevel = 0; |
||
49 | |||
50 | /** |
||
51 | * @param IManager $manager |
||
52 | * @param IL10N $l |
||
53 | */ |
||
54 | public function __construct(IManager $manager, IL10N $l, IURLGenerator $urlGenerator) { |
||
59 | |||
60 | /** |
||
61 | * @param IStorage $storage |
||
62 | * @param string $path |
||
63 | * @throws ForbiddenException |
||
64 | */ |
||
65 | public function checkFileAccess(IStorage $storage, $path) { |
||
87 | |||
88 | /** |
||
89 | * @param IStorage $storage |
||
90 | * @param string $path |
||
91 | * @return bool |
||
92 | */ |
||
93 | protected function isBlockablePath(IStorage $storage, $path) { |
||
125 | |||
126 | /** |
||
127 | * For thumbnails and versions we want to check the tags of the original file |
||
128 | * |
||
129 | * @param IStorage $storage |
||
130 | * @param string $path |
||
131 | * @return bool |
||
132 | */ |
||
133 | protected function translatePath(IStorage $storage, $path) { |
||
155 | |||
156 | /** |
||
157 | * Check if we are in the LoginController and if so, ignore the firewall |
||
158 | * @return bool |
||
159 | */ |
||
160 | protected function isCreatingSkeletonFiles() { |
||
173 | |||
174 | /** |
||
175 | * @param string $name |
||
176 | * @param array[] $checks |
||
177 | * @param string $operation |
||
178 | * @throws \UnexpectedValueException |
||
179 | */ |
||
180 | public function validateOperation(string $name, array $checks, string $operation): void { |
||
185 | |||
186 | /** |
||
187 | * returns a translated name to be presented in the web interface |
||
188 | * |
||
189 | * Example: "Automated tagging" (en), "Aŭtomata etikedado" (eo) |
||
190 | * |
||
191 | * @since 18.0.0 |
||
192 | */ |
||
193 | public function getDisplayName(): string { |
||
196 | |||
197 | /** |
||
198 | * returns a translated, descriptive text to be presented in the web interface. |
||
199 | * |
||
200 | * It should be short and precise. |
||
201 | * |
||
202 | * Example: "Tag based automatic deletion of files after a given time." (en) |
||
203 | * |
||
204 | * @since 18.0.0 |
||
205 | */ |
||
206 | public function getDescription(): string { |
||
209 | |||
210 | /** |
||
211 | * returns the URL to the icon of the operator for display in the web interface. |
||
212 | * |
||
213 | * Usually, the implementation would utilize the `imagePath()` method of the |
||
214 | * `\OCP\IURLGenerator` instance and simply return its result. |
||
215 | * |
||
216 | * Example implementation: return $this->urlGenerator->imagePath('myApp', 'cat.svg'); |
||
217 | * |
||
218 | * @since 18.0.0 |
||
219 | */ |
||
220 | public function getIcon(): string { |
||
223 | |||
224 | /** |
||
225 | * returns whether the operation can be used in the requested scope. |
||
226 | * |
||
227 | * Scope IDs are defined as constants in OCP\WorkflowEngine\IManager. At |
||
228 | * time of writing these are SCOPE_ADMIN and SCOPE_USER. |
||
229 | * |
||
230 | * For possibly unknown future scopes the recommended behaviour is: if |
||
231 | * user scope is permitted, the default behaviour should return `true`, |
||
232 | * otherwise `false`. |
||
233 | * |
||
234 | * @since 18.0.0 |
||
235 | */ |
||
236 | public function isAvailableForScope(int $scope): bool { |
||
239 | |||
240 | /** |
||
241 | * returns the id of the entity the operator is designed for |
||
242 | * |
||
243 | * Example: 'WorkflowEngine_Entity_File' |
||
244 | * |
||
245 | * @since 18.0.0 |
||
246 | */ |
||
247 | public function getEntityId(): string { |
||
250 | |||
251 | /** |
||
252 | * As IComplexOperation chooses the triggering events itself, a hint has |
||
253 | * to be shown to the user so make clear when this operation is becoming |
||
254 | * active. This method returns such a translated string. |
||
255 | * |
||
256 | * Example: "When a file is accessed" (en) |
||
257 | * |
||
258 | * @since 18.0.0 |
||
259 | */ |
||
260 | public function getTriggerHint(): string { |
||
263 | |||
264 | public function onEvent(string $eventName, GenericEvent $event, IRuleMatcher $ruleMatcher): void { |
||
267 | } |
||
268 |