CLOUDSTACK-5960: Domain admin or user cannot register a template using

S3/Swift object store.
This commit is contained in:
Min Chen 2014-01-27 11:54:38 -08:00
parent 3fae917ebe
commit 6d1475182c

View File

@ -162,8 +162,14 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
}
boolean isAdmin = _accountDao.findById(templateOwner.getId()).getType() == Account.ACCOUNT_TYPE_ADMIN;
if (!isAdmin && zoneId == null) {
boolean isRegionStore = false;
List<ImageStoreVO> stores = _imgStoreDao.findRegionImageStores();
if (stores != null && stores.size() > 0) {
isRegionStore = true;
}
if (!isAdmin && zoneId == null && !isRegionStore ) {
// domain admin and user should also be able to register template on a region store
throw new InvalidParameterValueException("Please specify a valid zone Id.");
}