Skip to content

Commit

Permalink
Also pass user_role in get /index
Browse files Browse the repository at this point in the history
  • Loading branch information
vanatteveldt committed Feb 11, 2025
1 parent 70a967b commit 1f88d20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion amcat4/api/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from amcat4 import index
from amcat4.api.auth import authenticated_user, authenticated_writer, check_role
from amcat4.fields import field_stats, field_values
from amcat4.index import refresh_system_index, remove_role, set_role
from amcat4.index import get_role, refresh_system_index, remove_role, set_role
from amcat4.models import CreateField, FieldType, UpdateField

app_index = APIRouter(prefix="/index", tags=["index"])
Expand All @@ -37,6 +37,7 @@ def index_to_dict(ix: index.Index) -> dict:
id=ix_dict["id"],
name=ix_dict["name"],
guest_role=index.Role(guest_role_int).name,
user_role=index.Role(get_role(ix.id, current_user)).name,
description=ix_dict.get("description", ""),
archived=ix_dict.get("archived", ""),
folder=ix_dict.get("folder", ""),
Expand Down

0 comments on commit 1f88d20

Please sign in to comment.