Ed-Fi-Exchange-OSS / Leadership-Profile

Apache License 2.0
2 stars 3 forks source link

Manage users for admin roles #150

Closed stephenfuqua closed 3 months ago

stephenfuqua commented 3 months ago

Jira Description

1) List all Users (anyone who has registered for the leadership program with a tpdm username). 2) Allow Admin to elevate/promote a user to an "Admin" role. (role will be initially set based on the employment status of the user)

Jira Metadata

Key: LP-34 Epic: n/a Created: 2021-01-28T11:35:27.000-0600 Reporter: Yogiraj Aradhye

stephenfuqua commented 3 months ago

Jira Comment

The userclaims controller has three endpoints. Visit swagger for more information.

GET

Returns a list of profiles that have been assigned a specified role. The page number and the role to match must be provided as query string parameters (e.g. 'userclaims?page=1&role=admin'). 

Response example: 


{
  "totalCount": 1,
  "profiles": [
    {
      "id": "6494F430-48B7-4339-98B9-19D4E91342EC",
      "staffUsi": 1,
      "staffUniqueId": "0132398",
      "firstName": "Patricia",
      "middleName": null,
      "lastSurname": "Ramirez",
      "location": "Dallas",
      "fullName": "PatriciaRamirez",
      "isAdmin": true,
      "username": "whatever"
    }
  ],
  "page": 1
}

 

Note 'isAdmin' indicates if the user profile is assigned the admin role

POST 

Provide an array of StaffUniqueId strings that will be assigned a claim based role provided in the request body.

Request example:

 


{
  "claimType": "role",
  "claimValue": "Admin",
  "staffUniqueIds": [
    "0132398", "1000000017"
  ]
}

Response example:


{
  "resultMessage": "Processed 2 records",
  "userResults": [
    {
      "userName": "whatever",
      "succeeded": false,
      "message": "Claim already added"
    },
    {
      "userName": "anotheruser",
      "succeeded": true,
      "errors": []
    }
  ]
}

Note when a claim already exists compared to the claim that was successfully assigned. The empty errors array indicates NO errors. Any error that does occur would appear here.

DELETE

Removes a claim based role from the StaffUniqueId's provided

Request example:


{
  "claimType": "role",
  "claimValue": "Admin",
  "staffUniqueIds": [
    "1000000017", "12345"
  ]
}

Response example:


{
  "resultMessage": "Processed 1 records",
  "userResults": [
    {
      "userName": "anotheruser",
      "succeeded": true,
      "errors": []
    }
  ]
}

Note that response contains a successful removal annotated in the succeeded parameter. The next response indicates no action was taken. While the user is a registered user, they do not have the claim assigned. Profiles that have not registered are not processed. Example:


{
  "resultMessage": "Processed 1 records",
  "userResults": [
    {
      "userName": "anotheruser",
      "succeeded": false,
      "message": "Claim not found to remove"
    }
  ]
}

 

Jira Metadata

Created: 2021-02-24T21:47:03.493-0600 Commenter: Mark Harvey