Copilot commented on code in PR #11087:
URL: https://github.com/apache/cloudstack/pull/11087#discussion_r2166825042


##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -668,25 +618,22 @@ public ListResponse<UserResponse> 
searchForUsers(ResponseView responseView, List
             responseView = ResponseView.Full;
         }
         List<UserResponse> userResponses = 
ViewResponseHelper.createUserResponse(responseView, 
CallContext.current().getCallingAccount().getDomainId(),
-                result.first().toArray(new 
UserAccountJoinVO[result.first().size()]));
+                result.first().toArray(new UserAccountJoinVO[0]));
         response.setResponses(userResponses, result.second());
         return response;
     }
 
     public ListResponse<UserResponse> searchForUsers(Long domainId, boolean 
recursive) throws PermissionDeniedException {
         Account caller = CallContext.current().getCallingAccount();
 
-        List<Long> permittedAccounts = new ArrayList<Long>();
+        List<Long> permittedAccounts = new ArrayList<>();
 
         boolean listAll = true;
+        // TODO fix bug : id is always null from here
         Long id = null;
 
         if (caller.getType() == Account.Type.NORMAL) {
-            long currentId = CallContext.current().getCallingUser().getId();
-            if (id != null && currentId != id.longValue()) {
-                throw new PermissionDeniedException("Calling user is not 
authorized to see the user requested by id");
-            }
-            id = currentId;
+            id = CallContext.current().getCallingUser().getId();

Review Comment:
   [nitpick] This TODO indicates a known issue where `id` is always null. 
Consider removing or addressing this comment by fixing the initialization logic 
or clarifying its intended behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to