Skip to content

Commit 8911111

Browse files
server: Remove the rule(s) validation with api names while importing role, to be in sync with the create role permission behavior (#4840)
This PR removes the rule(s) validation with api names while importing a role. This will be in sync with the current create role permission behavior.
1 parent b8884ef commit 8911111

File tree

3 files changed

+0
-16
lines changed

3 files changed

+0
-16
lines changed

api/src/main/java/org/apache/cloudstack/api/ApiServerService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,4 @@ public ResponseObject loginUser(HttpSession session, String username, String pas
4242
public String handleRequest(Map<String, Object[]> params, String responseType, StringBuilder auditTrailSb) throws ServerApiException;
4343

4444
public Class<?> getCmdClass(String cmdName);
45-
46-
public boolean isValidApiName(String apiName);
4745
}

api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ImportRoleCmd.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ public List<Map<String, Object>> getRules() {
9494
if (Strings.isNullOrEmpty(rule)) {
9595
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty rule provided in rules param");
9696
}
97-
if (!rule.contains("*") && !_apiServer.isValidApiName(rule)) {
98-
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid api name: " + rule + " provided in rules param");
99-
}
10097
ruleDetails.put(ApiConstants.RULE, new Rule(rule));
10198

10299
String permission = detail.get(ApiConstants.PERMISSION);

server/src/main/java/com/cloud/api/ApiServer.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,17 +1208,6 @@ else if (cmdList.size() == 1)
12081208
}
12091209
}
12101210

1211-
@Override
1212-
public boolean isValidApiName(String apiName) {
1213-
if (apiName == null || apiName.isEmpty())
1214-
return false;
1215-
1216-
if (!s_apiNameCmdClassMap.containsKey(apiName))
1217-
return false;
1218-
1219-
return true;
1220-
}
1221-
12221211
// FIXME: rather than isError, we might was to pass in the status code to give more flexibility
12231212
private void writeResponse(final HttpResponse resp, final String responseText, final int statusCode, final String responseType, final String reasonPhrase) {
12241213
try {

0 commit comments

Comments
 (0)