You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/09/11 10:14:44 UTC
[cloudstack-primate] branch master updated: Disable users from
creating public templates based on global setting (#693)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
The following commit(s) were added to refs/heads/master by this push:
new ce854f7 Disable users from creating public templates based on global setting (#693)
ce854f7 is described below
commit ce854f7d89e17ccc6cc40151fc5106411efff737
Author: davidjumani <dj...@gmail.com>
AuthorDate: Fri Sep 11 15:44:35 2020 +0530
Disable users from creating public templates based on global setting (#693)
---
src/config/section/image.js | 16 ++++++++++++++--
src/views/image/RegisterOrUploadIso.vue | 4 +++-
src/views/image/RegisterOrUploadTemplate.vue | 10 ++++++----
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/config/section/image.js b/src/config/section/image.js
index e36fafd..cba2124 100644
--- a/src/config/section/image.js
+++ b/src/config/section/image.js
@@ -104,7 +104,13 @@ export default {
icon: 'share-alt',
label: 'label.action.template.share',
dataView: true,
- args: ['ispublic', 'isfeatured', 'isextractable'],
+ args: (record, store) => {
+ const fields = ['isfeatured', 'isextractable']
+ if (['Admin'].includes(store.userInfo.roletype) || store.features.userpublictemplateenabled) {
+ fields.unshift('ispublic')
+ }
+ return fields
+ },
show: (record, store) => {
return (['Admin'].includes(store.userInfo.roletype) || // If admin or owner or belongs to current project
(record.domainid === store.userInfo.domainid && record.account === store.userInfo.account) ||
@@ -225,7 +231,13 @@ export default {
icon: 'share-alt',
label: 'label.action.iso.share',
dataView: true,
- args: ['ispublic', 'isfeatured', 'isextractable'],
+ args: (record, store) => {
+ const fields = ['isfeatured', 'isextractable']
+ if (['Admin'].includes(store.userInfo.roletype) || store.features.userpublictemplateenabled) {
+ fields.unshift('ispublic')
+ }
+ return fields
+ },
show: (record, store) => {
return (['Admin'].includes(store.userInfo.roletype) || // If admin or owner or belongs to current project
(record.domainid === store.userInfo.domainid && record.account === store.userInfo.account) ||
diff --git a/src/views/image/RegisterOrUploadIso.vue b/src/views/image/RegisterOrUploadIso.vue
index 8b8d5ba..8c75a58 100644
--- a/src/views/image/RegisterOrUploadIso.vue
+++ b/src/views/image/RegisterOrUploadIso.vue
@@ -131,7 +131,9 @@
}]" />
</a-form-item>
- <a-form-item :label="$t('label.ispublic')">
+ <a-form-item
+ :label="$t('label.ispublic')"
+ v-if="$store.getters.userInfo.roletype === 'Admin' || $store.getters.features.userpublictemplateenabled" >
<a-switch
v-decorator="['ispublic', {
initialValue: false
diff --git a/src/views/image/RegisterOrUploadTemplate.vue b/src/views/image/RegisterOrUploadTemplate.vue
index 71d162b..7588ecd 100644
--- a/src/views/image/RegisterOrUploadTemplate.vue
+++ b/src/views/image/RegisterOrUploadTemplate.vue
@@ -339,8 +339,8 @@
</a-checkbox>
</a-col>
<a-col :span="12">
- <a-checkbox value="ispublic">
- {{ $t('label.ispublic') }}
+ <a-checkbox value="requireshvm">
+ {{ $t('label.requireshvm') }}
</a-checkbox>
</a-col>
</a-row>
@@ -351,8 +351,10 @@
</a-checkbox>
</a-col>
<a-col :span="12">
- <a-checkbox value="requireshvm">
- {{ $t('label.requireshvm') }}
+ <a-checkbox
+ value="ispublic"
+ v-if="$store.getters.userInfo.roletype === 'Admin' || $store.getters.features.userpublictemplateenabled" >
+ {{ $t('label.ispublic') }}
</a-checkbox>
</a-col>
</a-row>