mirror of https://github.com/apache/cloudstack.git
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.
This commit is contained in:
parent
b8884efa7f
commit
89111110cb
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue