Skip to content

Commit

Permalink
fixes: Remove auth bypass in for HOTOSM org #1785
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuj-Gupta4 committed Oct 30, 2024
1 parent 2e58733 commit 7bb71a5
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/backend/app/auth/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ async def check_access(
Access is determined based on the user's role and permissions:
- If the user has an 'ADMIN' role, access is granted.
- If the user has a 'READ_ONLY' role, access is denied.
- If the organisation is HOTOSM, then grant access.
- For other roles, access is granted if the user is an organisation manager
for the specified organisation (org_id) or has the specified role
in the specified project (project_id).
Expand All @@ -91,20 +90,6 @@ async def check_access(
CASE
WHEN role = 'ADMIN' THEN true
WHEN role = 'READ_ONLY' THEN false
WHEN EXISTS (
SELECT 1
FROM organisations
WHERE (organisations.id = :org_id
AND organisations.slug = 'hotosm')
OR EXISTS (
SELECT 1
FROM projects
JOIN organisations AS org
ON projects.organisation_id = org.id
WHERE org.slug = 'hotosm'
AND projects.id = :project_id
)
) THEN true
ELSE
EXISTS (
SELECT 1
Expand Down

0 comments on commit 7bb71a5

Please sign in to comment.