Skip to content

Commit de7bd73

Browse files
committed
@odeimaiz review: adapting web-api
1 parent de42aea commit de7bd73

File tree

3 files changed

+111
-4
lines changed
  • api/specs/web-server
  • packages/models-library/src/models_library/api_schemas_webserver
  • services/web/server/src/simcore_service_webserver/api/v0

3 files changed

+111
-4
lines changed

api/specs/web-server/_users.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
MyProfilePatch,
1616
MyTokenCreate,
1717
MyTokenGet,
18+
UserApprove,
1819
UserForAdminGet,
1920
UserGet,
21+
UserReject,
2022
UsersForAdminListQueryParams,
2123
UsersForAdminSearchQueryParams,
2224
UsersSearch,
@@ -156,6 +158,30 @@ async def list_users_for_admin(
156158
): ...
157159

158160

161+
@router.post(
162+
"/admin/users:approve",
163+
response_model=Envelope[Page[UserForAdminGet]],
164+
tags=_extra_tags,
165+
)
166+
async def approve_user_account(_body: UserApprove): ...
167+
168+
169+
@router.post(
170+
"/admin/users:reject",
171+
status_code=status.HTTP_204_NO_CONTENT,
172+
tags=_extra_tags,
173+
)
174+
async def reject_user_account(_body: UserReject): ...
175+
176+
177+
@router.post(
178+
"/admin/users:resendConfirmationEmail",
179+
status_code=status.HTTP_204_NO_CONTENT,
180+
tags=_extra_tags,
181+
)
182+
async def resend_user_confirmation_email(_body: UserApprove): ...
183+
184+
159185
@router.get(
160186
"/admin/users:search",
161187
response_model=Envelope[list[UserForAdminGet]],

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,20 @@ class UsersForAdminListFilter(Filters):
247247
# 2. If APPROVED AND user uses the invitation link, then it can be in any of these states:
248248
# CONFIRMATION_PENDING, ACTIVE, EXPIRED, BANNED, DELETED
249249
#
250-
approved: bool | None = None
250+
status: Literal["PENDING"] | None = None
251251

252252

253253
class UsersForAdminListQueryParams(PageQueryParameters, UsersForAdminListFilter): ...
254254

255255

256+
class UserApprove(InputSchema):
257+
email: EmailStr
258+
259+
260+
class UserReject(InputSchema):
261+
email: EmailStr
262+
263+
256264
class UsersForAdminSearchQueryParams(RequestParameters):
257265
email: Annotated[
258266
str,

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

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,14 +1373,15 @@ paths:
13731373
summary: List Users For Admin
13741374
operationId: list_users_for_admin
13751375
parameters:
1376-
- name: approved
1376+
- name: status
13771377
in: query
13781378
required: false
13791379
schema:
13801380
anyOf:
1381-
- type: boolean
1381+
- const: PENDING
1382+
type: string
13821383
- type: 'null'
1383-
title: Approved
1384+
title: Status
13841385
- name: limit
13851386
in: query
13861387
required: false
@@ -1402,6 +1403,58 @@ paths:
14021403
application/json:
14031404
schema:
14041405
$ref: '#/components/schemas/Envelope_Page_UserForAdminGet__'
1406+
/v0/admin/users:approve:
1407+
post:
1408+
tags:
1409+
- users
1410+
- admin
1411+
summary: Approve User Account
1412+
operationId: approve_user_account
1413+
requestBody:
1414+
content:
1415+
application/json:
1416+
schema:
1417+
$ref: '#/components/schemas/UserApprove'
1418+
required: true
1419+
responses:
1420+
'200':
1421+
description: Successful Response
1422+
content:
1423+
application/json:
1424+
schema:
1425+
$ref: '#/components/schemas/Envelope_Page_UserForAdminGet__'
1426+
/v0/admin/users:reject:
1427+
post:
1428+
tags:
1429+
- users
1430+
- admin
1431+
summary: Reject User Account
1432+
operationId: reject_user_account
1433+
requestBody:
1434+
content:
1435+
application/json:
1436+
schema:
1437+
$ref: '#/components/schemas/UserReject'
1438+
required: true
1439+
responses:
1440+
'204':
1441+
description: Successful Response
1442+
/v0/admin/users:resendConfirmationEmail:
1443+
post:
1444+
tags:
1445+
- users
1446+
- admin
1447+
summary: Resend User Confirmation Email
1448+
operationId: resend_user_confirmation_email
1449+
requestBody:
1450+
content:
1451+
application/json:
1452+
schema:
1453+
$ref: '#/components/schemas/UserApprove'
1454+
required: true
1455+
responses:
1456+
'204':
1457+
description: Successful Response
14051458
/v0/admin/users:search:
14061459
get:
14071460
tags:
@@ -16630,6 +16683,16 @@ components:
1663016683
- number
1663116684
- e_tag
1663216685
title: UploadedPart
16686+
UserApprove:
16687+
properties:
16688+
email:
16689+
type: string
16690+
format: email
16691+
title: Email
16692+
type: object
16693+
required:
16694+
- email
16695+
title: UserApprove
1663316696
UserForAdminGet:
1663416697
properties:
1663516698
firstName:
@@ -16883,6 +16946,16 @@ components:
1688316946
required:
1688416947
- read
1688516948
title: UserNotificationPatch
16949+
UserReject:
16950+
properties:
16951+
email:
16952+
type: string
16953+
format: email
16954+
title: Email
16955+
type: object
16956+
required:
16957+
- email
16958+
title: UserReject
1688616959
UserStatus:
1688716960
type: string
1688816961
enum:

0 commit comments

Comments
 (0)