fix permissions issue
This commit is contained in:
8
makefile
8
makefile
@@ -1,7 +1,7 @@
|
|||||||
#VENV=source ./.venv/bin/activate;
|
VENV=source ./.venv/bin/activate;
|
||||||
#ALEMBIC=alembic -c ./server/backend/database/alembic/alembic.ini
|
ALEMBIC=alembic -c ./server/backend/database/alembic/alembic.ini
|
||||||
VENV= .venv\Scripts\activate #Windows
|
#VENV= .venv\Scripts\activate #Windows
|
||||||
ALEMBIC=alembic -c server\backend\database\alembic\alembic.ini
|
#ALEMBIC=alembic -c server\backend\database\alembic\alembic.ini
|
||||||
.PHONY: run run_debug migrate_head migrate_down migrate_history migrate_current migrate_heads migrate_stamp migrate
|
.PHONY: run run_debug migrate_head migrate_down migrate_history migrate_current migrate_heads migrate_stamp migrate
|
||||||
run:
|
run:
|
||||||
$(VENV) python run.py --user_name admin
|
$(VENV) python run.py --user_name admin
|
||||||
|
|||||||
2
run.py
2
run.py
@@ -22,7 +22,7 @@ async def init_admin(user_name: str):
|
|||||||
def start(log_level: str):
|
def start(log_level: str):
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
"server.backend.endpoints.endpoints:api",
|
"server.backend.endpoints.endpoints:api",
|
||||||
host="0.0.0.0",
|
host="127.0.0.1",
|
||||||
port=settings.PORT,
|
port=settings.PORT,
|
||||||
reload=False,
|
reload=False,
|
||||||
log_level=log_level,
|
log_level=log_level,
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ async def update_user(data: pydantic.UserUpdate, user=Depends(get_current_user))
|
|||||||
if not user_check:
|
if not user_check:
|
||||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
|
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
|
||||||
if not user_check.admin:
|
if not user_check.admin:
|
||||||
if data.code != user_check.code:
|
print(data.code)
|
||||||
|
if data.code != user_check.code and data.code:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
detail="Ordinary users cannot change their code"
|
detail="Ordinary users cannot change their code"
|
||||||
|
|||||||
Reference in New Issue
Block a user