You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/12/13 01:42:45 UTC
[3/4] ControlledEntity Interface change to return EntityType and
added values to the AclEntityType enum and
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c6f1c14/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java b/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java
index cd94ba5..eaa6d5e 100644
--- a/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java
@@ -23,6 +23,8 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
+import org.apache.cloudstack.acl.AclEntityType;
+
import com.cloud.server.ResourceTag.ResourceObjectType;
@Entity
@@ -178,4 +180,9 @@ public class ResourceTagJoinVO extends BaseViewVO implements ControlledViewEntit
public String getCustomer() {
return customer;
}
+
+ @Override
+ public AclEntityType getEntityType() {
+ return AclEntityType.ResourceTag;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c6f1c14/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java b/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java
index ca1fa85..0e187cb 100644
--- a/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java
@@ -23,6 +23,8 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
+import org.apache.cloudstack.acl.AclEntityType;
+
import com.cloud.network.security.SecurityRule.SecurityRuleType;
import com.cloud.server.ResourceTag.ResourceObjectType;
@@ -302,4 +304,9 @@ public class SecurityGroupJoinVO extends BaseViewVO implements ControlledViewEnt
public String getTagCustomer() {
return tagCustomer;
}
+
+ @Override
+ public AclEntityType getEntityType() {
+ return AclEntityType.SecurityGroup;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c6f1c14/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/TemplateJoinVO.java b/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
index ca5963e..34cbb7a 100644
--- a/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
@@ -27,6 +27,7 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@@ -532,4 +533,9 @@ public class TemplateJoinVO extends BaseViewVO implements ControlledViewEntity {
public String getTempZonePair() {
return tempZonePair;
}
+
+ @Override
+ public AclEntityType getEntityType() {
+ return AclEntityType.VirtualMachineTemplate;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c6f1c14/server/src/com/cloud/api/query/vo/UserVmJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/UserVmJoinVO.java b/server/src/com/cloud/api/query/vo/UserVmJoinVO.java
index 5aae820..2cafbf2 100644
--- a/server/src/com/cloud/api/query/vo/UserVmJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/UserVmJoinVO.java
@@ -28,6 +28,8 @@ import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
+import org.apache.cloudstack.acl.AclEntityType;
+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Network.GuestType;
import com.cloud.network.Networks.TrafficType;
@@ -899,4 +901,9 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
public String getDetailValue() {
return detailValue;
}
+
+ @Override
+ public AclEntityType getEntityType() {
+ return AclEntityType.VirtualMachine;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c6f1c14/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
index 7c03cd7..f83ef7b 100644
--- a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java
@@ -25,6 +25,9 @@ import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.acl.AclEntityType;
+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.server.ResourceTag.ResourceObjectType;
import com.cloud.storage.Storage;
@@ -695,5 +698,8 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
return path;
}
-
+ @Override
+ public AclEntityType getEntityType() {
+ return AclEntityType.Volume;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c6f1c14/server/src/com/cloud/api/response/SecurityGroupResultObject.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/response/SecurityGroupResultObject.java b/server/src/com/cloud/api/response/SecurityGroupResultObject.java
index aab13cd..9ed8fe8 100644
--- a/server/src/com/cloud/api/response/SecurityGroupResultObject.java
+++ b/server/src/com/cloud/api/response/SecurityGroupResultObject.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.acl.ControlledEntity;
import com.cloud.api.ApiDBUtils;
import com.cloud.network.security.SecurityGroup;
@@ -204,4 +205,9 @@ public class SecurityGroupResultObject implements ControlledEntity, InternalIden
}
return resultObjects;
}
+
+ @Override
+ public AclEntityType getEntityType() {
+ return AclEntityType.SecurityGroup;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c6f1c14/server/src/com/cloud/network/vpc/PrivateGatewayProfile.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/PrivateGatewayProfile.java b/server/src/com/cloud/network/vpc/PrivateGatewayProfile.java
index 421c2ab..807a9d0 100644
--- a/server/src/com/cloud/network/vpc/PrivateGatewayProfile.java
+++ b/server/src/com/cloud/network/vpc/PrivateGatewayProfile.java
@@ -16,6 +16,8 @@
// under the License.
package com.cloud.network.vpc;
+import org.apache.cloudstack.acl.AclEntityType;
+
public class PrivateGatewayProfile implements PrivateGateway {
VpcGateway vpcGateway;
@@ -111,4 +113,8 @@ public class PrivateGatewayProfile implements PrivateGateway {
return vpcGateway.getNetworkACLId();
}
+ @Override
+ public AclEntityType getEntityType() {
+ return AclEntityType.VpcGateway;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c6f1c14/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index 65ba15f..26e8b58 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -2394,7 +2394,8 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
// get caller role permission on VM List
//TODO: this method needs to pass the entity type instead of current hard-code to VM for now. Also, api action name
// should be passed in caller context.
- AclPolicyPermission policyPerm = _aclService.getAclPolicyPermission(caller.getId(), AclEntityType.VM.toString(), "listVirtualMachine");
+ AclPolicyPermission policyPerm = _aclService.getAclPolicyPermission(caller.getId(),
+ AclEntityType.VirtualMachine.toString(), "listVirtualMachine");
if (policyPerm == null) {
// no list entry permission
throw new PermissionDeniedException("Caller has no policy permission assigned to list VM");