Skip to content

Commit

Permalink
feat: change RBAC rule for public brains
Browse files Browse the repository at this point in the history
  • Loading branch information
mamadoudicko committed Sep 21, 2023
1 parent 133ce02 commit b67e2db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/routes/authorizations/brain_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from fastapi import Depends, HTTPException, status
from models import UserIdentity
from repository.brain import get_brain_for_user
from repository.brain.get_brain_details import get_brain_details

from routes.authorizations.types import RoleEnum


Expand Down Expand Up @@ -43,6 +45,11 @@ def validate_brain_authorization(
return: None
"""

brain = get_brain_details(brain_id)

if brain and brain.status == "public":
return

if required_roles is None:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
Expand Down

0 comments on commit b67e2db

Please sign in to comment.