From 2897447b94edf35002f985d4055a4699bb5333d9 Mon Sep 17 00:00:00 2001
From: Sivaprabu Ganesan <sivaprabug@ami.com>
Date: Thu, 5 Jan 2023 18:52:51 +0530
Subject: Enhanced User Management page error message

Description 1:
When WebUI creates the user with an already existing username
the error message will display the exact failure reason.

Tested:
Step 1: Login to webUI and navigate to user management page
Step 2: Create new user with username "testUser1"
Step 3: Create another user with same username "testUser1"
Step 4: WEB UI will through the error message
as "Username 'testuser1' already exists."

Description 2:
User can able to disable and change the root user via WebUI
Now restricted to disable the root user and changing the
root user privilege.

Tested:
Step 1: Login to Web UI with root user
Step 2: Navigate to User management page
Step 3: Try to modify the root user's details
Step 4: WebUI won't allow to disable the user,
username change and privilege change
Step 5: Login Web UI with non-root user
Step 6: Web UI won't allow to modify or delete the root
user's details

Change-Id: I0e38215b51fb058984664ec38ae9613e18043ed7
Signed-off-by: Sivaprabu Ganesan <sivaprabug@ami.com>
---
 src/views/SecurityAndAccess/UserManagement/ModalUser.vue | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'src/views/SecurityAndAccess/UserManagement/ModalUser.vue')

diff --git a/src/views/SecurityAndAccess/UserManagement/ModalUser.vue b/src/views/SecurityAndAccess/UserManagement/ModalUser.vue
index 0f8757ce..5a1dc61a 100644
--- a/src/views/SecurityAndAccess/UserManagement/ModalUser.vue
+++ b/src/views/SecurityAndAccess/UserManagement/ModalUser.vue
@@ -56,6 +56,7 @@
                 name="user-status"
                 data-test-id="userManagement-radioButton-statusDisabled"
                 :value="false"
+                :disabled="!newUser && originalUsername === disabled"
                 @input="$v.form.status.$touch()"
               >
                 {{ $t('global.status.disabled') }}
@@ -81,7 +82,7 @@
                 aria-describedby="username-help-block"
                 data-test-id="userManagement-input-username"
                 :state="getValidationState($v.form.username)"
-                :disabled="!newUser && originalUsername === 'root'"
+                :disabled="!newUser && originalUsername === disabled"
                 @input="$v.form.username.$touch()"
               />
               <b-form-invalid-feedback role="alert">
@@ -259,6 +260,7 @@ export default {
         passwordConfirmation: '',
         manualUnlock: false,
       },
+      disabled: this.$store.getters['global/username'],
     };
   },
   computed: {
-- 
cgit v1.2.3

