// 认证设置
Vue.component("http-auth-config-box", {
props: ["v-auth-config", "v-is-location"],
data: function () {
let authConfig = this.vAuthConfig
if (authConfig == null) {
authConfig = {
isPrior: false,
isOn: false
}
}
if (authConfig.policyRefs == null) {
authConfig.policyRefs = []
}
return {
authConfig: authConfig
}
},
methods: {
isOn: function () {
return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn
},
add: function () {
let that = this
teaweb.popup("/servers/server/settings/access/createPopup", {
callback: function (resp) {
that.authConfig.policyRefs.push(resp.data.policyRef)
}
})
},
update: function (index, policyId) {
let that = this
teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, {
callback: function (resp) {
Vue.set(that.authConfig.policyRefs, index, resp.data.policyRef)
}
})
},
delete: function (index) {
that.authConfig.policyRefs.$remove(index)
}
},
template: `
`
})