aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine
diff options
context:
space:
mode:
Diffstat (limited to 'apps/workflowengine')
-rw-r--r--apps/workflowengine/composer/composer/autoload_classmap.php1
-rw-r--r--apps/workflowengine/composer/composer/autoload_static.php1
-rw-r--r--apps/workflowengine/l10n/mk.js10
-rw-r--r--apps/workflowengine/l10n/mk.json10
-rw-r--r--apps/workflowengine/l10n/sw.js123
-rw-r--r--apps/workflowengine/l10n/sw.json121
-rw-r--r--apps/workflowengine/lib/Check/Directory.php58
-rw-r--r--apps/workflowengine/lib/Manager.php2
-rw-r--r--apps/workflowengine/src/components/Checks/file.js13
-rw-r--r--apps/workflowengine/tests/Check/DirectoryTest.php68
10 files changed, 407 insertions, 0 deletions
diff --git a/apps/workflowengine/composer/composer/autoload_classmap.php b/apps/workflowengine/composer/composer/autoload_classmap.php
index 0444cce13e7..52d221fb767 100644
--- a/apps/workflowengine/composer/composer/autoload_classmap.php
+++ b/apps/workflowengine/composer/composer/autoload_classmap.php
@@ -10,6 +10,7 @@ return array(
'OCA\\WorkflowEngine\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
'OCA\\WorkflowEngine\\BackgroundJobs\\Rotate' => $baseDir . '/../lib/BackgroundJobs/Rotate.php',
'OCA\\WorkflowEngine\\Check\\AbstractStringCheck' => $baseDir . '/../lib/Check/AbstractStringCheck.php',
+ 'OCA\\WorkflowEngine\\Check\\Directory' => $baseDir . '/../lib/Check/Directory.php',
'OCA\\WorkflowEngine\\Check\\FileMimeType' => $baseDir . '/../lib/Check/FileMimeType.php',
'OCA\\WorkflowEngine\\Check\\FileName' => $baseDir . '/../lib/Check/FileName.php',
'OCA\\WorkflowEngine\\Check\\FileSize' => $baseDir . '/../lib/Check/FileSize.php',
diff --git a/apps/workflowengine/composer/composer/autoload_static.php b/apps/workflowengine/composer/composer/autoload_static.php
index 0b9ac89ae30..57b569dbc10 100644
--- a/apps/workflowengine/composer/composer/autoload_static.php
+++ b/apps/workflowengine/composer/composer/autoload_static.php
@@ -25,6 +25,7 @@ class ComposerStaticInitWorkflowEngine
'OCA\\WorkflowEngine\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
'OCA\\WorkflowEngine\\BackgroundJobs\\Rotate' => __DIR__ . '/..' . '/../lib/BackgroundJobs/Rotate.php',
'OCA\\WorkflowEngine\\Check\\AbstractStringCheck' => __DIR__ . '/..' . '/../lib/Check/AbstractStringCheck.php',
+ 'OCA\\WorkflowEngine\\Check\\Directory' => __DIR__ . '/..' . '/../lib/Check/Directory.php',
'OCA\\WorkflowEngine\\Check\\FileMimeType' => __DIR__ . '/..' . '/../lib/Check/FileMimeType.php',
'OCA\\WorkflowEngine\\Check\\FileName' => __DIR__ . '/..' . '/../lib/Check/FileName.php',
'OCA\\WorkflowEngine\\Check\\FileSize' => __DIR__ . '/..' . '/../lib/Check/FileSize.php',
diff --git a/apps/workflowengine/l10n/mk.js b/apps/workflowengine/l10n/mk.js
index 357509f3896..a7f641f0aff 100644
--- a/apps/workflowengine/l10n/mk.js
+++ b/apps/workflowengine/l10n/mk.js
@@ -47,13 +47,19 @@ OC.L10N.register(
"Select a file type" : "Изберете вид на датотека",
"e.g. httpd/unix-directory" : "Пр. httpd/unix-directory",
"Please enter a valid time span" : "Внесете валиден времески осег",
+ "Android client" : "Android клиент",
+ "iOS client" : "iOS клиент",
"Desktop client" : "Клиент за компјутер",
"Select groups" : "Одбери групи",
"Groups" : "Групи",
+ "Select a trigger" : "Избери активатор",
+ "At least one event must be selected" : "Најмалку едно мора да биде означено",
+ "Add new flow" : "Додади нов проток",
"Active" : "Активно",
"Save" : "Зачувај",
"When" : "Кога",
"and" : "и",
+ "Add a new filter" : "Додади нов филтер",
"Cancel" : "Откажи",
"Delete" : "Избриши",
"Available flows" : "Достапни протоци",
@@ -75,6 +81,7 @@ OC.L10N.register(
"less or equals" : "помалку или еднакво",
"greater or equals" : "поголемо или еднакво",
"greater" : "поголемо",
+ "Request remote address" : "Барање од надворешна адреса",
"matches IPv4" : "се совпаѓањаат IPv4",
"does not match IPv4" : "не се совпаѓаат IPv4",
"matches IPv6" : "се совпаѓањаат IPv6",
@@ -82,8 +89,11 @@ OC.L10N.register(
"File system tag" : "Датотека со системска ознака",
"is tagged with" : "е означена со",
"is not tagged with" : "не е означена со",
+ "Request URL" : "Барање URL",
+ "Request time" : "Време на барање",
"between" : "помеѓу",
"not between" : "не помеѓу",
+ "Request user agent" : "Барање од кориснички агент",
"is member of" : "е член на",
"is not member of" : "не е член на"
},
diff --git a/apps/workflowengine/l10n/mk.json b/apps/workflowengine/l10n/mk.json
index a50e5edf93c..f2ef7213da4 100644
--- a/apps/workflowengine/l10n/mk.json
+++ b/apps/workflowengine/l10n/mk.json
@@ -45,13 +45,19 @@
"Select a file type" : "Изберете вид на датотека",
"e.g. httpd/unix-directory" : "Пр. httpd/unix-directory",
"Please enter a valid time span" : "Внесете валиден времески осег",
+ "Android client" : "Android клиент",
+ "iOS client" : "iOS клиент",
"Desktop client" : "Клиент за компјутер",
"Select groups" : "Одбери групи",
"Groups" : "Групи",
+ "Select a trigger" : "Избери активатор",
+ "At least one event must be selected" : "Најмалку едно мора да биде означено",
+ "Add new flow" : "Додади нов проток",
"Active" : "Активно",
"Save" : "Зачувај",
"When" : "Кога",
"and" : "и",
+ "Add a new filter" : "Додади нов филтер",
"Cancel" : "Откажи",
"Delete" : "Избриши",
"Available flows" : "Достапни протоци",
@@ -73,6 +79,7 @@
"less or equals" : "помалку или еднакво",
"greater or equals" : "поголемо или еднакво",
"greater" : "поголемо",
+ "Request remote address" : "Барање од надворешна адреса",
"matches IPv4" : "се совпаѓањаат IPv4",
"does not match IPv4" : "не се совпаѓаат IPv4",
"matches IPv6" : "се совпаѓањаат IPv6",
@@ -80,8 +87,11 @@
"File system tag" : "Датотека со системска ознака",
"is tagged with" : "е означена со",
"is not tagged with" : "не е означена со",
+ "Request URL" : "Барање URL",
+ "Request time" : "Време на барање",
"between" : "помеѓу",
"not between" : "не помеѓу",
+ "Request user agent" : "Барање од кориснички агент",
"is member of" : "е член на",
"is not member of" : "не е член на"
},"pluralForm" :"nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;"
diff --git a/apps/workflowengine/l10n/sw.js b/apps/workflowengine/l10n/sw.js
new file mode 100644
index 00000000000..302055b39f2
--- /dev/null
+++ b/apps/workflowengine/l10n/sw.js
@@ -0,0 +1,123 @@
+OC.L10N.register(
+ "workflowengine",
+ {
+ "The given operator is invalid" : "Opereta uliyopewa si sahihi",
+ "The given regular expression is invalid" : "Msemo wa kawaida uliotolewa si sahihi",
+ "The given file size is invalid" : "Ukubwa wa faili uliotolewa si sahihi",
+ "The given tag id is invalid" : "Kitambulisho cha lebo kilichotolewa si sahihi",
+ "The given IP range is invalid" : "Anuwai ya IP iliyotolewa si sahihi",
+ "The given IP range is not valid for IPv4" : "Anuwai ya IP iliyotolewa si halali kwa IPv4",
+ "The given IP range is not valid for IPv6" : "Anuwai ya IP iliyotolewa si halali kwa IPv6",
+ "The given time span is invalid" : "Muda uliyopewa si sahihi",
+ "The given start time is invalid" : "Muda wa kuanza uliyopewa si sahihi",
+ "The given end time is invalid" : "Muda wa kumaliza uliyopewa ni batili",
+ "The given group does not exist" : "Kundi lililotolewa halipo",
+ "File" : "Faili",
+ "File created" : "Faili imeundwa",
+ "File updated" : "Faili imesasishwa",
+ "File renamed" : "Faili imepewa jina upya",
+ "File deleted" : "Faili imefutwa",
+ "File accessed" : "Faili imefikiwa",
+ "File copied" : "Faili imenakiliwa",
+ "Tag assigned" : "Lebo imetolewa",
+ "Someone" : "Mtu fulani",
+ "%s created %s" : "%s imeundwa %s",
+ "%s modified %s" : "%s imeboreshwa %s",
+ "%s deleted %s" : "%s imefutwa %s",
+ "%s accessed %s" : "%s imefikiwa %s",
+ "%s renamed %s" : "%s imepewa jina jipya %s",
+ "%s copied %s" : "%s imenakiliwa %s",
+ "%s assigned %s to %s" : "%simekabidhiwa %s kwa %s",
+ "Operation #%s does not exist" : "Operesheni #%s haipo",
+ "Entity %s does not exist" : "Huluki %s haipo",
+ "Entity %s is invalid" : "Huluki %s si sahihi",
+ "No events are chosen." : "Hakuna matukio yaliyochaguliwa.",
+ "Entity %s has no event %s" : "Huluki %s haina tukio %s",
+ "Operation %s does not exist" : "Operesheni %s haipo",
+ "Operation %s is invalid" : "Operesheni %s si sahihi",
+ "At least one check needs to be provided" : "Angalau hundi moja inahitaji kutolewa",
+ "The provided operation data is too long" : "Taarifa za operesheni zilizotolewa ni ndefu sana",
+ "Invalid check provided" : "Hundi batili imetolewa",
+ "Check %s does not exist" : "Angalia %s haipo",
+ "Check %s is invalid" : "Angalia %s si sahihi",
+ "Check %s is not allowed with this entity" : "Kukagua %s hairuhusiwi na huluki hii",
+ "The provided check value is too long" : "Thamani ya hundi iliyotolewa ni ndefu sana",
+ "Check #%s does not exist" : "Ukaguzi #%s haupo",
+ "Check %s is invalid or does not exist" : "Angalia %s si sahihi au haipo",
+ "Flow" : "Mtiririko",
+ "Nextcloud workflow engine" : "Injini ya mtiririko wa kazi ya Nextcloud",
+ "Select a filter" : "Chagua kichujio",
+ "Select a comparator" : "Chagua kipimajoto",
+ "Remove filter" : "Ondoa kichujio",
+ "Folder" : "Kisanduku",
+ "Images" : "Picha",
+ "Office documents" : "Nyaraka za ofisi",
+ "PDF documents" : "Nyaraka za PDF",
+ "Custom MIME type" : "Aina ya MIME ya kawaida",
+ "Custom mimetype" : "Aina maalum ya mime",
+ "Select a file type" : "Chagua aina ya faili",
+ "e.g. httpd/unix-directory" : "e.g. httpd/unix-directory",
+ "Please enter a valid time span" : "Tafadhali ingiza muda halali",
+ "Files WebDAV" : "Faili za WebDAV",
+ "Custom URL" : "URL maalum",
+ "Select a request URL" : "Chagua URL ya ombi",
+ "Android client" : "Mteja wa Android",
+ "iOS client" : "Mteja wa iOS",
+ "Desktop client" : "Mteja wa eneo-kazi",
+ "Thunderbird & Outlook addons" : "Viongezeo vya Thunderbird na Outlook",
+ "Custom user agent" : "Wakala maalum wa mtumiaji ",
+ "Select a user agent" : "Chagua wakala wa mtumiaji",
+ "Select groups" : "Chagua makundi",
+ "Groups" : "Makundi",
+ "Type to search for group …" : "Andika kutafuta kikundi …",
+ "Select a trigger" : "Chagua kichocheo",
+ "At least one event must be selected" : "Angalau tukio moja lazima lichaguliwe",
+ "Add new flow" : "Ongeza mtiririko mpya",
+ "The configuration is invalid" : "Usanidi si sahihi",
+ "Active" : "Hai",
+ "Save" : "Hifadhi",
+ "When" : "Lini",
+ "and" : "na",
+ "Add a new filter" : "Ongeza kichujio kipya",
+ "Cancel" : "Sitisha",
+ "Delete" : "Futa",
+ "Available flows" : "Mitiririko inayopatikana",
+ "For details on how to write your own flow, check out the development documentation." : "Kwa maelezo kuhusu jinsi ya kuandika mtiririko wako mwenyewe, angalia nyaraka za maendeleo.",
+ "No flows installed" : "Hakuna mtiririko uliowekwa",
+ "Ask your administrator to install new flows." : "Muulize msimamizi wako aweke mitiririko mipya.",
+ "More flows" : "Mtiririko zaidi",
+ "Browse the App Store" : "Vinjari hifadhi ya Programu",
+ "Show less" : "Onesha kidogo",
+ "Show more" : "Onesha zaidi",
+ "Configured flows" : "Mitiririko iliyosanidiwa",
+ "Your flows" : "Mitiririko yako",
+ "No flows configured" : "Hakuna mitiririko iliyosanidiwa",
+ "matches" : "inafanana",
+ "does not match" : "haifanani",
+ "is" : "ni",
+ "is not" : "si",
+ "File name" : "Jina la faili",
+ "File MIME type" : "Aina ya MIME ya faili",
+ "File size (upload)" : "Ukubwa wa faili (kupakia)",
+ "less" : "chini",
+ "less or equals" : "chini au sawa na",
+ "greater or equals" : "kubwa au sawa na",
+ "greater" : "kubwa",
+ "Request remote address" : "Omba anwani ya mbali",
+ "matches IPv4" : "Inafanana na IPv4",
+ "does not match IPv4" : "haifanani na IPv4",
+ "matches IPv6" : "inafanana na IPv6",
+ "does not match IPv6" : "haifanani na IPv6",
+ "File system tag" : "Lebo ya mfumo wa faili",
+ "is tagged with" : "Imewekewa alama na",
+ "is not tagged with" : "haijawekewa alama na",
+ "Request URL" : "Omba URL",
+ "Request time" : "Muda wa ombi",
+ "between" : "kati ya",
+ "not between" : "si kati ya",
+ "Request user agent" : "Omba wakala wa mtumiaji",
+ "Group membership" : "Uanachama wa kikundi",
+ "is member of" : "ni mwanachama wa",
+ "is not member of" : "si mwanachama wa"
+},
+"nplurals=2; plural=(n != 1);");
diff --git a/apps/workflowengine/l10n/sw.json b/apps/workflowengine/l10n/sw.json
new file mode 100644
index 00000000000..a0d1179f2d9
--- /dev/null
+++ b/apps/workflowengine/l10n/sw.json
@@ -0,0 +1,121 @@
+{ "translations": {
+ "The given operator is invalid" : "Opereta uliyopewa si sahihi",
+ "The given regular expression is invalid" : "Msemo wa kawaida uliotolewa si sahihi",
+ "The given file size is invalid" : "Ukubwa wa faili uliotolewa si sahihi",
+ "The given tag id is invalid" : "Kitambulisho cha lebo kilichotolewa si sahihi",
+ "The given IP range is invalid" : "Anuwai ya IP iliyotolewa si sahihi",
+ "The given IP range is not valid for IPv4" : "Anuwai ya IP iliyotolewa si halali kwa IPv4",
+ "The given IP range is not valid for IPv6" : "Anuwai ya IP iliyotolewa si halali kwa IPv6",
+ "The given time span is invalid" : "Muda uliyopewa si sahihi",
+ "The given start time is invalid" : "Muda wa kuanza uliyopewa si sahihi",
+ "The given end time is invalid" : "Muda wa kumaliza uliyopewa ni batili",
+ "The given group does not exist" : "Kundi lililotolewa halipo",
+ "File" : "Faili",
+ "File created" : "Faili imeundwa",
+ "File updated" : "Faili imesasishwa",
+ "File renamed" : "Faili imepewa jina upya",
+ "File deleted" : "Faili imefutwa",
+ "File accessed" : "Faili imefikiwa",
+ "File copied" : "Faili imenakiliwa",
+ "Tag assigned" : "Lebo imetolewa",
+ "Someone" : "Mtu fulani",
+ "%s created %s" : "%s imeundwa %s",
+ "%s modified %s" : "%s imeboreshwa %s",
+ "%s deleted %s" : "%s imefutwa %s",
+ "%s accessed %s" : "%s imefikiwa %s",
+ "%s renamed %s" : "%s imepewa jina jipya %s",
+ "%s copied %s" : "%s imenakiliwa %s",
+ "%s assigned %s to %s" : "%simekabidhiwa %s kwa %s",
+ "Operation #%s does not exist" : "Operesheni #%s haipo",
+ "Entity %s does not exist" : "Huluki %s haipo",
+ "Entity %s is invalid" : "Huluki %s si sahihi",
+ "No events are chosen." : "Hakuna matukio yaliyochaguliwa.",
+ "Entity %s has no event %s" : "Huluki %s haina tukio %s",
+ "Operation %s does not exist" : "Operesheni %s haipo",
+ "Operation %s is invalid" : "Operesheni %s si sahihi",
+ "At least one check needs to be provided" : "Angalau hundi moja inahitaji kutolewa",
+ "The provided operation data is too long" : "Taarifa za operesheni zilizotolewa ni ndefu sana",
+ "Invalid check provided" : "Hundi batili imetolewa",
+ "Check %s does not exist" : "Angalia %s haipo",
+ "Check %s is invalid" : "Angalia %s si sahihi",
+ "Check %s is not allowed with this entity" : "Kukagua %s hairuhusiwi na huluki hii",
+ "The provided check value is too long" : "Thamani ya hundi iliyotolewa ni ndefu sana",
+ "Check #%s does not exist" : "Ukaguzi #%s haupo",
+ "Check %s is invalid or does not exist" : "Angalia %s si sahihi au haipo",
+ "Flow" : "Mtiririko",
+ "Nextcloud workflow engine" : "Injini ya mtiririko wa kazi ya Nextcloud",
+ "Select a filter" : "Chagua kichujio",
+ "Select a comparator" : "Chagua kipimajoto",
+ "Remove filter" : "Ondoa kichujio",
+ "Folder" : "Kisanduku",
+ "Images" : "Picha",
+ "Office documents" : "Nyaraka za ofisi",
+ "PDF documents" : "Nyaraka za PDF",
+ "Custom MIME type" : "Aina ya MIME ya kawaida",
+ "Custom mimetype" : "Aina maalum ya mime",
+ "Select a file type" : "Chagua aina ya faili",
+ "e.g. httpd/unix-directory" : "e.g. httpd/unix-directory",
+ "Please enter a valid time span" : "Tafadhali ingiza muda halali",
+ "Files WebDAV" : "Faili za WebDAV",
+ "Custom URL" : "URL maalum",
+ "Select a request URL" : "Chagua URL ya ombi",
+ "Android client" : "Mteja wa Android",
+ "iOS client" : "Mteja wa iOS",
+ "Desktop client" : "Mteja wa eneo-kazi",
+ "Thunderbird & Outlook addons" : "Viongezeo vya Thunderbird na Outlook",
+ "Custom user agent" : "Wakala maalum wa mtumiaji ",
+ "Select a user agent" : "Chagua wakala wa mtumiaji",
+ "Select groups" : "Chagua makundi",
+ "Groups" : "Makundi",
+ "Type to search for group …" : "Andika kutafuta kikundi …",
+ "Select a trigger" : "Chagua kichocheo",
+ "At least one event must be selected" : "Angalau tukio moja lazima lichaguliwe",
+ "Add new flow" : "Ongeza mtiririko mpya",
+ "The configuration is invalid" : "Usanidi si sahihi",
+ "Active" : "Hai",
+ "Save" : "Hifadhi",
+ "When" : "Lini",
+ "and" : "na",
+ "Add a new filter" : "Ongeza kichujio kipya",
+ "Cancel" : "Sitisha",
+ "Delete" : "Futa",
+ "Available flows" : "Mitiririko inayopatikana",
+ "For details on how to write your own flow, check out the development documentation." : "Kwa maelezo kuhusu jinsi ya kuandika mtiririko wako mwenyewe, angalia nyaraka za maendeleo.",
+ "No flows installed" : "Hakuna mtiririko uliowekwa",
+ "Ask your administrator to install new flows." : "Muulize msimamizi wako aweke mitiririko mipya.",
+ "More flows" : "Mtiririko zaidi",
+ "Browse the App Store" : "Vinjari hifadhi ya Programu",
+ "Show less" : "Onesha kidogo",
+ "Show more" : "Onesha zaidi",
+ "Configured flows" : "Mitiririko iliyosanidiwa",
+ "Your flows" : "Mitiririko yako",
+ "No flows configured" : "Hakuna mitiririko iliyosanidiwa",
+ "matches" : "inafanana",
+ "does not match" : "haifanani",
+ "is" : "ni",
+ "is not" : "si",
+ "File name" : "Jina la faili",
+ "File MIME type" : "Aina ya MIME ya faili",
+ "File size (upload)" : "Ukubwa wa faili (kupakia)",
+ "less" : "chini",
+ "less or equals" : "chini au sawa na",
+ "greater or equals" : "kubwa au sawa na",
+ "greater" : "kubwa",
+ "Request remote address" : "Omba anwani ya mbali",
+ "matches IPv4" : "Inafanana na IPv4",
+ "does not match IPv4" : "haifanani na IPv4",
+ "matches IPv6" : "inafanana na IPv6",
+ "does not match IPv6" : "haifanani na IPv6",
+ "File system tag" : "Lebo ya mfumo wa faili",
+ "is tagged with" : "Imewekewa alama na",
+ "is not tagged with" : "haijawekewa alama na",
+ "Request URL" : "Omba URL",
+ "Request time" : "Muda wa ombi",
+ "between" : "kati ya",
+ "not between" : "si kati ya",
+ "Request user agent" : "Omba wakala wa mtumiaji",
+ "Group membership" : "Uanachama wa kikundi",
+ "is member of" : "ni mwanachama wa",
+ "is not member of" : "si mwanachama wa"
+},"pluralForm" :"nplurals=2; plural=(n != 1);"
+} \ No newline at end of file
diff --git a/apps/workflowengine/lib/Check/Directory.php b/apps/workflowengine/lib/Check/Directory.php
new file mode 100644
index 00000000000..f7b856a95fe
--- /dev/null
+++ b/apps/workflowengine/lib/Check/Directory.php
@@ -0,0 +1,58 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCA\WorkflowEngine\Check;
+
+use OCA\WorkflowEngine\Entity\File;
+use OCP\IL10N;
+use OCP\WorkflowEngine\IFileCheck;
+
+class Directory extends AbstractStringCheck implements IFileCheck {
+ use TFileCheck;
+
+ /**
+ * @param IL10N $l
+ */
+ public function __construct(
+ IL10N $l,
+ ) {
+ parent::__construct($l);
+ }
+
+ /**
+ * @return string
+ */
+ protected function getActualValue(): string {
+ if ($this->path === null) {
+ return '';
+ }
+ // files/some/path -> some/path
+ return preg_replace('/^files\//', '', pathinfo($this->path, PATHINFO_DIRNAME));
+ }
+
+ /**
+ * @param string $operator
+ * @param string $checkValue
+ * @param string $actualValue
+ * @return bool
+ */
+ protected function executeStringCheck($operator, $checkValue, $actualValue) {
+ if ($operator === 'is' || $operator === '!is') {
+ $checkValue = ltrim(rtrim($checkValue, '/'), '/');
+ }
+ return parent::executeStringCheck($operator, $checkValue, $actualValue);
+ }
+
+ public function supportedEntities(): array {
+ return [ File::class ];
+ }
+
+ public function isAvailableForScope(int $scope): bool {
+ return true;
+ }
+}
diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php
index 0f41679789d..27b25a2e752 100644
--- a/apps/workflowengine/lib/Manager.php
+++ b/apps/workflowengine/lib/Manager.php
@@ -8,6 +8,7 @@ namespace OCA\WorkflowEngine;
use Doctrine\DBAL\Exception;
use OCA\WorkflowEngine\AppInfo\Application;
+use OCA\WorkflowEngine\Check\Directory;
use OCA\WorkflowEngine\Check\FileMimeType;
use OCA\WorkflowEngine\Check\FileName;
use OCA\WorkflowEngine\Check\FileSize;
@@ -692,6 +693,7 @@ class Manager implements IManager {
protected function getBuildInChecks(): array {
try {
return [
+ $this->container->query(Directory::class),
$this->container->query(FileMimeType::class),
$this->container->query(FileName::class),
$this->container->query(FileSize::class),
diff --git a/apps/workflowengine/src/components/Checks/file.js b/apps/workflowengine/src/components/Checks/file.js
index 568efc81cd3..b2d348e4712 100644
--- a/apps/workflowengine/src/components/Checks/file.js
+++ b/apps/workflowengine/src/components/Checks/file.js
@@ -32,6 +32,19 @@ const FileChecks = [
},
{
+ class: 'OCA\\WorkflowEngine\\Check\\Directory',
+ name: t('workflowengine', 'Directory'),
+ operators: stringOrRegexOperators,
+ placeholder: (check) => {
+ if (check.operator === 'matches' || check.operator === '!matches') {
+ return '/^myfolder/.+$/i'
+ }
+ return 'myfolder/subfolder'
+ },
+ validate: stringValidator,
+ },
+
+ {
class: 'OCA\\WorkflowEngine\\Check\\FileMimeType',
name: t('workflowengine', 'File MIME type'),
operators: stringOrRegexOperators,
diff --git a/apps/workflowengine/tests/Check/DirectoryTest.php b/apps/workflowengine/tests/Check/DirectoryTest.php
new file mode 100644
index 00000000000..6eef082b5e5
--- /dev/null
+++ b/apps/workflowengine/tests/Check/DirectoryTest.php
@@ -0,0 +1,68 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\WorkflowEngine\Tests\Check;
+
+use OCA\WorkflowEngine\Check\Directory;
+use OCA\WorkflowEngine\Entity\File;
+use OCP\Files\Storage\IStorage;
+use OCP\IL10N;
+use Test\TestCase;
+
+class DirectoryTest extends TestCase {
+ /** @var IL10N */
+ private $l10n;
+
+ /** @var IStorage */
+ private $storage;
+
+ /** @var Directory */
+ private $directory;
+
+ protected function setUp(): void {
+ parent::setUp();
+ $this->l10n = $this->createMock(IL10N::class);
+ $this->storage = $this->createMock(IStorage::class);
+ $this->directory = new Directory($this->l10n);
+ }
+
+ /**
+ * @dataProvider dataProviderCheck
+ */
+ public function testExecuteStringCheck(string $operator, string $configuredDirectoryPath, string $filePath, bool $expectedResult): void {
+ $this->directory->setFileInfo($this->storage, $filePath);
+
+ $result = $this->directory->executeCheck($operator, $configuredDirectoryPath);
+
+ $this->assertEquals($expectedResult, $result);
+ }
+
+ public function testSupportedEntities(): void {
+ $this->assertSame([File::class], $this->directory->supportedEntities());
+ }
+
+ public function testIsAvailableForScope(): void {
+ $this->assertTrue($this->directory->isAvailableForScope(1));
+ }
+
+ public function dataProviderCheck(): array {
+ return [
+ ['is', 'some/path', 'files/some/path/file.txt', true],
+ ['is', '/some/path/', 'files/some/path/file.txt', true],
+
+ ['!is', 'some/path', 'files/some/path/file.txt', false],
+ ['!is', 'some/path/', 'files/someother/path/file.txt', true],
+
+ ['matches', '/^some\/path\/.+$/i', 'files/SomE/PATH/subfolder/file.txt', true],
+ ['matches', '/some\/path\/.*\/sub2/', 'files/some/path/subfolder1/sub2/anotherfile.pdf', true],
+
+ ['!matches', '/some\/path/', 'files/some/path/file.txt', false],
+ ['!matches', '/some\/path/', 'files/another/path/file.txt', true],
+ ];
+ }
+}