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/28 10:50:13 UTC

[cloudstack-primate] branch master updated: account: Choose `User` is the default selection when the user role is Domain Admin (#754)

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 1e2edcf  account: Choose `User` is the default selection when the user role is Domain Admin (#754)
1e2edcf is described below

commit 1e2edcfbc8bff68c6c0b0e0dfdf56c8da5bf2f22
Author: Hoang Nguyen <ho...@unitech.vn>
AuthorDate: Mon Sep 28 17:50:03 2020 +0700

    account: Choose `User` is the default selection when the user role is Domain Admin (#754)
    
    * account: choose `User` is the default selection when the user role is Domain Admin
    
    * renamed to userRole
    
    * Fix the incorrect variable
---
 src/views/iam/AddAccount.vue | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/views/iam/AddAccount.vue b/src/views/iam/AddAccount.vue
index fdfa44d..eca86a7 100644
--- a/src/views/iam/AddAccount.vue
+++ b/src/views/iam/AddAccount.vue
@@ -167,7 +167,8 @@
           <a-select
             showSearch
             v-decorator="['timezone']"
-            :loading="timeZoneLoading">
+            :loading="timeZoneLoading"
+            :placeholder="apiParams.timezone.description">
             <a-select-option v-for="opt in timeZoneMap" :key="opt.id">
               {{ opt.name || opt.description }}
             </a-select-option>
@@ -270,6 +271,9 @@ export default {
     isAdminOrDomainAdmin () {
       return ['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype)
     },
+    isDomainAdmin () {
+      return this.$store.getters.userInfo.roletype === 'DomainAdmin'
+    },
     isValidValueForKey (obj, key) {
       return key in obj && obj[key] != null
     },
@@ -311,6 +315,12 @@ export default {
       api('listRoles').then(response => {
         this.roles = response.listrolesresponse.role || []
         this.selectedRole = this.roles[0].id
+        if (this.isDomainAdmin()) {
+          const userRole = this.roles.filter(role => role.type === 'User')
+          if (userRole.length > 0) {
+            this.selectedRole = userRole[0].id
+          }
+        }
       }).finally(() => {
         this.roleLoading = false
       })