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 |
|
package info.magnolia.rest.service.setup; |
35 |
|
|
36 |
|
import info.magnolia.cms.security.Permission; |
37 |
|
import info.magnolia.module.DefaultModuleVersionHandler; |
38 |
|
import info.magnolia.module.InstallContext; |
39 |
|
import info.magnolia.module.delta.AddPermissionTask; |
40 |
|
import info.magnolia.module.delta.ArrayDelegateTask; |
41 |
|
import info.magnolia.module.delta.CheckAndModifyPropertyValueTask; |
42 |
|
import info.magnolia.module.delta.DeltaBuilder; |
43 |
|
import info.magnolia.module.delta.NodeExistsDelegateTask; |
44 |
|
import info.magnolia.module.delta.Task; |
45 |
|
import info.magnolia.repository.RepositoryConstants; |
46 |
|
|
47 |
|
import java.util.ArrayList; |
48 |
|
import java.util.List; |
49 |
|
|
50 |
|
|
51 |
|
@link |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
53 |
|
public class RestServicesModuleVersionHandler extends DefaultModuleVersionHandler { |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
55 |
3 |
public RestServicesModuleVersionHandler() {... |
56 |
3 |
register(DeltaBuilder.update("1.1", "") |
57 |
|
.addTask(new CheckAndModifyPropertyValueTask("/modules/rest-services/rest-endpoints/commands", "implementationClass", "info.magnolia.rest.service.command.v1.CommandEndpoint", "info.magnolia.rest.service.command.v2.CommandEndpoint")) |
58 |
|
); |
59 |
3 |
register(DeltaBuilder.update("2.0", "") |
60 |
|
.addTask(new NodeExistsDelegateTask("Update activate command rest role to rest-editor", "/modules/rest-services/rest-endpoints/commands/enabledCommands/activate/access/roles", |
61 |
|
new CheckAndModifyPropertyValueTask("/modules/rest-services/rest-endpoints/commands/enabledCommands/activate/access/roles", "rest", "rest", "rest-editor"))) |
62 |
|
.addTask(new NodeExistsDelegateTask("Update markAsDeleted command rest role to rest-editor", "/modules/rest-services/rest-endpoints/commands/enabledCommands/markAsDeleted/access/roles", |
63 |
|
new CheckAndModifyPropertyValueTask("/modules/rest-services/rest-endpoints/commands/enabledCommands/markAsDeleted/access/roles", "rest", "rest", "rest-editor"))) |
64 |
|
); |
65 |
|
} |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
67 |
1 |
@Override... |
68 |
|
protected List<Task> getExtraInstallTasks(InstallContext installContext) { |
69 |
1 |
List<Task> list = new ArrayList<Task>(); |
70 |
|
|
71 |
|
|
72 |
1 |
list.add(new CheckAndModifyPropertyValueTask("Enable PUT method", "Enables PUT method in '/server/IPConfig/allow-all.methods'", RepositoryConstants.CONFIG, "/server/IPConfig/allow-all", "methods", "GET,POST", "GET,POST,PUT,DELETE")); |
73 |
|
|
74 |
1 |
list.add(new ArrayDelegateTask("Update 'rest-editor' role", |
75 |
|
new AddPermissionTask("Update 'rest-editor' role", "Allows access to the REST API documentation interface residing under '/.rest/api-docs' in role 'rest-editor'.", "rest-editor", "uri", "/.rest/commands*", Permission.NONE, false), |
76 |
|
|
77 |
|
new AddPermissionTask("Update 'rest-editor' role", "Denies access to the 'nodes' endpoint.", "rest-editor", "uri", "/.rest/nodes*", Permission.NONE, false), |
78 |
|
new AddPermissionTask("Update 'rest-editor' role", "Allows access to the 'nodes' endpoint for workspace 'website'.", "rest-editor", "uri", "/.rest/nodes/v1/website*", Permission.ALL, false), |
79 |
|
|
80 |
|
new AddPermissionTask("Update 'rest-editor' role", "Denies access to the 'properties' endpoint.", "rest-editor", "uri", "/.rest/properties*", Permission.NONE, false), |
81 |
|
new AddPermissionTask("Update 'rest-editor' role", "Allows access to the 'nodes' properties for workspace 'website'.", "rest-editor", "uri", "/.rest/properties/v1/website*", Permission.ALL, false) |
82 |
|
)); |
83 |
1 |
return list; |
84 |
|
} |
85 |
|
|
86 |
|
} |