1032: Enforce permissions on 'convert to order'

Test Case #:1032


Test Case Name: Enforce permissions on 'convert to order'

System: openLMIS

Subsystem: blue

Test case designed by: Lucyna Laska

Design Date:.09.11.2016

Short description

  • user permissions are enforced by checking the user's role assignments or using the convenience properties in the user (like fulfillmentFacilities)
    • based on users fulfillment rights, only those approved requisitions will be available (Example, if the warehouse clerk has fulfillment rights for Warehouse A and B, it will not see approved requisitions from Facility 5)
  • add automated tests for the case where the user does not have any facilities where they have the "Requisition - convert to order" right; then a case where they have it at one facility and make sure that prevents them from seeing requisitions at another facility where they don't have the right; finally a test where they have this permission at multiple warehouse facilities and make sure it shows all the requisitions from multiple facilities on the list

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       

Step

Action

Expected system response

Comment

1

                                                                                                                                                                                                                                                                                                                                                    

2

Log in as administrator

 

 

3

Get the facilities that the administrator has fulfillment rights for.



4

Display all requisition ready for approve.

URL:  http://10.222.17.134/requisition/api/requisitions/requisitionsForApproval?access_token=01277d95-5e43-4508-a564-6d720705d393

Method: GET


5

Approve one requisition from list (e.g c6ce0209-6caf-4f40-bea8-01ce529fdc67)

URL: http://10.222.17.134/requisition/api/requisitions/c6ce0209-6caf-4f40-bea8-01ce529fdc67/approve?access_token=fe1a01cd-57a0-429d-ae49-f43b6a9b9cd6

Method: POST

Body:

