@@ -856,7 +856,7 @@ private Pair<List<EventJoinVO>, Integer> searchForEventsInternal(ListEventsCmd c
856856
857857 private Pair <List <Long >, Integer > searchForEventIdsAndCount (ListEventsCmd cmd ) {
858858 Account caller = CallContext .current ().getCallingAccount ();
859- boolean isRootAdmin = accountMgr . isRootAdmin ( caller );
859+ boolean isRootAdmin = CallContext . current (). isCallingAccountRootAdmin ( );
860860 List <Long > permittedAccounts = new ArrayList <>();
861861
862862 Long id = cmd .getId ();
@@ -950,7 +950,7 @@ private Pair<List<Long>, Integer> searchForEventIdsAndCount(ListEventsCmd cmd) {
950950 accountMgr .buildACLSearchCriteria (sc , domainId , isRecursive , permittedAccounts , listProjectResourcesCriteria );
951951
952952 // For end users display only enabled events
953- if (!accountMgr . isRootAdmin ( caller )) {
953+ if (!CallContext . current (). isCallingAccountRootAdmin ( )) {
954954 sc .setParameters ("displayEvent" , true );
955955 }
956956
@@ -1185,8 +1185,7 @@ public ListResponse<UserVmResponse> searchForUserVMs(ListVMsCmd cmd) {
11851185 }
11861186
11871187 ResponseView respView = ResponseView .Restricted ;
1188- Account caller = CallContext .current ().getCallingAccount ();
1189- if (accountMgr .isRootAdmin (caller )) {
1188+ if (CallContext .current ().isCallingAccountRootAdmin ()) {
11901189 respView = ResponseView .Full ;
11911190 }
11921191 List <UserVmResponse > vmResponses = ViewResponseHelper .createUserVmResponse (respView , "virtualmachine" , cmd .getDetails (), cmd .getAccumulate (), cmd .getShowUserData (),
@@ -1315,7 +1314,7 @@ private Pair<List<Long>, Integer> searchForUserVMIdsAndCount(ListVMsCmd cmd) {
13151314 isAdmin = true ;
13161315 }
13171316
1318- if (accountMgr . isRootAdmin ( caller )) {
1317+ if (CallContext . current (). isCallingAccountRootAdmin ( )) {
13191318 isRootAdmin = true ;
13201319 podId = (Long ) getObjectPossibleMethodValue (cmd , "getPodId" );
13211320 clusterId = (Long ) getObjectPossibleMethodValue (cmd , "getClusterId" );
@@ -2630,7 +2629,7 @@ private Pair<List<Long>, Integer> searchForVolumeIdsAndCount(ListVolumesCmd cmd)
26302629 Boolean display = cmd .getDisplay ();
26312630 String state = cmd .getState ();
26322631 boolean shouldListSystemVms = Boolean .TRUE .equals (cmd .getListSystemVms ()) &&
2633- CallContext .registerPlaceHolderContext ().isCallingAccountRootAdmin ();
2632+ CallContext .current ().isCallingAccountRootAdmin ();
26342633
26352634 Long zoneId = cmd .getZoneId ();
26362635 Long podId = cmd .getPodId ();
@@ -4009,14 +4008,14 @@ private Pair<List<Long>, Integer> searchForServiceOfferingIdsAndCount(ListServic
40094008
40104009 final Account owner = accountMgr .finalizeOwner (caller , accountName , domainId , projectId );
40114010
4012- if (!accountMgr . isRootAdmin ( caller ) && isSystem ) {
4011+ if (!CallContext . current (). isCallingAccountRootAdmin ( ) && isSystem ) {
40134012 throw new InvalidParameterValueException ("Only ROOT admins can access system offerings." );
40144013 }
40154014
40164015 // Keeping this logic consistent with domain specific zones
40174016 // if a domainId is provided, we just return the so associated with this
40184017 // domain
4019- if (domainId != null && !accountMgr . isRootAdmin ( caller )) {
4018+ if (domainId != null && !CallContext . current (). isCallingAccountRootAdmin ( )) {
40204019 // check if the user's domain == so's domain || user's domain is a
40214020 // child of so's domain
40224021 if (!isPermissible (owner .getDomainId (), domainId )) {
0 commit comments