feat(users): add paginated admin metadata APIs
This commit is contained in:
@@ -533,6 +533,15 @@ def list_users(
|
||||
return queryset[offset : offset + limit]
|
||||
|
||||
|
||||
@auth_router.get("/users/{user_id}", response={200: UserProfileSchema, 403: ErrorSchema, 404: ErrorSchema}, auth=jwt_auth)
|
||||
def get_user_detail(request, user_id: int):
|
||||
user = request.auth
|
||||
if not (user.is_staff or user.is_superuser):
|
||||
return 403, {"error": "اجازه دسترسی ندارید."}
|
||||
target = get_object_or_404(User, id=user_id)
|
||||
return 200, target
|
||||
|
||||
|
||||
@auth_router.get("/roles", response={200: list[AuthorizationRoleSchema], 403: ErrorSchema}, auth=jwt_auth)
|
||||
def list_authorization_roles(request):
|
||||
if not _ensure_superuser(request.auth):
|
||||
|
||||
Reference in New Issue
Block a user