Skip to content

Commit 15ccbae

Browse files
authored
minor: let anonymous users check if a V1 project has been migrated (#920)
1 parent 1a802c1 commit 15ccbae

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

components/renku_data_services/project/blueprints.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ def get_migration(self) -> BlueprintFactoryResponse:
109109
"""Get project migration by project v1 id."""
110110

111111
@authenticate(self.authenticator)
112-
@only_authenticated
113112
async def _get_migration(_: Request, user: base_models.APIUser, v1_id: int) -> JSONResponse:
114113
project = await self.project_migration_repo.get_migration_by_v1_id(user, v1_id)
115114
project_dump = self._dump_project(project)

components/renku_data_services/project/db.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,9 +1014,6 @@ async def migrate_v1_project(
10141014

10151015
async def get_migration_by_v1_id(self, user: base_models.APIUser, v1_id: int) -> models.Project:
10161016
"""Retrieve all migration records for a given project v1 ID."""
1017-
if user.id is None:
1018-
raise errors.UnauthorizedError(message="You do not have the required permissions for this operation.")
1019-
10201017
async with self.session_maker() as session:
10211018
stmt = select(schemas.ProjectMigrationsORM).where(schemas.ProjectMigrationsORM.project_v1_id == v1_id)
10221019
result = await session.execute(stmt)
@@ -1026,7 +1023,9 @@ async def get_migration_by_v1_id(self, user: base_models.APIUser, v1_id: int) ->
10261023
raise errors.MissingResourceError(message=f"Migration for project v1 with id '{v1_id}' does not exist.")
10271024

10281025
# NOTE: Show only those projects that user has access to
1029-
allowed_projects = await self.authz.resources_with_direct_membership(user, ResourceType.project)
1026+
allowed_projects = await self.authz.resources_with_permission(
1027+
user, user.id, ResourceType.project, Scope.READ
1028+
)
10301029
project_id_list = [project_ids.project_id]
10311030
stmt = select(schemas.ProjectORM)
10321031
stmt = stmt.where(schemas.ProjectORM.id.in_(project_id_list))

0 commit comments

Comments
 (0)