Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 7653719

Browse files
committed
#221 Protected paths and query rolesets are now in default set of commands
1 parent 5de1390 commit 7653719

File tree

9 files changed

+31
-26
lines changed

9 files changed

+31
-26
lines changed

src/main/java/com/marklogic/appdeployer/ConfigDir.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public File getUsersDir() {
114114

115115
public File getProtectedPathsDir() { return new File(getSecurityDir(), "protected-paths"); }
116116

117-
public File getQueryRoleSetsDir() { return new File(getSecurityDir(), "query-rolesets"); }
117+
public File getQueryRolesetsDir() { return new File(getSecurityDir(), "query-rolesets"); }
118118

119119
public File getServersDir() {
120120
return new File(baseDir, "servers");

src/main/java/com/marklogic/appdeployer/command/AbstractResourceCommand.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ protected File[] findResourceDirs(AppConfig appConfig, ResourceDirFinder resourc
5555
File dir = resourceDirFinder.getResourceDir(configDir);
5656
if (dir != null && dir.exists()) {
5757
list.add(dir);
58+
} else if (dir != null && logger.isInfoEnabled()) {
59+
logger.info("No resource directory found at: " + dir.getAbsolutePath());
5860
}
5961
}
6062
}
@@ -71,13 +73,13 @@ protected void processExecuteOnResourceDir(CommandContext context, File resource
7173
logger.info("Processing files in directory: " + resourceDir.getAbsolutePath());
7274
}
7375
for (File f : listFilesInDirectory(resourceDir, context)) {
74-
if (logger.isInfoEnabled()) {
75-
logger.info("Processing file: " + f.getAbsolutePath());
76-
}
77-
SaveReceipt receipt = saveResource(mgr, context, f);
78-
afterResourceSaved(mgr, context, f, receipt);
76+
if (logger.isInfoEnabled()) {
77+
logger.info("Processing file: " + f.getAbsolutePath());
78+
}
79+
SaveReceipt receipt = saveResource(mgr, context, f);
80+
afterResourceSaved(mgr, context, f, receipt);
81+
}
7982
}
80-
}
8183
}
8284

