Educado-App / educado-frontend

The repository for the educado content creation web platform.
https://app.educado.com
GNU General Public License v3.0
0 stars 4 forks source link

[Web - Admin] Users CRUD #130

Open iarandrd opened 2 days ago

iarandrd commented 2 days ago

Set who has a admin permission, and that person should be able to manage user permission.

Figma: https://www.figma.com/design/BCEVQYvMDrcBE9qqehr9HL/Mobile-Education-UI?node-id=5217-8061&t=5ai9ByHIYOhBLRiC-4

If a user doesn’t have admin permissions, the admin page shouldn’t show to this user

sourtendon commented 1 day ago

Acceptance Criteria:

1. Admin Tab Visibility: Given a user with admin permissions, When the admin logs in to the platform, Then a new tab labeled "User Management" should be visible on the admin page. Given a user without admin permissions, When the user logs in, Then the "User Management" tab should not be visible.

2. Users Management Table: Given an admin user on the "User Management" tab, When the page loads, Then a table should display the list of all users. The table should include columns for: User name Email address Current role (e.g., Admin, Content Creator, Regular User)

3. Set as Admin: Given an admin user on the "User Management" tab, When the admin clicks the "Set as Admin" button on a specific user row, Then that user’s role should be updated to "Admin" in the system. Then the change should be reflected in the table.

4. Approve/Refuse Content Creator: Given an admin user on the "User Management" tab, When a new user requests content creator status, Then a notification or indicator should be present next to their name. When the admin clicks "Approve" or "Refuse" for the user, Then the user's status should be updated accordingly in the system, and the change should be reflected in the table.

5. Delete User: Given an admin user on the "User Management" tab, When the admin clicks the "Delete" button on a specific user row, Then a confirmation prompt should appear asking the admin to confirm the deletion. When the admin confirms the deletion, Then the user should be removed from the table and permanently deleted from the system.

6. View User Profile: Given an admin user on the "User Management" tab, When the admin clicks the "View Profile" button on a specific user row, Then a modal should appear displaying the following details for the selected user: Full name Email Role Any additional profile information filled by the user (e.g., bio, social links) When the admin closes the modal, Then the modal should disappear, and the user management table should remain visible.

7. CRUD for Users: Create: Admins cannot create users manually, but users can register, and admins can approve/refuse content creator status. Read: Admins can view the list of users and their profiles. Update: Admins can update user roles (set as admin, approve/refuse content creator). Delete: Admins can delete users from the system.

8. Data Validation: When changing a user's role to admin, Then the system should ensure that the user’s email is valid and that they are an existing user. When trying to delete or modify a user that does not exist, Then an appropriate error message should be displayed, and no changes should be made.

9. Permissions: Given a user without admin permissions, When they attempt to access the User Management page (e.g., via URL), Then they should receive an "Access Denied" message or be redirected to the homepage.

10. Notifications for User Role Changes: When an admin sets a user as an admin or approves/refuses content creator status, Then the user should receive an email or notification about the change.

11. Sorting and Filtering: Given an admin user on the "User Management" tab, When viewing the table, Then the admin should be able to sort the list of users by name, role, or status (e.g., pending content creator approval). Then the admin should be able to filter the table to only show users with specific roles (e.g., admin, content creator, regular user).

12. Audit Log for Changes: Given an admin changes a user's role or deletes a user, Then the action should be recorded in an audit log that is accessible only to other admins.