From 86de3af082ba6c541d9a6cb10c4db0d14f6267e8 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Mon, 5 Sep 2022 15:56:39 +0300 Subject: add method for isNotAdmin --- src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue | 68 +++++++------------------ 1 file changed, 17 insertions(+), 51 deletions(-) (limited to 'src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue') diff --git a/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue b/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue index 358cdf70..304ebc03 100644 --- a/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue +++ b/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue @@ -13,10 +13,7 @@ {{ $t('global.action.enable') }} @@ -48,8 +45,7 @@ :disabled=" !caCertificateExpiration || !ldapCertificateExpiration || - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' + isNotAdmin " @change="$v.form.secureLdapEnabled.$touch()" > @@ -83,11 +79,7 @@ v-model="form.activeDirectoryEnabled" data-test-id="ldap-radio-activeDirectoryEnabled" :value="false" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="onChangeServiceType" > OpenLDAP @@ -96,11 +88,7 @@ v-model="form.activeDirectoryEnabled" data-test-id="ldap-radio-activeDirectoryEnabled" :value="true" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="onChangeServiceType" > Active Directory @@ -123,11 +111,7 @@ v-model="form.serverUri" data-test-id="ldap-input-serverUri" :state="getValidationState($v.form.serverUri)" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.serverUri.$touch()" /> @@ -146,11 +130,7 @@ v-model="form.bindDn" data-test-id="ldap-input-bindDn" :state="getValidationState($v.form.bindDn)" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.bindDn.$touch()" /> @@ -172,11 +152,7 @@ type="password" :state="getValidationState($v.form.bindPassword)" class="form-control-with-button" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.bindPassword.$touch()" /> @@ -195,11 +171,7 @@ v-model="form.baseDn" data-test-id="ldap-input-baseDn" :state="getValidationState($v.form.baseDn)" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.baseDn.$touch()" /> @@ -219,11 +191,7 @@ id="user-id-attribute" v-model="form.userIdAttribute" data-test-id="ldap-input-userIdAttribute" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.userIdAttribute.$touch()" /> @@ -240,11 +208,7 @@ id="group-id-attribute" v-model="form.groupIdAttribute" data-test-id="ldap-input-groupIdAttribute" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.groupIdAttribute.$touch()" /> @@ -260,11 +224,7 @@ variant="primary" type="submit" data-test-id="ldap-button-saveSettings" - :disabled=" - loading || - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="loading || isNotAdmin" > {{ $t('global.action.saveSettings') }} @@ -335,6 +295,12 @@ export default { 'ldap', 'activeDirectory', ]), + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, sslCertificates() { return this.$store.getters['certificates/allCertificates']; }, -- cgit v1.2.3