cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [1/4] git commit: updated refs/heads/4.4 to 8a46539
Date Fri, 04 Apr 2014 06:32:42 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 0d7709414 -> 8a46539bc


Changes while processing the @ACL annotation, to include only 1 object per parameter even
if the parameter is tied to multiple interfaces in the @EntityReference


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/458acc76
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/458acc76
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/458acc76

Branch: refs/heads/4.4
Commit: 458acc762af3a0dcd41f90482afe14c38ec3616a
Parents: 0d77094
Author: Prachi Damle <prachi@cloud.com>
Authored: Wed Apr 2 11:34:10 2014 -0700
Committer: Prachi Damle <prachi@cloud.com>
Committed: Thu Apr 3 23:07:04 2014 -0700

----------------------------------------------------------------------
 .../cloud/api/dispatch/ParamProcessWorker.java  | 101 +++++++++----------
 1 file changed, 46 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/458acc76/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
index 7d1b42f..6eef3d6 100644
--- a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
+++ b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
@@ -146,71 +146,62 @@ public class ParamProcessWorker implements DispatchWorker {
                 final CommandType fieldType = parameterAnnotation.type();
 
                 if (checkAccess != null) {
-                    // Verify that caller can perform actions in behalf of vm owner
-                    //acumulate all Controlled Entities together.
+                    // Verify that caller can perform actions in behalf of vm
+                    // owner acumulate all Controlled Entities together.
+                    // parse the array of resource types and in case of map
+                    // check access on key or value or both as specified in @acl
+                    // implement external dao for classes that need findByName
+                    // for maps, specify access to be checkd on key or value.
+                    // Find the controlled entity DBid by uuid
 
-                    //parse the array of resource types and in case of map check access on
key or value or both as specified in @acl
-                    //implement external dao for classes that need findByName
-                    //for maps, specify access to be checkd on key or value.
-
-                    // find the controlled entity DBid by uuid
                     if (parameterAnnotation.entityType() != null) {
                         final Class<?>[] entityList = parameterAnnotation.entityType()[0].getAnnotation(EntityReference.class).value();
 
-                        for (final Class entity : entityList) {
-                            // Check if the parameter type is a single
-                            // Id or list of id's/name's
-                            switch (fieldType) {
-                                case LIST:
-                                    final CommandType listType = parameterAnnotation.collectionType();
-                                    switch (listType) {
-                                        case LONG:
-                                        case UUID:
-                                            final List<Long> listParam = (List<Long>)field.get(cmd);
-                                            for (final Long entityId : listParam) {
+                        // Check if the parameter type is a single
+                        // Id or list of id's/name's
+                        switch (fieldType) {
+                            case LIST:
+                                final CommandType listType = parameterAnnotation.collectionType();
+                                switch (listType) {
+                                    case LONG:
+                                    case UUID:
+                                        final List<Long> listParam = (List<Long>)
field.get(cmd);
+                                        for (final Long entityId : listParam) {
+                                            for (final Class entity : entityList) {
                                                 final Object entityObj = _entityMgr.findById(entity,
entityId);
-                                                entitiesToAccess.put(entityObj, checkAccess.accessType());
+                                                if(entityObj != null){
+                                                    entitiesToAccess.put(entityObj, checkAccess.accessType());
+                                                    break;
+                                                }
                                             }
-                                            break;
-                                        /*
-                                         * case STRING: List<String> listParam =
-                                         * new ArrayList<String>(); listParam =
-                                         * (List)field.get(cmd); for(String
-                                         * entityName: listParam){
-                                         * ControlledEntity entityObj =
-                                         * (ControlledEntity
-                                         * )daoClassInstance(entityId);
-                                         * entitiesToAccess.add(entityObj); }
-                                         * break;
-                                         */
-                                        default:
-                                            break;
-                                    }
-                                    break;
-                                case LONG:
-                                case UUID:
-                                    final Object entityObj = _entityMgr.findById(entity,
(Long)field.get(cmd));
-                                    entitiesToAccess.put(entityObj, checkAccess.accessType());
-                                    break;
-                                default:
-                                    break;
-                            }
-
-                            if (ControlledEntity.class.isAssignableFrom(entity)) {
-                                if (s_logger.isDebugEnabled()) {
-                                    s_logger.debug("ControlledEntity name is:" + entity.getName());
+                                        }
+                                        break;
+                                    /*
+                                     * case STRING: List<String> listParam = new
+                                     * ArrayList<String>(); listParam =
+                                     * (List)field.get(cmd); for(String entityName:
+                                     * listParam){ ControlledEntity entityObj =
+                                     * (ControlledEntity )daoClassInstance(entityId);
+                                     * entitiesToAccess.add(entityObj); } break;
+                                     */
+                                    default:
+                                        break;
                                 }
-                            }
-
-                            if (InfrastructureEntity.class.isAssignableFrom(entity)) {
-                                if (s_logger.isDebugEnabled()) {
-                                    s_logger.debug("InfrastructureEntity name is:" + entity.getName());
+                                break;
+                            case LONG:
+                            case UUID:
+                                for (final Class entity : entityList) {
+                                    final Object entityObj = _entityMgr.findById(entity,
(Long) field.get(cmd));
+                                    if(entityObj != null){
+                                        entitiesToAccess.put(entityObj, checkAccess.accessType());
+                                        break;
+                                    }
                                 }
-                            }
+                                break;
+                            default:
+                                break;
                         }
-
                     }
-
                 }
 
             } catch (final IllegalArgumentException e) {


Mime
View raw message