You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@git.apache.org on 2017/05/22 12:37:25 UTC

[GitHub] sureshanaparti commented on a change in pull request #2042: CLOUDSTACK-9875: Unable to re-apply Explicit dedication to VM

sureshanaparti commented on a change in pull request #2042: CLOUDSTACK-9875: Unable to re-apply Explicit dedication to VM
URL: https://github.com/apache/cloudstack/pull/2042#discussion_r117734140
 
 

 ##########
 File path: server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
 ##########
 @@ -432,12 +432,25 @@ public UserVm updateVMAffinityGroups(Long vmId, List<Long> affinityGroupIds) {
                 throw new InvalidParameterValueException("Unable to find affinity group by id " + affinityGroupId);
             } else {
                 // verify permissions
-                _accountMgr.checkAccess(caller, null, true, owner, ag);
-                // Root admin has access to both VM and AG by default, but make sure the
-                // owner of these entities is same
-                if (caller.getId() == Account.ACCOUNT_ID_SYSTEM || _accountMgr.isRootAdmin(caller.getId())) {
-                    if (ag.getAccountId() != owner.getAccountId()) {
-                        throw new PermissionDeniedException("Affinity Group " + ag + " does not belong to the VM's account");
+                if (ag.getAclType() == ACLType.Domain) {
+                    _accountMgr.checkAccess(caller, null, false, owner, ag);
+                    // Root admin has access to both VM and AG by default,
+                    // but
+                    // make sure the owner of these entities is same
 
 Review comment:
   sameOwner flag is set to false in `_accountMgr.checkAccess()`. Update the above comment, as the owner of the entity is not the same. 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services