diff --git a/private_gpt/launcher.py b/private_gpt/launcher.py index 1d2b962a..4f819785 100644 --- a/private_gpt/launcher.py +++ b/private_gpt/launcher.py @@ -44,7 +44,7 @@ def create_app(root_injector: Injector) -> FastAPI: allow_credentials=True, allow_origins=["http://localhost:80/", "http://10.1.101.125:80", "http://quickgpt.gibl.com.np:80", "http://127.0.0.1", "http://10.1.101.125", "http://quickgpt.gibl.com.np", "http://localhost:8001", "http://192.168.1.93", "http://192.168.1.93:88", - "http://192.168.1.98", "http://192.168.1.98:5173", "http://localhost:5173", "http://127.0.0.1/", "http://localhost/", + "http://192.168.1.98", "http://192.168.1.98:5173", "http://localhost:3000","https://globaldocquery.gibl.com.np/", "http://127.0.0.1/", "http://localhost/", "http://localhost:80", "http://192.168.1.131:80/", "http://192.168.1.131"], allow_methods=["DELETE", "GET", "POST", "PUT", "OPTIONS", "PATCH"], allow_headers=["*"], diff --git a/private_gpt/users/api/v1/routers/audits.py b/private_gpt/users/api/v1/routers/audits.py index 793fd8cc..d9d41240 100644 --- a/private_gpt/users/api/v1/routers/audits.py +++ b/private_gpt/users/api/v1/routers/audits.py @@ -26,12 +26,18 @@ def list_companies( """ Retrieve a list of companies with pagination support. """ + def get_fullname(id): + user = crud.user.get_by_id(db, id=id) + if user: + return user.fullname + return "" + logs = crud.audit.get_multi_desc(db, skip=skip, limit=limit) logs = [ schemas.Audit( id=dep.id, model=dep.model, - username=(crud.user.get_by_id(db, id=dep.user_id).fullname), + username=get_fullname(dep.user_id), details=dep.details, action=dep.action, timestamp=dep.timestamp, diff --git a/private_gpt/users/api/v1/routers/auth.py b/private_gpt/users/api/v1/routers/auth.py index f099e309..f5b7ee10 100644 --- a/private_gpt/users/api/v1/routers/auth.py +++ b/private_gpt/users/api/v1/routers/auth.py @@ -131,10 +131,11 @@ def login_access_token( else: username, department = ldap_login(db=db, username=form_data.username, password=form_data.password) depart = crud.department.get_by_department_name(db, name=department) + if depart: ad_user_register(db=db, email=form_data.username, fullname=username, password=form_data.password, department_id=depart.id) else: - department_in = schemas.DepartmentCreate(name=depart) + department_in = schemas.DepartmentCreate(name=department) new_department = crud.department.create(db, obj_in=department_in) ad_user_register(db=db, email=form_data.username, fullname=username, password=form_data.password, department_id=new_department.id) return True diff --git a/settings.yaml b/settings.yaml index cf444d7d..5cdfc14e 100644 --- a/settings.yaml +++ b/settings.yaml @@ -3,7 +3,7 @@ # Syntax in `private_pgt/settings/settings.py` server: env_name: ${APP_ENV:prod} - port: ${PORT:88} + port: ${PORT:8000} cors: enabled: true allow_credentials: true