shwstppr commented on code in PR #12200:
URL: https://github.com/apache/cloudstack/pull/12200#discussion_r2598288642
##########
ui/src/views/iam/AddAccount.vue:
##########
@@ -263,9 +286,48 @@ export default {
isDomainAdmin () {
return this.$store.getters.userInfo.roletype === 'DomainAdmin'
},
+ isAdmin () {
+ return this.$store.getters.userInfo.roletype === 'Admin'
+ },
isValidValueForKey (obj, key) {
return key in obj && obj[key] != null
},
+ onDomainChange (newDomainId) {
+ if (newDomainId && this.roles.length > 0) {
+ this.$nextTick(() => {
+ this.setDefaultRole()
+ })
+ }
+ },
+ setDefaultRole () {
+ if (this.isAdmin()) {
+ if (this.isNonRootDomain) {
+ const domainAdminRole = this.roles.find(role => role.type ===
'DomainAdmin')
+ if (domainAdminRole) {
+ this.form.roleid = domainAdminRole.id
+ return
+ }
+ } else {
+ const rootAdminRole = this.roles.find(role => role.type === 'Admin')
+ if (rootAdminRole) {
+ this.form.roleid = rootAdminRole.id
+ return
+ }
+ }
+ }
Review Comment:
How about filtering Admin role when it is not the ROOT domain?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]