gpordeus commented on code in PR #8689:
URL: https://github.com/apache/cloudstack/pull/8689#discussion_r1497796941


##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -3303,17 +3305,38 @@ public UserVm rebootVirtualMachine(RebootVMCmd cmd) 
throws InsufficientCapacityE
         return  null;
     }
 
+    /**
+     *  Encapsulates AllowUserExpungeRecoverVm so we can unit test 
checkExpungeVmPermission.
+     */
+    protected boolean getConfigAllowUserExpungeRecoverVm(Long entityOwnerId) {
+        return AllowUserExpungeRecoverVm.valueIn(entityOwnerId);
+    }
+
+    protected void checkExpungeVmPermission (Account callingAccount, Long 
entityOwnerId) {
+        logger.debug(String.format("Checking if [%s] has permission for 
expunging VMs.", callingAccount));
+        if (!_accountMgr.isAdmin(callingAccount.getId()) && 
!getConfigAllowUserExpungeRecoverVm(entityOwnerId)) {

Review Comment:
   Sure, it seems better. I've adjusted it.



-- 
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