ControlledEntity Interface change to return EntityType and added values to the AclEntityType enum and

This commit is contained in:
Prachi Damle 2013-12-12 16:30:05 -08:00
parent d2c74bcf14
commit 7c6f1c14c2
68 changed files with 603 additions and 156 deletions

View File

@ -18,6 +18,8 @@ package com.cloud.network;
import java.net.URI;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
@ -276,4 +278,9 @@ public class NetworkProfile implements Network {
public String getIp6Cidr() {
return ip6Cidr;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Network;
}
}

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.network.vpc;
import org.apache.cloudstack.acl.AclEntityType;
public class StaticRouteProfile implements StaticRoute {
private long id;
@ -104,4 +105,9 @@ public class StaticRouteProfile implements StaticRoute {
return netmask;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.StaticRoute;
}
}

View File

@ -2,6 +2,39 @@ package org.apache.cloudstack.acl;
public enum AclEntityType {
// currently supported entity, to be added one by one after we support acl on the entity
VM,
VOLUME;
VirtualMachine,
Volume,
ResourceTag,
Account,
AffinityGroup,
AutoScalePolicy,
AutoScaleVmGroup,
AutoScaleVmProfile,
Condition,
Vpc,
VpcGateway,
VpnUser,
VMSnapshot,
VirtualMachineTemplate,
UserIpv6Address,
StaticRoute,
SSHKeyPair,
Snapshot,
Site2SiteVpnGateway,
Site2SiteVpnConnection,
Site2SiteCustomerGateway,
SecurityGroup,
RemoteAccessVpn,
PublicIpAddress,
ProjectInvitation,
NicSecondaryIp,
NicIpAlias,
Network,
IpAddress,
InstanceGroup,
GlobalLoadBalancerRule,
FirewallRule,
Event,
AclPolicy,
AclGroup;
}

View File

@ -36,8 +36,17 @@ public interface AclPolicyPermission extends InternalIdentity {
Permission getPermission();
public enum Permission {
Allow,
Deny
Allow(true), Deny(false);
boolean result;
Permission(boolean result) {
this.result = result;
}
public boolean isGranted() {
return result;
}
}
}

View File

@ -30,4 +30,5 @@ public interface ControlledEntity extends OwnedBy, PartOf {
Domain
}
AclEntityType getEntityType();
}

View File

@ -22,13 +22,13 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.FirewallResponse;
@ -112,7 +112,7 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
return vpcId;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
@ -246,7 +246,7 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
if (getVpcId() != null ){
throw new InvalidParameterValueException("Unable to create firewall rule for the network id=" + networkId +
" as firewall egress rule can be created only for non vpc networks.");
" as firewall egress rule can be created only for non vpc networks.");
}
try {
@ -287,7 +287,7 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
return getNetworkId();
}
@Override
public Integer getIcmpCode() {
if (icmpCode != null) {
@ -339,4 +339,9 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
return null;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.FirewallRule;
}
}

View File

@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.firewall;
import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -328,4 +329,9 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
return FirewallRule.TrafficType.Ingress;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.FirewallRule;
}
}

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.firewall;
import java.util.List;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -398,4 +399,9 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
return null;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.FirewallRule;
}
}

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.nat;
import java.util.List;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -314,4 +315,9 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
return null;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.FirewallRule;
}
}

View File

