Skip to content

Commit 1e0d671

Browse files
author
Alena Prokharchyk
committed
CLOUDSTACK-6436: listResourceDetails - don't return entries set with display=false, by default
Conflicts: api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java
1 parent a7e267b commit 1e0d671

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

api/src/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,10 @@ public long getEntityOwnerId() {
9999

100100

101101
public Boolean getDisplay() {
102-
Account caller = CallContext.current().getCallingAccount();
103-
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
104-
return true;
102+
if (display != null) {
103+
return display;
105104
}
106-
return display;
105+
return true;
107106
}
108107

109108
/////////////////////////////////////////////////////

api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
import java.util.List;
2121

22+
import org.apache.cloudstack.acl.RoleType;
2223
import org.apache.cloudstack.api.APICommand;
2324
import org.apache.cloudstack.api.ApiConstants;
2425
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
2526
import org.apache.cloudstack.api.Parameter;
2627
import org.apache.cloudstack.api.response.ListResponse;
2728
import org.apache.cloudstack.api.response.ResourceDetailResponse;
2829
import org.apache.cloudstack.api.response.ResourceTagResponse;
29-
import org.apache.cloudstack.context.CallContext;
3030

3131
import com.cloud.server.ResourceTag;
3232

@@ -45,7 +45,7 @@ public class ListResourceDetailsCmd extends BaseListProjectAndAccountResourcesCm
4545
private String key;
4646

4747
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "if set to true, only details marked with display=true, are returned."
48-
+ " Always false is the call is made by the regular user", since = "4.3")
48+
+ " False by default", since = "4.3", authorized = { RoleType.Admin })
4949
private Boolean forDisplay;
5050

5151
public String getResourceId() {
@@ -61,12 +61,12 @@ public String getCommandName() {
6161
return s_name;
6262
}
6363

64-
public Boolean forDisplay() {
65-
if (!_accountService.isAdmin(CallContext.current().getCallingAccount().getType())) {
66-
return true;
64+
@Override
65+
public Boolean getDisplay() {
66+
if (forDisplay != null) {
67+
return forDisplay;
6768
}
68-
69-
return forDisplay;
69+
return super.getDisplay();
7070
}
7171

7272
/////////////////////////////////////////////////////

server/src/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3321,7 +3321,7 @@ private List<AffinityGroupJoinVO> listDomainLevelAffinityGroups(SearchCriteria<A
33213321
@Override
33223322
public List<ResourceDetailResponse> listResourceDetails(ListResourceDetailsCmd cmd) {
33233323
String key = cmd.getKey();
3324-
Boolean forDisplay = cmd.forDisplay();
3324+
Boolean forDisplay = cmd.getDisplay();
33253325
ResourceTag.ResourceObjectType resourceType = cmd.getResourceType();
33263326
String resourceIdStr = cmd.getResourceId();
33273327
Long resourceId = null;

0 commit comments

Comments
 (0)