Co-authored-by: Tim Baek <tim@openwebui.com>
This commit is contained in:
Classic298
2026-02-12 15:50:13 -06:00
committed by GitHub
co-authored by Tim Baek
parent 2ffd8d9277
commit ea4ef28da5
2 changed files with 34 additions and 10 deletions
+21
View File
@@ -422,6 +422,13 @@ async def get_channel_by_id(
db: Session = Depends(get_session),
):
check_channels_access(request, user)
if user.role != "admin" and not has_permission(
user.id, "features.channels", request.app.state.config.USER_PERMISSIONS, db=db
):
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail=ERROR_MESSAGES.UNAUTHORIZED,
)
channel = Channels.get_channel_by_id(id, db=db)
if not channel:
raise HTTPException(
@@ -534,6 +541,13 @@ async def get_channel_members_by_id(
db: Session = Depends(get_session),
):
check_channels_access(request, user)
if user.role != "admin" and not has_permission(
user.id, "features.channels", request.app.state.config.USER_PERMISSIONS, db=db
):
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail=ERROR_MESSAGES.UNAUTHORIZED,
)
channel = Channels.get_channel_by_id(id, db=db)
if not channel:
@@ -855,6 +869,13 @@ async def get_channel_messages(
db: Session = Depends(get_session),
):
check_channels_access(request, user)
if user.role != "admin" and not has_permission(
user.id, "features.channels", request.app.state.config.USER_PERMISSIONS, db=db
):
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail=ERROR_MESSAGES.UNAUTHORIZED,
)
channel = Channels.get_channel_by_id(id, db=db)
if not channel:
raise HTTPException(