1598: Update user endpoint wipes user password

Test Case #:284


Test Case Name: Update user endpoint wipes user password

System: openLMIS

Subsystem: blue

Test case designed by: Lucyna Laska

Design Date:30.01.2017

Short description

  • Update user endpoint does not clear the user password (invoked either from referencedata or directly via auth service).
  • After updating the user, he is still able to log in to the system, using the same password
  • It is possible to update the user password via separate endpoint

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       

 

 

Step

Action

Expected system response

Comment

1

                   Add role to User and try to log in.          

   URL: http://test.openlmis.org/api/users?access_token=208fb47a-4e68-428a-83ce-606c50bfcaab

Method: PUT

Body:

 {
    "username": "devadmin",
    "firstName": "Admin",
    "lastName": "Admin",
    "email": "devadmin@openlmis.org",
    "timezone": "CET",
    "homeFacility": {
      "code": "WH01",
      "name": "CMST Warehouse",
      "geographicZone": {
        "code": "Mal-So",
        "name": "Southern Region",
        "level": {
          "code": "Region",
          "levelNumber": 2,
          "id": "9b497d87-cdd9-400e-bb04-fae0bf6a9491"
        },
        "id": "0bbd69c1-e20f-48f5-aae4-26dcd8aa7602"
      },
      "type": {
        "code": "warehouse",
        "name": "Warehouse",
        "displayOrder": 3,
        "active": true,
        "id": "e2faaa9e-4b2d-4212-bb60-fd62970b2113"
      },
      "operator": {
        "code": "moh",
        "name": "Ministry of Health",
        "displayOrder": 1,
        "id": "9456c3e9-c4a6-4a28-9e08-47ceb16a4121"
      },
      "active": true,
      "enabled": true,
      "openLmisAccessible": true,
      "supportedPrograms": [],
      "id": "19121381-9f3d-4e77-b9e5-d3f59fc1639e"
    },
    "verified": true,
    "active": true,
    "loginRestricted": false,
    "roleAssignments": [
          {
        "roleId": "2c3e59f2-6630-4e6d-b98a-4ed427ed778d",
        "programCode": "PRG001",
        "supervisoryNodeCode": "SN1.1"
      },
      {
        "roleId": "2c3e59f2-6630-4e6d-b98a-4ed427ed778d",
        "programCode": "PRG002",
        "supervisoryNodeCode": "SN1.1"
      },
      {
        "roleId": "b6134c01-cb37-4303-85f0-8c8eab9d3cec",
        "programCode": "PRG002"
      },
      {
        "roleId": "b6134c01-cb37-4303-85f0-8c8eab9d3cec",
        "programCode": "PRG001"
      }],
    "id": "56a50e9a-9668-437d-a09c-7e709ce22222"
  },

After adding roles to User, the logging in is possible without changing his password.



                                                                                                                            

                                                 

2

 Remove all roles from User and try to log in.

URL: http://test.openlmis.org/api/users?access_token=46fbf9b3-3aa8-4833-8fcf-5c10f937a21e

Method: PUT

Body:

 {
    "username": "devadmin",
    "firstName": "Admin",
    "lastName": "Admin",
    "email": "devadmin@openlmis.org",
    "timezone": "CET",
    "homeFacility": {
      "code": "WH01",
      "name": "CMST Warehouse",
      "geographicZone": {
        "code": "Mal-So",
        "name": "Southern Region",
        "level": {
          "code": "Region",
          "levelNumber": 2,
          "id": "9b497d87-cdd9-400e-bb04-fae0bf6a9491"
        },
        "id": "0bbd69c1-e20f-48f5-aae4-26dcd8aa7602"
      },
      "type": {
        "code": "warehouse",
        "name": "Warehouse",
        "displayOrder": 3,
        "active": true,
        "id": "e2faaa9e-4b2d-4212-bb60-fd62970b2113"
      },
      "operator": {
        "code": "moh",
        "name": "Ministry of Health",
        "displayOrder": 1,
        "id": "9456c3e9-c4a6-4a28-9e08-47ceb16a4121"
      },
      "active": true,
      "enabled": true,
      "openLmisAccessible": true,
      "supportedPrograms": [],
      "id": "19121381-9f3d-4e77-b9e5-d3f59fc1639e"
    },
    "verified": true,
    "active": true,
    "loginRestricted": false,
    "roleAssignments": [
 ],
    "id": "56a50e9a-9668-437d-a09c-7e709ce22222"
  },

 

After removing roles from User, the logging in is possible without changing his password.


 

3

Change the homeFacility and try to log in.

URL: http://test.openlmis.org/api/users?access_token=46fbf9b3-3aa8-4833-8fcf-5c10f937a21e

Method: PUT

Body:

 {
    "username": "devadmin",
    "firstName": "Admin",
    "lastName": "Admin",
    "email": "devadmin@openlmis.org",
    "timezone": "CET",
    "homeFacility": {
     "code": "HC01",
      "name": "Comfort Health Clinic",
      "geographicZone": {
        "code": "M-So-Bal-Bal",
        "name": "Balaka",
        "level": {
          "code": "City",
          "levelNumber": 4,
          "id": "90e35999-a64f-4312-ba8f-bc13a1311c75"
        },
        "latitude": -14.99,
        "longitude": 34.92,
        "id": "bf2b810b-cdbf-48b2-b569-149b3cf42387"
      },
      "type": {
        "code": "health_center",
        "name": "Health Center",
        "displayOrder": 1,
        "active": true,
        "id": "ac1d268b-ce10-455f-bf87-9c667da8f060"
      },
      "operator": {
        "code": "moh",
        "name": "Ministry of Health",
        "displayOrder": 1,
        "id": "9456c3e9-c4a6-4a28-9e08-47ceb16a4121"
      },
      "active": true,
      "enabled": true,
      "openLmisAccessible": true,
      "supportedPrograms": [
        {
          "id": "dce17f2e-af3e-40ad-8e00-3496adef44c3",
          "code": "PRG001",
          "name": "Family Planning",
          "programActive": true,
          "periodsSkippable": true,
          "showNonFullSupplyTab": true,
          "supportActive": true
        },
        {
          "id": "10845cb9-d365-4aaa-badd-b4fa39c6a26a",
          "code": "PRG002",
          "name": "Essential Meds",
          "programActive": true,
          "periodsSkippable": false,
          "showNonFullSupplyTab": false,
          "supportActive": true
        }
      ],
      "id": "e6799d64-d10d-4011-b8c2-0e4d4a3f65ce"
    },
    "verified": true,
    "active": true,
    "loginRestricted": false,
    "roleAssignments": [
 ],
    "id": "56a50e9a-9668-437d-a09c-7e709ce22222"
  },


After changing homeFacility, the logging in is possible without changing his password.

 


 

4

  

 

5

   

6

  

 

7

  

 

8

                                                 

 

 

 

Post – conditions:

OpenLMIS: the global initiative for powerful LMIS software