mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-5960: Domain admin or user cannot register a template using
S3/Swift object store.(cherry picked from commit 6d1475182c)
Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
This commit is contained in:
parent
8d1d0c54f2
commit
7e8b8e6cd0
|
|
@ -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.");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue