Import Permissions as last object
parent
2333bbc35e
commit
b2a6880d24
|
|
@ -25,6 +25,7 @@ import org.libreccm.files.FileAccessException;
|
||||||
import org.libreccm.files.FileAlreadyExistsException;
|
import org.libreccm.files.FileAlreadyExistsException;
|
||||||
import org.libreccm.files.FileDoesNotExistException;
|
import org.libreccm.files.FileDoesNotExistException;
|
||||||
import org.libreccm.files.InsufficientPermissionsException;
|
import org.libreccm.files.InsufficientPermissionsException;
|
||||||
|
import org.libreccm.security.Permission;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -228,6 +229,23 @@ public class ImportExport {
|
||||||
);
|
);
|
||||||
final List<EntityImExporterTreeNode> orderedNodes = treeManager
|
final List<EntityImExporterTreeNode> orderedNodes = treeManager
|
||||||
.orderImExporters(tree);
|
.orderImExporters(tree);
|
||||||
|
|
||||||
|
// Put the node for Permissions to the end of the list.
|
||||||
|
final EntityImExporterTreeNode permissionsNode = orderedNodes
|
||||||
|
.stream()
|
||||||
|
.filter(node -> node.getEntityImExporter().getEntityClass().equals(Permission.class))
|
||||||
|
.findAny()
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new UnexpectedErrorException(
|
||||||
|
String.format(
|
||||||
|
"There should be an ImExporter in the tree for "
|
||||||
|
+ "%s, but it is not.",
|
||||||
|
Permission.class.getName()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
orderedNodes.remove(permissionsNode);
|
||||||
|
orderedNodes.add(permissionsNode);
|
||||||
|
|
||||||
final ImportManifest manifest = createImportManifest(importName);
|
final ImportManifest manifest = createImportManifest(importName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ public class PermissionImExporter extends AbstractEntityImExporter<Permission> {
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||||
return Set.of(
|
return Set.of(
|
||||||
CcmObject.class,
|
|
||||||
Role.class
|
Role.class
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue