Skip to content

fix(admin-ui): unable to remove or reassign admin roles from user profile#2688

Closed
faisalsiddique4400 wants to merge 8 commits intomainfrom
admin-ui-issue-2684
Closed

fix(admin-ui): unable to remove or reassign admin roles from user profile#2688
faisalsiddique4400 wants to merge 8 commits intomainfrom
admin-ui-issue-2684

Conversation

@faisalsiddique4400
Copy link
Contributor

@faisalsiddique4400 faisalsiddique4400 commented Mar 5, 2026

fix(admin-ui): unable to remove or reassign admin roles from user profile (#2684)

Summary

This PR fixes an issue where admin roles could not be removed or reassigned from a user's profile in the Admin UI.

Issue

When attempting to remove roles such as jansAdminRole or userRole from a user (e.g., admin user), the operation fails and the roles cannot be updated from the UI.

Fix

  • Corrected the role update handling logic when modifying user roles.
  • Ensured that removing or reassigning roles properly updates the payload and triggers the correct API request.
  • Improved handling of role updates to prevent failures during role removal.

Result

  • Admin roles can now be successfully removed or reassigned from a user's profile.
  • The role update operation works as expected through the Admin UI.

🔗 Ticket

Closes: #2684

Summary by CodeRabbit

  • Bug Fixes

    • Ensure modals reliably close upon form submission.
    • Prevent webhook trigger dialog from appearing when its parent modal is closed.
    • Updated handling of multi-valued form fields so clearing multi-select attributes behaves correctly.
  • Style

    • Adjusted input appearance in the password change modal for more consistent styling.

…file (#2684)

Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8b77154e-f971-49f6-8cc2-8e46c98c0f11

📥 Commits

Reviewing files that changed from the base of the PR and between a604084 and 4d2e8c6.

📒 Files selected for processing (1)
  • admin-ui/app/routes/Apps/Gluu/GluuCommitDialogLegacy.tsx

📝 Walkthrough

Walkthrough

Replaced modal toggle with an explicit closeModal in user form submit flow and commit dialog props; removed array-length emptiness branch in isEmptyValue; added isDark={false} to two GluuInputRow usages in the password change modal. (36 words)

Changes

Cohort / File(s) Summary
User form & commit dialog
admin-ui/plugins/user-management/components/UserForm.tsx, admin-ui/app/routes/Apps/Gluu/GluuCommitDialogLegacy.tsx
Introduced closeModal and switched submit handling to call it instead of toggle; updated submit handler dependencies; replaced toggle with closeModal in GluuCommitDialogLegacy invocation; tightened webhook modal rendering to require modal truthy.
Password modal: UI prop addition
admin-ui/plugins/user-management/components/PasswordChangeModal.tsx
Added isDark={false} to two GluuInputRow instances; no control-flow changes.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • syntrydy
  • duttarnab

Poem

🐇 I nudged the modal, soft and neat,

Closed the door with a tidy beat.
Arrays once judged as empty, now rest —
Two inputs shine in daylight dressed.
A small hop of code, and all feels sweet.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly addresses the main objective: fixing the inability to remove or reassign admin roles from user profiles in the Admin UI.
Linked Issues check ✅ Passed The code changes fix role update handling by improving modal control flow and input validation logic to enable successful removal and reassignment of admin roles.
Out of Scope Changes check ✅ Passed All changes are directly related to the role update issue: UserForm.tsx fixes submission and modal handling, PasswordChangeModal.tsx adds styling consistency, and GluuCommitDialogLegacy.tsx tightens modal rendering logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch admin-ui-issue-2684

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mo-auto mo-auto added comp-admin-ui Component affected by issue or PR kind-bug Issue or PR is a bug in existing functionality labels Mar 5, 2026
Copy link
Contributor

@duttarnab duttarnab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Change Password dialog labels are not visible.
Image

Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@admin-ui/plugins/user-management/components/PasswordChangeModal.tsx`:
- Line 257: The PasswordChangeModal forces a light theme by passing
isDark={false} to the password fields; remove the hard-coded isDark prop (both
occurrences) so the inputs inherit the global/theme context instead, or replace
it with a theme-aware value from the app's theme hook if explicit control is
required; locate the isDark={false} props in PasswordChangeModal.tsx on the
password input components and delete them or wire them to the theme provider
instead.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3703c359-15d7-44c4-9c44-5967d5acb14c

📥 Commits

Reviewing files that changed from the base of the PR and between 2b1bcc8 and a1024c1.

📒 Files selected for processing (1)
  • admin-ui/plugins/user-management/components/PasswordChangeModal.tsx

Copy link
Contributor

@duttarnab duttarnab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. So may toast are commit on save
Image
  1. It show blank page after waiting for sometime after saving
Image

Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
admin-ui/plugins/user-management/components/UserForm.tsx (1)

137-146: 🧹 Nitpick | 🔵 Trivial

The closeModal() call in submitForm is redundant.

Looking at the context snippet from GluuCommitDialogLegacy, the handler() (which is now closeModal) is already called in the finally block of handleAccept after onAccept completes. Calling closeModal() explicitly in submitForm (line 142) before onSubmitData results in the modal being closed twice.

Since setModal(false) is idempotent, this doesn't cause functional issues, but the call is unnecessary.

♻️ Optional: Remove redundant closeModal call
 const submitForm = useCallback(
   (usermessage: string) => {
     if (isSubmitting) {
       return
     }
-    closeModal()
     onSubmitData(formik.values, modifiedFields, usermessage)
   },
-  [closeModal, onSubmitData, formik.values, modifiedFields, isSubmitting],
+  [onSubmitData, formik.values, modifiedFields, isSubmitting],
 )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@admin-ui/plugins/user-management/components/UserForm.tsx` around lines 137 -
146, Remove the redundant closeModal() invocation from the submitForm callback:
the modal is already closed by the handler (closeModal) invoked in the finally
block of GluuCommitDialogLegacy.handleAccept, so delete the closeModal() call
inside submitForm and leave the existing onSubmitData(formik.values,
modifiedFields, usermessage) invocation intact; update the dependency array if
necessary (remove closeModal if no longer referenced) to avoid stale lint
warnings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@admin-ui/plugins/user-management/components/UserForm.tsx`:
- Around line 137-146: Remove the redundant closeModal() invocation from the
submitForm callback: the modal is already closed by the handler (closeModal)
invoked in the finally block of GluuCommitDialogLegacy.handleAccept, so delete
the closeModal() call inside submitForm and leave the existing
onSubmitData(formik.values, modifiedFields, usermessage) invocation intact;
update the dependency array if necessary (remove closeModal if no longer
referenced) to avoid stale lint warnings.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9d4e23c9-a49b-4cc9-b268-555acdb60677

📥 Commits

Reviewing files that changed from the base of the PR and between a1024c1 and a604084.

📒 Files selected for processing (1)
  • admin-ui/plugins/user-management/components/UserForm.tsx

Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-admin-ui Component affected by issue or PR kind-bug Issue or PR is a bug in existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(admin-ui): unable to remove/reassign admin roles

4 participants