@ -18,6 +18,8 @@ package com.cloud.network.addr;
import java.util.Date;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.dc.VlanVO;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.dao.IPAddressVO;
@ -40,7 +42,7 @@ public class PublicIp implements PublicIpAddress {
public static PublicIp createFromAddrAndVlan(IPAddressVO addr, VlanVO vlan) {
return new PublicIp(addr, vlan, NetUtils.createSequenceBasedMacAddress(addr.getMacAddress()));
}
@Override
public Ip getAddress() {
return _addr.getAddress();
@ -194,7 +196,7 @@ public class PublicIp implements PublicIpAddress {
public boolean getSystem() {
return _addr.getSystem();
}
@Override
public Long getVpcId() {
return _addr.getVpcId();
@ -232,4 +234,9 @@ public class PublicIp implements PublicIpAddress {
public Long getIpMacAddress() {
return _addr.getMacAddress();
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.PublicIpAddress;
}
}

View File

@ -18,6 +18,7 @@ package com.cloud.network.rules;
import java.util.List;
import org.apache.cloudstack.acl.AclEntityType;
public class StaticNatRuleImpl implements StaticNatRule {
long id;
@ -144,4 +145,9 @@ public class StaticNatRuleImpl implements StaticNatRule {
return null;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.FirewallRule;
}
}

View File

@ -29,6 +29,8 @@ import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
@Entity
@ -191,4 +193,9 @@ public class EventVO implements Event {
public void setArchived(Boolean archived) {
this.archived = archived;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Event;
}
}

View File

@ -29,6 +29,8 @@ import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
@Entity
@ -72,10 +74,10 @@ public class UserIpv6AddressVO implements UserIpv6Address {
@Column(name="domain_id")
private Long domainId = null;
@Column(name = GenericDao.CREATED_COLUMN)
Date created;
protected UserIpv6AddressVO() {
this.uuid = UUID.randomUUID().toString();
}
@ -185,4 +187,9 @@ public class UserIpv6AddressVO implements UserIpv6Address {
public void setCreated(Date created) {
this.created = created;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.UserIpv6Address;
}
}

View File

@ -27,9 +27,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.Encrypt;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name=("vpn_users"))
@ -128,4 +127,9 @@ public class VpnUserVO implements VpnUser {
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.VpnUser;
}
}

View File

@ -29,6 +29,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.Table;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@ -131,4 +133,9 @@ public class AutoScalePolicyVO implements AutoScalePolicy, InternalIdentity {
public void setQuietTime(Integer quietTime) {
this.quietTime = quietTime;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AutoScalePolicy;
}
}

View File

@ -29,6 +29,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.Table;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@ -188,4 +190,9 @@ public class AutoScaleVmGroupVO implements AutoScaleVmGroup, InternalIdentity {
public String getUuid() {
return uuid;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AutoScaleVmGroup;
}
}

View File

@ -33,6 +33,7 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.Identity;
import com.cloud.utils.Pair;
import com.cloud.utils.db.GenericDao;
@ -215,4 +216,9 @@ public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity, Inter
public long getAutoScaleUserId() {
return autoscaleUserId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AutoScaleVmProfile;
}
}

View File

@ -29,6 +29,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.Identity;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.InternalIdentity;
@ -126,4 +127,9 @@ public class ConditionVO implements Condition, Identity, InternalIdentity {
public Date getRemoved() {
return removed;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Condition;
}
}

View File

@ -31,6 +31,8 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.network.IpAddress;
import com.cloud.utils.net.Ip;
@ -333,4 +335,9 @@ public class IPAddressVO implements IpAddress {
public Long getNetworkId() {
return sourceNetworkId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.IpAddress;
}
}

View File

@ -29,6 +29,7 @@ import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.acl.ControlledEntity;
import com.cloud.network.Network;
@ -562,4 +563,9 @@ public class NetworkVO implements Network {
public Long getNetworkACLId() {
return networkACLId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Network;
}
}

View File

@ -25,6 +25,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.network.RemoteAccessVpn;
@Entity
@ -35,13 +37,13 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn {
@Column(name="network_id")
private Long networkId;
@Column(name="domain_id")
private long domainId;
@Column(name="vpn_server_addr_id")
private long serverAddressId;
@Column(name="local_ip")
private String localIp;
@ -50,22 +52,22 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn {
@Column(name="ipsec_psk")
private String ipsecPresharedKey;
@Column(name="state")
private State state;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="uuid")
private String uuid;
@Column(name="vpc_id")
private Long vpcId;
public RemoteAccessVpnVO() {
public RemoteAccessVpnVO() {
this.uuid = UUID.randomUUID().toString();
}
@ -81,12 +83,12 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn {
this.uuid = UUID.randomUUID().toString();
this.vpcId = vpcId;
}
@Override
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
@ -95,7 +97,7 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn {
public long getAccountId() {
return accountId;
}
@Override
public long getServerAddressId() {
return serverAddressId;
@ -128,7 +130,7 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn {
public long getDomainId() {
return domainId;
}
@Override
public Long getNetworkId() {
return networkId;
@ -148,4 +150,9 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn {
public Long getVpcId() {
return vpcId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.RemoteAccessVpn;
}
}

View File

@ -5,7 +5,7 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
@ -29,6 +29,8 @@ import javax.persistence.Table;
import com.cloud.network.Site2SiteCustomerGateway;
import com.cloud.utils.db.Encrypt;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@ -72,7 +74,7 @@ public class Site2SiteCustomerGatewayVO implements Site2SiteCustomerGateway {
@Column(name="domain_id")
private Long domainId;
@Column(name="account_id")
private Long accountId;
@ -195,7 +197,7 @@ public class Site2SiteCustomerGatewayVO implements Site2SiteCustomerGateway {
public String getUuid() {
return uuid;
}
@Override
public long getDomainId() {
return domainId;
@ -205,4 +207,9 @@ public class Site2SiteCustomerGatewayVO implements Site2SiteCustomerGateway {
public long getAccountId() {
return accountId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Site2SiteCustomerGateway;
}
}

View File

@ -5,7 +5,7 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
@ -31,6 +31,8 @@ import javax.persistence.Table;
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.network.Site2SiteVpnConnection.State;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@ -40,32 +42,32 @@ public class Site2SiteVpnConnectionVO implements Site2SiteVpnConnection, Interna
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="uuid")
private String uuid;
private String uuid;
@Column(name="vpn_gateway_id")
private long vpnGatewayId;
@Column(name="customer_gateway_id")
private long customerGatewayId;
@Column(name="state")
@Enumerated(value=EnumType.STRING)
private State state;
@Column(name="domain_id")
private Long domainId;
@Column(name="account_id")
private Long accountId;
@Column(name=GenericDao.CREATED_COLUMN)
private Date created;
@Column(name=GenericDao.REMOVED_COLUMN)
private Date removed;
@Column(name="passive")
private boolean passive;
@ -80,12 +82,12 @@ public class Site2SiteVpnConnectionVO implements Site2SiteVpnConnection, Interna
this.domainId = domainId;
this.passive = passive;
}
@Override
public long getId() {
return id;
}
@Override
public State getState() {
return state;
@ -130,11 +132,11 @@ public class Site2SiteVpnConnectionVO implements Site2SiteVpnConnection, Interna
public void setRemoved(Date removed) {
this.removed = removed;
}
public String getUuid() {
return uuid;
}
@Override
public long getDomainId() {
return domainId;
@ -152,4 +154,9 @@ public class Site2SiteVpnConnectionVO implements Site2SiteVpnConnection, Interna
public void setPassive(boolean passive) {
this.passive = passive;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Site2SiteVpnConnection;
}
}

View File

@ -5,7 +5,7 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
@ -28,6 +28,8 @@ import javax.persistence.Table;
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@ -37,10 +39,10 @@ public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="uuid")
private String uuid;
private String uuid;
@Column(name="addr_id")
private long addrId;
@ -49,13 +51,13 @@ public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway {
@Column(name="domain_id")
private Long domainId;
@Column(name="account_id")
private Long accountId;
@Column(name=GenericDao.REMOVED_COLUMN)
private Date removed;
public Site2SiteVpnGatewayVO() { }
public Site2SiteVpnGatewayVO(long accountId, long domainId, long addrId, long vpcId) {
@ -65,7 +67,7 @@ public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway {
this.accountId = accountId;
this.domainId = domainId;
}
@Override
public long getId() {
return id;
@ -75,7 +77,7 @@ public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway {
public long getVpcId() {
return vpcId;
}
public void setVpcId(long vpcId) {
this.vpcId = vpcId;
}
@ -101,7 +103,7 @@ public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway {
public String getUuid() {
return uuid;
}
@Override
public long getDomainId() {
return domainId;
@ -111,4 +113,9 @@ public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway {
public long getAccountId() {
return accountId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Site2SiteVpnGateway;
}
}

View File

@ -5,7 +5,7 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
@ -34,6 +34,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
import com.cloud.utils.net.NetUtils;
@ -192,7 +194,7 @@ public class FirewallRuleVO implements FirewallRule {
this.uuid = UUID.randomUUID().toString();
}
public FirewallRuleVO(String xId, Long ipAddressId, Integer portStart, Integer portEnd, String protocol,
public FirewallRuleVO(String xId, Long ipAddressId, Integer portStart, Integer portEnd, String protocol,
long networkId, long accountId, long domainId, Purpose purpose, List<String> sourceCidrs, Integer icmpCode,
Integer icmpType, Long related, TrafficType trafficType) {
this.xId = xId;
@ -230,7 +232,7 @@ public class FirewallRuleVO implements FirewallRule {
this.type = type;
}
public FirewallRuleVO(String xId, long ipAddressId, int port, String protocol, long networkId, long accountId,
public FirewallRuleVO(String xId, long ipAddressId, int port, String protocol, long networkId, long accountId,
long domainId, Purpose purpose, List<String> sourceCidrs, Integer icmpCode, Integer icmpType, Long related) {
this(xId, ipAddressId, port, port, protocol, networkId, accountId, domainId, purpose, sourceCidrs, icmpCode, icmpType, related, null);
}
@ -272,4 +274,9 @@ public class FirewallRuleVO implements FirewallRule {
public TrafficType getTrafficType() {
return trafficType;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.FirewallRule;
}
}

View File

@ -25,6 +25,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
@ -50,7 +51,7 @@ public class SecurityGroupVO implements SecurityGroup {
@Column(name = "uuid")
private String uuid;
public SecurityGroupVO() {
this.uuid = UUID.randomUUID().toString();
}
@ -87,13 +88,18 @@ public class SecurityGroupVO implements SecurityGroup {
public long getAccountId() {
return accountId;
}
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.SecurityGroup;
}
}

View File

@ -28,6 +28,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.Identity;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.InternalIdentity;
@ -138,4 +139,9 @@ public class StaticRouteVO implements StaticRoute {
buf.append(uuid).append("|").append(cidr).append("|").append(vpcGatewayId).append("]");
return buf.toString();
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.StaticRoute;
}
}

View File

@ -28,58 +28,60 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
@Entity
@Table(name="vpc_gateways")
public class VpcGatewayVO implements VpcGateway {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name = "ip4_address")
String ip4Address;
@Column(name="gateway")
@Column(name="gateway")
String gateway;
@Column(name="netmask")
@Column(name="netmask")
String netmask;
@Column(name="vlan_tag")
@Column(name="vlan_tag")
String broadcastUri;
@Column(name = "type")
@Enumerated(value = EnumType.STRING)
VpcGateway.Type type;
@Column(name="vpc_id")
Long vpcId;
@Column(name="zone_id")
long zoneId;
@Column(name="network_id")
long networkId;
@Column(name=GenericDao.CREATED_COLUMN)
Date created;
@Column(name=GenericDao.REMOVED_COLUMN)
Date removed;
@Column(name="uuid")
private String uuid;
@Column(name = "account_id")
long accountId;
@Column(name = "domain_id")
long domainId;
@Column(name="state")
@Enumerated(value=EnumType.STRING)
State state;
@ -95,7 +97,7 @@ public class VpcGatewayVO implements VpcGateway {
protected VpcGatewayVO(){
this.uuid = UUID.randomUUID().toString();
}
/**
* @param ip4Address
* @param type
@ -110,7 +112,7 @@ public class VpcGatewayVO implements VpcGateway {
* @param account_id
* @param sourceNat
*/
public VpcGatewayVO(String ip4Address, Type type, long vpcId, long zoneId, long networkId, String broadcastUri,
public VpcGatewayVO(String ip4Address, Type type, long vpcId, long zoneId, long networkId, String broadcastUri,
String gateway, String netmask, long accountId, long domainId, boolean sourceNat, long networkACLId) {
this.ip4Address = ip4Address;
this.type = type;
@ -131,9 +133,9 @@ public class VpcGatewayVO implements VpcGateway {
@Override
public String getUuid() {
return this.uuid;
return this.uuid;
}
@Override
public long getId() {
return id;
@ -163,7 +165,7 @@ public class VpcGatewayVO implements VpcGateway {
public long getNetworkId() {
return networkId;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder("VpcGateway[");
@ -185,7 +187,7 @@ public class VpcGatewayVO implements VpcGateway {
public String getBroadcastUri() {
return broadcastUri;
}
@Override
public long getAccountId() {
return accountId;
@ -218,4 +220,9 @@ public class VpcGatewayVO implements VpcGateway {
public long getNetworkACLId() {
return networkACLId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.VpcGateway;
}
}

View File

@ -26,6 +26,8 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
@Entity
@ -34,13 +36,13 @@ public class VpcVO implements Vpc {
@Id
@Column(name="id")
long id;
@Column(name="uuid")
private String uuid;
@Column(name="name")
private String name;
@Column(name = "display_text")
String displayText;
@ -49,36 +51,36 @@ public class VpcVO implements Vpc {
@Column(name="cidr")
private String cidr = null;
@Column(name="domain_id")
Long domainId = null;
@Column(name="account_id")
Long accountId = null;
@Column(name="state")
@Enumerated(value=EnumType.STRING)
State state;
@Column(name="vpc_offering_id")
long vpcOfferingId;
@Column(name=GenericDao.REMOVED_COLUMN)
Date removed;
@Column(name=GenericDao.CREATED_COLUMN)
Date created;
@Column(name="network_domain")
String networkDomain;
@Column(name="restart_required")
boolean restartRequired = false;
public VpcVO() {
this.uuid = UUID.randomUUID().toString();
}
public VpcVO(long zoneId, String name, String displayText, long accountId, long domainId, long vpcOffId, String cidr,
String networkDomain) {
this.zoneId = zoneId;
@ -117,7 +119,7 @@ public class VpcVO implements Vpc {
public String getCidr() {
return cidr;
}
@Override
public long getDomainId() {
return domainId;
@ -158,7 +160,7 @@ public class VpcVO implements Vpc {
public void setDisplayText(String displayText) {
this.displayText = displayText;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder("[VPC [");
@ -169,7 +171,7 @@ public class VpcVO implements Vpc {
public String getNetworkDomain() {
return networkDomain;
}
public void setRestartRequired(boolean restartRequired) {
this.restartRequired = restartRequired;
}
@ -178,4 +180,9 @@ public class VpcVO implements Vpc {
public boolean isRestartRequired() {
return restartRequired;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Vpc;
}
}

View File

@ -28,9 +28,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name = "project_invitations")
@ -147,4 +146,9 @@ public class ProjectInvitationVO implements ProjectInvitation {
public long getAccountId() {
return forAccountId == null ? -1 : forAccountId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.ProjectInvitation;
}
}

View File

@ -21,6 +21,9 @@ import com.cloud.utils.db.GenericDao;
import com.google.gson.annotations.Expose;
import javax.persistence.*;
import org.apache.cloudstack.acl.AclEntityType;
import java.util.Date;
import java.util.UUID;
@ -226,4 +229,9 @@ public class SnapshotVO implements Snapshot {
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Snapshot;
}
}

View File

@ -31,6 +31,8 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType;
@ -573,4 +575,9 @@ public class VMTemplateVO implements VirtualMachineTemplate {
this.updated = updated;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.VirtualMachineTemplate;
}
}

View File

@ -32,10 +32,11 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.GenericDao;
import com.cloud.vm.VirtualMachine.State;
@Entity
@Table(name = "volumes")
@ -156,7 +157,7 @@ public class VolumeVO implements Volume {
@Column(name = "iso_id")
private Long isoId;
@Transient
// @Column(name="reservation")
String reservationId;
@ -558,7 +559,7 @@ public class VolumeVO implements Volume {
public void setFormat(Storage.ImageFormat format) {
this.format = format;
}
public void setVmSnapshotChainSize(Long vmSnapshotChainSize){
this.vmSnapshotChainSize = vmSnapshotChainSize;
}
@ -574,10 +575,15 @@ public class VolumeVO implements Volume {
public void setIsoId(Long isoId) {
this.isoId =isoId;
}
// don't use this directly, use volume state machine instead
// This method is used by UpdateVolume as a part of "Better control over first class objects in CS"
public void setState(State state) {
this.state = state;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Volume;
}
}

View File

@ -27,53 +27,52 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.server.ResourceTag;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name="resource_tags")
public class ResourceTagVO implements ResourceTag {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="uuid")
private String uuid;
@Column(name="key")
private String key;
@Column(name="value")
String value;
@Column(name="domain_id")
long domainId;
@Column(name="account_id")
long accountId;
@Column(name="resource_id")
long resourceId;
@Column(name="resource_uuid")
private String resourceUuid;
@Column(name="resource_type")
@Enumerated(value=EnumType.STRING)
private ResourceObjectType resourceType;
@Column(name="customer")
String customer;
protected ResourceTagVO(){
this.uuid = UUID.randomUUID().toString();
}
/**
* @param key
* @param value
@ -84,7 +83,7 @@ public class ResourceTagVO implements ResourceTag {
* @param customer TODO
* @param resourceUuid TODO
*/
public ResourceTagVO(String key, String value, long accountId, long domainId, long resourceId,
public ResourceTagVO(String key, String value, long accountId, long domainId, long resourceId,
ResourceObjectType resourceType, String customer, String resourceUuid) {
super();
this.key = key;
@ -97,8 +96,8 @@ public class ResourceTagVO implements ResourceTag {
this.customer = customer;
this.resourceUuid = resourceUuid;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder("Tag[");
@ -107,7 +106,7 @@ public class ResourceTagVO implements ResourceTag {
.append("|accountId=").append(accountId).append("]");
return buf.toString();
}
@Override
public long getId() {
return id;
@ -147,7 +146,7 @@ public class ResourceTagVO implements ResourceTag {
public String getUuid() {
return uuid;
}
@Override
public String getCustomer() {
return customer;
@ -157,4 +156,9 @@ public class ResourceTagVO implements ResourceTag {
public String getResourceUuid() {
return resourceUuid;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.ResourceTag;
}
}

View File

@ -28,6 +28,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
@Entity
@ -186,4 +188,9 @@ public class AccountVO implements Account {
public boolean isDefault() {
return isDefault;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Account;
}
}

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.user;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.api.InternalIdentity;
import javax.persistence.Column;
@ -29,27 +30,27 @@ import javax.persistence.Transient;
@Entity
@Table(name="ssh_keypairs")
public class SSHKeyPairVO implements SSHKeyPair {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private Long id = null;
@Column(name="account_id")
private long accountId;
@Column(name="domain_id")
private long domainId;
@Column(name="keypair_name")
private String name;
@Column(name="fingerprint")
private String fingerprint;
@Column(name="public_key", length=5120)
private String publicKey;
@Transient
private String privateKey;
@ -57,7 +58,7 @@ public class SSHKeyPairVO implements SSHKeyPair {
public long getId() {
return id;
}
@Override
public long getAccountId() {
return accountId;
@ -67,7 +68,7 @@ public class SSHKeyPairVO implements SSHKeyPair {
public long getDomainId() {
return domainId;
}
@Override
public String getFingerprint() {
return fingerprint;
@ -82,7 +83,7 @@ public class SSHKeyPairVO implements SSHKeyPair {
public String getPublicKey() {
return publicKey;
}
@Override
public String getPrivateKey() {
return privateKey;
@ -111,9 +112,14 @@ public class SSHKeyPairVO implements SSHKeyPair {
public void setPublicKey(String publicKey) {
this.publicKey = publicKey;
}
public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.SSHKeyPair;
}
}

View File

@ -28,9 +28,8 @@ import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Table;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name="instance_group")
@ -41,16 +40,16 @@ public class InstanceGroupVO implements InstanceGroup {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="name")
String name;
@Column(name="account_id")
private long accountId;
@Column(name="domain_id", table="account", insertable=false, updatable=false)
private long domainId;
@Column(name=GenericDao.REMOVED_COLUMN)
private Date removed;
@ -59,47 +58,47 @@ public class InstanceGroupVO implements InstanceGroup {
@Column(name="uuid")
private String uuid;
@Column(name="type", table="account", insertable=false, updatable=false)
private short accountType;
public InstanceGroupVO(String name, long accountId) {
this.name = name;
this.accountId = accountId;
this.uuid = UUID.randomUUID().toString();
}
protected InstanceGroupVO() {
super();
}
@Override
public long getId() {
return id;
}
@Override
public String getName() {
return name;
return name;
}
@Override
public long getAccountId() {
return accountId;
}
public long getDomainId() {
return domainId;
}
public Date getRemoved() {
return removed;
}
public Date getCreated() {
return created;
}
public void setName(String name) {
this.name = name;
}
@ -108,13 +107,18 @@ public class InstanceGroupVO implements InstanceGroup {
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public Short getAccountType() {
return accountType;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.InstanceGroup;
}
}

View File

@ -5,7 +5,7 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
@ -36,6 +36,8 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.db.Encrypt;
import com.cloud.utils.db.GenericDao;
@ -153,7 +155,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
@Column(name="tags")
protected String tags;
*/
@Transient
Map<String, String> details;
@ -162,7 +164,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
@Column(name="disk_offering_id")
protected Long diskOfferingId;
public VMInstanceVO(long id,
long serviceOfferingId,
String name,
@ -501,4 +503,9 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
return this.dynamicallyScalable;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.VirtualMachine;
}
}

View File

@ -28,6 +28,9 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import java.util.Date;
import java.util.UUID;
@ -223,4 +226,9 @@ public class NicIpAliasVO implements NicIpAlias {
return startIpOfSubnet;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.NicIpAlias;
}
}

View File

@ -26,6 +26,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
import com.cloud.vm.NicSecondaryIp;
@ -157,4 +159,9 @@ public class NicSecondaryIpVO implements NicSecondaryIp {
public void setVmId(Long vmId) {
this.vmId = vmId;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.NicSecondaryIp;
}
}

View File

@ -33,6 +33,7 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotOptions;
import com.cloud.utils.db.GenericDao;
@ -83,14 +84,14 @@ public class VMSnapshotVO implements VMSnapshot {
@Column(name = "current")
Boolean current;
@Column(name = "parent")
Long parent;
@Column(name = "updated")
@Temporal(value = TemporalType.TIMESTAMP)
Date updated;
@Column(name="update_count", updatable = true, nullable=false)
protected long updatedCount;
@ -231,8 +232,13 @@ public class VMSnapshotVO implements VMSnapshot {
public Type getType() {
return type;
}
public void setRemoved(Date removed) {
this.removed = removed;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.VMSnapshot;
}
}

View File

@ -116,4 +116,9 @@ public class AclGroupVO implements AclGroup {
public Date getCreated() {
return created;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AclGroup;
}
}

View File

@ -133,4 +133,9 @@ public class AclPolicyVO implements AclPolicy {
this.policyType = policyType;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AclPolicy;
}
}

View File

@ -33,5 +33,6 @@ public interface AclPolicyPermissionDao extends GenericDao<AclPolicyPermissionVO
List<AclPolicyPermissionVO> listGrantedByActionAndScope(long policyId, String action, PermissionScope scope);
List<AclPolicyPermissionVO> listByPolicyActionAndEntity(long policyId, String action, String entityType);
}

View File

@ -92,4 +92,13 @@ public class AclPolicyPermissionDaoImpl extends GenericDaoBase<AclPolicyPermissi
return listBy(sc);
}
@Override
public List<AclPolicyPermissionVO> listByPolicyActionAndEntity(long policyId, String action, String entityType) {
SearchCriteria<AclPolicyPermissionVO> sc = fullSearch.create();
sc.setParameters("policyId", policyId);
sc.setParameters("entityType", entityType);
sc.setParameters("action", action);
return listBy(sc);
}
}

View File

@ -28,6 +28,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.AclEntityType;
@Entity
@Table(name = ("affinity_group"))
@ -124,4 +125,9 @@ public class AffinityGroupVO implements AffinityGroup {
return buf.toString();
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AffinityGroup;
}
}

View File

@ -37,6 +37,8 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.db.Encrypt;
import com.cloud.utils.db.GenericDao;
@ -574,4 +576,9 @@ public class VMEntityVO implements VirtualMachine, FiniteStateObject<State, Virt
this.vmReservation = vmReservation;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.VirtualMachine;
}
}

View File

@ -20,6 +20,9 @@ package org.apache.cloudstack.region.gslb;
import com.cloud.region.ha.GlobalLoadBalancerRule;
import javax.persistence.*;
import org.apache.cloudstack.acl.AclEntityType;
import java.util.UUID;
@Entity
@ -180,4 +183,9 @@ public class GlobalLoadBalancerRuleVO implements GlobalLoadBalancerRule {
public GlobalLoadBalancerRule.State getState() {
return state;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.GlobalLoadBalancerRule;
}
}

View File

@ -25,6 +25,7 @@ import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
@ -438,4 +439,9 @@ public class TemplateObject implements TemplateInfo {
return true;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.VirtualMachineTemplate;
}
}

View File

@ -23,6 +23,7 @@ import java.util.List;
import javax.inject.Inject;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
@ -367,4 +368,9 @@ public class SnapshotObject implements SnapshotInfo {
}
return true;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Snapshot;
}
}

View File

@ -23,6 +23,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
import org.apache.cloudstack.storage.image.datastore.ImageStoreInfo;
@ -285,4 +286,10 @@ public class TemplateEntityImpl implements TemplateEntity {
return 0;
}
@Override
public AclEntityType getEntityType() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -21,6 +21,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.engine.cloud.entity.api.SnapshotEntity;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@ -183,4 +184,9 @@ public class SnapshotEntityImpl implements SnapshotEntity {
return null;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Snapshot;
}
}

View File

@ -22,6 +22,8 @@ import javax.inject.Inject;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.dao.DiskOfferingDao;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
@ -640,4 +642,9 @@ public class VolumeObject implements VolumeInfo {
public Long getVmSnapshotChainSize() {
return this.volumeVO.getVmSnapshotChainSize();
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Volume;
}
}

View File

@ -27,6 +27,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.acl.PermissionScope;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
@ -241,5 +242,9 @@ public class AclGroupJoinVO extends BaseViewVO implements ControlledViewEntity {
return permissionAccessType;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AclGroup;
}
}

View File

@ -210,4 +210,9 @@ public class AclPolicyJoinVO extends BaseViewVO implements ControlledViewEntity
return permissionAllowDeny;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AclPolicy;
}
}

View File

@ -23,6 +23,7 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import org.apache.cloudstack.acl.ControlledEntity;
import com.cloud.vm.VirtualMachine;
@ -192,5 +193,10 @@ public class AffinityGroupJoinVO extends BaseViewVO implements ControlledViewEnt
return aclType;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.AffinityGroup;
}
}

View File

@ -26,6 +26,8 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.network.Network.GuestType;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.router.VirtualRouter;
@ -503,4 +505,9 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
public VirtualRouter.Role getRole() {
return role;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.VirtualMachine;
}
}

View File

@ -25,6 +25,8 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.event.Event.State;
import com.cloud.utils.db.GenericDao;
@ -216,4 +218,9 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity {
public boolean getArchived() {
return archived;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.Event;
}
}

View File

@ -23,6 +23,8 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.utils.db.GenericDao;
@Entity
@ -156,4 +158,9 @@ public class InstanceGroupJoinVO extends BaseViewVO implements ControlledViewEnt
public Date getCreated() {
return created;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.InstanceGroup;
}
}

View File

@ -25,6 +25,8 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.acl.AclEntityType;
import com.cloud.projects.ProjectInvitation.State;
import com.cloud.utils.db.GenericDao;
@ -161,4 +163,9 @@ public class ProjectInvitationJoinVO extends BaseViewVO implements ControlledVie
public String getDomainPath() {
return domainPath;
}
@Override
public AclEntityType getEntityType() {
return AclEntityType.ProjectInvitation;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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");