improve update helpers
This commit is contained in:
parent
5f0df61fe1
commit
51cb520bfd
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<groupId>at.ucs.magnolia.util</groupId>
|
<groupId>at.ucs.magnolia.util</groupId>
|
||||||
<artifactId>ucs-magnolia-utils</artifactId>
|
<artifactId>ucs-magnolia-utils</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ucs-magnolia-utils</name>
|
<name>ucs-magnolia-utils</name>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SimpleACLDefinition {
|
public class SimpleJcrACLDefinition {
|
||||||
private String workspace;
|
private String workspace;
|
||||||
private String path;
|
private String path;
|
||||||
private long permission;
|
private long permission;
|
||||||
@ -20,7 +20,7 @@ public class UpdateHelper {
|
|||||||
* @param aclDefinitions list of ACL definitions to add
|
* @param aclDefinitions list of ACL definitions to add
|
||||||
* @param uuid uuid the new node should have
|
* @param uuid uuid the new node should have
|
||||||
*/
|
*/
|
||||||
public static void createAndPublishUserrole(List<Task> tasks, String roleName, Collection<SimpleACLDefinition> aclDefinitions, List<String> assignToGroups, String uuid) {
|
public static void createAndPublishUserrole(List<Task> tasks, String roleName, Collection<SimpleJcrACLDefinition> aclDefinitions, List<String> assignToGroups, String uuid) {
|
||||||
addCreateRoleTask(tasks, roleName, aclDefinitions, null, assignToGroups, uuid);
|
addCreateRoleTask(tasks, roleName, aclDefinitions, null, assignToGroups, uuid);
|
||||||
setActivationStatus(tasks, Workspace.USER_ROLES, "/" + roleName);
|
setActivationStatus(tasks, Workspace.USER_ROLES, "/" + roleName);
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public class UpdateHelper {
|
|||||||
* @param aclDefinitions list of ACL definitions to add
|
* @param aclDefinitions list of ACL definitions to add
|
||||||
* @param uuid uuid the new node should have
|
* @param uuid uuid the new node should have
|
||||||
*/
|
*/
|
||||||
public static void createAndPublishUserrole(List<Task> tasks, String roleName, Collection<SimpleACLDefinition> aclDefinitions, Collection<SimpleWebACLDefinition> webACLDefinitions, List<String> assignToGroups, String uuid) {
|
public static void createAndPublishUserrole(List<Task> tasks, String roleName, Collection<SimpleJcrACLDefinition> aclDefinitions, Collection<SimpleWebACLDefinition> webACLDefinitions, List<String> assignToGroups, String uuid) {
|
||||||
addCreateRoleTask(tasks, roleName, aclDefinitions, webACLDefinitions, assignToGroups, uuid);
|
addCreateRoleTask(tasks, roleName, aclDefinitions, webACLDefinitions, assignToGroups, uuid);
|
||||||
setActivationStatus(tasks, Workspace.USER_ROLES, "/" + roleName);
|
setActivationStatus(tasks, Workspace.USER_ROLES, "/" + roleName);
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public class UpdateHelper {
|
|||||||
* @param roleName the name of the newly created role
|
* @param roleName the name of the newly created role
|
||||||
* @param aclDefinitions list of ACL definitions to add
|
* @param aclDefinitions list of ACL definitions to add
|
||||||
*/
|
*/
|
||||||
public static void createUserrole(List<Task> tasks, String roleName, Collection<SimpleACLDefinition> aclDefinitions, List<String> assignToGroups) {
|
public static void createUserrole(List<Task> tasks, String roleName, Collection<SimpleJcrACLDefinition> aclDefinitions, List<String> assignToGroups) {
|
||||||
addCreateRoleTask(tasks, roleName, aclDefinitions, null, assignToGroups, null);
|
addCreateRoleTask(tasks, roleName, aclDefinitions, null, assignToGroups, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class UpdateHelper {
|
|||||||
* @param webACLDefinitions list of web ACL definitions to add
|
* @param webACLDefinitions list of web ACL definitions to add
|
||||||
* @param uuid uuid the new node should have, if null a uuid is automatically assigned.
|
* @param uuid uuid the new node should have, if null a uuid is automatically assigned.
|
||||||
*/
|
*/
|
||||||
private static void addCreateRoleTask(List<Task> tasks, String roleName, Collection<SimpleACLDefinition> aclDefinitions, Collection<SimpleWebACLDefinition> webACLDefinitions, List<String> assignToGroups, String uuid) {
|
public static void addCreateRoleTask(List<Task> tasks, String roleName, Collection<SimpleJcrACLDefinition> aclDefinitions, Collection<SimpleWebACLDefinition> webACLDefinitions, List<String> assignToGroups, String uuid) {
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
tasks.add(new CreateNodeWithFixedUUIDTask("Create default userrole " + roleName, "Creates default userroles", Workspace.USER_ROLES, "/", roleName, NodeTypes.Role.NAME, uuid));
|
tasks.add(new CreateNodeWithFixedUUIDTask("Create default userrole " + roleName, "Creates default userroles", Workspace.USER_ROLES, "/", roleName, NodeTypes.Role.NAME, uuid));
|
||||||
} else {
|
} else {
|
||||||
@ -68,7 +68,7 @@ public class UpdateHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (aclDefinitions != null) {
|
if (aclDefinitions != null) {
|
||||||
for (SimpleACLDefinition definition : aclDefinitions) {
|
for (SimpleJcrACLDefinition definition : aclDefinitions) {
|
||||||
addJcrAcl(tasks, roleName, definition.getWorkspace(), definition.getPath(), definition.getPermission(), definition.isIncludeSubNodes());
|
addJcrAcl(tasks, roleName, definition.getWorkspace(), definition.getPath(), definition.getPermission(), definition.isIncludeSubNodes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ public class UpdateHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addJcrAcl(List<Task> tasks, String roleName, List<SimpleACLDefinition> jcrAcls) {
|
public static void addJcrAcl(List<Task> tasks, String roleName, List<SimpleJcrACLDefinition> jcrAcls) {
|
||||||
jcrAcls.forEach(
|
jcrAcls.forEach(
|
||||||
simpleACLDefinition ->
|
simpleACLDefinition ->
|
||||||
tasks.add(new AddPermissionTask("Add permission to default userrole " + roleName, roleName, simpleACLDefinition.getWorkspace(), simpleACLDefinition.getPath(), simpleACLDefinition.getPermission() , simpleACLDefinition.isIncludeSubNodes()))
|
tasks.add(new AddPermissionTask("Add permission to default userrole " + roleName, roleName, simpleACLDefinition.getWorkspace(), simpleACLDefinition.getPath(), simpleACLDefinition.getPermission() , simpleACLDefinition.isIncludeSubNodes()))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user