Skip to content

Commit 3d9ed4b

Browse files
committed
drafting service layer
1 parent 17a6bcd commit 3d9ed4b

File tree

3 files changed

+56
-6
lines changed

3 files changed

+56
-6
lines changed

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4541,6 +4541,34 @@ paths:
45414541
responses:
45424542
'204':
45434543
description: Successful Response
4544+
/v0/projects/{project_id}:share:
4545+
post:
4546+
tags:
4547+
- projects
4548+
- groups
4549+
summary: Share Project
4550+
operationId: share_project
4551+
parameters:
4552+
- name: project_id
4553+
in: path
4554+
required: true
4555+
schema:
4556+
type: string
4557+
format: uuid
4558+
title: Project Id
4559+
requestBody:
4560+
required: true
4561+
content:
4562+
application/json:
4563+
schema:
4564+
$ref: '#/components/schemas/_ProjectsGroupsBodyParams'
4565+
responses:
4566+
'201':
4567+
description: Successful Response
4568+
content:
4569+
application/json:
4570+
schema:
4571+
$ref: '#/components/schemas/Envelope_ProjectGroupGet_'
45444572
/v0/projects/{project_id}/groups/{group_id}:
45454573
post:
45464574
tags:

services/web/server/src/simcore_service_webserver/projects/_controller/groups_rest.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
class _ProjectShare(InputSchema):
3232
# TODO: move to models_library.api_schemas_webserver.groups together with the rest
33-
user_email: EmailStr
33+
sharee_email: EmailStr
3434

3535
# sharing access
3636
read: bool
@@ -57,12 +57,19 @@ async def share_project(request: web.Request):
5757
req_ctx.user_id,
5858
req_ctx.product_name,
5959
path_params.project_id,
60-
body_params.user_email,
60+
body_params.sharee_email,
6161
):
6262

63-
# TODO: share project
64-
if body_params.user_email:
65-
raise NotImplementedError
63+
await _groups_service.share_project_by_email(
64+
app=request.app,
65+
user_id=req_ctx.user_id,
66+
project_id=path_params.project_id,
67+
sharee_email=body_params.sharee_email,
68+
read=body_params.read,
69+
write=body_params.write,
70+
delete=body_params.delete,
71+
product_name=req_ctx.product_name,
72+
)
6673

6774
return web.json_response(status=status.HTTP_204_NO_CONTENT)
6875

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from models_library.products import ProductName
77
from models_library.projects import ProjectID
88
from models_library.users import UserID
9-
from pydantic import BaseModel
9+
from pydantic import BaseModel, EmailStr
1010

1111
from ..users import api as users_service
1212
from . import _groups_repository
@@ -170,6 +170,21 @@ async def delete_project_group(
170170
)
171171

172172

173+
async def share_project_by_email(
174+
app: web.Application,
175+
*,
176+
product_name: ProductName,
177+
user_id: UserID, # sharer
178+
project_id: ProjectID, # shared
179+
sharee_email: EmailStr, # sharee
180+
# access-rights for sharing
181+
read: bool,
182+
write: bool,
183+
delete: bool,
184+
):
185+
raise NotImplementedError
186+
187+
173188
### Operations without checking permissions
174189

175190

0 commit comments

Comments
 (0)