-
Notifications
You must be signed in to change notification settings - Fork 0
Admin API
Here holds the endpoints that are exclusive to superAdmin. All endpoints here require the token to confirm one is a superAdmin.
Change log:
1. Self password reset is moved to auth wiki page.
2. Change password is moved to auth wiki page.
3. Admin creation of special accounts are removed. Instead, they are expected to create via conventional methods
and simply change the status and roles to the necessary ones.
(v0.2.0-beta)
4. Added User Responsive Search for all the different status
(v0.5.0-beta)
5. Added ability to clone a class as required by the organisation
(v0.6.0-beta)
6. Aligns to new Schemas. The response will differ from older patch.
- Change user status and roles
- Show all pending users (who have just signed up and confirmed their email)
- Get Suspended and Deleted users
- Mass deletion of users
- Get All Users based on name search (Responsive)
- Clone a Class
-
This endpoint allows the admin to change the status of a user (E.g from Pending to Active and vice versa) and set their roles as [SuperAdmin, Admin, Mentor, Supervisor, Volunteer, Adhoc, Temporary].
-
API could permit one to change User Status to and fro
Suspended
andDeleted
. For mass deletion during spring cleaning, please use the DELETE API. This API is available as a tick and delete option on the volunteer view page of the admin panel. -
It is to note that similar to volunteer delete, all status other than Active will remove the volunteer's name from all classes. However, under the Profile page, he still has that classID as a record, allowing him to be automatically re-added when the status changes back to Active.
POST http://localhost:3000/api/admin/userStatusPermissions
Parameter | Required | Description |
---|---|---|
token | true | Obtained from login or register. Place in x-access-token header |
userId | true | _id of the user |
newStatus | false | A string to describe the status of the user. Pending users would not have access to most of the functions |
newRoles | false | An array of roles. Possible roles: [Superadmin, Admin, Mentor, Supervisor, Volunteer, Adhoc, Temporary] |
GET http://localhost:3000/api/admin/pendingUsers
{
"users": [
{
"_id": "5a23c38802e5572184176bb1",
"email": "windowstest@gmail.com",
"roles": [
"Tutor"
],
"name": "Batman1",
"status": "Pending"
{
"_id": "5a23e392c69db63be4984cc7",
"email": "windows@gmail.com",
"roles": [
"Tutor"
],
"name": "Batman2",
"status": "Pending"
}
]
}
This 2 endpoints retrieve the suspended and deleted users list for admin to perform further actions respectively
- Suspended: GET
http://localhost:3000/api/admin/suspended
- Deleted: GET
http://localhost:3000/api/admin/deleted
The response are similar to the API used to retrieve pending users.
The superAdmin might want to perform a large deletion.
DELETE http://localhost:3000/api/admin/user
{
"userId": ["5a23e47775822d4e7c7a69a4", "321983831831931938122", "and many more..."]
}
The response would tell you the number that is successfully deleted. If a deletion request is sent to an already "deleted" user, there will be a response that the user does not exist.
This endpoints retrieve the users list for admin to perform further actions respectively based on name searched. This function is Case Insensitive
GET http://localhost:3000/api/admin/search/:name
{
"pendingMatched": [],
"activeMatched": [
{
"name": "Admin",
"status": "Active",
"roles": [
"SuperAdmin"
],
"_id": "59c65c7d860b5d3fce0096b2"
}
],
"suspendedMatched": [],
"deletedMatched": []
}
This API allows an admin to clone a class in a new year. The class will be quick and automatically adds a "Clone" word at the back of the class name. The admin will then receive a link to visit and update the class accordingly.
GET http://localhost:3000/api/class/clone/:id
Copyright © R3:C0D3 | Ulu Pandan Stars. All rights reserved.