1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
import ConvertToPdf from './../components/Operations/ConvertToPdf'
import Tag from './../components/Operations/Tag'
const ALL_CHECKS = [
'OCA\\WorkflowEngine\\Check\\FileMimeType',
'OCA\\WorkflowEngine\\Check\\FileName',
'OCA\\WorkflowEngine\\Check\\FileSize',
'OCA\\WorkflowEngine\\Check\\FileSystemTags',
'OCA\\WorkflowEngine\\Check\\RequestRemoteAddress',
'OCA\\WorkflowEngine\\Check\\RequestTime',
'OCA\\WorkflowEngine\\Check\\RequestURL',
'OCA\\WorkflowEngine\\Check\\RequestUserAgent',
'OCA\\WorkflowEngine\\Check\\UserGroupMembership'
]
const Checks = Object.values(OCA.WorkflowEngine.Plugins).map((plugin) => {
if (plugin.component) {
return { ...plugin.getCheck(), component: plugin.component }
}
return plugin.getCheck()
}).reduce((obj, item) => {
obj[item.class] = item
return obj
}, {})
const Operators = OCP.InitialState.loadState('workflowengine', 'operators')
/**
* Extend operators for testing
*/
Operators['OCA\\FilesAccessControl\\Operation'] = {
...Operators['OCA\\FilesAccessControl\\Operation'],
color: 'var(--color-error)',
entities: [
'OCA\\WorkflowEngine\\Entity\\File'
],
operation: 'deny'
}
Operators['OCA\\WorkflowPDFConverter\\Operation'] = {
id: 'OCA\\WorkflowPDFConverter\\Operation',
name: 'Convert to PDF',
description: 'Generate a PDF file',
color: '#dc5047',
iconClass: 'icon-convert-pdf',
options: ConvertToPdf
}
Operators['OCA\\TestExample\\Operation1'] = {
id: 'OCA\\TestExample\\Operation1',
name: 'Rename file',
description: '🚧 For UI mocking only',
iconClass: 'icon-address-white',
color: 'var(--color-success)',
operation: 'deny'
}
Operators['OCA\\TestExample\\Operation2'] = {
id: 'OCA\\TestExample\\Operation2',
name: 'Notify me',
description: '🚧 For UI mocking only',
iconClass: 'icon-comment-white',
color: 'var(--color-warning)',
operation: 'deny'
}
Operators['OCA\\FilesAutomatedTagging\\Operation'] = {
id: 'OCA\\FilesAutomatedTagging\\Operation',
name: 'Tag a file',
description: 'Assign a tag to a file',
iconClass: 'icon-tag-white',
color: 'var(--color-primary)',
options: Tag
}
export {
Checks,
Operators,
ALL_CHECKS
}
|