Skip to content

Commit cc97ca1

Browse files
committed
feat: add pseudocode for user endpoints
1 parent dfac9fa commit cc97ca1

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

  • src/register_your_data_api/routers

src/register_your_data_api/routers/users.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ def add_user_to_reporting_org(
1515
request: starlette.requests.Request,
1616
user: authn.UserAndCredentials = Security(authn.parse_decoded_token, scopes=["ryd", "ryd:reporting_org:user"]),
1717
) -> JSONResponse:
18+
# check token has required scopes
19+
# check roles
20+
# get user ID from the access token
21+
# make sure user exists in CRM and identity service
22+
# make sure reporting org exists
23+
# find user in CRM and add relationship
24+
# write fga token to identity service
1825
raise fastapi.HTTPException(
1926
status_code=fastapi.status.HTTP_501_NOT_IMPLEMENTED,
2027
detail="Not yet implemented",
@@ -28,6 +35,15 @@ def update_user_role_in_reporting_org(
2835
authn.parse_decoded_token, scopes=["ryd", "ryd:reporting_org:user:update"]
2936
),
3037
) -> JSONResponse:
38+
# check token has required scopes
39+
# check roles
40+
# get user ID from the access token (the requester, "sub")
41+
# make sure user {user_id} exists in CRM and identity service
42+
# make sure reporting org exists
43+
# make sure "sub" has the permissions to set user authz for this reporting org
44+
# make sure user {user_id} and reporting org are related in CRM
45+
# make sure user {user_id} has an FGA token in the identity service
46+
# update token in the identity service
3147
raise fastapi.HTTPException(
3248
status_code=fastapi.status.HTTP_501_NOT_IMPLEMENTED,
3349
detail="Not yet implemented",
@@ -41,6 +57,16 @@ def remove_user_from_reporting_org(
4157
authn.parse_decoded_token, scopes=["ryd", "ryd:reporting_org:user:update"]
4258
),
4359
) -> JSONResponse:
60+
# check token has required scopes
61+
# check roles
62+
# get user ID from the access token (the requester, "sub")
63+
# make sure user {user_id} exists in CRM and identity service
64+
# make sure reporting org exists
65+
# make sure "sub" has the permissions to set user authz for this reporting org
66+
# make sure user {user_id} and reporting org are related in CRM
67+
# make sure user {user_id} has an FGA token in the identity service
68+
# update token in the identity service
69+
# remove relationship between user and reporting org in the CRM
4470
raise fastapi.HTTPException(
4571
status_code=fastapi.status.HTTP_501_NOT_IMPLEMENTED,
4672
detail="Not yet implemented",

0 commit comments

Comments
 (0)