bug 9791: check if user is authorized to use a private template for vm creation

status 9791: resolved fixed
This commit is contained in:
alena 2011-05-10 10:35:50 -07:00
parent 84d62553e8
commit 71d0ea4e22
1 changed files with 6 additions and 0 deletions

View File

@ -2184,6 +2184,12 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
throw new InvalidParameterValueException("Installing from ISO requires an ISO that is bootable: " + template.getId());
}
// Check templates permissions
if (!template.isPublicTemplate()) {
Account templateOwner = _accountMgr.getAccount(template.getAccountId());
_accountMgr.checkAccess(owner, templateOwner);
}
// If the template represents an ISO, a disk offering must be passed in, and will be used to create the root disk
// Else, a disk offering is optional, and if present will be used to create the data disk
Pair<DiskOfferingVO, Long> rootDiskOffering = new Pair<DiskOfferingVO, Long>(null, null);