workflow_script
workflow_script copied to clipboard
Add user-specific / folder specific filter criteria
Use case for this enhancement request
-
Nextcloud server is configured to allow multiple users to upload photographs to shared folders owned by devices (a digital picture frames connected by davfs)
-
Users will be uploading from smartphones with variable image sizes between 4-8 MB. To address download sizes, a jpegoptim script is being run to reduce the image quality. This script is as follows:
#/bin/bash
/usr/bin/jpegoptim -m90 /mnt/nextclouddata/"$1"
/usr/bin/php /var/www/nextcloud/occ files:scan --path="$1"
The script is being called by the following command inside of the flow:
/home/myuser/jpegoptim.sh %n
Expected behaviour
The jpegoptim script should be triggered only when jpeg files are being uploaded to a specific account / directory within Nextcloud. Here is an example regex expression that reflects the desired level of granularity:
/^\/mnt\/nextclouddata\/userA\/files\/"Picture Frame"\/.+(\.jpg|\.jpeg)$/
Actual behaviour
The "File name" criteria is limited to the file name itself, and is thus global within the Nextgen server. For this use case, that means that any jpeg / jpg files uploaded to the server will be compressed, regardless of location or need.
Server configuration detail
Operating system: Linux 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64
Webserver: Apache/2.4.51 (Ubuntu) (apache2handler)
Database: mysql 10.3.31
PHP version:
7.4.3 Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, sodium, apache2handler, mysqlnd, PDO, xml, bcmath, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, imagick, intl, json, ldap, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
Nextcloud version: 22.2.3 - 22.2.3.0
Updated from an older Nextcloud/ownCloud or fresh install: Fresh Install
Where did you install Nextcloud from: https://download.nextcloud.com/server/releases/nextcloud-22.2.3.tar.bz2
Signing status
Array ( )
List of activated apps
Enabled:
- accessibility: 1.8.0
- activity: 2.15.0
- circles: 22.1.1
- cloud_federation_api: 1.5.0
- comments: 1.12.0
- contactsinteraction: 1.3.0
- dashboard: 7.2.0
- dav: 1.19.0
- federatedfilesharing: 1.12.0
- federation: 1.12.0
- files: 1.17.0
- files_automatedtagging: 1.12.0
- files_pdfviewer: 2.3.1
- files_rightclick: 1.1.0
- files_sharing: 1.14.0
- files_trashbin: 1.12.0
- files_versions: 1.15.0
- files_videoplayer: 1.11.0
- firstrunwizard: 2.11.0
- issuetemplate: 0.7.0
- logreader: 2.7.0
- lookup_server_connector: 1.10.0
- nextcloud_announcements: 1.11.0
- notifications: 2.10.1
- oauth2: 1.10.0
- password_policy: 1.12.0
- photos: 1.4.0
- privacy: 1.6.0
- provisioning_api: 1.12.0
- recommendations: 1.1.0
- serverinfo: 1.12.0
- settings: 1.4.0
- sharebymail: 1.12.0
- support: 1.5.0
- survey_client: 1.10.0
- systemtags: 1.12.0
- text: 3.3.0
- theming: 1.13.0
- twofactor_backupcodes: 1.11.0
- twofactor_email: 2.1.1
- twofactor_totp: 6.1.0
- twofactor_webauthn: 0.2.12
- updatenotification: 1.12.0
- user_ldap: 1.12.1
- user_status: 1.2.0
- viewer: 1.6.0
- weather_status: 1.2.0
- workflow_script: 1.7.0
- workflowengine: 2.4.0
Disabled:
- admin_audit
- encryption
- files_external
Configuration (config/config.php)
{
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"***REMOVED SENSITIVE VALUE***"
"***REMOVED SENSITIVE VALUE***"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"loglevel": 2,
"dbtype": "mysql",
"version": "22.2.3.0",
"overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
"htaccess.RewriteBase": "\/",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"default_phone_region": "US",
"installed": true,
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_smtpmode": "smtp",
"mail_sendmailmode": "smtp",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpsecure": "ssl",
"mail_smtpauthtype": "LOGIN",
"mail_smtpauth": 1,
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "465 ",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
"twofactor_enforced": "true",
"twofactor_enforced_groups": [
"admin"
],
"twofactor_enforced_excluded_groups": [
"Photo Frame",
"Nextcloud Users"
],
"maintenance": false,
"app_install_overwrite": [
"issuetemplate"
]
}
Are you using external storage, if yes which one: None
Are you using encryption:
Are you using an external user-backend, if yes which one: Active Directory
Please add, this is really needed! It should be possible to limit scripts to only work on specific folders.
best way is to use tagging to include or exclude them