Skip to content

Commit 238a03b

Browse files
committed
ongoing
1 parent 127ee4d commit 238a03b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

services/storage/src/simcore_service_storage/simcore_s3_dsm.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,25 @@ async def list_paths(
253253

254254
async def compute_path_total_size(self, user_id: UserID, *, path: Path) -> ByteSize:
255255
"""returns the total size of the path"""
256+
project_id = None
257+
node_id = None
258+
with contextlib.suppress(ValueError):
259+
# NOTE: we currently do not support anything else than project_id/node_id/file_path here, sorry chap
260+
project_id = ProjectID(path.parts[0])
261+
if len(path.parts) > 1:
262+
node_id = NodeID(path.parts[1])
263+
async with self.engine.connect() as conn:
264+
if project_id:
265+
project_access_rights = await get_project_access_rights(
266+
conn=conn, user_id=user_id, project_id=project_id
267+
)
268+
if not project_access_rights.read:
269+
raise ProjectAccessRightError(
270+
access_right="read", project_id=project_id
271+
)
272+
accessible_projects_ids = [project_id]
273+
else:
274+
accessible_projects_ids = await get_readable_project_ids(conn, user_id)
256275
return 0
257276

258277
async def list_files(

0 commit comments

Comments
 (0)