File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
services/web/server/src/simcore_service_webserver/users Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1+ from pydantic import BaseModel
2+
3+
4+ #
5+ # REST models
6+ #
7+ class ProfilePrivacyGet (BaseModel ):
8+ hide_fullname : bool
9+ hide_email : bool
10+
11+
12+ class ProfilePrivacyUpdate (BaseModel ):
13+ hide_fullname : bool | None = None
14+ hide_email : bool | None = None
Original file line number Diff line number Diff line change @@ -65,7 +65,9 @@ async def get_user_profile(
6565 sa .join (
6666 users ,
6767 sa .join (
68- user_to_groups , groups , user_to_groups .c .gid == groups .c .gid
68+ user_to_groups ,
69+ groups ,
70+ user_to_groups .c .gid == groups .c .gid ,
6971 ),
7072 users .c .id == user_to_groups .c .uid ,
7173 )
Original file line number Diff line number Diff line change 1212from simcore_postgres_database .models .users import UserRole
1313
1414from ..utils import gravatar_hash
15+ from ._models import ProfilePrivacyGet , ProfilePrivacyUpdate
1516
1617
1718#
@@ -66,6 +67,7 @@ class ProfileGet(BaseModel):
6667 alias = "expirationDate" ,
6768 )
6869
70+ privacy : ProfilePrivacyGet = ProfilePrivacyGet (hide_fullname = True , hide_email = True )
6971 preferences : AggregatedPreferences
7072
7173 model_config = ConfigDict (
@@ -74,6 +76,7 @@ class ProfileGet(BaseModel):
7476 populate_by_name = True ,
7577 json_schema_extra = {
7678 "examples" : [
79+ # 1. with gravatar
7780 {
7881 "id" : 1 ,
7982@@ -82,6 +85,7 @@ class ProfileGet(BaseModel):
8285 "gravatar_id" : "205e460b479e2e5b48aec07710c08d50" ,
8386 "preferences" : {},
8487 },
88+ # 2. with expiration date
8589 {
8690 "id" : 42 ,
8791@@ -117,6 +121,8 @@ class ProfileUpdate(BaseModel):
117121 first_name : FirstNameStr | None = None
118122 last_name : LastNameStr | None = None
119123
124+ privacy : ProfilePrivacyUpdate | None = None
125+
120126 model_config = ConfigDict (
121127 json_schema_extra = {
122128 "example" : {
You can’t perform that action at this time.
0 commit comments