diff options
Diffstat (limited to 'apps/workflowengine/src/components/Values/file.js')
-rw-r--r-- | apps/workflowengine/src/components/Values/file.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/workflowengine/src/components/Values/file.js b/apps/workflowengine/src/components/Values/file.js new file mode 100644 index 00000000000..4a473dbc13c --- /dev/null +++ b/apps/workflowengine/src/components/Values/file.js @@ -0,0 +1,67 @@ +/* + * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net> + * + * @author Julius Härtl <jus@bitgrid.net> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import './../../legacy/filenameplugin' +import './../../legacy/filesystemtagsplugin' +import './../../legacy/requestremoteaddressplugin' +import './../../legacy/requesttimeplugin' +import './../../legacy/requesturlplugin' +import './../../legacy/requestuseragentplugin' +import './../../legacy/usergroupmembershipplugin' + +import FileMimeType from './FileMimeType'; +import SizeValue from './SizeValue'; + +const FileChecks = Object.values(OCA.WorkflowEngine.Plugins).map((plugin) => { + if (plugin.component) { + return { ...plugin.getCheck(), component: plugin.component() } + } + return plugin.getCheck() +}) + + +// new way of registering checks +FileChecks.push({ + class: 'OCA\\WorkflowEngine\\Check\\FileMimeType', + name: t('workflowengine', 'File MIME type'), + operators: [ + { operator: 'is', name: t('workflowengine', 'is') }, + { operator: '!is', name: t('workflowengine', 'is not') }, + { operator: 'matches', name: t('workflowengine', 'matches') }, + { operator: '!matches', name: t('workflowengine', 'does not match') } + ], + component: FileMimeType +}) + +FileChecks.push({ + class: 'OCA\\WorkflowEngine\\Check\\FileSize', + name: t('workflowengine', 'File size (upload)'), + operators: [ + { operator: 'less', name: t('workflowengine', 'less') }, + { operator: '!greater', name: t('workflowengine', 'less or equals') }, + { operator: '!less', name: t('workflowengine', 'greater or equals') }, + { operator: 'greater', name: t('workflowengine', 'greater') } + ], + component: SizeValue +}) + +export default FileChecks |