This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.15 by this push:
     new 8911111  server: Remove the rule(s) validation with api names while 
importing role, to be in sync with the create role permission behavior (#4840)
8911111 is described below

commit 89111110cb6a00d6447f29ded7825ee4cc6b3f71
Author: sureshanaparti <[email protected]>
AuthorDate: Mon Mar 29 16:23:43 2021 +0530

    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.
---
 .../main/java/org/apache/cloudstack/api/ApiServerService.java |  2 --
 .../cloudstack/api/command/admin/acl/ImportRoleCmd.java       |  3 ---
 server/src/main/java/com/cloud/api/ApiServer.java             | 11 -----------
 3 files changed, 16 deletions(-)

diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java 
b/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java
index 1f6d3d5..54fda7e 100644
--- a/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java
+++ b/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java
@@ -42,6 +42,4 @@ public interface ApiServerService {
     public String handleRequest(Map<String, Object[]> params, String 
responseType, StringBuilder auditTrailSb) throws ServerApiException;
 
     public Class<?> getCmdClass(String cmdName);
-
-    public boolean isValidApiName(String apiName);
 }
diff --git 
a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ImportRoleCmd.java
 
b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ImportRoleCmd.java
index 3afac9f..c5d9c3f 100644
--- 
a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ImportRoleCmd.java
+++ 
b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/ImportRoleCmd.java
@@ -94,9 +94,6 @@ public class ImportRoleCmd extends RoleCmd {
             if (Strings.isNullOrEmpty(rule)) {
                 throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty 
rule provided in rules param");
             }
-            if (!rule.contains("*") && !_apiServer.isValidApiName(rule)) {
-                throw new ServerApiException(ApiErrorCode.PARAM_ERROR, 
"Invalid api name: " + rule + " provided in rules param");
-            }
             ruleDetails.put(ApiConstants.RULE, new Rule(rule));
 
             String permission = detail.get(ApiConstants.PERMISSION);
diff --git a/server/src/main/java/com/cloud/api/ApiServer.java 
b/server/src/main/java/com/cloud/api/ApiServer.java
index 586d80b..cf0891f 100644
--- a/server/src/main/java/com/cloud/api/ApiServer.java
+++ b/server/src/main/java/com/cloud/api/ApiServer.java
@@ -1208,17 +1208,6 @@ public class ApiServer extends ManagerBase implements 
HttpRequestHandler, ApiSer
         }
     }
 
-    @Override
-    public boolean isValidApiName(String apiName) {
-        if (apiName == null || apiName.isEmpty())
-            return false;
-
-        if (!s_apiNameCmdClassMap.containsKey(apiName))
-            return false;
-
-        return true;
-    }
-
     // FIXME: rather than isError, we might was to pass in the status code to 
give more flexibility
     private void writeResponse(final HttpResponse resp, final String 
responseText, final int statusCode, final String responseType, final String 
reasonPhrase) {
         try {

Reply via email to