Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename public beta org to hotosm #1784

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/backend/app/auth/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ 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 the public beta, then grant access.
- 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 Down Expand Up @@ -95,13 +95,13 @@ async def check_access(
SELECT 1
FROM organisations
WHERE (organisations.id = :org_id
AND organisations.slug = 'fmtm-public-beta')
AND organisations.slug = 'hotosm')
OR EXISTS (
SELECT 1
FROM projects
JOIN organisations AS org
ON projects.organisation_id = org.id
WHERE org.slug = 'fmtm-public-beta'
WHERE org.slug = 'hotosm'
AND projects.id = :project_id
)
) THEN true
Expand Down
10 changes: 5 additions & 5 deletions src/backend/app/organisations/organisation_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def init_admin_org(db: Session):
-- Start a transaction
BEGIN;

-- Insert FMTM Public Beta organisation
-- Insert HOTOSM organisation
INSERT INTO public.organisations (
name,
slug,
Expand All @@ -58,10 +58,10 @@ async def init_admin_org(db: Session):
odk_central_password
)
VALUES (
'FMTM Public Beta',
'fmtm-public-beta',
'HOTOSM',
'hotosm',
'https://avatars.githubusercontent.com/u/458752?s=280&v=4',
'HOTOSM Public Beta for FMTM.',
'Humanitarian OpenStreetMap Team.',
'https://hotosm.org',
'FREE',
true,
Expand Down Expand Up @@ -106,7 +106,7 @@ async def init_admin_org(db: Session):
-- Set localadmin user as org admin
WITH org_cte AS (
SELECT id FROM public.organisations
WHERE name = 'FMTM Public Beta'
WHERE name = 'HOTOSM'
)
INSERT INTO public.organisation_managers (organisation_id, user_id)
SELECT (SELECT id FROM org_cte), :admin_user_id
Expand Down
15 changes: 15 additions & 0 deletions src/backend/migrations/005-rename-public-beta.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- ## Migration to:
-- * Rename FMTM Public Beta org --> HOTOSM

-- Start a transaction
BEGIN;

UPDATE public.organisations
SET
name = 'HOTOSM',
slug = 'hotosm',
description = 'Humanitarian OpenStreetMap Team'
WHERE slug = 'fmtm-public-beta';

-- Commit the transaction
COMMIT;
8 changes: 4 additions & 4 deletions src/backend/pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [
"pyjwt>=2.8.0",
"async-lru>=2.0.4",
"osm-login-python==2.0.0",
"osm-fieldwork==0.16.0",
"osm-fieldwork==0.16.1",
"osm-rawdata==0.3.2",
"fmtm-splitter==1.3.0",
]
Expand Down
6 changes: 1 addition & 5 deletions src/backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,7 @@ async def admin_user(db):
@pytest.fixture(scope="function")
def organisation(db):
"""A test organisation."""
return (
db.query(DbOrganisation)
.filter(DbOrganisation.name == "FMTM Public Beta")
.first()
)
return db.query(DbOrganisation).filter(DbOrganisation.name == "HOTOSM").first()


@pytest.fixture(scope="function")
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/e2e/01-create-new-project.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('create new project', async ({ browserName, page }) => {
await page.locator('#description').click();
await page.locator('#description').fill('desc');
await page.getByRole('combobox').click();
await page.getByLabel('FMTM Public Beta').click();
await page.getByLabel('HOTOSM').click();
await page.getByRole('button', { name: 'NEXT' }).click();

// 2. Upload Area Step
Expand Down