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

List of users is not populated for super admin #2221

Open
manjitapandey opened this issue Feb 24, 2025 · 7 comments
Open

List of users is not populated for super admin #2221

manjitapandey opened this issue Feb 24, 2025 · 7 comments
Labels
backend Related to backend code bug Something isn't working effort:low Likely a few hours priority:low Backlog of tasks that will be addressed in time

Comments

@manjitapandey
Copy link
Contributor

Describe the bug
When admin user tries to view the list of users from manage section, the list of user is not populated and upon inspection there is 400 bad request error message on network panel

To Reproduce
Steps to reproduce the behavior:
Make sure you have an admin role

  1. Go to 'manage tab'
  2. Click on 'manage users'
  3. See error

Expected behavior
The list of users should be populated

Screenshots

Image

Additional context
the error message is as below:
"errors": [
{
"loc": [
"query",
"project_id"
],
"msg": "Field required",
"error": "Field required['query', 'project_id']"
}
]
}
for
https://api.stage.fmtm.hotosm.org/users?results_per_page=13&page=1&search=

@manjitapandey manjitapandey added bug Something isn't working backend Related to backend code labels Feb 24, 2025
@spwoodcock
Copy link
Member

I think the frontend just needs

?project_id={projectId}

@NSUWAL123
Copy link
Contributor

I think the frontend just needs

?project_id={projectId}

No @spwoodcock. The /users API is used in the manage-users section as well as in the create project (display user list to assign project admin). So it's not possible to pass ?project_id={projectId} param

@spwoodcock
Copy link
Member

Well that makes sense then. I just assumed that was the fix based on the error.

So you are suggesting we might need separate endpoints for both?

On a side note, I personally still don't understand why we need this functionality in the frontend - its close to the very bottom of what I see for FMTM priorities 😅 (along with any admin-specific frontend functionality)

@spwoodcock spwoodcock added priority:low Backlog of tasks that will be addressed in time effort:low Likely a few hours labels Feb 24, 2025
@NSUWAL123
Copy link
Contributor

I assume the manage users page was the top priority as we discussed in the meeting last month 🤔

@NSUWAL123
Copy link
Contributor

We will be using the user API in many places as well as in the user tagging feature in comments. But I didn't understand why project_id is needed to pass in the user's API.

@spwoodcock
Copy link
Member

spwoodcock commented Feb 25, 2025

I assume the manage users page was the top priority as we discussed in the meeting last month 🤔

Oh my bad then, if Ramya and Manjita agree its priority then ignore me, sorry!
(I don't necessarily agree - I think writing a UI for one admin user isn't the best idea 😅)

However, that said, if we could reuse this component for managing users at a project level too (for project admins), then its a great idea 👍

@spwoodcock
Copy link
Member

My main concern is not writing a load of additional code specifically for the admin user.

On the backend we need to pass the project id generally, to determine the user roles.

However in this case we can adapt the logic probably to make passing project id optional.

  • If no id, check if user is admin, return all users
  • If id included, check if user is at least project manager, return filtered users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code bug Something isn't working effort:low Likely a few hours priority:low Backlog of tasks that will be addressed in time
Projects
None yet
Development

No branches or pull requests

3 participants