Skip to content

Commit 459b32c

Browse files
committed
bug 11493: no need to do cross domain checks for the templates as domain level templates are not supported. We support only public (everybody can see and use) and private (only owner can see and use unless changed with updateTemplatePermissions call)
status 11493: resolved fixed Reviewed-by: will@cloud.com
1 parent 7bcbdeb commit 459b32c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎server/src/com/cloud/template/TemplateManagerImpl.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,7 @@ public boolean attachIso(AttachIsoCmd cmd) {
839839
}
840840

841841
//check permissions
842-
_accountMgr.checkAccess(caller, null, iso);
843-
_accountMgr.checkAccess(caller, null, vm);
842+
_accountMgr.checkAccess(caller, null, iso, vm);
844843

845844
State vmState = vm.getState();
846845
if (vmState != State.Running && vmState != State.Stopped) {

‎server/src/com/cloud/user/AccountManagerImpl.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
import com.cloud.storage.dao.VolumeDao;
9898
import com.cloud.storage.snapshot.SnapshotManager;
9999
import com.cloud.template.TemplateManager;
100+
import com.cloud.template.VirtualMachineTemplate;
100101
import com.cloud.user.Account.State;
101102
import com.cloud.user.dao.AccountDao;
102103
import com.cloud.user.dao.UserAccountDao;
@@ -808,8 +809,9 @@ public void checkAccess(Account caller, AccessType accessType, ControlledEntity.
808809
Account account = ApiDBUtils.findAccountById(entity.getAccountId());
809810
domainId = account != null ? account.getDomainId() : -1 ;
810811
}
811-
if (entity.getAccountId() != -1 && domainId != -1) {
812+
if (entity.getAccountId() != -1 && domainId != -1 && !(entity instanceof VirtualMachineTemplate)) {
812813
List<ControlledEntity> toBeChecked = domains.get(entity.getDomainId());
814+
//for templates, we don't have to do cross domains check
813815
if (toBeChecked == null) {
814816
toBeChecked = new ArrayList<ControlledEntity>();
815817
domains.put(domainId, toBeChecked);

0 commit comments

Comments
 (0)