Skip to content

Organization Users

Alexandru Chiraples edited this page Jul 22, 2017 · 1 revision

As an administrator, I need to be able to create, list, update and delete users in order to manage access to a specific organization.

Details

  • Everything happens in the context of a selected Organization. For more information please refer to the links presented below in the Other references topic.
  • The design should reflect the existing template from #/index/samples
  • A list of users affiliated to the selected Organization should be displayed having #/index/users as its url and the following columns:
    • Id - the record's auto-generated id from database(we might get rid of it later)
    • Nume - the name of the user; this is actually the email address of the user
    • Level - user access level. Can either be 0 or 100 with actual labels Admin and User.
    • Status - the status of the user which can be either 1 or 0 representing Activ or Inactiv
  • A form with the ability to add a new user to the selected Organization should be displayed having #/index/users/new as its url and the following fields:
    • Nume - email address of the user; for now no auto-complete will be implemented, thus the admin will need to provide the full email address
    • Level - access level, 0 being the highest rank
    • Status - the status of the user which can be either 1 or 0 representing Activ or Inactiv
  • A form with the ability to edit an existing user from the selected Organization should be displayed having #/index/users/:id as its url and the following fields:
    • Nume - email address of the user; for now no auto-complete will be implemented, thus the admin will need to provide the full email address
    • Level - user access level. Can either be 0 or 100 with actual labels Admin and User.
    • Status - the status of the user which can be either Activ or Inactiv
  • Users which are not assigned to the Organization should not be allowed to access the Api. The restriction will be implemented using an ActionFilter which will check the organizationId from the endpoint against the logged in user's associated organizations which are stored in the claims

Api reference

List users

Lists all users from the selected Organization.

GET api/organizations/:organizationId/users

Parameters

Name Type Description
currentPage int The page to display.
itemsPerPage int The number of items per page. Default is 10.
sortAscending bool Sorting style. True for ascending and False for descending.
sortBy string What to sort results by. Can be either id, level, status, user. Default: user.

Response

{
  "list" : [
    {
      "id": 1,
      "name": "[email protected]",
      "level": 0,
      "status": 1,
    }
  ],
  "totalItems": 1
}

List individual user

GET api/organizations/:organizationId/users/:id

Response

{
  "id": 1,
  "name": "[email protected]",
  "level": 0,
  "status": 1,
}

Create user

Creates a new user inside the selected Organization.

POST api/organizations/:organizationId/users

Parameters

Name Type Description
name string The name of the user. This is its actual email address.
level int User access level. Can either be 0 or 100 with actual labels Admin and User.
status int User status. Can either be 1 or 0 with actual labels Activ and Inactiv.

Example

{
  "name": "[email protected]",
  "level": 0,
  "status": 1,
}

Edit user

Updates an existing user inside the selected Organization.

PUT api/organizations/:organizationId/users

Parameters

Name Type Description
id long Actual user id. This is a auto-generated database value.
name string The name of the user. This is its actual email address.
level int User access level. Can either be 0 or 100 with actual labels Admin and User.
status int User status. Can either be 1 or 0 with actual labels Activ and Inactiv.

Example

{
  "id": 1,
  "level": 0,
  "status": 0,
  "name": "[email protected]",
}

Other references

  • In order to understand how a specific organization gets selected, please refer to #49 and #50
  1. Quickstarts
  1. Configuration
  2. Documentation
Clone this wiki locally