5555 ProjectsSearchQueryParams ,
5656)
5757
58- # When the user requests a project with a repo, the working copy might differ from
59- # the repo project. A middleware in the meta module (if active) will resolve
60- # the working copy and redirect to the appropriate project entrypoint. Nonetheless, the
61- # response needs to refer to the uuid of the request and this is passed through this request key
62- RQ_REQUESTED_REPO_PROJECT_UUID_KEY = f"{ __name__ } .RQT_REQUESTED_REPO_PROJECT_UUID_KEY"
63-
6458_logger = logging .getLogger (__name__ )
6559
6660
@@ -277,6 +271,7 @@ async def get_project(request: web.Request):
277271 req_ctx = RequestContext .model_validate (request )
278272 path_params = parse_request_path_parameters_as (ProjectPathParams , request )
279273
274+ # 1. Get project if user has access
280275 project = await _projects_service .get_project_for_user (
281276 request .app ,
282277 project_uuid = f"{ path_params .project_id } " ,
@@ -285,6 +280,7 @@ async def get_project(request: web.Request):
285280 include_trashed_by_primary_gid = True ,
286281 )
287282
283+ # 2. Check if user has access to all services within the project
288284 services_in_project = {
289285 (srv ["key" ], srv ["version" ]) for _ , srv in project .get ("workbench" , {}).items ()
290286 }
@@ -295,6 +291,7 @@ async def get_project(request: web.Request):
295291 user_id = req_ctx .user_id ,
296292 services_ids = list (services_in_project ),
297293 )
294+
298295 not_my_services = services_in_project .difference (
299296 {(srv .key , srv .release .version ) for srv in my_services }
300297 )
@@ -311,10 +308,7 @@ async def get_project(request: web.Request):
311308 )
312309 )
313310
314- if new_uuid := request .get (RQ_REQUESTED_REPO_PROJECT_UUID_KEY ):
315- project ["uuid" ] = new_uuid
316-
317- # Adds permalink
311+ # 3. Adds permalink
318312 await update_or_pop_permalink_in_project (request , project )
319313
320314 data = ProjectGet .from_domain_model (project ).data (exclude_unset = True )
0 commit comments