From b4d1fb8b8e6e6cdb7be76a2d4fa0d2b9a84f3ba2 Mon Sep 17 00:00:00 2001
From: Vitalii Lysak <v.lysak@dunice.net>
Date: Wed, 10 Aug 2022 15:46:15 +0300
Subject: SILABMC-236: upd layput for ReadOnly role

---
 src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue | 33 +++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 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 6800ead5..12584fac 100644
--- a/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue
+++ b/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue
@@ -13,6 +13,7 @@
               <b-form-checkbox
                 v-model="form.ldapAuthenticationEnabled"
                 data-test-id="ldap-checkbox-ldapAuthenticationEnabled"
+                :disabled="$store.getters['authentication/role'] === 'ReadOnly'"
                 @change="onChangeldapAuthenticationEnabled"
               >
                 {{ $t('global.action.enable') }}
@@ -42,7 +43,9 @@
                     aria-describedby="enable-secure-help-block"
                     data-test-id="ldap-checkbox-secureLdapEnabled"
                     :disabled="
-                      !caCertificateExpiration || !ldapCertificateExpiration
+                      !caCertificateExpiration ||
+                      !ldapCertificateExpiration ||
+                      $store.getters['authentication/role'] === 'ReadOnly'
                     "
                     @change="$v.form.secureLdapEnabled.$touch()"
                   >
@@ -76,6 +79,9 @@
                         v-model="form.activeDirectoryEnabled"
                         data-test-id="ldap-radio-activeDirectoryEnabled"
                         :value="false"
+                        :disabled="
+                          $store.getters['authentication/role'] === 'ReadOnly'
+                        "
                         @change="onChangeServiceType"
                       >
                         OpenLDAP
@@ -84,6 +90,9 @@
                         v-model="form.activeDirectoryEnabled"
                         data-test-id="ldap-radio-activeDirectoryEnabled"
                         :value="true"
+                        :disabled="
+                          $store.getters['authentication/role'] === 'ReadOnly'
+                        "
                         @change="onChangeServiceType"
                       >
                         Active Directory
@@ -106,6 +115,9 @@
                           v-model="form.serverUri"
                           data-test-id="ldap-input-serverUri"
                           :state="getValidationState($v.form.serverUri)"
+                          :disabled="
+                            $store.getters['authentication/role'] === 'ReadOnly'
+                          "
                           @change="$v.form.serverUri.$touch()"
                         />
                         <b-form-invalid-feedback role="alert">
@@ -124,6 +136,9 @@
                         v-model="form.bindDn"
                         data-test-id="ldap-input-bindDn"
                         :state="getValidationState($v.form.bindDn)"
+                        :disabled="
+                          $store.getters['authentication/role'] === 'ReadOnly'
+                        "
                         @change="$v.form.bindDn.$touch()"
                       />
                       <b-form-invalid-feedback role="alert">
@@ -145,6 +160,9 @@
                           type="password"
                           :state="getValidationState($v.form.bindPassword)"
                           class="form-control-with-button"
+                          :disabled="
+                            $store.getters['authentication/role'] === 'ReadOnly'
+                          "
                           @change="$v.form.bindPassword.$touch()"
                         />
                         <b-form-invalid-feedback role="alert">
@@ -163,6 +181,9 @@
                         v-model="form.baseDn"
                         data-test-id="ldap-input-baseDn"
                         :state="getValidationState($v.form.baseDn)"
+                        :disabled="
+                          $store.getters['authentication/role'] === 'ReadOnly'
+                        "
                         @change="$v.form.baseDn.$touch()"
                       />
                       <b-form-invalid-feedback role="alert">
@@ -182,6 +203,9 @@
                         id="user-id-attribute"
                         v-model="form.userIdAttribute"
                         data-test-id="ldap-input-userIdAttribute"
+                        :disabled="
+                          $store.getters['authentication/role'] === 'ReadOnly'
+                        "
                         @change="$v.form.userIdAttribute.$touch()"
                       />
                     </b-form-group>
@@ -198,6 +222,9 @@
                         id="group-id-attribute"
                         v-model="form.groupIdAttribute"
                         data-test-id="ldap-input-groupIdAttribute"
+                        :disabled="
+                          $store.getters['authentication/role'] === 'ReadOnly'
+                        "
                         @change="$v.form.groupIdAttribute.$touch()"
                       />
                     </b-form-group>
@@ -213,7 +240,9 @@
               variant="primary"
               type="submit"
               data-test-id="ldap-button-saveSettings"
-              :disabled="loading"
+              :disabled="
+                loading || $store.getters['authentication/role'] === 'ReadOnly'
+              "
             >
               {{ $t('global.action.saveSettings') }}
             </b-btn>
-- 
cgit v1.2.3

