Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ui/src/views/iam/AddAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
v-decorator="['networkdomain']"
:placeholder="apiParams.networkdomain.description" />
</a-form-item>
<div v-if="'authorizeSamlSso' in $store.getters.apis">
<div v-if="samlAllowed">
<a-form-item :label="$t('label.samlenable')">
<a-switch v-decorator="['samlenable']" @change="checked => { this.samlEnable = checked }" />
</a-form-item>
Expand Down Expand Up @@ -217,12 +217,17 @@ export default {
created () {
this.fetchData()
},
computed: {
samlAllowed () {
return 'authorizeSamlSso' in this.$store.getters.apis
}
},
methods: {
fetchData () {
this.fetchDomains()
this.fetchRoles()
this.fetchTimeZone()
if ('listIdps' in this.$store.getters.apis) {
if (this.samlAllowed) {
this.fetchIdps()
}
},
Expand Down Expand Up @@ -344,7 +349,7 @@ export default {
userid: users[i].id
}).then(response => {
this.$notification.success({
message: this.$t('samlenable'),
message: this.$t('label.samlenable'),
description: this.$t('message.success.enable.saml.auth')
})
}).catch(error => {
Expand Down
45 changes: 24 additions & 21 deletions ui/src/views/iam/AddUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
</a-select-option>
</a-select>
</a-form-item>
<div v-if="'authorizeSamlSso' in $store.getters.apis">
<div v-if="samlAllowed">
<a-form-item :label="$t('label.samlenable')">
<a-switch v-decorator="['samlenable']" @change="checked => { this.samlEnable = checked }" />
</a-form-item>
Expand Down Expand Up @@ -208,6 +208,11 @@ export default {
this.apiParams = this.$getApiParams('createUser', 'authorizeSamlSso')
this.fetchData()
},
computed: {
samlAllowed () {
return 'authorizeSamlSso' in this.$store.getters.apis
}
},
methods: {
fetchData () {
this.account = this.$route.query && this.$route.query.account ? this.$route.query.account : null
Expand All @@ -219,7 +224,7 @@ export default {
this.fetchAccount()
}
this.fetchTimeZone()
if ('listIdps' in this.$store.getters.apis) {
if (this.samlAllowed) {
this.fetchIdps()
}
},
Expand Down Expand Up @@ -318,26 +323,24 @@ export default {
message: this.$t('label.create.user'),
description: `${this.$t('message.success.create.user')} ${params.username}`
})
const users = response.createuserresponse.user.user
if (values.samlenable && users) {
for (var i = 0; i < users.length; i++) {
api('authorizeSamlSso', {
enable: values.samlenable,
entityid: values.samlentity,
userid: users[i].id
}).then(response => {
this.$notification.success({
message: this.$t('label.samlenable'),
description: this.$t('message.success.enable.saml.auth')
})
}).catch(error => {
this.$notification.error({
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0
})
const user = response.createuserresponse.user
if (values.samlenable && user) {
api('authorizeSamlSso', {
enable: values.samlenable,
entityid: values.samlentity,
userid: user.id
}).then(response => {
this.$notification.success({
message: this.$t('label.samlenable'),
description: this.$t('message.success.enable.saml.auth')
})
}).catch(error => {
this.$notification.error({
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0
})
}
})
}
this.closeAction()
}).catch(error => {
Expand Down