abh1sar commented on code in PR #8875:
URL: https://github.com/apache/cloudstack/pull/8875#discussion_r1549932174


##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -1148,6 +1150,91 @@ public PrimaryDataStoreInfo 
updateStoragePool(UpdateStoragePoolCmd cmd) throws I
         return (PrimaryDataStoreInfo)_dataStoreMgr.getDataStore(pool.getId(), 
DataStoreRole.Primary);
     }
 
+    @Override
+    public boolean changeStoragePoolScope(ChangeStoragePoolScopeCmd cmd) 
throws IllegalArgumentException, InvalidParameterValueException, 
PermissionDeniedException {
+        Long id = cmd.getId();
+
+        Long accountId = cmd.getEntityOwnerId();
+        if (!_accountMgr.isRootAdmin(accountId)) {
+            throw new PermissionDeniedException("Only root admin can perform 
this operation");
+        }
+
+        ScopeType scopeType = 
ScopeType.validateAndGetScopeType(cmd.getScope());

Review Comment:
   No, it can't be.
   I can see how usage of validateAndGetScopeType can cause confusion about the 
assumption.
   Have changed the code to use  EnumUtils.getEnumIgnoreCase to get the enum 
from string.



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