Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
// under the License.
package org.apache.cloudstack.api;

import com.cloud.user.Account;

import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.context.CallContext;

public abstract class BaseListDomainResourcesCmd extends BaseListCmd implements IBaseListDomainResourcesCmd {

Expand All @@ -42,7 +45,10 @@ public boolean listAll() {
@Override
public boolean isRecursive() {
if (listAll()) {
return recursive == null ? true : recursive;
Account caller = CallContext.current().getCallingAccount();
if (caller.getType() != Account.Type.NORMAL) {
return recursive == null ? true : recursive;
}
}
return recursive == null ? false : recursive;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ public ListResponse<KubernetesClusterResponse> listKubernetesClusters(ListKubern
accountManager.buildACLSearchParameters(caller, clusterId, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
Project.ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), clusterId);
Filter searchFilter = new Filter(KubernetesClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<KubernetesClusterVO> sb = kubernetesClusterDao.createSearchBuilder();
accountManager.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
Expand Down
26 changes: 13 additions & 13 deletions server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ private Pair<List<UserAccountJoinVO>, Integer> searchForUsersInternal(ListUsersC
Object keyword = cmd.getKeyword();

Long domainId = cmd.getDomainId();
boolean recursive = cmd.isRecursive();
boolean recursive = determineRecursiveness(cmd.isRecursive(), id);
Long pageSizeVal = cmd.getPageSizeVal();
Long startIndex = cmd.getStartIndex();

Expand Down Expand Up @@ -683,7 +683,7 @@ private Pair<List<EventJoinVO>, Integer> searchForEventsInternal(ListEventsCmd c
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);

Filter searchFilter = new Filter(EventJoinVO.class, "createDate", false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<EventJoinVO> sb = _eventJoinDao.createSearchBuilder();
Expand Down Expand Up @@ -887,7 +887,7 @@ private Pair<List<InstanceGroupJoinVO>, Integer> searchForVmGroupsInternal(ListV
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);

Filter searchFilter = new Filter(InstanceGroupJoinVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());

Expand Down Expand Up @@ -945,7 +945,7 @@ private Pair<List<UserVmJoinVO>, Integer> searchForUserVMsInternal(ListVMsCmd cm
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, listAll, false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);

Filter searchFilter = new Filter(UserVmJoinVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());

Expand Down Expand Up @@ -1270,7 +1270,7 @@ private Pair<List<SecurityGroupJoinVO>, Integer> searchForSecurityGroupsInternal
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);

Filter searchFilter = new Filter(SecurityGroupJoinVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<SecurityGroupJoinVO> sb = _securityGroupJoinDao.createSearchBuilder();
Expand Down Expand Up @@ -1397,7 +1397,7 @@ private Pair<List<DomainRouterJoinVO>, Integer> searchForRoutersInternal(BaseLis
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
Filter searchFilter = new Filter(DomainRouterJoinVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());

SearchBuilder<DomainRouterJoinVO> sb = _routerJoinDao.createSearchBuilder();
Expand Down Expand Up @@ -1554,7 +1554,7 @@ private Pair<List<ProjectJoinVO>, Integer> listProjectsInternal(ListProjectsCmd
Long startIndex = cmd.getStartIndex();
Long pageSize = cmd.getPageSizeVal();
boolean listAll = cmd.listAll();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
cmd.getTags();


Expand Down Expand Up @@ -1726,7 +1726,7 @@ public Pair<List<ProjectInvitationJoinVO>, Integer> listProjectInvitationsIntern
Long startIndex = cmd.getStartIndex();
Long pageSizeVal = cmd.getPageSizeVal();
Long userId = cmd.getUserId();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
boolean listAll = cmd.listAll();

Account caller = CallContext.current().getCallingAccount();
Expand Down Expand Up @@ -2051,7 +2051,7 @@ private Pair<List<VolumeJoinVO>, Integer> searchForVolumesInternal(ListVolumesCm
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
Filter searchFilter = new Filter(VolumeJoinVO.class, "created", false, cmd.getStartIndex(), cmd.getPageSizeVal());

// hack for now, this should be done better but due to needing a join I
Expand Down Expand Up @@ -2293,7 +2293,7 @@ private Pair<List<AccountJoinVO>, Integer> searchForAccountsInternal(ListAccount
Long domainId = cmd.getDomainId();
Long accountId = cmd.getId();
String accountName = cmd.getSearchName();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), accountId);
boolean listAll = cmd.listAll();
boolean callerIsAdmin = _accountMgr.isAdmin(caller.getId());
Account account;
Expand Down Expand Up @@ -2899,7 +2899,7 @@ private Pair<List<DiskOfferingJoinVO>, Integer> searchForDiskOfferingsInternal(L
Object keyword = cmd.getKeyword();
Long domainId = cmd.getDomainId();
Boolean isRootAdmin = _accountMgr.isRootAdmin(account.getAccountId());
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
Long zoneId = cmd.getZoneId();
Long volumeId = cmd.getVolumeId();
Long storagePoolId = cmd.getStoragePoolId();
Expand Down Expand Up @@ -3068,7 +3068,7 @@ private Pair<List<ServiceOfferingJoinVO>, Integer> searchForServiceOfferingsInte
Boolean isSystem = cmd.getIsSystem();
String vmTypeStr = cmd.getSystemVmType();
ServiceOfferingVO currentVmOffering = null;
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
Long zoneId = cmd.getZoneId();
Integer cpuNumber = cmd.getCpuNumber();
Integer memory = cmd.getMemory();
Expand Down Expand Up @@ -4001,7 +4001,7 @@ public Pair<List<AffinityGroupJoinVO>, Integer> searchForAffinityGroupsInternal(
final String accountName = cmd.getAccountName();
Long domainId = cmd.getDomainId();
final Long projectId = cmd.getProjectId();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), affinityGroupId);
final Boolean listAll = cmd.listAll();
final Long startIndex = cmd.getStartIndex();
final Long pageSize = cmd.getPageSizeVal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ public Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd
Long physicalNetworkId = cmd.getPhysicalNetworkId();
List<String> supportedServicesStr = cmd.getSupportedServices();
Boolean restartRequired = cmd.isRestartRequired();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
Boolean specifyIpRanges = cmd.isSpecifyIpRanges();
Long vpcId = cmd.getVpcId();
Boolean canUseForDeploy = cmd.canUseForDeploy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public Pair<List<? extends FirewallRule>, Integer> listFirewallRules(IListFirewa
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);

Filter filter = new Filter(FirewallRuleVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<FirewallRuleVO> sb = _firewallDao.createSearchBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,7 @@ public Pair<List<? extends LoadBalancer>, Integer> searchForLoadBalancers(ListLo
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);

Filter searchFilter = new Filter(LoadBalancerVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<LoadBalancerVO> sb = _lbDao.createSearchBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ public Pair<List<? extends PortForwardingRule>, Integer> listPortForwardingRules
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);

Filter filter = new Filter(PortForwardingRuleVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<PortForwardingRuleVO> sb = _portForwardingDao.createSearchBuilder();
Expand Down Expand Up @@ -1041,6 +1041,7 @@ public Pair<List<? extends FirewallRule>, Integer> searchStaticNatRules(Long ipI
Long projectId, boolean isRecursive, boolean listAll) {
Account caller = CallContext.current().getCallingAccount();
List<Long> permittedAccounts = new ArrayList<Long>();
isRecursive = determineRecursiveness(isRecursive, id);;

if (ipId != null) {
IPAddressVO ipAddressVO = _ipAddressDao.findById(ipId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public Pair<List<? extends NetworkACL>, Integer> listNetworkACLs(final ListNetwo
// and list ACLs belonging to the permitted VPCs
final List<Long> permittedAccounts = new ArrayList<Long>();
Long domainId = cmd.getDomainId();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
final String accountName = cmd.getAccountName();
final Long projectId = cmd.getProjectId();
final boolean listAll = cmd.listAll();
Expand Down Expand Up @@ -735,7 +735,7 @@ public Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(final L
// List permitted VPCs and filter aclItems
final List<Long> permittedAccounts = new ArrayList<Long>();
Long domainId = cmd.getDomainId();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
final String accountName = cmd.getAccountName();
final Long projectId = cmd.getProjectId();
final boolean listAll = cmd.listAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@ public Pair<List<? extends Vpc>, Integer> listVpcs(final Long id, final String v
final Long zoneId, Boolean isRecursive, final Boolean listAll, final Boolean restartRequired, final Map<String, String> tags, final Long projectId,
final Boolean display) {
final Account caller = CallContext.current().getCallingAccount();
isRecursive = determineRecursiveness(isRecursive, id);
final List<Long> permittedAccounts = new ArrayList<Long>();
final Pair<Long, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Pair<Long, ListProjectResourcesCriteria>(domainId,null);
_accountMgr.buildACLSearchParameters(caller, id, accountName, projectId, permittedAccounts, domainIdRecursiveListProject, listAll, false);
Expand Down Expand Up @@ -2093,7 +2094,7 @@ public Pair<List<PrivateGateway>, Integer> listPrivateGateway(final ListPrivateG
final String vlan = cmd.getVlan();
final Long vpcId = cmd.getVpcId();
final Long id = cmd.getId();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
final Boolean listAll = cmd.listAll();
Long domainId = cmd.getDomainId();
final String accountName = cmd.getAccountName();
Expand Down Expand Up @@ -2341,7 +2342,7 @@ public Pair<List<? extends StaticRoute>, Integer> listStaticRoutes(final ListSta
final Long gatewayId = cmd.getGatewayId();
final Long vpcId = cmd.getVpcId();
Long domainId = cmd.getDomainId();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
final Boolean listAll = cmd.listAll();
final String accountName = cmd.getAccountName();
final Account caller = CallContext.current().getCallingAccount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public Pair<List<? extends VpnUser>, Integer> searchForVpnUsers(ListVpnUsersCmd
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
Filter searchFilter = new Filter(VpnUserVO.class, "username", true, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<VpnUserVO> sb = _vpnUsersDao.createSearchBuilder();
_accountMgr.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
Expand Down Expand Up @@ -706,7 +706,7 @@ public Pair<List<? extends RemoteAccessVpn>, Integer> searchForRemoteAccessVpns(
_accountMgr.buildACLSearchParameters(caller, null, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
Long domainId = domainIdRecursiveListProject.first();
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.second();
Boolean isRecursive = cmd.isRecursive();
Boolean isRecursive = determineRecursiveness(cmd.isRecursive(), vpnId);

Filter filter = new Filter(RemoteAccessVpnVO.class, "serverAddressId", false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<RemoteAccessVpnVO> sb = _remoteAccessVpnDao.createSearchBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ public Site2SiteVpnConnection resetVpnConnection(ResetVpnConnectionCmd cmd) thro
public Pair<List<? extends Site2SiteCustomerGateway>, Integer> searchForCustomerGateways(ListVpnCustomerGatewaysCmd cmd) {
Long id = cmd.getId();
Long domainId = cmd.getDomainId();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
String accountName = cmd.getAccountName();
boolean listAll = cmd.listAll();
long startIndex = cmd.getStartIndex();
Expand Down Expand Up @@ -668,7 +668,7 @@ public Pair<List<? extends Site2SiteVpnGateway>, Integer> searchForVpnGateways(L
Boolean display = cmd.getDisplay();

Long domainId = cmd.getDomainId();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
String accountName = cmd.getAccountName();
boolean listAll = cmd.listAll();
long startIndex = cmd.getStartIndex();
Expand Down Expand Up @@ -716,7 +716,7 @@ public Pair<List<? extends Site2SiteVpnConnection>, Integer> searchForVpnConnect
Boolean display = cmd.getDisplay();

Long domainId = cmd.getDomainId();
boolean isRecursive = cmd.isRecursive();
boolean isRecursive = determineRecursiveness(cmd.isRecursive(), id);
String accountName = cmd.getAccountName();
boolean listAll = cmd.listAll();
long startIndex = cmd.getStartIndex();
Expand Down
Loading