Skip to content

Commit a53a97e

Browse files
Merge branch 'master' into extract-celery-code
2 parents 614df7d + eccf0c0 commit a53a97e

File tree

58 files changed

+4119
-720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4119
-720
lines changed

api/specs/web-server/_users.py

Lines changed: 8 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,23 @@
44
# pylint: disable=too-many-arguments
55

66

7-
from enum import Enum
87
from typing import Annotated
98

10-
from _common import as_query
119
from fastapi import APIRouter, Depends, status
1210
from models_library.api_schemas_webserver.users import (
11+
MyFunctionPermissionsGet,
1312
MyPermissionGet,
1413
MyProfileGet,
1514
MyProfilePatch,
1615
MyTokenCreate,
1716
MyTokenGet,
18-
UserAccountApprove,
19-
UserAccountGet,
20-
UserAccountReject,
21-
UserAccountSearchQueryParams,
2217
UserGet,
23-
UsersAccountListQueryParams,
2418
UsersSearch,
2519
)
2620
from models_library.api_schemas_webserver.users_preferences import PatchRequestBody
2721
from models_library.generics import Envelope
28-
from models_library.rest_pagination import Page
2922
from models_library.user_preferences import PreferenceIdentifier
3023
from simcore_service_webserver._meta import API_VTAG
31-
from simcore_service_webserver.users._common.schemas import PreRegisteredUserGet
3224
from simcore_service_webserver.users._notifications import (
3325
UserNotification,
3426
UserNotificationCreate,
@@ -128,6 +120,13 @@ async def mark_notification_as_read(
128120
async def list_user_permissions(): ...
129121

130122

123+
@router.get(
124+
"/me/function-permissions",
125+
response_model=Envelope[MyFunctionPermissionsGet],
126+
)
127+
async def list_user_functions_permissions(): ...
128+
129+
131130
#
132131
# USERS public
133132
#
@@ -139,56 +138,3 @@ async def list_user_permissions(): ...
139138
description="Search among users who are publicly visible to the caller (i.e., me) based on their privacy settings.",
140139
)
141140
async def search_users(_body: UsersSearch): ...
142-
143-
144-
#
145-
# USERS admin
146-
#
147-
148-
_extra_tags: list[str | Enum] = ["admin"]
149-
150-
151-
@router.get(
152-
"/admin/user-accounts",
153-
response_model=Page[UserAccountGet],
154-
tags=_extra_tags,
155-
)
156-
async def list_users_accounts(
157-
_query: Annotated[as_query(UsersAccountListQueryParams), Depends()],
158-
): ...
159-
160-
161-
@router.post(
162-
"/admin/user-accounts:approve",
163-
status_code=status.HTTP_204_NO_CONTENT,
164-
tags=_extra_tags,
165-
)
166-
async def approve_user_account(_body: UserAccountApprove): ...
167-
168-
169-
@router.post(
170-
"/admin/user-accounts:reject",
171-
status_code=status.HTTP_204_NO_CONTENT,
172-
tags=_extra_tags,
173-
)
174-
async def reject_user_account(_body: UserAccountReject): ...
175-
176-
177-
@router.get(
178-
"/admin/user-accounts:search",
179-
response_model=Envelope[list[UserAccountGet]],
180-
tags=_extra_tags,
181-
)
182-
async def search_user_accounts(
183-
_query: Annotated[UserAccountSearchQueryParams, Depends()],
184-
):
185-
# NOTE: see `Search` in `Common Custom Methods` in https://cloud.google.com/apis/design/custom_methods
186-
...
187-
188-
189-
@router.post(
190-
"/admin/user-accounts:pre-register",
191-
response_model=Envelope[UserAccountGet],
192-
tags=_extra_tags,
193-
)
194-
async def pre_register_user_account(_body: PreRegisteredUserGet): ...
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# pylint: disable=redefined-outer-name
2+
# pylint: disable=unused-argument
3+
# pylint: disable=unused-variable
4+
# pylint: disable=too-many-arguments
5+
6+
7+
from enum import Enum
8+
from typing import Annotated
9+
10+
from _common import as_query
11+
from fastapi import APIRouter, Depends, status
12+
from models_library.api_schemas_webserver.users import (
13+
UserAccountApprove,
14+
UserAccountGet,
15+
UserAccountReject,
16+
UserAccountSearchQueryParams,
17+
UsersAccountListQueryParams,
18+
)
19+
from models_library.generics import Envelope
20+
from models_library.rest_pagination import Page
21+
from simcore_service_webserver._meta import API_VTAG
22+
from simcore_service_webserver.users._common.schemas import PreRegisteredUserGet
23+
24+
router = APIRouter(prefix=f"/{API_VTAG}", tags=["users"])
25+
26+
_extra_tags: list[str | Enum] = ["admin"]
27+
28+
29+
@router.get(
30+
"/admin/user-accounts",
31+
response_model=Page[UserAccountGet],
32+
tags=_extra_tags,
33+
)
34+
async def list_users_accounts(
35+
_query: Annotated[as_query(UsersAccountListQueryParams), Depends()],
36+
): ...
37+
38+
39+
@router.post(
40+
"/admin/user-accounts:approve",
41+
status_code=status.HTTP_204_NO_CONTENT,
42+
tags=_extra_tags,
43+
)
44+
async def approve_user_account(_body: UserAccountApprove): ...
45+
46+
47+
@router.post(
48+
"/admin/user-accounts:reject",
49+
status_code=status.HTTP_204_NO_CONTENT,
50+
tags=_extra_tags,
51+
)
52+
async def reject_user_account(_body: UserAccountReject): ...
53+
54+
55+
@router.get(
56+
"/admin/user-accounts:search",
57+
response_model=Envelope[list[UserAccountGet]],
58+
tags=_extra_tags,
59+
)
60+
async def search_user_accounts(
61+
_query: Annotated[UserAccountSearchQueryParams, Depends()],
62+
):
63+
# NOTE: see `Search` in `Common Custom Methods` in https://cloud.google.com/apis/design/custom_methods
64+
...
65+
66+
67+
@router.post(
68+
"/admin/user-accounts:pre-register",
69+
response_model=Envelope[UserAccountGet],
70+
tags=_extra_tags,
71+
)
72+
async def pre_register_user_account(_body: PreRegisteredUserGet): ...

api/specs/web-server/openapi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"_tags_groups", # after _tags
2727
"_products",
2828
"_users",
29+
"_users_admin", # after _users
2930
"_wallets",
3031
# add-ons ---
3132
"_activity",

packages/models-library/src/models_library/api_schemas_webserver/users.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,7 @@ class MyPermissionGet(OutputSchema):
377377
@classmethod
378378
def from_domain_model(cls, permission: UserPermission) -> Self:
379379
return cls(name=permission.name, allowed=permission.allowed)
380+
381+
382+
class MyFunctionPermissionsGet(OutputSchema):
383+
write_functions: bool

packages/models-library/src/models_library/functions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ class FunctionJobDB(BaseModel):
227227
class_specific_data: FunctionJobClassSpecificData
228228
function_class: FunctionClass
229229

230+
model_config = ConfigDict(from_attributes=True)
231+
230232

231233
class RegisteredFunctionJobDB(FunctionJobDB):
232234
uuid: FunctionJobID
@@ -242,6 +244,8 @@ class FunctionDB(BaseModel):
242244
default_inputs: FunctionInputs
243245
class_specific_data: FunctionClassSpecificData
244246

247+
model_config = ConfigDict(from_attributes=True)
248+
245249

246250
class RegisteredFunctionDB(FunctionDB):
247251
uuid: FunctionID
@@ -252,6 +256,8 @@ class FunctionJobCollectionDB(BaseModel):
252256
title: str = ""
253257
description: str = ""
254258

259+
model_config = ConfigDict(from_attributes=True)
260+
255261

256262
class RegisteredFunctionJobCollectionDB(FunctionJobCollectionDB):
257263
uuid: FunctionJobCollectionID

services/api-server/openapi.json

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4459,6 +4459,16 @@
44594459
"title": "Study Id"
44604460
}
44614461
},
4462+
{
4463+
"name": "hidden",
4464+
"in": "query",
4465+
"required": false,
4466+
"schema": {
4467+
"type": "boolean",
4468+
"default": false,
4469+
"title": "Hidden"
4470+
}
4471+
},
44624472
{
44634473
"name": "x-simcore-parent-project-uuid",
44644474
"in": "header",
@@ -4494,6 +4504,15 @@
44944504
}
44954505
}
44964506
],
4507+
"requestBody": {
4508+
"content": {
4509+
"application/json": {
4510+
"schema": {
4511+
"$ref": "#/components/schemas/Body_clone_study_v0_studies__study_id__clone_post"
4512+
}
4513+
}
4514+
}
4515+
},
44974516
"responses": {
44984517
"201": {
44994518
"description": "Successful Response",
@@ -7585,6 +7604,42 @@
75857604
"format": "uuid",
75867605
"title": "Function Id"
75877606
}
7607+
},
7608+
{
7609+
"name": "x-simcore-parent-project-uuid",
7610+
"in": "header",
7611+
"required": true,
7612+
"schema": {
7613+
"anyOf": [
7614+
{
7615+
"type": "string",
7616+
"format": "uuid"
7617+
},
7618+
{
7619+
"const": "null",
7620+
"type": "string"
7621+
}
7622+
],
7623+
"title": "X-Simcore-Parent-Project-Uuid"
7624+
}
7625+
},
7626+
{
7627+
"name": "x-simcore-parent-node-id",
7628+
"in": "header",
7629+
"required": true,
7630+
"schema": {
7631+
"anyOf": [
7632+
{
7633+
"type": "string",
7634+
"format": "uuid"
7635+
},
7636+
{
7637+
"const": "null",
7638+
"type": "string"
7639+
}
7640+
],
7641+
"title": "X-Simcore-Parent-Node-Id"
7642+
}
75887643
}
75897644
],
75907645
"requestBody": {
@@ -7681,6 +7736,42 @@
76817736
"format": "uuid",
76827737
"title": "Function Id"
76837738
}
7739+
},
7740+
{
7741+
"name": "x-simcore-parent-project-uuid",
7742+
"in": "header",
7743+
"required": true,
7744+
"schema": {
7745+
"anyOf": [
7746+
{
7747+
"type": "string",
7748+
"format": "uuid"
7749+
},
7750+
{
7751+
"const": "null",
7752+
"type": "string"
7753+
}
7754+
],
7755+
"title": "X-Simcore-Parent-Project-Uuid"
7756+
}
7757+
},
7758+
{
7759+
"name": "x-simcore-parent-node-id",
7760+
"in": "header",
7761+
"required": true,
7762+
"schema": {
7763+
"anyOf": [
7764+
{
7765+
"type": "string",
7766+
"format": "uuid"
7767+
},
7768+
{
7769+
"const": "null",
7770+
"type": "string"
7771+
}
7772+
],
7773+
"title": "X-Simcore-Parent-Node-Id"
7774+
}
76847775
}
76857776
],
76867777
"requestBody": {
@@ -7762,6 +7853,36 @@
77627853
],
77637854
"title": "Body_abort_multipart_upload_v0_files__file_id__abort_post"
77647855
},
7856+
"Body_clone_study_v0_studies__study_id__clone_post": {
7857+
"properties": {
7858+
"title": {
7859+
"anyOf": [
7860+
{
7861+
"type": "string"
7862+
},
7863+
{
7864+
"type": "null"
7865+
}
7866+
],
7867+
"title": "Title",
7868+
"empty": true
7869+
},
7870+
"description": {
7871+
"anyOf": [
7872+
{
7873+
"type": "string"
7874+
},
7875+
{
7876+
"type": "null"
7877+
}
7878+
],
7879+
"title": "Description",
7880+
"empty": true
7881+
}
7882+
},
7883+
"type": "object",
7884+
"title": "Body_clone_study_v0_studies__study_id__clone_post"
7885+
},
77657886
"Body_complete_multipart_upload_v0_files__file_id__complete_post": {
77667887
"properties": {
77677888
"client_file": {

0 commit comments

Comments
 (0)