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
This commit is contained in:
alena 2011-09-19 15:11:38 -07:00
parent 7bcbdeb834
commit 459b32cc6a
2 changed files with 4 additions and 3 deletions

View File

@ -839,8 +839,7 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe
}
//check permissions
_accountMgr.checkAccess(caller, null, iso);
_accountMgr.checkAccess(caller, null, vm);
_accountMgr.checkAccess(caller, null, iso, vm);
State vmState = vm.getState();
if (vmState != State.Running && vmState != State.Stopped) {

View File

@ -97,6 +97,7 @@ import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.storage.snapshot.SnapshotManager;
import com.cloud.template.TemplateManager;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account.State;
import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.UserAccountDao;
@ -808,8 +809,9 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
Account account = ApiDBUtils.findAccountById(entity.getAccountId());
domainId = account != null ? account.getDomainId() : -1 ;
}
if (entity.getAccountId() != -1 && domainId != -1) {
if (entity.getAccountId() != -1 && domainId != -1 && !(entity instanceof VirtualMachineTemplate)) {
List<ControlledEntity> toBeChecked = domains.get(entity.getDomainId());
//for templates, we don't have to do cross domains check
if (toBeChecked == null) {
toBeChecked = new ArrayList<ControlledEntity>();
domains.put(domainId, toBeChecked);