diff --git a/api/src/com/cloud/acl/APIAccessChecker.java b/api/src/com/cloud/acl/APIAccessChecker.java index caa94f5416a..9066e747517 100644 --- a/api/src/com/cloud/acl/APIAccessChecker.java +++ b/api/src/com/cloud/acl/APIAccessChecker.java @@ -27,6 +27,6 @@ import com.cloud.utils.component.Adapter; * APIAccessChecker checks the ownership and access control to API requests */ public interface APIAccessChecker extends Adapter { - // Interface for checking access to an API for a user + // Interface for checking access to an API for an user boolean canAccessAPI(User user, String apiCommandName) throws PermissionDeniedException; } diff --git a/api/src/org/apache/cloudstack/api/Validator.java b/api/src/org/apache/cloudstack/api/Validate.java similarity index 97% rename from api/src/org/apache/cloudstack/api/Validator.java rename to api/src/org/apache/cloudstack/api/Validate.java index 541e01f8e97..deedda62273 100644 --- a/api/src/org/apache/cloudstack/api/Validator.java +++ b/api/src/org/apache/cloudstack/api/Validate.java @@ -24,7 +24,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ FIELD }) -public @interface Validator { +public @interface Validate { Class[] validators() default Object.class; String description() default ""; } diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 251aab94c4b..ed60ba73529 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -396,20 +396,19 @@ public class ApiDispatcher { } for (Field field : fields) { - //plug Services + PlugService plugServiceAnnotation = field.getAnnotation(PlugService.class); if(plugServiceAnnotation != null){ plugService(field, cmd); } - //APITODO: change the checking here + Parameter parameterAnnotation = field.getAnnotation(Parameter.class); if ((parameterAnnotation == null) || !parameterAnnotation.expose()) { continue; } - //ACL checkAccess = field.getAnnotation(ACL.class); - - Validator validators = field.getAnnotation(Validator.class); + //TODO: Annotate @Validate on API Cmd classes, FIXME how to process Validate + Validate validateAnnotation = field.getAnnotation(Validate.class); Object paramObj = unpackedParams.get(parameterAnnotation.name()); if (paramObj == null) { if (parameterAnnotation.required()) { @@ -530,7 +529,7 @@ public class ApiDispatcher { } - //check access on the entities. + //check access on the enstities. } private static Long translateUuidToInternalId(String uuid, Parameter annotation)