[PR #17848] [MERGED] Feat/chore: Add warning for conflicting group permissions / Refactored Permissions.svelte #40203

Closed
opened 2026-04-25 12:37:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/17848
Author: @Classic298
Created: 9/28/2025
Status: Merged
Merged: 9/29/2025
Merged by: @tjbck

Base: devHead: feat/group-permission-warning


📝 Commits (6)

  • 30550d9 Feat: Add warning for conflicting group permissions
  • fb3eeaa Update Groups.svelte
  • a4e0c10 Delete src/lib/components/admin/Users/Groups/PermissionSwitch.svelte
  • ad9cae3 Delete src/lib/components/icons/ExclamationTriangle.svelte
  • 67b3929 Delete src/lib/components/common/Warning.svelte
  • cf20f04 Update Permissions.svelte

📊 Changes

4 files changed (+449 additions, -315 deletions)

View changed files

📝 src/lib/components/admin/Users/Groups.svelte (+11 -51)
📝 src/lib/components/admin/Users/Groups/EditGroupModal.svelte (+2 -1)
📝 src/lib/components/admin/Users/Groups/GroupItem.svelte (+2 -0)
📝 src/lib/components/admin/Users/Groups/Permissions.svelte (+434 -263)

📄 Description

Add warning for conflicting group permissions

Problem

When group permissions are disabled but the default "user" role has them enabled, the disabled settings have no effect due to additive permission inheritance. This creates confusion for administrators.

Solution

Adds visual warnings when a group permission is disabled but remains enabled in the default "user" role, explaining that the restriction won't take effect.

Large Refactor Justification

The Permissions.svelte file had 50+ repetitive Switch components with identical boilerplate. To add warning logic without massive code duplication, I created a reusable PermissionSwitch component that:

  • Eliminates 400+ lines of repetitive code
  • Centralizes permission logic in one place
  • Automatically applies warning functionality to all permissions
  • Makes future permission additions much easier

Technical Changes

  • New: PermissionSwitch.svelte with built-in warning logic
  • New: Warning.svelte and ExclamationTriangle.svelte components
  • Fixed: Removed unused getUserDefaultPermissions import causing ReferenceError
  • Improved: Gets default permissions from "user" group instead of separate API call

The refactor pays down technical debt while delivering the core warning feature. The large diff reflects consolidating repetitive code, not scope creep.

Screenshots or Videos

image image

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/17848 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 9/28/2025 **Status:** ✅ Merged **Merged:** 9/29/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `feat/group-permission-warning` --- ### 📝 Commits (6) - [`30550d9`](https://github.com/open-webui/open-webui/commit/30550d9190ef5e70d9c765b5d15a074b76848167) Feat: Add warning for conflicting group permissions - [`fb3eeaa`](https://github.com/open-webui/open-webui/commit/fb3eeaa12662cf89c1efc8e116d622b50a1e3677) Update Groups.svelte - [`a4e0c10`](https://github.com/open-webui/open-webui/commit/a4e0c10f344ccaf5726f6dadcf3cdbd400ed2673) Delete src/lib/components/admin/Users/Groups/PermissionSwitch.svelte - [`ad9cae3`](https://github.com/open-webui/open-webui/commit/ad9cae32dc3df80f6206d5c01032bfbb1ec6963d) Delete src/lib/components/icons/ExclamationTriangle.svelte - [`67b3929`](https://github.com/open-webui/open-webui/commit/67b39299541d5f242afa4a45f17bf0cf5c47e3bc) Delete src/lib/components/common/Warning.svelte - [`cf20f04`](https://github.com/open-webui/open-webui/commit/cf20f04bdce27233028b89db4b30f8db043e4c6c) Update Permissions.svelte ### 📊 Changes **4 files changed** (+449 additions, -315 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/admin/Users/Groups.svelte` (+11 -51) 📝 `src/lib/components/admin/Users/Groups/EditGroupModal.svelte` (+2 -1) 📝 `src/lib/components/admin/Users/Groups/GroupItem.svelte` (+2 -0) 📝 `src/lib/components/admin/Users/Groups/Permissions.svelte` (+434 -263) </details> ### 📄 Description ## Add warning for conflicting group permissions ### Problem When group permissions are disabled but the default "user" role has them enabled, the disabled settings have no effect due to additive permission inheritance. This creates confusion for administrators. ### Solution Adds visual warnings when a group permission is disabled but remains enabled in the default "user" role, explaining that the restriction won't take effect. ### Large Refactor Justification The `Permissions.svelte` file had 50+ repetitive Switch components with identical boilerplate. To add warning logic without massive code duplication, I created a reusable `PermissionSwitch` component that: - Eliminates 400+ lines of repetitive code - Centralizes permission logic in one place - Automatically applies warning functionality to all permissions - Makes future permission additions much easier ### Technical Changes - **New**: `PermissionSwitch.svelte` with built-in warning logic - **New**: `Warning.svelte` and `ExclamationTriangle.svelte` components - **Fixed**: Removed unused `getUserDefaultPermissions` import causing ReferenceError - **Improved**: Gets default permissions from "user" group instead of separate API call The refactor pays down technical debt while delivering the core warning feature. The large diff reflects consolidating repetitive code, not scope creep. ### Screenshots or Videos <img width="773" height="525" alt="image" src="https://github.com/user-attachments/assets/7a6d3bd4-3806-4b9a-879b-fbf436f2194a" /> <img width="814" height="561" alt="image" src="https://github.com/user-attachments/assets/af73c7ec-afd2-4546-afd0-273c9a662ddd" /> ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 12:37:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#40203