(20241205) Working on clientUserId (how the third-party client recognizes your user).
This commit is contained in:
@@ -100,7 +100,7 @@ class MailOAuthModel(BaseModel):
|
||||
db_conn: AsyncMySQL,
|
||||
mongo_conn: AsyncMongo,
|
||||
user_info: dict,
|
||||
email_id: str,
|
||||
client_user_id: dict,
|
||||
service_client: Literal["gmail"],
|
||||
auth_type: Literal["oauth"],
|
||||
sync_freq: Literal[60, 300, 900] = 300,
|
||||
@@ -113,7 +113,7 @@ class MailOAuthModel(BaseModel):
|
||||
:param db_conn: The database connection (MariaDB) to use to perform the action.
|
||||
:param mongo_conn: The database connection (MongoDB) to use to perform the action.
|
||||
:param user_info: The dictionary that has the user's session information.
|
||||
:param email_id: The e-mail id that the user wants to connect to your service.
|
||||
:param client_user_id: The way the third-party client recognizes your user.
|
||||
:param service_client: The name of the company or brand that is providing this service that is being integrated.
|
||||
:param auth_type: To identify the type of authentication being done here. This could indicate simple password
|
||||
authentication, more advance OAuth2.0 authentication, etc.
|
||||
@@ -134,9 +134,7 @@ class MailOAuthModel(BaseModel):
|
||||
"entityId": user_info["entityId"],
|
||||
"billingAccountId": user_info["billingAccountId"]
|
||||
},
|
||||
"clientUserId": {
|
||||
"email": email_id
|
||||
}
|
||||
"clientUserId": client_user_id
|
||||
}),
|
||||
update = {
|
||||
"$set": {
|
||||
@@ -148,6 +146,7 @@ class MailOAuthModel(BaseModel):
|
||||
"client": service_client,
|
||||
"authType": auth_type,
|
||||
"user": user_info,
|
||||
"clientUserId": client_user_id,
|
||||
"token": None,
|
||||
"firstRefreshTs": None,
|
||||
"lastRefreshTs": None,
|
||||
@@ -191,7 +190,7 @@ class MailOAuthModel(BaseModel):
|
||||
db_conn: AsyncMySQL,
|
||||
mongo_conn: AsyncMongo,
|
||||
token_id: ObjectId | str,
|
||||
email_id: str,
|
||||
client_user_id: dict,
|
||||
token: dict,
|
||||
session_token: str = None
|
||||
) -> bool:
|
||||
@@ -203,8 +202,8 @@ class MailOAuthModel(BaseModel):
|
||||
:param db_conn: The database connection (MariaDB) to use to perform the action.
|
||||
:param mongo_conn: The database connection (MongoDB) to use to perform the action.
|
||||
:param token_id: The identifier granted by the 'get_token_id' method.
|
||||
:param email_id: The e-mail id that the user tried to connect to your service. This should match the e-mail id
|
||||
the user claimed he wants to connect when he used 'get_token_identifier'.
|
||||
:param client_user_id: The way the third-party client recognizes your user. These details should match the
|
||||
details furnished while requesting the authorization through 'get_token_id' method.
|
||||
:param token: The token granted by the third-party service.
|
||||
:param session_token: The session token of the user who requested this service.
|
||||
:return: True if saved, False if failed.
|
||||
@@ -221,9 +220,7 @@ class MailOAuthModel(BaseModel):
|
||||
collection = MailOAuthModel.AUTH_COLLECTION,
|
||||
filter = mongo_conn.dict_to_dot_notation({
|
||||
"_id": ObjectId(token_id),
|
||||
"clientUserId": {
|
||||
"email": email_id
|
||||
}
|
||||
"clientUserId": client_user_id
|
||||
}),
|
||||
update = {
|
||||
"$set": {
|
||||
|
||||
Reference in New Issue
Block a user