8385
/**

src/main/java/com/marklogic/appdeployer/command/CommandMapBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public Map<String, List<Command>> buildCommandMap() {
6161
securityCommands.add(new DeployExternalSecurityCommand());
6262
securityCommands.add(new DeployPrivilegesCommand());
6363
securityCommands.add(new DeployProtectedCollectionsCommand());
64+
securityCommands.add(new DeployProtectedPathsCommand());
65+
securityCommands.add(new DeployQueryRolesetsCommand());
6466
map.put("mlSecurityCommands", securityCommands);
6567

6668
// Cluster

src/main/java/com/marklogic/appdeployer/command/SortOrderConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public abstract class SortOrderConstants {
1414
public static Integer DEPLOY_PROTECTED_COLLECTIONS = 80;
1515
public static Integer DEPLOY_MIMETYPES = 90;
1616
public static Integer DEPLOY_PROTECTED_PATHS = 95;
17-
public static Integer DEPLOY_QUERY_ROLE_SETS = 97;
17+
public static Integer DEPLOY_QUERY_ROLESETS = 97;
1818

1919
public static Integer DEPLOY_TRIGGERS_DATABASE = 100;
2020
public static Integer DEPLOY_SCHEMAS_DATABASE = 100;
@@ -74,7 +74,7 @@ public abstract class SortOrderConstants {
7474
public static Integer DELETE_CERTIFICATE_AUTHORITIES = 9020;
7575
public static Integer DELETE_EXTERNAL_SECURITY = 9030;
7676
public static Integer DELETE_PROTECTED_COLLECTIONS = 9040;
77-
public static Integer DELETE_QUERY_ROLE_SETS = 9050;
77+
public static Integer DELETE_QUERY_ROLESETS = 9050;
7878

7979
// Roles can reference privileges, so must delete roles first
8080
public static Integer DELETE_ROLES = 9060;

src/main/java/com/marklogic/appdeployer/command/security/DeployProtectedPathCommand.java renamed to src/main/java/com/marklogic/appdeployer/command/security/DeployProtectedPathsCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
import java.io.File;
1111

12-
public class DeployProtectedPathCommand extends AbstractResourceCommand {
12+
public class DeployProtectedPathsCommand extends AbstractResourceCommand {
1313

14-
public DeployProtectedPathCommand() {
14+
public DeployProtectedPathsCommand() {
1515
setExecuteSortOrder(SortOrderConstants.DEPLOY_PROTECTED_PATHS);
1616
setUndoSortOrder(SortOrderConstants.DELETE_PROTECTED_PATHS);
1717
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
import com.marklogic.appdeployer.command.CommandContext;
55
import com.marklogic.appdeployer.command.SortOrderConstants;
66
import com.marklogic.mgmt.resource.ResourceManager;
7-
import com.marklogic.mgmt.resource.security.QueryRoleSetsManager;
7+
import com.marklogic.mgmt.resource.security.QueryRolesetsManager;
88

99
import java.io.File;
1010

11-
public class DeployQueryRoleSetsCommand extends AbstractResourceCommand {
11+
public class DeployQueryRolesetsCommand extends AbstractResourceCommand {
1212

13-
public DeployQueryRoleSetsCommand() {
14-
setExecuteSortOrder(SortOrderConstants.DEPLOY_QUERY_ROLE_SETS);
15-
setUndoSortOrder(SortOrderConstants.DELETE_QUERY_ROLE_SETS);
13+
public DeployQueryRolesetsCommand() {
14+
setExecuteSortOrder(SortOrderConstants.DEPLOY_QUERY_ROLESETS);
15+
setUndoSortOrder(SortOrderConstants.DELETE_QUERY_ROLESETS);
1616
}
17-
17+
1818
@Override
1919
protected File[] getResourceDirs(CommandContext context) {
20-
return findResourceDirs(context, configDir -> configDir.getQueryRoleSetsDir());
20+
return findResourceDirs(context, configDir -> configDir.getQueryRolesetsDir());
2121
}
2222

2323
@Override
2424
protected ResourceManager getResourceManager(CommandContext context) {
25-
return new QueryRoleSetsManager(context.getManageClient());
25+
return new QueryRolesetsManager(context.getManageClient());
2626
}
2727
}

src/main/java/com/marklogic/mgmt/resource/security/QueryRoleSetsManager.java renamed to src/main/java/com/marklogic/mgmt/resource/security/QueryRolesetsManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
import java.util.List;
1010

11-
public class QueryRoleSetsManager extends AbstractResourceManager {
11+
public class QueryRolesetsManager extends AbstractResourceManager {
1212

1313
private boolean updateAllowed = false;
1414

15-
public QueryRoleSetsManager(ManageClient client) {
15+
public QueryRolesetsManager(ManageClient client) {
1616
super(client);
1717
}
1818

src/test/java/com/marklogic/appdeployer/command/security/ManageProtectedPathsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protected ResourceManager newResourceManager() {
1313

1414
@Override
1515
protected Command newCommand() {
16-
return new DeployProtectedPathCommand();
16+
return new DeployProtectedPathsCommand();
1717
}
1818

1919
@Override

src/test/java/com/marklogic/appdeployer/command/security/ManageQueryRoleSetsTest.java renamed to src/test/java/com/marklogic/appdeployer/command/security/ManageQueryRolesetsTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
import com.marklogic.appdeployer.command.AbstractManageResourceTest;
44
import com.marklogic.appdeployer.command.Command;
55
import com.marklogic.mgmt.resource.ResourceManager;
6-
import com.marklogic.mgmt.resource.security.QueryRoleSetsManager;
6+
import com.marklogic.mgmt.resource.security.QueryRolesetsManager;
7+
8+
public class ManageQueryRolesetsTest extends AbstractManageResourceTest {
79

8-
public class ManageQueryRoleSetsTest extends AbstractManageResourceTest {
910
@Override
1011
protected ResourceManager newResourceManager() {
11-
return new QueryRoleSetsManager(manageClient);
12+
return new QueryRolesetsManager(manageClient);
1213
}
1314

1415
@Override
1516
protected Command newCommand() {
16-
return new DeployQueryRoleSetsCommand();
17+
return new DeployQueryRolesetsCommand();
1718
}
1819

1920
@Override

0 commit comments

Comments
 (0)