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.setup; |
35 |
|
|
36 |
|
import info.magnolia.module.DefaultModuleVersionHandler; |
37 |
|
import info.magnolia.module.InstallContext; |
38 |
|
import info.magnolia.module.delta.AddPermissionTask; |
39 |
|
import info.magnolia.module.delta.AddRoleToUserTask; |
40 |
|
import info.magnolia.module.delta.BootstrapSingleModuleResource; |
41 |
|
import info.magnolia.module.delta.DeltaBuilder; |
42 |
|
import info.magnolia.module.delta.Task; |
43 |
|
|
44 |
|
import java.util.ArrayList; |
45 |
|
import java.util.List; |
46 |
|
|
47 |
|
|
48 |
|
@link |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
50 |
|
public class RestIntegrationModuleVersionHandler extends DefaultModuleVersionHandler { |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
3 |
public RestIntegrationModuleVersionHandler() {... |
53 |
3 |
register(DeltaBuilder.update("2.0", "") |
54 |
|
.addTask(new UpdateRestEditorRoleTask("Update old rest role to new rest-editor role", "")) |
55 |
|
.addTask(new BootstrapSingleModuleResource("Bootstrap file userroles.rest-admin.xml", "", "userroles.rest-admin.xml")) |
56 |
|
.addTask(new BootstrapSingleModuleResource("Bootstrap file userroles.rest-anonymous.xml", "", "userroles.rest-anonymous.xml")) |
57 |
|
.addTask(new RemoveRoleFromUserTask("Remove rest-editor role from superuser", "superuser", "rest-editor")) |
58 |
|
.addTask(new AddRoleToUserTask("Add role 'rest-admin' to user 'superuser'", "superuser", "rest-admin")) |
59 |
|
.addTask(new AddRoleToUserTask("Add role 'rest-anonymous' to user 'anonymous'", "anonymous", "rest-anonymous")) |
60 |
|
); |
61 |
|
} |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
63 |
1 |
@Override... |
64 |
|
protected List<Task> getExtraInstallTasks(InstallContext installContext) { |
65 |
1 |
List<Task> list = new ArrayList<>(); |
66 |
|
|
67 |
|
|
68 |
1 |
list.add(new AddRoleToUserTask("Add role 'rest-admin' to user 'superuser'", "superuser", "rest-admin")); |
69 |
|
|
70 |
|
|
71 |
1 |
list.add(new AddRoleToUserTask("Add role 'rest-anonymous' to user 'anonymous'", "anonymous", "rest-anonymous")); |
72 |
|
|
73 |
|
|
74 |
1 |
list.add(new AddPermissionTask("Update 'security-base' role", "Denies access to the REST interfaces residing under '/.rest' to role 'security-base'.", "security-base", "uri", "/.rest*", 0, false)); |
75 |
|
|
76 |
1 |
return list; |
77 |
|
} |
78 |
|
} |