1162: Refactor hasRight endpoint to check supervision rights by facility

Test Case #:284


Test Case Name: Refactor hasRight endpoint to check supervision rights by facility

System: openLMIS

Subsystem: blue

Test case designed by: Lucyna Laska

Design Date:21.11.2016

Short description

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       

Step

Action

Expected system response

Comment

1

  Check if administrator has an supervisory right assigned to his program and facility.

     URL:

http://10.222.17.134/referencedata/api/users/a337ec45-31a0-4f2b-9b2e-a105c4b669bb/hasRight?rightId=feb4c0b8-f6d2-4289-b29d-811c1d0b2863&programId=10845cb9-d365-4aaa-badd-b4fa39c6a26a&facilityId=e6799d64-d10d-4011-b8c2-0e4d4a3f65ce&access_token=0eff62d7-85a6-4a3f-8c4a-62466e3d0734

                                                                                                                       

                                                 

2

The proper role has been crearted.

body:

  {

    "id": "185db8f7-ee35-44d0-8b40-6de12489ae77",

    "name": "Storeroom Manager",

    "rights": [

      {

        "id": "3e181470-ca69-4f26-a8a9-30f947bc0929",

        "name": "OREDR",

        "type": "ORDER_FULFILLMENT",

        "attachments": []

      }

    ]

  },

3


4


5

Check if administrator can verify his rights when program is definined in request but facility don't.

URL:

http://10.222.17.134/referencedata/api/users/a337ec45-31a0-4f2b-9b2e-a105c4b669bb/hasRight?rightId=feb4c0b8-f6d2-4289-b29d-811c1d0b2863&programId=10845cb9-d365-4aaa-badd-b4fa39c6a26a&access_token=0eff62d7-85a6-4a3f-8c4a-62466e3d0734


6

 Check if it possible to check the user rights when parameter rightID is not specified in the request.

URL:

http://10.222.17.134/referencedata/api/users/a337ec45-31a0-4f2b-9b2e-a105c4b669bb/hasRight?access_token=0eff62d7-85a6-4a3f-8c4a-62466e3d0734


7

Assign supervision right to devadmin:

{

"id": "56a50e9a-9668-437d-a09c-7e709ce22222",

"username": "devadmin",

"firstName": "Admin",

"lastName": "Admin",

"email": "devadmin@openlmis.org",

"timezone": "CET",

"homeFacility": {

"code": "W01",

"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": "WH",

"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": [

{

"code": "PRG003",

"name": "New program",

"active": true,

"periodsSkippable": false,

"id": "66032ea8-b69b-4102-a1eb-844e57143187"

}

],

"id": "19121381-9f3d-4e77-b9e5-d3f59fc1639e"

},

"verified": true,

"active": true,

"loginRestricted": false,

"roleAssignments": [

{

"roleId": "d30a2fbb-51d9-49ad-90fe-fb405470a439",

"programCode": "PRG001",

"supervisoryNodeCode": "N1"

}]


}


8


9

Assign the devadmin a facility for fulfill.


 {
              "id": "56a50e9a-9668-437d-a09c-7e709ce22222",
    "username": "devadmin",
    "firstName": "Admin",
    "lastName": "Admin",
    "email": "devadmin@openlmis.org",
    "timezone": "CET",
    "homeFacility": {
      "code": "W01",
      "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": "WH",
        "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": [
        {
          "code": "PRG003",
          "name": "New program",
          "active": true,
          "periodsSkippable": false,
          "id": "66032ea8-b69b-4102-a1eb-844e57143187"
        }
      ],
      "id": "19121381-9f3d-4e77-b9e5-d3f59fc1639e"
    },
    "verified": true,
    "active": true,
    "loginRestricted": false,
    "roleAssignments": [
          {
        "roleId": "185db8f7-ee35-44d0-8b40-6de12489ae77",
        "warehouseCode": "FAC004"
      }
      ]

  }

10

  Check if devadmin has fulfillment right for facility which he supervises.

     URL:http://10.222.17.134/referencedata/api/users/56a50e9a-9668-437d-a09c-7e709ce22222/hasRight?rightId=3e181470-ca69-4f26-a8a9-30f947bc0929&warehouseId=ab95f1cf-ae8d-4888-ba9d-05141d3f50de&access_token=287fc724-c58b-4151-b3ae-d90487c0b7b1


Post – conditions:

OpenLMIS: the global initiative for powerful LMIS software