Adding new APIs for access

Overview

Roles define the permissions of a user to perform a group of tasks. The tasks are created as API calls to do certain actions when request for those calls is sent by the system. Access permission is grated by mapping roles with API. User assigned with the roles to provide the access for the API

Pre-requisites

Before proceeding with the configuration, make sure the following pre-requisites are met -

Key Functionalities

  • Adding New APIs(actions) and Mapping Roles with that APIs provides permission to perform certain task can be restricted based on the requirement.

Deployment Details

  • After mapping Roles with APIs, the MDMS service needs to be restarted to read the newly added data.

Configuration Details

  1. APIs are added in actions-test.json and called as action.
    In MDMS, file actions-test.json, under ACCESSCONTROL-ACTIONS-TEST folder APIs are added.
    API Sample:

    { "tenantId": "uk", "moduleName": "ACCESSCONTROL-ACTIONS-TEST", "actions-test": [ { "id": <unique and sequential to previous id>, "name": "rainmaker-common-propertytax", "url": "card", "displayName": "Property Tax", "orderNumber": 2, "parentModule": "", "enabled": true, "serviceCode": "", "code": "", "path": "", "navigationURL": "property-tax", "leftIcon": "action:store", "rightIcon": "", "queryParams": "" }, ] }
  2. APIs are added as action array element with the request url and other required details for the array "actions-test"

  3. Each action is defined as key value pair:

Sr. No.

key

Data Type

Is Mandatory?

Definition/ Description

Sr. No.

key

Data Type

Is Mandatory?

Definition/ Description

1

id

Numeric

Yes

A unique id that identifies action.

2

name

Text

No

A short narration provided to the action.

3

url

Text

Yes

It is the endpoint of API or type like url or card.

4

displayName

Text

No

It is display name.

5

orderNumber

Numeric

Yes

A number to represent order to display in UI

6

parentModule

Text

No

Code of the service to referred as parent

7

enabled

boolean

Yes

To enable or disable display in UI.

8

serviceCode

Text

No

Code of the service to which API belongs.

9

code

Text

No

 

10

path

Text

No

 

11

navigationUrl

Text

Yes

Url to navigate in UI

12

leftIcon

Icon

No

 

13

rightIcon

Icon

No

 

 

4. Roles are added in roles.json
In MDMS, file roles.json, under ACCESSCONTROL-ROLES folder roles are added.
More about roles can be checked in the below link:

5. Mapping of Roles and APIs/action are added in roleactions.json, under folder
ACCESSCONTROL-ROLEACTIONS.
Sample mapping:

{ "tenantId": "uk", "moduleName": "ACCESSCONTROL-ROLEACTIONS", "roleactions": [ { "rolecode": <specific code defined in roles.json>, "actionid": <id of an action>, "actioncode": "", "tenantId": <state notation of tenantId>(like uk,pb etc) } ] }

6. Role and API/action mapping is added as an array element under array roleactions.
7. Each mapping is defined with key-value pairs. keys are rolecode, actionid, actioncode and tenantId.

Sr. No.

key

Is Mandatory?

Definition/ Description

Sr. No.

key

Is Mandatory?

Definition/ Description

1

rolecode

Yes

The unique code of the role which is defined in roles.json and which required mapping for API.

2

actionid

Yes

The unique id of the API/action which is defined in actions-test.json and which is required to be mapped with the role.

3

actioncode

No

The code of the API/action which is defined in actions-test.json and which is required to be mapped with the role.

4

tenantid

Yes

tenant id of state.

Reference Docs

Doc Links