Skip to content

Commit

Permalink
fix: logic to bypass project_admin if public beta
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Feb 26, 2024
1 parent 7a6ca5c commit 1a4f6bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/backend/app/auth/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,16 @@ async def check_access(
WHEN EXISTS (
SELECT 1
FROM organisations
WHERE organisations.id = :org_id
AND organisations.slug = 'fmtm-public-beta'
WHERE (organisations.id = :org_id
AND organisations.slug = 'fmtm-public-beta')
OR EXISTS (
SELECT 1
FROM projects
JOIN organisations AS org
ON projects.organisation_id = org.id
WHERE org.slug = 'fmtm-public-beta'
AND projects.id = :project_id
)
) THEN true
ELSE
EXISTS (
Expand Down
4 changes: 2 additions & 2 deletions src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ async def get_or_set_data_extract(
url: Optional[str] = None,
project_id: int = Query(..., description="Project ID"),
db: Session = Depends(database.get_db),
org_user_dict: db_models.DbUser = Depends(project_admin),
project_user_dict: db_models.DbUser = Depends(project_admin),
):
"""Get or set the data extract URL for a project."""
fgb_url = await project_crud.get_or_set_data_extract_url(
Expand All @@ -839,7 +839,7 @@ async def upload_custom_extract(
custom_extract_file: UploadFile = File(...),
project_id: int = Query(..., description="Project ID"),
db: Session = Depends(database.get_db),
org_user_dict: db_models.DbUser = Depends(project_admin),
project_user_dict: db_models.DbUser = Depends(project_admin),
):
"""Upload a custom data extract geojson for a project.
Expand Down

0 comments on commit 1a4f6bb

Please sign in to comment.