Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegionAdmin Manage Users Bugfix #758

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion backend/src/xfd_django/xfd_api/api_methods/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,15 @@ def get_users(current_user):
"""Retrieve a list of all users."""
try:
# Check if user is a regional admin or global admin
if not is_global_view_admin(current_user):
can_access_users = False

if is_global_view_admin(current_user) or is_regional_admin(current_user):
can_access_users = True

if not can_access_users:
raise HTTPException(status_code=401, detail="Unauthorized")

# Get Users
users = User.objects.all().prefetch_related("roles__organization")

# Return the updated user details
Expand Down
Loading