Skip to content

Add confirmation dialog for administrator privilege grant#6548

Merged
cstns merged 3 commits intomainfrom
admin-checkbox-confirmation-dialog
Jan 30, 2026
Merged

Add confirmation dialog for administrator privilege grant#6548
cstns merged 3 commits intomainfrom
admin-checkbox-confirmation-dialog

Conversation

@dimitrieh
Copy link
Contributor

@dimitrieh dimitrieh commented Jan 20, 2026

Description

Adds a confirmation dialog to the Create User form that appears when the Administrator checkbox is clicked. This prevents accidental granting of administrator privileges by requiring explicit confirmation.

The implementation includes:

  • New ConfirmAdminGrantDialog component with danger styling
  • Watcher on the isAdmin checkbox that triggers the dialog on state change (false → true)
  • Clear warning message listing specific administrator capabilities
  • Automatic reversion of checkbox state if user cancels the dialog
CleanShot 2026-01-20 at 13 09 52@2x

Related Issue(s)

N/A - Proactive security improvement

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Note: No changelog entry needed as this is a minor UX enhancement without breaking changes.

Labels

  • Includes a DB migration? -> add the area:migration label

Testing

Manually tested in development environment:

  • Dialog appears when Administrator checkbox is checked
  • Dialog uses danger styling (red) to emphasize critical action
  • Canceling reverts the checkbox to unchecked state
  • Confirming keeps the checkbox checked
  • User can be successfully created with admin privileges after confirmation
  • ESLint passes with no errors
  • Webpack compiles successfully

Implement a confirmation dialog that appears when granting administrator
privileges during user creation to prevent accidental privilege escalation.

The dialog:
- Uses danger styling to emphasize the critical nature of the action
- Lists specific capabilities granted to administrators
- Requires explicit confirmation before allowing the checkbox to remain checked
- Only triggers when checking the box (not unchecking)
@dimitrieh dimitrieh requested a review from cstns January 20, 2026 12:13
@dimitrieh
Copy link
Contributor Author

@cstns executed on a quick idea for https://flowfuse.slack.com/archives/C04GW82DJFK/p1768911237024339?thread_ts=1768900709.338869&cid=C04GW82DJFK

Can you do a review? Do we use ff-dialog here? 🤔

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@1fbb1cc). Learn more about missing BASE report.
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6548   +/-   ##
=======================================
  Coverage        ?   76.66%           
=======================================
  Files           ?      398           
  Lines           ?    20103           
  Branches        ?     4841           
=======================================
  Hits            ?    15411           
  Misses          ?     4692           
  Partials        ?        0           
Flag Coverage Δ
backend 76.66% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Move admin privilege confirmation from checkbox watcher to form submission handler. This allows users to toggle the admin checkbox without interruption and shows the confirmation dialog only when creating the user, improving UX and simplifying state management.
@dimitrieh dimitrieh requested a review from cstns January 30, 2026 10:08
@cstns cstns merged commit 2ea0263 into main Jan 30, 2026
27 checks passed
@cstns cstns deleted the admin-checkbox-confirmation-dialog branch January 30, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants