Commit 8f0c4a48 authored by arun.uday's avatar arun.uday

AssetManager-V1.0- Not reviewed

Updated code to include user id validations, cookie authentication, changed the api's for add, update, delete to a single api, given separate file for password encryption, new api's created based on UI requirements, add details according to the Ui needs.
parent 27bc1824
...@@ -22,6 +22,7 @@ class _Services(BaseSettings): ...@@ -22,6 +22,7 @@ class _Services(BaseSettings):
EMAIL_PASSWORD: str EMAIL_PASSWORD: str
HTML_LINK: str HTML_LINK: str
RESET_ENDPOINT: str RESET_ENDPOINT: str
DATE_TIME = '%Y-%m-%d %H:%M:%S'
class _Databases(BaseSettings): class _Databases(BaseSettings):
...@@ -41,7 +42,7 @@ class _PathConf: ...@@ -41,7 +42,7 @@ class _PathConf:
class _Secrets(BaseSettings): class _Secrets(BaseSettings):
ACCESS_TOKEN_EXPIRE_MINUTES = 30 ACCESS_TOKEN_EXPIRE_MINUTES = 480
TOKEN_EXPIRE_TIME = 5 TOKEN_EXPIRE_TIME = 5
leeway_in_minutes: int = 10 leeway_in_minutes: int = 10
KEY_ENCRYPTION: str KEY_ENCRYPTION: str
......
...@@ -4,15 +4,17 @@ class ApiEndPoints: ...@@ -4,15 +4,17 @@ class ApiEndPoints:
# common # common
submit: str = "/submit" submit: str = "/submit"
add: str = "/add" add: str = "/adduser"
view: str = "/view" view: str = "/table_body"
table_actions: str = "/table_actions"
update: str = "/update" update: str = "/update"
delete: str = "/delete" delete: str = "/delete"
header: str = "/header" header: str = "/table_header"
download: str = "/download" download: str = "/download"
search: str = "/search" search: str = "/search"
forgot: str = "/forgot" forgot: str = "/forgot"
reset: str = "/reset" reset: str = "/reset"
logout: str = "/logout"
# login-management # login-management
asset_manager_login: str = "/login" asset_manager_login: str = "/login"
...@@ -24,9 +26,12 @@ class ApiEndPoints: ...@@ -24,9 +26,12 @@ class ApiEndPoints:
asset_manager_user_management: str = "/users" asset_manager_user_management: str = "/users"
asset_manager_user_add: str = asset_manager_user_management + add asset_manager_user_add: str = asset_manager_user_management + add
asset_manager_user_view: str = asset_manager_user_management + view asset_manager_user_view: str = asset_manager_user_management + view
asset_manager_user_header: str = asset_manager_user_management + header
asset_manager_user_table_actions: str = asset_manager_user_management + table_actions
asset_manager_user_update: str = asset_manager_user_management + update asset_manager_user_update: str = asset_manager_user_management + update
asset_manager_user_delete: str = asset_manager_user_management + delete asset_manager_user_delete: str = asset_manager_user_management + delete
asset_manager_user_search: str = asset_manager_user_management + search asset_manager_user_search: str = asset_manager_user_management + search
asset_manager_user_logout: str = asset_manager_user_management + logout
# dashboard-management # dashboard-management
asset_manager_dashboard: str = "/dashboard" asset_manager_dashboard: str = "/dashboard"
......
class Validations:
email = "user@example.com"
...@@ -8,12 +8,14 @@ from scripts.utils.response_utils import ResponseData ...@@ -8,12 +8,14 @@ from scripts.utils.response_utils import ResponseData
obj_download_util = ResponseData() obj_download_util = ResponseData()
# download header and row data
class DashboardManagement: class DashboardManagement:
def __init__(self): def __init__(self):
self.download_files = obj_download_util.download_file_data() self.download_files = obj_download_util.download_file_data()
def download_header(self): def download_header(self):
try: try:
# header contents
data = { data = {
"actions": [ "actions": [
{ {
...@@ -26,10 +28,13 @@ class DashboardManagement: ...@@ -26,10 +28,13 @@ class DashboardManagement:
{ {
"headerName": "File Name", "headerName": "File Name",
"field": "file_name", "field": "file_name",
"key": "file_name" "key": "file_name",
"flex": 0,
"width": 1010
}], }],
} }
# column urls
column_urls = [{"file_name": key, "file_url": value} for key, value in self.download_files.items()] column_urls = [{"file_name": key, "file_url": value} for key, value in self.download_files.items()]
data["rowData"] = column_urls data["rowData"] = column_urls
return JSONResponse( return JSONResponse(
......
...@@ -12,7 +12,7 @@ from scripts.core.handlers.normal_login import NormalLogin ...@@ -12,7 +12,7 @@ from scripts.core.handlers.normal_login import NormalLogin
from scripts.database.mongo.mongo_db import MongoUser from scripts.database.mongo.mongo_db import MongoUser
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
from scripts.schemas.default_responses import DefaultFailureResponse, DefaultResponse from scripts.schemas.default_responses import DefaultFailureResponse, DefaultResponse, DefaultSuccessResponse
from scripts.utils.security.jwt_util import JWT from scripts.utils.security.jwt_util import JWT
from scripts.utils.security.password_util import EncryptDecryptPassword from scripts.utils.security.password_util import EncryptDecryptPassword
...@@ -48,9 +48,8 @@ class LoginHandlers: ...@@ -48,9 +48,8 @@ class LoginHandlers:
return JSONResponse(content=DefaultFailureResponse(status="failed", return JSONResponse(content=DefaultFailureResponse(status="failed",
message=data).dict(), message=data).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
# generating the access tokens # generating the access tokens
responses, exp = self.obj_login_handler.generate_cookie_tokens(user_data, request) responses, exp = self.obj_login_handler.generate_cookie_tokens(data, request)
# token generation unsuccessful # token generation unsuccessful
if responses is None: if responses is None:
return JSONResponse( return JSONResponse(
...@@ -59,12 +58,13 @@ class LoginHandlers: ...@@ -59,12 +58,13 @@ class LoginHandlers:
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
# sending successful response to UI # sending successful response to UI
response = JSONResponse( response = JSONResponse(
content=DefaultResponse(status="success", message="Logged In Successfully", data=data).dict(), content=DefaultResponse(status="success", message="Logged In Successfully",
data=data).dict(),
status_code=status.HTTP_200_OK, headers={"Content-Type": "application/json"}) status_code=status.HTTP_200_OK, headers={"Content-Type": "application/json"})
response.set_cookie(key="login-token", value=responses, expires=exp) response.set_cookie(key="login-token", value=responses, expires=exp)
return response return response
# v1 # v2
def google_login(self, request): def google_login(self, request):
pass pass
...@@ -72,6 +72,7 @@ class LoginHandlers: ...@@ -72,6 +72,7 @@ class LoginHandlers:
def microsoft_login(self, request): def microsoft_login(self, request):
pass pass
# forgot password handler
@staticmethod @staticmethod
def forgot_password_handler(email): def forgot_password_handler(email):
try: try:
...@@ -79,12 +80,12 @@ class LoginHandlers: ...@@ -79,12 +80,12 @@ class LoginHandlers:
# If user exists, send forgot password email with JWT token # If user exists, send forgot password email with JWT token
# This should include email and expire time # This should include email and expire time
# Send email using MIME # Send email using MIME
db_user_data = obj_mongo_user.fetch_one_user_details(email) db_user_data = obj_mongo_user.fetch_one_user_details({"email": email})
# if the user is not available # if the user is not available
if not db_user_data: if not db_user_data:
return JSONResponse( return JSONResponse(
content=DefaultFailureResponse(status="failed", content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_ID_DOESNT_EXIST).dict(), message=ErrorMessages.ERROR_USER_ID_DOESNT_EXIST).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
mail = MIMEMultipart() mail = MIMEMultipart()
mail['From'] = Services.EMAIL_SENDER mail['From'] = Services.EMAIL_SENDER
...@@ -112,8 +113,7 @@ class LoginHandlers: ...@@ -112,8 +113,7 @@ class LoginHandlers:
smtp.sendmail(Services.EMAIL_SENDER, email, mail.as_string()) smtp.sendmail(Services.EMAIL_SENDER, email, mail.as_string())
return JSONResponse( return JSONResponse(
content=DefaultResponse(status="success", message="Email Send Successfully", content=DefaultSuccessResponse(status="success", message="Email Send Successfully").dict(),
data={"username": email}).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
...@@ -5,7 +5,6 @@ from datetime import datetime ...@@ -5,7 +5,6 @@ from datetime import datetime
from passlib.context import CryptContext from passlib.context import CryptContext
from validate_email import validate_email from validate_email import validate_email
from scripts.config import Secrets
from scripts.database.mongo.mongo_db import MongoUser from scripts.database.mongo.mongo_db import MongoUser
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
...@@ -20,6 +19,7 @@ class NormalLogin: ...@@ -20,6 +19,7 @@ class NormalLogin:
self.dt = datetime.now() self.dt = datetime.now()
self.time_dt = datetime.now() self.time_dt = datetime.now()
# user data validation
@staticmethod @staticmethod
def user_data_validation(email, password) -> dict | None: def user_data_validation(email, password) -> dict | None:
try: try:
...@@ -33,10 +33,11 @@ class NormalLogin: ...@@ -33,10 +33,11 @@ class NormalLogin:
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
# db validation
def db_data_validation(self, login_type, email): def db_data_validation(self, login_type, email):
try: try:
# fetching the data based on the username # fetching the data based on the username
self.db_user_data = MongoUser().fetch_one_user_details(email) self.db_user_data = MongoUser().fetch_one_user_details({"email": email})
# if the user is not available # if the user is not available
if not self.db_user_data: if not self.db_user_data:
return False, ErrorMessages.ERROR_UNAUTHORIZED_USER_LOGIN return False, ErrorMessages.ERROR_UNAUTHORIZED_USER_LOGIN
...@@ -48,6 +49,7 @@ class NormalLogin: ...@@ -48,6 +49,7 @@ class NormalLogin:
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
# matching the password
def db_password_matching(self, login_type, user_data, password): def db_password_matching(self, login_type, user_data, password):
try: try:
# getting the response after checking for the user data in db # getting the response after checking for the user data in db
...@@ -59,17 +61,19 @@ class NormalLogin: ...@@ -59,17 +61,19 @@ class NormalLogin:
if not self.pwd_context.verify(password, self.db_user_data["password"]): if not self.pwd_context.verify(password, self.db_user_data["password"]):
return False, ErrorMessages.ERROR_PASSWORD_MISMATCH return False, ErrorMessages.ERROR_PASSWORD_MISMATCH
# if the password is correct # if the password is correct
return None, {"username": user_data.email, "role": self.db_user_data["user_role"]} return None, {"user_id": self.db_user_data["user_id"], "name": self.db_user_data["name"],
"email": user_data.email,
"user_role": self.db_user_data["user_role"]}
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
# cookie and token creation
@staticmethod @staticmethod
def generate_cookie_tokens(user_data, request): def generate_cookie_tokens(user_data, request):
try: try:
# creating the access token # creating the access token
access_token, exp = create_token( access_token, exp = create_token(
user_id=user_data.email, user_id=user_data["user_id"],
login_token=Secrets.SECRET_KEY,
ip=request.client.host ip=request.client.host
) )
# returning the login token # returning the login token
......
import datetime import datetime
import uuid
from scripts.database.mongo.mongo_db import MongoUser from scripts.database.mongo.mongo_db import MongoUser
from scripts.database.redis.redis_conn import login_db
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from fastapi import status from fastapi import status
from scripts.schemas.default_responses import DefaultResponse, DefaultFailureResponse from scripts.schemas.default_responses import DefaultResponse, DefaultFailureResponse, DefaultSuccessResponse
from scripts.utils.mongo_utils import MongoStageCreator
from scripts.utils.response_utils import ResponseData from scripts.utils.response_utils import ResponseData
from scripts.utils.security.password_util import EncryptDecryptPassword from scripts.utils.security.password_util import EncryptDecryptPassword
from scripts.utils.validations_util import UserDataValidations from scripts.utils.validations_util import UserDataValidations
obj_mongo_user = MongoUser() obj_mongo_user = MongoUser()
obj_response_data = ResponseData() obj_response_data = ResponseData()
obj_stage = MongoStageCreator()
# user management
class UserManagement: class UserManagement:
def __init__(self): def __init__(self):
self.method = "register" self.method = "register"
...@@ -35,29 +40,59 @@ class UserManagement: ...@@ -35,29 +40,59 @@ class UserManagement:
content=DefaultFailureResponse(status="failed", content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_EXIST).dict(), message=ErrorMessages.ERROR_EMAIL_EXIST).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
# creating a unique user id
uid = str(uuid.uuid4()).replace("-", "")
user_data.user_id = "user_" + uid
created_at = datetime.datetime.now() created_at = datetime.datetime.now()
updated_at = datetime.datetime.now() updated_at = datetime.datetime.now()
reg_time = {"created_at": created_at, "updated_at": updated_at} reg_time = {"created_at": created_at, "updated_at": updated_at}
# storing the user data in dict, encrypting the password
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value) user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
if key == "password" else value) for key, value in user_data} if key == "password" else value) for key, value in user_data if key != 'action'}
# adding the registration time to the user data
user_data_reg = user_data_dict | reg_time user_data_reg = user_data_dict | reg_time
# checking if the insertion is working
if not obj_mongo_user.insert_new_user(user_data_reg): if not obj_mongo_user.insert_new_user(user_data_reg):
return JSONResponse( return JSONResponse(
content=DefaultFailureResponse(status="failed", content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_STORING_DATA).dict(), message=ErrorMessages.ERROR_STORING_DATA).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
return JSONResponse( return JSONResponse(
content=DefaultResponse(status="success", message="Inserted Successfully", content=DefaultSuccessResponse(status="success", message="User Registration Successful").dict(),
data={"username": user_data_dict["email"]}).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
@staticmethod @staticmethod
# for Google registration using gmail # for Google registration using gmail
def google_register(): def google_register(user_data):
try: try:
return {"message": "Not available now"} # fetching the data based on the username
db_user_data = obj_mongo_user.fetch_one_user_details({"email": user_data.email})
# if the user is not available
if db_user_data:
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_EXIST).dict(),
status_code=status.HTTP_200_OK)
# creating a unique user id
uid = str(uuid.uuid4()).replace("-", "")
user_data.user_id = "user_" + uid
created_at = datetime.datetime.now()
updated_at = datetime.datetime.now()
reg_time = {"created_at": created_at, "updated_at": updated_at}
# removing action and none values of the user data
user_data_dict = {key: value for key, value in user_data if key != 'action' and value is not None}
user_data_reg = user_data_dict | reg_time
# checking if the insertion is working
if not obj_mongo_user.insert_new_user(user_data_reg):
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_STORING_DATA).dict(),
status_code=status.HTTP_200_OK)
return JSONResponse(
content=DefaultSuccessResponse(status="success", message="User Registration Successful").dict(),
status_code=status.HTTP_200_OK)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
...@@ -70,16 +105,18 @@ class UserManagement: ...@@ -70,16 +105,18 @@ class UserManagement:
logger.exception(e) logger.exception(e)
# update user details # update user details
def update_user_details(self, email, update_data): def update_user_details(self, update_data):
try: try:
self.method = "update" self.method = "update"
db_user_data = obj_mongo_user.fetch_one_user_details(email) # fetching and validating the user details
db_user_data = obj_mongo_user.fetch_one_user_details({"user_id": update_data.user_id})
# if the user is not available # if the user is not available
if db_user_data is None: if db_user_data is None:
return JSONResponse( return JSONResponse(
content=DefaultFailureResponse(status="failed", content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_ID_DOESNT_EXIST).dict(), message=ErrorMessages.ERROR_USER_ID_DOESNT_EXIST).dict(),
status_code=status.HTTP_404_NOT_FOUND) status_code=status.HTTP_404_NOT_FOUND)
# checking the user email and validating
if update_data.email is not None: if update_data.email is not None:
db_user_data = obj_mongo_user.fetch_one_user_details(update_data.email) db_user_data = obj_mongo_user.fetch_one_user_details(update_data.email)
# if the user is not available # if the user is not available
...@@ -88,11 +125,17 @@ class UserManagement: ...@@ -88,11 +125,17 @@ class UserManagement:
content=DefaultFailureResponse(status="failed", content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_EXIST).dict(), message=ErrorMessages.ERROR_EMAIL_EXIST).dict(),
status_code=status.HTTP_404_NOT_FOUND) status_code=status.HTTP_404_NOT_FOUND)
filter_data_updated = {"email": email} # creating the filter data
update_data_removed = {key: value for key, value in update_data if value is not None} filter_data_updated = {"user_id": update_data.user_id}
# encrypting the password
update_data_removed = {key: (EncryptDecryptPassword().password_encrypt(value)
if key == "password" else value) for key, value in update_data if
key != 'action' and value is not None}
# validating the data
response, message = UserDataValidations.update_data_validation(update_data) response, message = UserDataValidations.update_data_validation(update_data)
if not response: if not response:
return message return message
# updating the data
response = obj_mongo_user.update_user(filter_data_updated, update_data_removed) response = obj_mongo_user.update_user(filter_data_updated, update_data_removed)
if not response: if not response:
return JSONResponse( return JSONResponse(
...@@ -100,23 +143,25 @@ class UserManagement: ...@@ -100,23 +143,25 @@ class UserManagement:
message=ErrorMessages.ERROR_IN_UPDATING).dict(), message=ErrorMessages.ERROR_IN_UPDATING).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
return JSONResponse( return JSONResponse(
content=DefaultResponse(status="success", message="Updated Successfully", content=DefaultSuccessResponse(status="success", message="Updated Successfully").dict(),
data=update_data_removed).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
# delete user # delete user
@staticmethod @staticmethod
def delete_user_details(email): def delete_user_details(user_id):
db_user_data = obj_mongo_user.fetch_one_user_details(email) # fetching and validating the user id
db_user_data = obj_mongo_user.fetch_one_user_details({"user_id": user_id})
# if the user is not available # if the user is not available
if db_user_data is None: if db_user_data is None:
return JSONResponse( return JSONResponse(
content=DefaultFailureResponse(status="failed", content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_ID_DOESNT_EXIST).dict(), message=ErrorMessages.ERROR_USER_ID_DOESNT_EXIST).dict(),
status_code=status.HTTP_404_NOT_FOUND) status_code=status.HTTP_404_NOT_FOUND)
filter_data_updated = {"email": email} # generating the filter
filter_data_updated = {"user_id": user_id}
# deleting the user
response = obj_mongo_user.delete_user(filter_data_updated) response = obj_mongo_user.delete_user(filter_data_updated)
if not response: if not response:
return JSONResponse( return JSONResponse(
...@@ -124,42 +169,77 @@ class UserManagement: ...@@ -124,42 +169,77 @@ class UserManagement:
message=ErrorMessages.ERROR_IN_UPDATING).dict(), message=ErrorMessages.ERROR_IN_UPDATING).dict(),
status_code=status.HTTP_404_NOT_FOUND) status_code=status.HTTP_404_NOT_FOUND)
return JSONResponse( return JSONResponse(
content=DefaultResponse(status="success", message="Deleted Successfully", content=DefaultSuccessResponse(status="success", message="Deleted Successfully").dict(),
data=filter_data_updated).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
@staticmethod
def fetch_view_header():
try:
# fetching the table header for the user view
data_response = obj_response_data.user_view_header()
if data_response:
return JSONResponse(
content=DefaultResponse(status="success", message="Header Fetched Successfully",
data=data_response).dict(),
status_code=status.HTTP_200_OK)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_IN_FETCHING).dict(),
status_code=status.HTTP_404_NOT_FOUND)
except Exception as e:
logger.exception(e)
@staticmethod @staticmethod
def fetch_user_details(): def fetch_user_details():
try: try:
# defining the filter values
filter_data = {'_id': 0, filter_data = {'_id': 0,
"login_type": 0, "login_type": 0,
"is_alive": 0, "is_alive": 0,
"password": 0, "password": 0,
"created_at": 0, "created_at": 0,
"updated_at": 0} "updated_at": 0}
# filtering the users and getting all the details
cursor_data = obj_mongo_user.fetch_all_user_details({}, filter_data) cursor_data = obj_mongo_user.fetch_all_user_details({}, filter_data)
cursor_data_count = cursor_data.explain() cursor_data_count = cursor_data.explain()
# counting the total records in the query
if cursor_data_count["executionStats"]["nReturned"] <= 0: if cursor_data_count["executionStats"]["nReturned"] <= 0:
return None return None
list_user_data = [] list_user_data = []
for users in cursor_data: for users in cursor_data:
list_user_data.append(users) list_user_data.append(users)
data_response = obj_response_data.user_view() # listing the user data
print(data_response.update({"rowData": list_user_data})) if list_user_data:
return JSONResponse( return JSONResponse(
content=DefaultResponse(status="success", message="Fetched Successfully", content=DefaultResponse(status="success", message="Fetched Successfully",
data=data_response).dict(), data={"bodyContent": list_user_data}).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_IN_FETCHING).dict(),
status_code=status.HTTP_404_NOT_FOUND)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
# user logout
@staticmethod @staticmethod
def user_filter_data(body_data): def logout_user(user_id, request):
try: try:
# getting the cookie token
uid = request.login_token
# checking the user id with the user id stored in cookie
if user_id.user_id != request.user_id:
return JSONResponse( return JSONResponse(
content=DefaultResponse(status="success", message="Fetched Successfully", content=DefaultFailureResponse(status="failed",
data=list_user_data).dict(), message=ErrorMessages.ERROR_USER_SESSION).dict(),
status_code=status.HTTP_404_NOT_FOUND)
# deleting the login token from redis
login_db.delete(uid)
response = JSONResponse(
content=DefaultSuccessResponse(status="success", message="Logged Out").dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
# deleting the cookie
response.delete_cookie("login-token")
return response
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
...@@ -6,6 +6,7 @@ collection_name = DatabaseConstants.collection_user_details ...@@ -6,6 +6,7 @@ collection_name = DatabaseConstants.collection_user_details
class UserDetailsKeys: class UserDetailsKeys:
KEY_USER_ID = "user_id"
KEY_NAME = "name" KEY_NAME = "name"
KEY_EMAIL = "email" KEY_EMAIL = "email"
KEY_PASSWORD = "password" KEY_PASSWORD = "password"
...@@ -17,6 +18,7 @@ class UserDetailsKeys: ...@@ -17,6 +18,7 @@ class UserDetailsKeys:
class MongoUser(CollectionBaseClass): class MongoUser(CollectionBaseClass):
key_name = UserDetailsKeys.KEY_NAME key_name = UserDetailsKeys.KEY_NAME
key_user_id = UserDetailsKeys.KEY_USER_ID
key_email = UserDetailsKeys.KEY_EMAIL key_email = UserDetailsKeys.KEY_EMAIL
key_password = UserDetailsKeys.KEY_PASSWORD key_password = UserDetailsKeys.KEY_PASSWORD
key_user_role = UserDetailsKeys.KEY_USER_ROLE key_user_role = UserDetailsKeys.KEY_USER_ROLE
...@@ -28,16 +30,18 @@ class MongoUser(CollectionBaseClass): ...@@ -28,16 +30,18 @@ class MongoUser(CollectionBaseClass):
super().__init__(mongo_client, Databases.DB_NAME, collection_name) super().__init__(mongo_client, Databases.DB_NAME, collection_name)
# fetching the user details based on the email id # fetching the user details based on the email id
def fetch_one_user_details(self, email): def fetch_one_user_details(self, query):
if user := self.find_one(query={self.key_email: email}): if user := self.find_one(query=query):
return user return user
return None return None
# fetching the user data
def fetch_all_user_details(self, query, filter_data): def fetch_all_user_details(self, query, filter_data):
if user := self.find(query=query, filter_dict=filter_data): if user := self.find(query=query, filter_dict=filter_data):
return user return user
return None return None
# inserting the user
def insert_new_user(self, data): def insert_new_user(self, data):
if user := self.insert_one(data=data): if user := self.insert_one(data=data):
return user return user
...@@ -54,3 +58,9 @@ class MongoUser(CollectionBaseClass): ...@@ -54,3 +58,9 @@ class MongoUser(CollectionBaseClass):
if user := self.delete_one(query=query): if user := self.delete_one(query=query):
return user return user
return None return None
# for filtering
def filter_data_aggregate(self, pipeline):
if user := self.aggregate(pipelines=pipeline):
return user
return None
...@@ -14,6 +14,8 @@ class ErrorMessages: ...@@ -14,6 +14,8 @@ class ErrorMessages:
ERROR_EMAIL_EXIST = "Email Id exists" ERROR_EMAIL_EXIST = "Email Id exists"
ERROR_IN_FETCHING = "Details cannot be fetched" ERROR_IN_FETCHING = "Details cannot be fetched"
ERROR_IN_UPDATING = "Error in Updating" ERROR_IN_UPDATING = "Error in Updating"
ERROR_INVALID_REQUEST = "Invalid Request"
ERROR_USER_SESSION = "Not The Users Session"
# Data Validation # Data Validation
ERROR_INVALID_PASSWORD = "Invalid Password" ERROR_INVALID_PASSWORD = "Invalid Password"
...@@ -21,4 +23,5 @@ class ErrorMessages: ...@@ -21,4 +23,5 @@ class ErrorMessages:
ERROR_INVALID_EMAIL = "Invalid Email Id" ERROR_INVALID_EMAIL = "Invalid Email Id"
ERROR_INVALID_PHONE_NUMBER = "Invalid Phone Number" ERROR_INVALID_PHONE_NUMBER = "Invalid Phone Number"
ERROR_INVALID_USER_ROLE = "Invalid User Role" ERROR_INVALID_USER_ROLE = "Invalid User Role"
ERROR_EMAIL_ID_DOESNT_EXIST = "Email Id doesn't exist" ERROR_USER_ID_DOESNT_EXIST = "User Id doesn't exist"
ERROR_USER_ID = "User Id Not Required"
...@@ -2877,3 +2877,1099 @@ TypeError: Expecting a mapping object, as JWT only supports JSON objects as payl ...@@ -2877,3 +2877,1099 @@ TypeError: Expecting a mapping object, as JWT only supports JSON objects as payl
2023-03-28 20:00:18 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671 2023-03-28 20:00:18 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-28 20:00:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671 2023-03-28 20:00:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-28 20:03:00 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671 2023-03-28 20:03:00 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:00:16 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:09:49 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:17:37 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:21:58 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:22:40 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:39:58 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:40:27 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:40:44 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 10:55:17 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:06:20 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:10:11 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:13:57 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:15:57 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:21:18 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:23:51 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:23:58 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:54:09 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:56:06 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 11:58:11 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:00:09 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:00:18 - ERROR - [MainThread:aggregate(): 227] - pipeline must be a list
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2333, in _aggregate
cmd = aggregation_command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 52, in __init__
pipeline = common.validate_list("pipeline", pipeline)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\common.py", line 487, in validate_list
raise TypeError("%s must be a list" % (option,))
TypeError: pipeline must be a list
2023-03-29 12:00:18 - ERROR - [MainThread:user_filter_data(): 178] - pipeline must be a list
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 172, in user_filter_data
print(obj_mongo_user.filter_data_aggregate(pattern))
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 59, in filter_data_aggregate
if user := self.aggregate(pipelines=pipeline):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2333, in _aggregate
cmd = aggregation_command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 52, in __init__
pipeline = common.validate_list("pipeline", pipeline)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\common.py", line 487, in validate_list
raise TypeError("%s must be a list" % (option,))
TypeError: pipeline must be a list
2023-03-29 12:00:47 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:00:49 - ERROR - [MainThread:aggregate(): 227] - pipeline must be a list
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2333, in _aggregate
cmd = aggregation_command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 52, in __init__
pipeline = common.validate_list("pipeline", pipeline)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\common.py", line 487, in validate_list
raise TypeError("%s must be a list" % (option,))
TypeError: pipeline must be a list
2023-03-29 12:00:49 - ERROR - [MainThread:user_filter_data(): 178] - pipeline must be a list
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 172, in user_filter_data
print(obj_mongo_user.filter_data_aggregate(pattern))
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 59, in filter_data_aggregate
if user := self.aggregate(pipelines=pipeline):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2333, in _aggregate
cmd = aggregation_command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 52, in __init__
pipeline = common.validate_list("pipeline", pipeline)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\common.py", line 487, in validate_list
raise TypeError("%s must be a list" % (option,))
TypeError: pipeline must be a list
2023-03-29 12:01:09 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:01:13 - ERROR - [MainThread:aggregate(): 227] - pipeline must be a list
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2333, in _aggregate
cmd = aggregation_command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 52, in __init__
pipeline = common.validate_list("pipeline", pipeline)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\common.py", line 487, in validate_list
raise TypeError("%s must be a list" % (option,))
TypeError: pipeline must be a list
2023-03-29 12:01:13 - ERROR - [MainThread:user_filter_data(): 179] - pipeline must be a list
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 173, in user_filter_data
print(obj_mongo_user.filter_data_aggregate(pattern))
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 59, in filter_data_aggregate
if user := self.aggregate(pipelines=pipeline):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2333, in _aggregate
cmd = aggregation_command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 52, in __init__
pipeline = common.validate_list("pipeline", pipeline)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\common.py", line 487, in validate_list
raise TypeError("%s must be a list" % (option,))
TypeError: pipeline must be a list
2023-03-29 12:02:31 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:07:27 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:08:23 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:09:17 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:09:25 - ERROR - [MainThread:aggregate(): 227] - Each element of the 'pipeline' array must be an object, full error: {'ok': 0.0, 'errmsg': "Each element of the 'pipeline' array must be an object", 'code': 14, 'codeName': 'TypeMismatch'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2343, in _aggregate
return self.__database.client._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 142, in get_cursor
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 166, in command
helpers._check_command_response(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Each element of the 'pipeline' array must be an object, full error: {'ok': 0.0, 'errmsg': "Each element of the 'pipeline' array must be an object", 'code': 14, 'codeName': 'TypeMismatch'}
2023-03-29 12:09:25 - ERROR - [MainThread:user_filter_data(): 178] - Each element of the 'pipeline' array must be an object, full error: {'ok': 0.0, 'errmsg': "Each element of the 'pipeline' array must be an object", 'code': 14, 'codeName': 'TypeMismatch'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 172, in user_filter_data
print(obj_mongo_user.filter_data_aggregate([pattern]))
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 59, in filter_data_aggregate
if user := self.aggregate(pipelines=pipeline):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2343, in _aggregate
return self.__database.client._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 142, in get_cursor
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 166, in command
helpers._check_command_response(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Each element of the 'pipeline' array must be an object, full error: {'ok': 0.0, 'errmsg': "Each element of the 'pipeline' array must be an object", 'code': 14, 'codeName': 'TypeMismatch'}
2023-03-29 12:10:20 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:10:24 - ERROR - [MainThread:aggregate(): 227] - Each element of the 'pipeline' array must be an object, full error: {'ok': 0.0, 'errmsg': "Each element of the 'pipeline' array must be an object", 'code': 14, 'codeName': 'TypeMismatch'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2343, in _aggregate
return self.__database.client._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 142, in get_cursor
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 166, in command
helpers._check_command_response(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Each element of the 'pipeline' array must be an object, full error: {'ok': 0.0, 'errmsg': "Each element of the 'pipeline' array must be an object", 'code': 14, 'codeName': 'TypeMismatch'}
2023-03-29 12:10:24 - ERROR - [MainThread:user_filter_data(): 179] - Each element of the 'pipeline' array must be an object, full error: {'ok': 0.0, 'errmsg': "Each element of the 'pipeline' array must be an object", 'code': 14, 'codeName': 'TypeMismatch'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 173, in user_filter_data
print(obj_mongo_user.filter_data_aggregate([pattern]))
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 59, in filter_data_aggregate
if user := self.aggregate(pipelines=pipeline):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2343, in _aggregate
return self.__database.client._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 142, in get_cursor
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 166, in command
helpers._check_command_response(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Each element of the 'pipeline' array must be an object, full error: {'ok': 0.0, 'errmsg': "Each element of the 'pipeline' array must be an object", 'code': 14, 'codeName': 'TypeMismatch'}
2023-03-29 12:10:47 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:10:50 - ERROR - [MainThread:aggregate(): 227] - Unrecognized pipeline stage name: '$regex', full error: {'ok': 0.0, 'errmsg': "Unrecognized pipeline stage name: '$regex'", 'code': 40324, 'codeName': 'Location40324'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2343, in _aggregate
return self.__database.client._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 142, in get_cursor
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 166, in command
helpers._check_command_response(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Unrecognized pipeline stage name: '$regex', full error: {'ok': 0.0, 'errmsg': "Unrecognized pipeline stage name: '$regex'", 'code': 40324, 'codeName': 'Location40324'}
2023-03-29 12:10:50 - ERROR - [MainThread:user_filter_data(): 179] - Unrecognized pipeline stage name: '$regex', full error: {'ok': 0.0, 'errmsg': "Unrecognized pipeline stage name: '$regex'", 'code': 40324, 'codeName': 'Location40324'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 173, in user_filter_data
print(obj_mongo_user.filter_data_aggregate([pattern]))
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 59, in filter_data_aggregate
if user := self.aggregate(pipelines=pipeline):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 225, in aggregate
return collection.aggregate(pipelines)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2436, in aggregate
return self._aggregate(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 2343, in _aggregate
return self.__database.client._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\aggregation.py", line 142, in get_cursor
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 166, in command
helpers._check_command_response(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Unrecognized pipeline stage name: '$regex', full error: {'ok': 0.0, 'errmsg': "Unrecognized pipeline stage name: '$regex'", 'code': 40324, 'codeName': 'Location40324'}
2023-03-29 12:35:26 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:35:52 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:35:55 - ERROR - [MainThread:user_filter_data(): 181] - FieldPath field names may not start with '$'. Consider using $getField or $setField., full error: {'ok': 0.0, 'errmsg': "FieldPath field names may not start with '$'. Consider using $getField or $setField.", 'code': 16410, 'codeName': 'Location16410'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 174, in user_filter_data
for i in cursor:
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1248, in next
if len(self.__data) or self._refresh():
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1165, in _refresh
self.__send_message(q)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1052, in __send_message
response = client._run_operation(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1330, in _run_operation
return self._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1326, in _cmd
return server.run_operation(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\server.py", line 134, in run_operation
_check_command_response(first, sock_info.max_wire_version)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: FieldPath field names may not start with '$'. Consider using $getField or $setField., full error: {'ok': 0.0, 'errmsg': "FieldPath field names may not start with '$'. Consider using $getField or $setField.", 'code': 16410, 'codeName': 'Location16410'}
2023-03-29 12:38:14 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:38:16 - ERROR - [MainThread:user_filter_data(): 181] - unknown top level operator: $regex. If you have a field name that starts with a '$' symbol, consider using $getField or $setField., full error: {'ok': 0.0, 'errmsg': "unknown top level operator: $regex. If you have a field name that starts with a '$' symbol, consider using $getField or $setField.", 'code': 2, 'codeName': 'BadValue'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 174, in user_filter_data
for i in cursor:
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1248, in next
if len(self.__data) or self._refresh():
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1165, in _refresh
self.__send_message(q)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1052, in __send_message
response = client._run_operation(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1330, in _run_operation
return self._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1326, in _cmd
return server.run_operation(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\server.py", line 134, in run_operation
_check_command_response(first, sock_info.max_wire_version)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: unknown top level operator: $regex. If you have a field name that starts with a '$' symbol, consider using $getField or $setField., full error: {'ok': 0.0, 'errmsg': "unknown top level operator: $regex. If you have a field name that starts with a '$' symbol, consider using $getField or $setField.", 'code': 2, 'codeName': 'BadValue'}
2023-03-29 12:50:22 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:51:16 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:52:05 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:52:27 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:52:57 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:53:20 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:53:38 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 12:53:52 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:17:20 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:17:36 - ERROR - [MainThread:update_user_details(): 111] - 'email'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 85, in update_user_details
if request_data["email"] is not None:
KeyError: 'email'
2023-03-29 14:25:23 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:25:30 - ERROR - [MainThread:update_user_details(): 111] - too many values to unpack (expected 2)
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 94, in update_user_details
update_data_removed = {key: value for key, value in request_data if value is not None or (
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 94, in <dictcomp>
update_data_removed = {key: value for key, value in request_data if value is not None or (
ValueError: too many values to unpack (expected 2)
2023-03-29 14:27:25 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:27:28 - ERROR - [MainThread:update_data_validation(): 46] - 'user_role'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 41, in update_data_validation
if user_data["user_role"] == "":
KeyError: 'user_role'
2023-03-29 14:27:28 - ERROR - [MainThread:update_user_details(): 112] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 98, in update_user_details
response, message = UserDataValidations.update_data_validation(update_data_removed)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 14:27:42 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:27:46 - ERROR - [MainThread:update_data_validation(): 46] - 'user_role'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 41, in update_data_validation
if user_data["user_role"] == "":
KeyError: 'user_role'
2023-03-29 14:27:46 - ERROR - [MainThread:update_user_details(): 112] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 98, in update_user_details
response, message = UserDataValidations.update_data_validation(update_data_removed)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 14:28:06 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:28:09 - ERROR - [MainThread:update_data_validation(): 46] - 'user_role'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 41, in update_data_validation
if user_data["user_role"] == "":
KeyError: 'user_role'
2023-03-29 14:28:09 - ERROR - [MainThread:update_user_details(): 112] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 98, in update_user_details
response, message = UserDataValidations.update_data_validation(update_data_removed)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 14:31:45 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:31:48 - ERROR - [MainThread:update_user_details(): 111] - 'dict' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in update_user_details
db_user_data = obj_mongo_user.fetch_one_user_details(request_data.user_id)
AttributeError: 'dict' object has no attribute 'user_id'
2023-03-29 14:32:50 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:32:52 - ERROR - [MainThread:update_user_details(): 111] - 'dict' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in update_user_details
db_user_data = obj_mongo_user.fetch_one_user_details(request_data.user_id)
AttributeError: 'dict' object has no attribute 'user_id'
2023-03-29 14:33:37 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:33:40 - ERROR - [MainThread:update_user_details(): 112] - 'dict' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 80, in update_user_details
db_user_data = obj_mongo_user.fetch_one_user_details(request_data.user_id)
AttributeError: 'dict' object has no attribute 'user_id'
2023-03-29 14:36:08 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:36:11 - ERROR - [MainThread:update_user_details(): 112] - 'dict' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in update_user_details
print(request_data.user_id)
AttributeError: 'dict' object has no attribute 'user_id'
2023-03-29 14:36:46 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:36:49 - ERROR - [MainThread:update_user_details(): 112] - 'dict' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 80, in update_user_details
db_user_data = obj_mongo_user.fetch_one_user_details(request_data.user_id)
AttributeError: 'dict' object has no attribute 'user_id'
2023-03-29 14:39:45 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:39:48 - ERROR - [MainThread:update_user_details(): 112] - 'dict' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in update_user_details
print(request_data.user_id)
AttributeError: 'dict' object has no attribute 'user_id'
2023-03-29 14:49:38 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:50:32 - ERROR - [MainThread:update_user_details(): 109] - name 'email' is not defined
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 93, in update_user_details
filter_data_updated = {"email": email}
NameError: name 'email' is not defined
2023-03-29 14:50:56 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:50:59 - ERROR - [MainThread:update_data_validation(): 46] - 'UserUpdate' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 38, in update_data_validation
if user_data["name"] == "":
TypeError: 'UserUpdate' object is not subscriptable
2023-03-29 14:50:59 - ERROR - [MainThread:update_user_details(): 109] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 95, in update_user_details
response, message = UserDataValidations.update_data_validation(update_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 14:51:53 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:56:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 14:56:47 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 15:10:11 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 15:10:20 - ERROR - [MainThread:user_filter_data(): 181] - unknown top level operator: $regex. If you have a field name that starts with a '$' symbol, consider using $getField or $setField., full error: {'ok': 0.0, 'errmsg': "unknown top level operator: $regex. If you have a field name that starts with a '$' symbol, consider using $getField or $setField.", 'code': 2, 'codeName': 'BadValue'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 174, in user_filter_data
for i in cursor:
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1248, in next
if len(self.__data) or self._refresh():
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1165, in _refresh
self.__send_message(q)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\cursor.py", line 1052, in __send_message
response = client._run_operation(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1330, in _run_operation
return self._retryable_read(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1326, in _cmd
return server.run_operation(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\server.py", line 134, in run_operation
_check_command_response(first, sock_info.max_wire_version)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: unknown top level operator: $regex. If you have a field name that starts with a '$' symbol, consider using $getField or $setField., full error: {'ok': 0.0, 'errmsg': "unknown top level operator: $regex. If you have a field name that starts with a '$' symbol, consider using $getField or $setField.", 'code': 2, 'codeName': 'BadValue'}
2023-03-29 15:56:38 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 16:21:13 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 16:22:22 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 16:39:33 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 16:55:18 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 16:56:54 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 16:57:44 - ERROR - [MainThread:normal_register(): 61] - time data '2023-03-29 16:57:44.875253' does not match format '%Y-%m-%dT%H:%M:%S'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 44, in normal_register
created_at = datetime.datetime.strptime(str(created_at), '%Y-%m-%dT%H:%M:%S')
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2023-03-29 16:57:44.875253' does not match format '%Y-%m-%dT%H:%M:%S'
2023-03-29 17:03:37 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:13:41 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:23:26 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:24:01 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:24:32 - ERROR - [MainThread:register_data_validation(): 33] - 'UserActions' object has no attribute 'password'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 22, in register_data_validation
if user_data.password == "" or user_data.password == "string":
AttributeError: 'UserActions' object has no attribute 'password'
2023-03-29 17:24:32 - ERROR - [MainThread:normal_register(): 59] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 27, in normal_register
response, message = UserDataValidations.register_data_validation(user_data, 'general', self.method)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 17:25:13 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:27:40 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:28:52 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:29:51 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:33:08 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:34:33 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:50:34 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 17:53:09 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:03:03 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:03:06 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'LoginRequest' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
user_id=user_data.user_id,
AttributeError: 'LoginRequest' object has no attribute 'user_id'
2023-03-29 18:03:06 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 53, in normal_login
responses, exp = self.obj_login_handler.generate_cookie_tokens(user_data, request)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 18:03:09 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'LoginRequest' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
user_id=user_data.user_id,
AttributeError: 'LoginRequest' object has no attribute 'user_id'
2023-03-29 18:03:09 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 53, in normal_login
responses, exp = self.obj_login_handler.generate_cookie_tokens(user_data, request)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 18:04:34 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:04:37 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'LoginRequest' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
user_id=user_data.user_id,
AttributeError: 'LoginRequest' object has no attribute 'user_id'
2023-03-29 18:04:37 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 53, in normal_login
responses, exp = self.obj_login_handler.generate_cookie_tokens(user_data, request)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 18:05:03 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:05:06 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
user_id=user_data["user_id"],
TypeError: 'NoneType' object is not subscriptable
2023-03-29 18:05:06 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 52, in normal_login
responses, exp = self.obj_login_handler.generate_cookie_tokens(user_data_response, request)
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 18:05:56 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:06:48 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:12:15 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:20:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:21:31 - ERROR - [MainThread:user_register(): 117] - 'str' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 111, in user_register
return obj_user_handler.delete_user_details(user_data.user_id)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 117, in delete_user_details
db_user_data = obj_mongo_user.fetch_one_user_details(userdata.user_id)
AttributeError: 'str' object has no attribute 'user_id'
2023-03-29 18:28:31 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:28:40 - ERROR - [MainThread:user_register(): 118] - 'str' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 112, in user_register
return obj_user_handler.delete_user_details(user_data.user_id)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 117, in delete_user_details
db_user_data = obj_mongo_user.fetch_one_user_details(userdata.user_id)
AttributeError: 'str' object has no attribute 'user_id'
2023-03-29 18:29:28 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:29:31 - ERROR - [MainThread:user_register(): 117] - 'str' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 111, in user_register
return obj_user_handler.delete_user_details(user_data.user_id)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 117, in delete_user_details
db_user_data = obj_mongo_user.fetch_one_user_details(userdata.user_id)
AttributeError: 'str' object has no attribute 'user_id'
2023-03-29 18:30:03 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:30:06 - ERROR - [MainThread:user_register(): 117] - 'str' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 111, in user_register
return obj_user_handler.delete_user_details(user_data.user_id)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 117, in delete_user_details
print(userdata.user_id)
AttributeError: 'str' object has no attribute 'user_id'
2023-03-29 18:30:16 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:30:18 - ERROR - [MainThread:user_register(): 117] - 'str' object has no attribute 'user_id'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 111, in user_register
return obj_user_handler.delete_user_details(user_data.user_id)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 118, in delete_user_details
db_user_data = obj_mongo_user.fetch_one_user_details(userdata.user_id)
AttributeError: 'str' object has no attribute 'user_id'
2023-03-29 18:31:17 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:32:27 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:57:04 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:57:39 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:58:48 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 18:59:21 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 19:19:45 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 19:30:57 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:01:23 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:02:38 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:26:34 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:28:16 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:28:36 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:30:36 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:33:05 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:33:30 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:36:46 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:36:50 - ERROR - [MainThread:logout_user(): 197] - 'Request' object has no attribute 'cookie'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 189, in logout_user
uid = request.cookie("login-token")
AttributeError: 'Request' object has no attribute 'cookie'
2023-03-29 20:37:24 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:37:27 - ERROR - [MainThread:logout_user(): 197] - 'dict' object is not callable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 189, in logout_user
uid = request.cookies("login-token")
TypeError: 'dict' object is not callable
2023-03-29 20:38:45 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:41:10 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-29 20:41:27 - ERROR - [MainThread:db_password_matching(): 66] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 59, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-29 20:41:27 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-29 20:46:00 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 09:48:38 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:03:26 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:07:29 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:11:56 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:13:06 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:14:03 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:16:27 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:20:11 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:22:29 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:31:42 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:36:08 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:48:31 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:48:46 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:52:05 - ERROR - [MainThread:password_decrypt(): 38] - argument should be a bytes-like object or ASCII string, not 'NoneType'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\security\password_util.py", line 23, in password_decrypt
enc = base64.b64decode(password)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'
2023-03-30 10:52:05 - ERROR - [MainThread:google_register(): 90] - 'NoneType' object has no attribute 'split'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 78, in google_register
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 78, in <dictcomp>
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
File "E:\Git\meta-services\scripts\utils\security\password_util.py", line 42, in password_encrypt
hashed_password = self.pwd_context.hash(decrypted_password.split("\"")[1])
AttributeError: 'NoneType' object has no attribute 'split'
2023-03-30 10:58:36 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:59:12 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 10:59:28 - ERROR - [MainThread:password_decrypt(): 38] - argument should be a bytes-like object or ASCII string, not 'NoneType'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\security\password_util.py", line 23, in password_decrypt
enc = base64.b64decode(password)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'
2023-03-30 10:59:28 - ERROR - [MainThread:google_register(): 90] - 'NoneType' object has no attribute 'split'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 78, in google_register
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 78, in <dictcomp>
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
File "E:\Git\meta-services\scripts\utils\security\password_util.py", line 42, in password_encrypt
hashed_password = self.pwd_context.hash(decrypted_password.split("\"")[1])
AttributeError: 'NoneType' object has no attribute 'split'
2023-03-30 11:02:18 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 11:03:31 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 11:04:40 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 11:22:30 - ERROR - [MainThread:register_data_validation(): 33] - expected string or bytes-like object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 17, in register_data_validation
if user_data.email == "" or validate_email(
File "E:\Git\meta-services\venv\lib\site-packages\validate_email.py", line 127, in validate_email
assert re.match(VALID_ADDRESS_REGEXP, email) is not None
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\re.py", line 191, in match
return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object
2023-03-30 11:22:30 - ERROR - [MainThread:normal_register(): 61] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 29, in normal_register
response, message = UserDataValidations.register_data_validation(user_data, 'general', self.method)
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 11:30:36 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 11:30:44 - ERROR - [MainThread:db_password_matching(): 65] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 58, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 11:30:44 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 11:31:49 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 11:31:56 - ERROR - [MainThread:db_password_matching(): 66] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 59, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 11:31:56 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 12:07:57 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 12:14:05 - ERROR - [MainThread:db_password_matching(): 65] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 58, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 12:14:05 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 12:15:58 - ERROR - [MainThread:db_password_matching(): 65] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 58, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 12:15:58 - ERROR - [MainThread:login_default(): 46] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 39, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 12:19:32 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 12:19:37 - ERROR - [MainThread:decode(): 26] - Exception while encoding JWT: Not enough segments
Traceback (most recent call last):
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 250, in _load
signing_input, crypto_segment = jwt.rsplit(b".", 1)
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\security\jwt_util.py", line 24, in decode
return jwt.decode(token, self.key, algorithms=self.alg)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
decoded = self.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
decoded = api_jws.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
payload, signing_input, header, signature = self._load(jwt)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 253, in _load
raise DecodeError("Not enough segments") from err
jwt.exceptions.DecodeError: Not enough segments
2023-03-30 12:19:37 - ERROR - [MainThread:login_default(): 48] - Not enough segments
Traceback (most recent call last):
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 250, in _load
signing_input, crypto_segment = jwt.rsplit(b".", 1)
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 31, in login_default
print(JWT().decode("Qp8mzwtoHXMxS1IaOC1Heqs6QeYWNAU8sZ3XlPupvwE="))
File "E:\Git\meta-services\scripts\utils\security\jwt_util.py", line 24, in decode
return jwt.decode(token, self.key, algorithms=self.alg)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
decoded = self.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
decoded = api_jws.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
payload, signing_input, header, signature = self._load(jwt)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 253, in _load
raise DecodeError("Not enough segments") from err
jwt.exceptions.DecodeError: Not enough segments
2023-03-30 12:20:54 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 12:20:58 - ERROR - [MainThread:decode(): 26] - Exception while encoding JWT: Not enough segments
Traceback (most recent call last):
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 250, in _load
signing_input, crypto_segment = jwt.rsplit(b".", 1)
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\security\jwt_util.py", line 24, in decode
return jwt.decode(token, self.key, algorithms=self.alg)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
decoded = self.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
decoded = api_jws.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
payload, signing_input, header, signature = self._load(jwt)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 253, in _load
raise DecodeError("Not enough segments") from err
jwt.exceptions.DecodeError: Not enough segments
2023-03-30 12:20:58 - ERROR - [MainThread:login_default(): 48] - Not enough segments
Traceback (most recent call last):
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 250, in _load
signing_input, crypto_segment = jwt.rsplit(b".", 1)
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 31, in login_default
print(JWT().decode("Qp8mzwtoHXMxS1IaOC1Heqs6QeYWNAU8sZ3XlPupvwE="))
File "E:\Git\meta-services\scripts\utils\security\jwt_util.py", line 24, in decode
return jwt.decode(token, self.key, algorithms=self.alg)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
decoded = self.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
decoded = api_jws.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
payload, signing_input, header, signature = self._load(jwt)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 253, in _load
raise DecodeError("Not enough segments") from err
jwt.exceptions.DecodeError: Not enough segments
2023-03-30 12:21:27 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 12:21:30 - ERROR - [MainThread:decode(): 26] - Exception while encoding JWT: Invalid header padding
Traceback (most recent call last):
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 256, in _load
header_data = base64url_decode(header_segment)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\utils.py", line 34, in base64url_decode
return base64.urlsafe_b64decode(input)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 133, in urlsafe_b64decode
return b64decode(s)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (25) cannot be 1 more than a multiple of 4
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\security\jwt_util.py", line 24, in decode
return jwt.decode(token, self.key, algorithms=self.alg)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
decoded = self.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
decoded = api_jws.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
payload, signing_input, header, signature = self._load(jwt)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 258, in _load
raise DecodeError("Invalid header padding") from err
jwt.exceptions.DecodeError: Invalid header padding
2023-03-30 12:21:30 - ERROR - [MainThread:login_default(): 48] - Invalid header padding
Traceback (most recent call last):
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 256, in _load
header_data = base64url_decode(header_segment)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\utils.py", line 34, in base64url_decode
return base64.urlsafe_b64decode(input)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 133, in urlsafe_b64decode
return b64decode(s)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (25) cannot be 1 more than a multiple of 4
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 31, in login_default
print(JWT().decode("$2b$12$ecZEhxjIWmMR7sjDMd0ad.J/AwAbDqq8LB8KMN6Jx32GcAusTAYF."))
File "E:\Git\meta-services\scripts\utils\security\jwt_util.py", line 24, in decode
return jwt.decode(token, self.key, algorithms=self.alg)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
decoded = self.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
decoded = api_jws.decode_complete(
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
payload, signing_input, header, signature = self._load(jwt)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jws.py", line 258, in _load
raise DecodeError("Invalid header padding") from err
jwt.exceptions.DecodeError: Invalid header padding
2023-03-30 12:24:29 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 12:24:52 - ERROR - [MainThread:encode(): 18] - Exception while encoding JWT: Expecting a mapping object, as JWT only supports JSON objects as payloads.
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\security\jwt_util.py", line 16, in encode
return jwt.encode(payload, self.key, algorithm=self.alg)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 51, in encode
raise TypeError(
TypeError: Expecting a mapping object, as JWT only supports JSON objects as payloads.
2023-03-30 12:24:52 - ERROR - [MainThread:login_default(): 48] - Expecting a mapping object, as JWT only supports JSON objects as payloads.
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 31, in login_default
print(JWT().encode("'arunuday@123'"))
File "E:\Git\meta-services\scripts\utils\security\jwt_util.py", line 16, in encode
return jwt.encode(payload, self.key, algorithm=self.alg)
File "E:\Git\meta-services\venv\lib\site-packages\jwt\api_jwt.py", line 51, in encode
raise TypeError(
TypeError: Expecting a mapping object, as JWT only supports JSON objects as payloads.
2023-03-30 12:39:48 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 12:39:53 - ERROR - [MainThread:db_password_matching(): 65] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 58, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 12:39:53 - ERROR - [MainThread:login_default(): 50] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 43, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 12:40:15 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 12:40:17 - ERROR - [MainThread:db_password_matching(): 65] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 58, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 12:40:17 - ERROR - [MainThread:login_default(): 50] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 43, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 12:40:36 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 13:02:21 - ERROR - [MainThread:login_default(): 50] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 33, in login_default
print(pwd_context.verify("'arunuday@123'", "Qp8mzwtoHXMxS1IaOC1Heqs6QeYWNAU8sZ3XlPupvwE="))
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 13:02:47 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 13:04:18 - ERROR - [MainThread:db_password_matching(): 65] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 58, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 13:04:18 - ERROR - [MainThread:login_default(): 48] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 41, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 13:04:39 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 13:04:42 - ERROR - [MainThread:db_password_matching(): 65] - hash could not be identified
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 58, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2343, in verify
record = self._get_or_identify_record(hash, scheme, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2031, in _get_or_identify_record
return self._identify_record(hash, category)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 1132, in identify_record
raise exc.UnknownHashError("hash could not be identified")
passlib.exc.UnknownHashError: hash could not be identified
2023-03-30 13:04:42 - ERROR - [MainThread:login_default(): 50] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 43, in login_default
return login_mapper[user_data.login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 44, in normal_login
user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
TypeError: cannot unpack non-iterable NoneType object
2023-03-30 13:05:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 13:05:39 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:21:56 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:22:26 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:24:19 - ERROR - [MainThread:password_decrypt(): 38] - argument should be a bytes-like object or ASCII string, not 'NoneType'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\security\password_util.py", line 23, in password_decrypt
enc = base64.b64decode(password)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'
2023-03-30 14:24:19 - ERROR - [MainThread:google_register(): 90] - 'NoneType' object has no attribute 'split'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 78, in google_register
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 78, in <dictcomp>
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
File "E:\Git\meta-services\scripts\utils\security\password_util.py", line 42, in password_encrypt
hashed_password = self.pwd_context.hash(decrypted_password.split("\"")[1])
AttributeError: 'NoneType' object has no attribute 'split'
2023-03-30 14:25:20 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:25:23 - ERROR - [MainThread:password_decrypt(): 38] - argument should be a bytes-like object or ASCII string, not 'NoneType'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\security\password_util.py", line 23, in password_decrypt
enc = base64.b64decode(password)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'
2023-03-30 14:25:23 - ERROR - [MainThread:google_register(): 92] - 'NoneType' object has no attribute 'split'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in google_register
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in <dictcomp>
user_data_dict = {key: (EncryptDecryptPassword().password_encrypt(value)
File "E:\Git\meta-services\scripts\utils\security\password_util.py", line 42, in password_encrypt
hashed_password = self.pwd_context.hash(decrypted_password.split("\"")[1])
AttributeError: 'NoneType' object has no attribute 'split'
2023-03-30 14:26:03 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:26:55 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:28:06 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:28:21 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:28:59 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:29:58 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:31:21 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:33:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:34:50 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:39:34 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 14:58:53 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 15:09:01 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 15:09:17 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 15:16:20 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 15:26:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-30 16:40:56 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
...@@ -10,6 +10,11 @@ class DefaultResponse(BaseModel): ...@@ -10,6 +10,11 @@ class DefaultResponse(BaseModel):
data: Optional[Any] data: Optional[Any]
class DefaultSuccessResponse(BaseModel):
status: str
message: str
# default failure responses # default failure responses
class DefaultFailureResponse(BaseModel): class DefaultFailureResponse(BaseModel):
status: str status: str
......
...@@ -5,6 +5,7 @@ from pydantic import BaseModel ...@@ -5,6 +5,7 @@ from pydantic import BaseModel
# model for login request # model for login request
class LoginRequest(BaseModel): class LoginRequest(BaseModel):
login_type: str
email: str email: str
password: str password: str
...@@ -18,12 +19,26 @@ class RegistrationData(BaseModel): ...@@ -18,12 +19,26 @@ class RegistrationData(BaseModel):
user_role: str user_role: str
class UserUpdate(BaseModel): class UserActions(BaseModel):
action: str
user_id: Optional[str] = None
name: Optional[str] = None name: Optional[str] = None
email: Optional[str] = None email: Optional[str] = None
password: Optional[str]
phone_number: Optional[str] = None phone_number: Optional[str] = None
login_type: Optional[str] = None
user_role: Optional[str] = None user_role: Optional[str] = None
class UsersFilter(BaseModel):
name: Optional[str] = None
email: Optional[str] = None
user_role: Optional[str] = None
class UserIDValidation(BaseModel):
user_id: str
class EmailValidation(BaseModel): class EmailValidation(BaseModel):
email: str email: str
...@@ -8,7 +8,7 @@ from scripts.core.handlers.user_management_handler import UserManagement ...@@ -8,7 +8,7 @@ from scripts.core.handlers.user_management_handler import UserManagement
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
from scripts.schemas.default_responses import DefaultFailureResponse from scripts.schemas.default_responses import DefaultFailureResponse
from scripts.schemas.project_schema import LoginRequest, RegistrationData, UserUpdate, EmailValidation from scripts.schemas.project_schema import LoginRequest, UserActions, EmailValidation, UserIDValidation
from scripts.utils.security.authorize_access import AuthorizeAccess from scripts.utils.security.authorize_access import AuthorizeAccess
from scripts.utils.security.decorators import MetaInfoSchema, auth from scripts.utils.security.decorators import MetaInfoSchema, auth
...@@ -23,7 +23,6 @@ obj_dashboard_handler = DashboardManagement() ...@@ -23,7 +23,6 @@ obj_dashboard_handler = DashboardManagement()
# login API # login API
@router.post(ApiEndPoints.asset_manager_submit) @router.post(ApiEndPoints.asset_manager_submit)
async def login_default( async def login_default(
login_type: str,
user_data: LoginRequest, user_data: LoginRequest,
request: Request, request: Request,
): ):
...@@ -36,12 +35,12 @@ async def login_default( ...@@ -36,12 +35,12 @@ async def login_default(
} }
# getting the functions based on the login types # getting the functions based on the login types
if login_type in login_mapper: if user_data.login_type in login_mapper:
return login_mapper[login_type](user_data, request) return login_mapper[user_data.login_type](user_data, request)
else: else:
return HTTPException( return HTTPException(
status_code=status.HTTP_403_FORBIDDEN, status_code=status.HTTP_403_FORBIDDEN,
detail="Invalid Request") detail=ErrorMessages.ERROR_INVALID_REQUEST)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
...@@ -84,10 +83,10 @@ async def forgot_password( ...@@ -84,10 +83,10 @@ async def forgot_password(
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
# Create new users API # User Management API
@router.post(ApiEndPoints.asset_manager_user_add) @router.post(ApiEndPoints.asset_manager_user_table_actions)
async def user_register( async def user_register(
user_data: RegistrationData, user_data: UserActions,
request: MetaInfoSchema = Depends(auth) request: MetaInfoSchema = Depends(auth)
): ):
try: try:
...@@ -97,21 +96,26 @@ async def user_register( ...@@ -97,21 +96,26 @@ async def user_register(
content=DefaultFailureResponse(status="failed", content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS).dict(), message=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
# mapper for login types # mapper for registration types
register_mapper = { register_mapper = {
"general": obj_user_handler.normal_register, "general_login": obj_user_handler.normal_register,
"google": obj_user_handler.google_register, "google": obj_user_handler.google_register,
"microsoft": obj_user_handler.microsoft_register "microsoft": obj_user_handler.microsoft_register
} }
# getting the functions based on the login types if user_data.action == "addnew" and user_data.login_type in register_mapper:
if user_data.login_type in register_mapper: # registration
return register_mapper[user_data.login_type](user_data) return register_mapper[user_data.login_type](user_data)
elif user_data.action == "edit":
# updating
return obj_user_handler.update_user_details(user_data)
elif user_data.action == "delete":
# deleting
return obj_user_handler.delete_user_details(user_data.user_id)
else: else:
return HTTPException( return HTTPException(
status_code=status.HTTP_403_FORBIDDEN, status_code=status.HTTP_403_FORBIDDEN,
detail="Invalid Request") detail=ErrorMessages.ERROR_INVALID_REQUEST)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
return JSONResponse( return JSONResponse(
...@@ -120,44 +124,25 @@ async def user_register( ...@@ -120,44 +124,25 @@ async def user_register(
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
# Update users API # View users API Header
@router.post(ApiEndPoints.asset_manager_user_update) @router.post(ApiEndPoints.asset_manager_user_header)
async def user_register( async def user_register(
email: str,
update_data: UserUpdate,
request: MetaInfoSchema = Depends(auth) request: MetaInfoSchema = Depends(auth)
): ):
try: try:
# authorize the user
response = AuthorizeAccess().admin_authorize(request) response = AuthorizeAccess().admin_authorize(request)
if not response: if not response:
return JSONResponse( return JSONResponse(
content=DefaultFailureResponse(status="failed", content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS).dict(), message=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
response = obj_user_handler.update_user_details(email, update_data) # getting the header for the user table
return response response = obj_user_handler.fetch_view_header()
except Exception as e:
logger.exception(e)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.OP_FAILED).dict(),
status_code=status.HTTP_200_OK)
# Delete users API
@router.post(ApiEndPoints.asset_manager_user_delete)
async def user_register(
email: str,
request: MetaInfoSchema = Depends(auth)
):
try:
response = AuthorizeAccess().admin_authorize(request)
if not response: if not response:
return JSONResponse( return HTTPException(
content=DefaultFailureResponse(status="failed", status_code=status.HTTP_403_FORBIDDEN,
message=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS).dict(), detail=ErrorMessages.ERROR_IN_FETCHING)
status_code=status.HTTP_200_OK)
response = obj_user_handler.delete_user_details(email)
return response return response
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
...@@ -173,6 +158,7 @@ async def user_register( ...@@ -173,6 +158,7 @@ async def user_register(
request: MetaInfoSchema = Depends(auth) request: MetaInfoSchema = Depends(auth)
): ):
try: try:
# authorize the user
response = AuthorizeAccess().admin_authorize(request) response = AuthorizeAccess().admin_authorize(request)
if not response: if not response:
return JSONResponse( return JSONResponse(
...@@ -196,15 +182,10 @@ async def user_register( ...@@ -196,15 +182,10 @@ async def user_register(
# download Button Dashboard # download Button Dashboard
@router.post(ApiEndPoints.asset_manager_dashboard_download) @router.post(ApiEndPoints.asset_manager_dashboard_download)
async def dashboard_download( async def dashboard_download(
request: MetaInfoSchema = Depends(auth)
): ):
try: try:
response = AuthorizeAccess().admin_authorize(request) # getting the data for the download dashboard
if not response:
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS).dict(),
status_code=status.HTTP_200_OK)
response = obj_dashboard_handler.download_header() response = obj_dashboard_handler.download_header()
if not response: if not response:
return HTTPException( return HTTPException(
...@@ -219,21 +200,16 @@ async def dashboard_download( ...@@ -219,21 +200,16 @@ async def dashboard_download(
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK)
# API for users search filter # API for logout
@router.post(ApiEndPoints.asset_manager_user_search) @router.post(ApiEndPoints.asset_manager_user_logout)
async def user_search_filter( async def user_logout(
payload_data: Request, user_id: UserIDValidation,
request: MetaInfoSchema = Depends(auth) request: MetaInfoSchema = Depends(auth)
): ):
try: try:
response = AuthorizeAccess().admin_authorize(request) # authorizing the user
if not response: # logging out
return JSONResponse( response = obj_user_handler.logout_user(user_id, request)
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS).dict(),
status_code=status.HTTP_200_OK)
request_body = await payload_data.json()
response = obj_user_handler.user_filter_data(request_body)
if not response: if not response:
return HTTPException( return HTTPException(
status_code=status.HTTP_403_FORBIDDEN, status_code=status.HTTP_403_FORBIDDEN,
......
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
class="download-link" class="download-link"
style="color: blue" style="color: blue"
target="_blank">Click here target="_blank">Click here
to download</a> to change password</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -57,3 +57,6 @@ class MongoStageCreator: ...@@ -57,3 +57,6 @@ class MongoStageCreator:
def sort_stage(self, stage: dict) -> dict: def sort_stage(self, stage: dict) -> dict:
return self.add_stage("$sort", stage) return self.add_stage("$sort", stage)
def regex_stage(self, stage: dict) -> dict:
return self.add_stage("$regex", stage)
...@@ -3,6 +3,7 @@ import re ...@@ -3,6 +3,7 @@ import re
from scripts.logging.logger import logger from scripts.logging.logger import logger
# for data validations
class RegexValidation: class RegexValidation:
@staticmethod @staticmethod
def name_validation(name): def name_validation(name):
......
# response data utils
class ResponseData: class ResponseData:
@staticmethod @staticmethod
def user_view(): def user_view_header():
header = { header = {
"actions": [ "actions": [
{ {
...@@ -12,7 +13,7 @@ class ResponseData: ...@@ -12,7 +13,7 @@ class ResponseData:
"class": "fa-trash", "class": "fa-trash",
"action": "delete", "action": "delete",
"tooltip": "Delete" "tooltip": "Delete"
} },
], "externalActions": [ ], "externalActions": [
{ {
"type": "button", "type": "button",
...@@ -22,8 +23,8 @@ class ResponseData: ...@@ -22,8 +23,8 @@ class ResponseData:
], "columnDefs": [ ], "columnDefs": [
{ {
"headerName": "User Name", "headerName": "User Name",
"field": "userName", "field": "email",
"key": "userName" "key": "email"
}, },
{ {
"headerName": "Name", "headerName": "Name",
...@@ -32,14 +33,17 @@ class ResponseData: ...@@ -32,14 +33,17 @@ class ResponseData:
}, },
{ {
"headerName": "Role", "headerName": "Role",
"field": "role", "field": "user_role",
"key": "role" "key": "user_role",
"width": 150,
"flex": 0
} }
], ],
} }
return header return header
# download api util
@staticmethod @staticmethod
def download_file_data(): def download_file_data():
data = { data = {
......
...@@ -33,7 +33,6 @@ def create_token( ...@@ -33,7 +33,6 @@ def create_token(
_payload = payload | _extras _payload = payload | _extras
# encoding the token # encoding the token
new_token = jwt.encode(_payload) new_token = jwt.encode(_payload)
# Add session to redis # Add session to redis
login_db.set(uid, new_token) login_db.set(uid, new_token)
login_db.expire(uid, timedelta(minutes=age)) login_db.expire(uid, timedelta(minutes=age))
......
...@@ -5,10 +5,12 @@ obj_mongo_user = MongoUser() ...@@ -5,10 +5,12 @@ obj_mongo_user = MongoUser()
class AuthorizeAccess: class AuthorizeAccess:
@staticmethod @staticmethod
# authorize the user
def admin_authorize(request): def admin_authorize(request):
try: try:
user_data = obj_mongo_user.fetch_one_user_details(request.user_id) # returning the user details
if user_data["user_role"] != "super admin": user_data = obj_mongo_user.fetch_one_user_details({"user_id": request.user_id})
if user_data["user_role"] != "super_admin":
return False return False
return True return True
except TypeError: except TypeError:
......
...@@ -6,6 +6,7 @@ from scripts.config import Secrets, Services ...@@ -6,6 +6,7 @@ from scripts.config import Secrets, Services
from scripts.logging.logger import logger from scripts.logging.logger import logger
# utility for the password
class EncryptDecryptPassword: class EncryptDecryptPassword:
def __init__(self): def __init__(self):
self.pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") self.pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
...@@ -37,7 +38,10 @@ class EncryptDecryptPassword: ...@@ -37,7 +38,10 @@ class EncryptDecryptPassword:
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
# encrypting the password
def password_encrypt(self, password): def password_encrypt(self, password):
# decrypting the UI password
decrypted_password = self.password_decrypt(password) decrypted_password = self.password_decrypt(password)
# hashing the decrypted password
hashed_password = self.pwd_context.hash(decrypted_password.split("\"")[1]) hashed_password = self.pwd_context.hash(decrypted_password.split("\"")[1])
return hashed_password return hashed_password
...@@ -6,6 +6,7 @@ from scripts.errors import ErrorMessages ...@@ -6,6 +6,7 @@ from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
# user data validations
class UserDataValidations: class UserDataValidations:
@staticmethod @staticmethod
def register_data_validation(user_data, method, feature): def register_data_validation(user_data, method, feature):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment