[PR #16718] [CLOSED] fix: Fixing exception with missing None check in access_control.py #39848

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

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/16718
Author: @cvanduyne
Created: 8/18/2025
Status: Closed

Base: devHead: main


📝 Commits (1)

  • 8aca95d Fixing exception with missing None check in access_control.py

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 backend/open_webui/utils/access_control.py (+1 -1)

📄 Description

Changelog Entry

Description

  • Fixed an exception that occurs when no groups have permission objects.

Fixed

  • Missing None check regarding group permissions

Additional Information

This was the exception:

File "/home/webui/.local/lib/python3.11/site-packages/open_webui/routers/knowledge.py", line 145, in create_new_knowledge       
  if user.role != "admin" and not has_permission(
                                  ^^^^^^^^^^^^^^^
File "/home/webui/.local/lib/python3.11/site-packages/open_webui/utils/access_control.py", line 100, in has_permission
  if get_permission(group_permissions, permission_hierarchy):
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/webui/.local/lib/python3.11/site-packages/open_webui/utils/access_control.py", line 87, in get_permission
  if key not in permissions:
     ^^^^^^^^^^^^^^^^^^^^^^

The root cause was that sometimes groups don't have permissions, causing get_permissions() to fail.
The fix is to use the same pattern as combine_permissions() within the same file.

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/16718 **Author:** [@cvanduyne](https://github.com/cvanduyne) **Created:** 8/18/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `main` --- ### 📝 Commits (1) - [`8aca95d`](https://github.com/open-webui/open-webui/commit/8aca95d0b728a845a90f04b696b287c0b8c5b879) Fixing exception with missing None check in access_control.py ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/access_control.py` (+1 -1) </details> ### 📄 Description # Changelog Entry ### Description - Fixed an exception that occurs when no groups have permission objects. ### Fixed - Missing None check regarding group permissions --- ### Additional Information This was the exception: ``` File "/home/webui/.local/lib/python3.11/site-packages/open_webui/routers/knowledge.py", line 145, in create_new_knowledge if user.role != "admin" and not has_permission( ^^^^^^^^^^^^^^^ File "/home/webui/.local/lib/python3.11/site-packages/open_webui/utils/access_control.py", line 100, in has_permission if get_permission(group_permissions, permission_hierarchy): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/webui/.local/lib/python3.11/site-packages/open_webui/utils/access_control.py", line 87, in get_permission if key not in permissions: ^^^^^^^^^^^^^^^^^^^^^^ ``` The root cause was that sometimes groups don't have permissions, causing get_permissions() to fail. The fix is to use the same pattern as combine_permissions() within the same file. ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/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:16:46 -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#39848