{

  "id": "c6ce0209-6caf-4f40-bea8-01ce529fdc67",

  "createdDate": [

    2016,

    4,

    26,

    15,

    43,

    16

  ],

  "requisitionLineItems": [

    {

      "id": "f27415c4-7049-46a6-9e59-818990c85390",

      "orderableProduct": {

        "id": "7b9b66e0-f008-4c38-93ec-7a5f4868cca9",

        "dispensingUnit": null,

        "productCode": "C600",

        "name": "Levonorgestrel ",

        "programs": [

          {

            "programId": "dce17f2e-af3e-40ad-8e00-3496adef44c3",

            "productId": "7b9b66e0-f008-4c38-93ec-7a5f4868cca9",

            "productCategoryId": "06606981-67cc-42d1-87ed-21f22fb0ea58",

            "productCategoryDisplayName": "Implantable Contraceptive",

            "productCategoryDisplayOrder": 8,

            "active": true,

            "fullSupply": true,

            "displayOrder": 5,

            "maxMonthsOfStock": 20,

            "dosesPerMonth": 1,

            "value": null

          }

        ]

      },

      "beginningBalance": 100,

      "totalReceivedQuantity": 16,

      "totalLossesAndAdjustments": 0,

      "stockOnHand": null,

      "requestedQuantity": 500,

      "totalConsumedQuantity": 16,

      "requestedQuantityExplanation": "Too few left to make any use out of it.",

      "remarks": null,

      "approvedQuantity": 12,

      "totalStockoutDays": 0,

      "total": 116,

      "stockAdjustments": []

    },

    {

      "id": "05119a44-5f7a-4ad3-b49f-739661304c59",

      "orderableProduct": {

        "id": "7f7b83db-580d-4269-88d2-7f9c80a591a9",

        "dispensingUnit": null,

        "productCode": "C300",

        "name": "Depo-Estradiol",

        "programs": [

          {

            "programId": "66032ea8-b69b-4102-a1eb-844e57143187",

            "productId": "7f7b83db-580d-4269-88d2-7f9c80a591a9",

            "productCategoryId": "74f39ab7-b5ce-4087-a6ea-65799a35e79b",

            "productCategoryDisplayName": "Injectable Hormonal Contraceptive",

            "productCategoryDisplayOrder": 9,

            "active": true,

            "fullSupply": true,

            "displayOrder": 6,

            "maxMonthsOfStock": 20,

            "dosesPerMonth": 1,

            "value": null

          },

          {

            "programId": "dce17f2e-af3e-40ad-8e00-3496adef44c3",

            "productId": "7f7b83db-580d-4269-88d2-7f9c80a591a9",

            "productCategoryId": "74f39ab7-b5ce-4087-a6ea-65799a35e79b",

            "productCategoryDisplayName": "Injectable Hormonal Contraceptive",

            "productCategoryDisplayOrder": 9,

            "active": true,

            "fullSupply": true,

            "displayOrder": 6,

            "maxMonthsOfStock": 20,

            "dosesPerMonth": 1,

            "value": null

          }

        ]

      },

      "beginningBalance": 300,

      "totalReceivedQuantity": 0,

      "totalLossesAndAdjustments": 0,

      "stockOnHand": null,

      "requestedQuantity": 0,

      "totalConsumedQuantity": 100,

      "requestedQuantityExplanation": null,

      "remarks": null,

      "approvedQuantity": 12,

      "totalStockoutDays": 0,

      "total": 300,

      "stockAdjustments": []

    }

  ],

  "comments": [

    {

      "id": "1efe3e9b-55b9-44e8-9a82-96c97fd1c9e9",

      "authorId": "a337ec45-31a0-4f2b-9b2e-a105c4b669bb",

      "body": "Let me take a double check on this.",

      "createdDate": [

        2016,

        7,

        25,

        13,

        21,

        31

      ]

    },

    {

      "id": "b666b2ae-0675-4687-b9ce-ba0d631acfa0",

      "authorId": "a337ec45-31a0-4f2b-9b2e-a105c4b669bb",

      "body": "This seems fine.",

      "createdDate": [

        2016,

        7,

        25,

        16,

        0,

        8

      ]

    }

  ],

  "facility": {

    "id": "e6799d64-d10d-4011-b8c2-0e4d4a3f65ce",

    "code": "HC01",

    "name": "Comfort Health Clinic",

    "description": null,

    "active": true,

    "goLiveDate": null,

    "goDownDate": null,

    "comment": null,

    "enabled": true,

    "openLmisAccessible": true,

    "supportedPrograms": [

      {

        "id": "dce17f2e-af3e-40ad-8e00-3496adef44c3",

        "code": "PRG001",

        "name": "Family Planing",

        "description": null,

        "active": true,

        "periodsSkippable": true,

        "showNonFullSupplyTab": null

      },

      {

        "id": "10845cb9-d365-4aaa-badd-b4fa39c6a26a",

        "code": "PRG002",

        "name": "Essential Meds",

        "description": null,

        "active": true,

        "periodsSkippable": false,

        "showNonFullSupplyTab": null

      }

    ],

    "geographicZone": {

      "id": "bf2b810b-cdbf-48b2-b569-149b3cf42387",

      "code": "M-So-Bal-Bal",

      "name": "Balaka",

      "level": {

        "id": "90e35999-a64f-4312-ba8f-bc13a1311c75",

        "code": "City",

        "name": null,

        "levelNumber": 4

      },

      "parent": null

    },

    "operator": {

      "id": "9456c3e9-c4a6-4a28-9e08-47ceb16a4121",

      "code": "moh",

      "name": "Ministry of Health"

    },

    "type": {

      "id": "ac1d268b-ce10-455f-bf87-9c667da8f060",

      "code": "HC",

      "name": "Health Center",

      "description": null,

      "displayOrder": 1,

      "active": true

    }

  },

  "program": {

    "id": "dce17f2e-af3e-40ad-8e00-3496adef44c3",

    "code": "PRG001",

    "name": "Family Planing",

    "description": null,

    "active": true,

    "periodsSkippable": true,

    "showNonFullSupplyTab": null

  },

  "processingPeriod": {

    "id": "04ec3c83-a086-4792-b7a3-c46559b7f6cd",

    "processingSchedule": {

      "id": "9c15bd6e-3f6b-4b91-b53a-36c199d35eac",

      "code": "SCH001",

      "description": null,

      "modifiedDate": [

        2015,

        12,

        31,

        23,

        59,

        59

      ],

      "name": "Monthly"

    },

    "name": "Feb2016",

    "description": null,

    "startDate": [

      2016,

      2,

      1

    ],

    "endDate": [

      2016,

      2,

      29

    ]

  },

  "status": "SUBMITTED",

  "emergency": false,

  "supplyingFacility": "e6799d64-d10d-4011-b8c2-0e4d4a3f65ce",

  "supervisoryNode": "fb38bd1c-beeb-4527-8345-900900329c10"

}




Convert requisition to order.


3

 Log in as devadmin.

 

 

4

Display all requisition ready for approve. 

The list is empty because user does not have assigned roles.

 

5


  

6


 

 

7

  

 

8

                                                 

 

Post – conditions:

OpenLMIS: the global initiative for powerful LMIS software