Skip to content

Commit f4ef677

Browse files
committed
adding privacy
1 parent 0f35ebe commit f4ef677

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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

services/web/server/src/simcore_service_webserver/users/api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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
)

services/web/server/src/simcore_service_webserver/users/schemas.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from simcore_postgres_database.models.users import UserRole
1313

1414
from ..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
"login": "[email protected]",
@@ -82,6 +85,7 @@ class ProfileGet(BaseModel):
8285
"gravatar_id": "205e460b479e2e5b48aec07710c08d50",
8386
"preferences": {},
8487
},
88+
# 2. with expiration date
8589
{
8690
"id": 42,
8791
"login": "[email protected]",
@@ -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": {

0 commit comments

Comments
 (0)