Skip to content

Commit 30b8d19

Browse files
add back function that is being used
1 parent 50a40f4 commit 30b8d19

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

services/web/server/src/simcore_service_webserver/projects/_projects_repository_legacy.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from models_library.products import ProductName
2424
from models_library.projects import (
2525
ProjectID,
26+
ProjectIDStr,
2627
ProjectListAtDB,
2728
ProjectTemplateType,
2829
)
@@ -834,6 +835,29 @@ async def get_project_product(self, project_uuid: ProjectID) -> ProductName:
834835
raise ProjectNotFoundError(project_uuid=project_uuid)
835836
return cast(str, row[0])
836837

838+
async def update_project_owner_without_checking_permissions( # <-- Used by Garbage Collector
839+
self,
840+
project_uuid: ProjectIDStr,
841+
*,
842+
new_project_owner: UserID,
843+
new_project_access_rights: dict,
844+
) -> None:
845+
"""The garbage collector needs to alter the row without passing through the
846+
permissions layer (sic)."""
847+
async with self.engine.acquire() as conn:
848+
# now update it
849+
result: ResultProxy = await conn.execute(
850+
projects.update()
851+
.values(
852+
prj_owner=new_project_owner,
853+
access_rights=new_project_access_rights,
854+
last_change_date=now_str(),
855+
)
856+
.where(projects.c.uuid == project_uuid)
857+
)
858+
result_row_count: int = result.rowcount
859+
assert result_row_count == 1 # nosec
860+
837861
async def delete_project(self, user_id: int, project_uuid: str):
838862
_logger.info(
839863
"Deleting project with %s for user with %s",

0 commit comments

Comments
 (0)