Skip to content

Commit d11897d

Browse files
committed
drafting service layer
1 parent 990cd96 commit d11897d

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

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)