You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2014/01/27 20:55:29 UTC
git commit: updated refs/heads/4.3-forward to 6d14751
Updated Branches:
refs/heads/4.3-forward 3fae917eb -> 6d1475182
CLOUDSTACK-5960: Domain admin or user cannot register a template using
S3/Swift object store.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6d147518
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6d147518
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6d147518
Branch: refs/heads/4.3-forward
Commit: 6d1475182cd9ea17010a142043dd9fe9c923cf81
Parents: 3fae917
Author: Min Chen <mi...@citrix.com>
Authored: Mon Jan 27 11:54:38 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Mon Jan 27 11:54:38 2014 -0800
----------------------------------------------------------------------
server/src/com/cloud/template/TemplateAdapterBase.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d147518/server/src/com/cloud/template/TemplateAdapterBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateAdapterBase.java b/server/src/com/cloud/template/TemplateAdapterBase.java
index 6194e6e..c75c1e4 100755
--- a/server/src/com/cloud/template/TemplateAdapterBase.java
+++ b/server/src/com/cloud/template/TemplateAdapterBase.java
@@ -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.");
}