async def admin_create_user(user: User, current_user: User = Depends(get_current_active_user)): # Check if the logged-in-User hat Admin Priveleges if current_user.PERMISSION_LEVEL >= 3: user.PASSWORD_HASH = get_password_hash(user.PASSWORD_HASH) create_user(user) return JSONResponse(status_code=status.HTTP_201_CREATED, content="User was successfully created") else: return JSONResponse( status_code=status.HTTP_403_FORBIDDEN, content="Not sufficient Permissions to create other users" )
def remove_passwordhash_obj(users: User): users.PASSWORD_HASH = None return users