karlpauls commented on a change in pull request #50:
URL:
https://github.com/apache/sling-org-apache-sling-feature-cpconverter/pull/50#discussion_r556663200
##########
File path:
src/main/java/org/apache/sling/feature/cpconverter/accesscontrol/DefaultAclManager.java
##########
@@ -164,49 +166,43 @@ public void reset() {
privilegeDefinitions = null;
}
- private void addPaths(@NotNull List<AccessControlEntry> authorizations,
@NotNull List<VaultPackageAssembler> packageAssemblers, @NotNull Formatter
formatter) {
- if (authorizations.isEmpty()) {
- return;
- }
-
- Set<RepoPath> paths = new TreeSet<>();
- for (AccessControlEntry authorization : authorizations) {
- RepoPath rp = authorization.getRepositoryPath();
- // exclude special paths: user/group home nodes and subtrees
therein, repository-level marker path
- if (!(rp.isRepositoryPath())) {
- addPath(authorization.getRepositoryPath(), paths);
- }
- }
-
- for (RepoPath path : paths) {
- String type = computePathType(path, packageAssemblers);
-
- formatter.format("create path (%s) %s%n", type, path);
- }
- }
-
- private static @NotNull String computePathType(@NotNull RepoPath path,
@NotNull List<VaultPackageAssembler> packageAssemblers) {
+ private static @Nullable String computePathWithTypes(@NotNull RepoPath
path, @NotNull List<VaultPackageAssembler> packageAssemblers) {
path = new
RepoPath(PlatformNameFormat.getPlatformPath(path.toString()));
- for (VaultPackageAssembler packageAssembler: packageAssemblers) {
- File currentDir = packageAssembler.getEntry(path.toString());
-
- if (currentDir.exists()) {
- File currentContent = new File(currentDir,
CONTENT_XML_FILE_NAME);
- if (currentContent.exists()) {
- try (FileInputStream input = new
FileInputStream(currentContent)) {
- return new
PrimaryTypeParser(DEFAULT_TYPE).parse(input);
+ boolean type = false;
+ String current = "";
+ for (String part : path.toString().substring(1).split("/")) {
+ current += current.isEmpty() ? part : "/" + part;
+ for (VaultPackageAssembler packageAssembler : packageAssemblers) {
+ File currentContent = packageAssembler.getEntry(current + "/"
+ CONTENT_XML_FILE_NAME);
+ if (currentContent.isFile()) {
+ String primary;
+ String mixin;
+ try (FileInputStream input = new
FileInputStream(currentContent);
+ FileInputStream input2 = new
FileInputStream(currentContent)) {
+ primary = new
PrimaryTypeParser(DEFAULT_TYPE).parse(input);
+ mixin = new MixinParser(DEFAULT_TYPE).parse(input2);
Review comment:
I'll add an empty constructor
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]