# Policy Manager

### **Using Keycloak to allocate/get 'Partner Admin' and/or 'Policy Manager'**

Using the same partner admin credentials, follow the steps below so that the user can be configured with POLICYMANAGER role too.

Steps to configure **POLICYMANAGER** role in keycloak:

1. Go to keycloak and search your 'User-Name' in Users tab.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-447ca055b1093c36ef21e8b3173f4681ac3fd5c0%2Ftemp-pms-admin-image2.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Go to the **Role Mapping** tab.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-aaac5ecb7fef4b64bd69ac6d6f3a9f523649dee9%2Ftemp-pms-admin-image3.png?alt=media" alt=""><figcaption></figcaption></figure>

3. In the **Available Roles** section, select '**Policy Manager'**, click **Add** to move the selected role to the **Assigned Roles** list.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-ec9f0ac861d0cd601fe199cce0df8587049abf5b%2Ftemp-pms-admin-image4.png?alt=media" alt=""><figcaption></figcaption></figure>

4. Log in to the **PMS** portal with the same user credentials, you should now have access to the **Admin Dashboard** with 'Policies' card accessible for use.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-53daf1f97f0b1b416b2d2fd8b2908f87cc987aa2%2Ftemp-pms-admin-image5.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:**

Both PARTNER\_ADMIN and POLICYMANAGER roles are necessary for **Policies** card to appear on Admin dashboard UI.

Therefore add **Policy Manager** role when you want that the 'Policies-Card' should also get enabled for you and turn you into a 'Policy Manager' as well.

If only PARTNER\_ADMIN role would have been configured, only the following cards would have been displayed:
{% endhint %}

This card is accessible for roles Partner Admin and Policy Manager.

In UI- both PARTNER\_ADMIN and POLICYMANAGER roles should be granted for the card to appear in the dashboard.

As a partner admin cum policy manager - creation and management of Policy Group, Authentication Policy, Datashare Policy and MISP Policy are enabled within Policies card.

{% hint style="info" %}
**Note**:

If only 'Policy Manager' role is configured in keycloak, then the user will still be able to access the portals as a normal partner. Hence both; 'Partner Admin' & 'Policy Manager' roles are necessary to access all the cards/privileges above.
{% endhint %}

{% hint style="success" %}
**Important**:

After configuring the roles and if PMS portal is still logged in, make sure to logout and login again for the roles to get updated.
{% endhint %}

## Policies

You can use the 'Policies' to create and manage Policy Group, Authentication Policy and Datashare (You should have privileges of both; Partner Admin and Policy Manager).

The 'Policies' section is accessible to you only if both **Partner Admin**, **Policy Manager** and **MISP Policy** roles are allocated to you and also the 'Policies' card will appear enabled on the the dashboard.

### Policies has following tabs:

* Policy Group, (This tab is selected by default)
* Authentication Policy,
* Datashare Policy
* MISP Policy

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-339328c3a63f258200446baa12b376631a55de57%2Ftemp-pms-admin-image33.png?alt=media" alt=""><figcaption></figcaption></figure>

**Policy Group**

Policy Group tab allows you to do following:

* View Policy Group
  * List view
  * Details View
* Create Policy Group
* Deactivate Policy Group

**Authentication Policy**

* View Authentication Policy
  * List view
  * Details View
* Create Authentication Policy (by mapping to an already created Policy Group)
* Deactivate Authentication Policy
* Clone Authentication Policy - The download functionality of following certificates is possible only during following instances
* Edit Authentication Policy (Which is in draft status)
* Publish Authentication Policy (Which is in draft status so that the status changes to 'Activated')

**Datashare Policy**

* View Datashare Policy:
  * List view
  * Details view
* Create Datashare Policy: By mapping to an already created Policy Group
* Deactivate Datashare Policy
* Clone Datashare Policy
* Edit Datashare Policy (Which is in draft status)
* Publish Datashare Policy (Which is in draft status so that the status changes to 'Activated')

**MISP Policy features**

a) Create MISP Policy by mapping to an already created Policy Group.

b) Tabular view of previously created MISP Policy along with the status

c) View created MISP Policy details

d) Deactivate MISP Policy

e) Clone MISP Policy in different policy groups on clicking Clone option in action item of records in Tabular view screen

f) Edit MISP Policy which is in draft status.

g) Publish MISP Policy which is in draft status so that the status changes to ‘Active’.

### Policy Group

#### View Policy Group

**List View - Policy Groups**

All the policy groups created so far by Partner Admin / Policy Manager are displayed on 'List of Policy Groups' page.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-339328c3a63f258200446baa12b376631a55de57%2Ftemp-pms-admin-image33.png?alt=media" alt="" width="427"><figcaption></figcaption></figure>

**Details View - Policy Group**

Admin can either click on 'Go Back' to redirect to 'List of Policy Groups' page as shown below or click on 'Home' to navigate back to Home page/ dashboard.

The options provided in 'Action menu are: View, Deactivate.

Clicking on View in action menu or by clicking the row item itself, admin is navigated to View Policy Group page where the policy group details are displayed along with its status: Activated or Deactivated.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-32116c9fa2dcec5c214873987328355732dff8c3%2Ftemp-pms-admin-image36.png?alt=media" alt=""><figcaption></figcaption></figure>

**Create Policy Group**

On clicking the 'Create Policy Group' option on the top right of the screen, we can create a Policy Group by providing suitable name and description that is self explanatory for partners, who would be selecting them during Partner Policy Request to create API Key / OIDC Client etc.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-8f7af1521d8e4f34c8fe6070c0226bb77ceb1687%2Ftemp-pms-admin-image34.png?alt=media" alt=""><figcaption></figcaption></figure>

On click of Submit, a success message appears.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-4760f87f535fdf9499786640dca7ac25c3c87ac1%2Ftemp-pms-admin-image35.png?alt=media" alt=""><figcaption></figcaption></figure>

**Deactivate Policy Group**

If the admin wants to deactivate the Policy Group, then click on Deactivate option in action menu.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-93481cd668728bc2d4ace73e68be299126986172%2Ftemp-pms-admin-image37.png?alt=media" alt=""><figcaption></figcaption></figure>

A popup window appears seeking for confirmation before proceeding to deactivate.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-bdba2bd9a6b52797c1c33d9bc9efa330a610e0f5%2Ftemp-pms-admin-image38.png?alt=media" alt=""><figcaption></figcaption></figure>

After confirming deactivation, the respective record is greyed out in the tabular view.

The action menu here is enabled with only View option. (Deactivate in action menu is disabled).

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-0edf4e49c06949707ce8e784b022148da424a53a%2Ftemp-pms-admin-image39.png?alt=media" alt=""><figcaption></figcaption></figure>

After deactivation, the View policy group page [MOSIP-36963](https://mosip.atlassian.net/browse/MOSIP-36963) will display 'Deactivated' status

Once the policy group is deactivated by Policy Manager, the partner will not be able to fetch this policy group in any of the screens in their PMS portal.

{% hint style="info" %}
**Note:**

Policy Group cannot be deactivated if there are active or draft policies associated to the given policy group.
{% endhint %}

If the Policy Group has active or draft policy / policies associated to it, then on clicking Confirm, following error message is displayed along with the count of such policies -

a) In case of Active and Draft policies associated to Policy Group:

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-644edfd88a2dac69b51c942dcf13f4d124e83b5b%2Ftemp-pms-admin-image40.png?alt=media" alt=""><figcaption></figcaption></figure>

b) In case of Active policies associated to Policy Group:

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-576c873933a64f2626854d03e404b7d4903bb676%2Ftemp-pms-admin-image41.png?alt=media" alt=""><figcaption></figcaption></figure>

c) In case of Draft policies associated to policy group:

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-df771c0230098f82b2a64f6c2a879caffef19754%2Ftemp-pms-admin-image42.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Authentication Policy / Datashare Policy/ MISP Policy:

* On clicking Authentication Policy tab, List of all previously created Authentication Policies are displayed.
* On clicking Datashare Policy tab, List of all previously created Datashare Policies are displayed.
* On clicking MISP Policy tab, List of all previously created MISP Policies are displayed.
* The steps and features are same for both Authentication, Datashare and MISP Policy.

{% hint style="info" %}
**Note**:

The steps and features are same for both Authentication and Datashare Policy.
{% endhint %}

Policies can have the following status - Draft, Activated or Deactivated.

1. Only Draft or Activated row items are clickable which navigates to View Authentication Policy details.
2. Action - Action menu displays a common menu item (View, Clone, Deactivate) with only the following menu items enabled for clicking based on below statuses:
   1. Draft: Publish, View, Edit
   2. Activated: View , Clone , Deactivate
   3. Deactivated: View

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-6ace53119cb60ae6c9d5231244aab1e622dc1e23%2Ftemp-pms-admin-image43.png?alt=media" alt=""><figcaption></figcaption></figure>

**Create Authentication Policy**

On clicking 'Create Authentication Policy' button, Partner Admin / Policy manager is navigated to Create Authentication Policy page where details such as policy group, policy name, description etc will have to be entered.

{% hint style="info" %}
**Note**:

Only active policy groups are available in the policy group dropdown.
{% endhint %}

Click on the upload button to upload policy data. Only json files are allowed for upload.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-ccdb8a2a26abbe0a3403c21549b1513d8230bc4e%2Ftemp-pms-admin-image44.png?alt=media" alt=""><figcaption></figcaption></figure>

Before saving the policy in draft, the policy data can be edited in the text area after policy data json file has been successfully uploaded.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-3204af536200c83855b1cfedd992d4d321c392d6%2Ftemp-pms-admin-image45.png?alt=media" alt=""><figcaption></figcaption></figure>

On clicking on Save as Draft, following success message appears.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-c64c0ca0f42503640fb90d9149e82afc2273eec8%2Ftemp-pms-admin-image46.png?alt=media" alt=""><figcaption></figcaption></figure>

On clicking 'Go Back', admin is navigated back to List view where the policy is saved as 'draft' status.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-038ef04b01c4b487d1bb9708982044e1e331bf3f%2Ftemp-pms-admin-image47.png?alt=media" alt=""><figcaption></figcaption></figure>

The Edit option provided to Draft policy can be used by admin to make any changes in the policy details (except policy group) before publishing the policy.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-4bcad71aabef62aa33584caf90f6ce481a6ed024%2Ftemp-pms-admin-image48.png?alt=media" alt=""><figcaption></figcaption></figure>

On submitting after making required changes, a success message appears.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-3e0abea596582cc90143b04a32ab070777f0fd84%2Ftemp-pms-admin-image49.png?alt=media" alt=""><figcaption></figcaption></figure>

To publish policy which is currently in draft status, click on 'publish' option in action menu. A popup window appears seeking for confirmation to publish.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-6a9f4e938c140ad2ae0907841a41f7b3e19735bc%2Ftemp-pms-admin-image50.png?alt=media" alt=""><figcaption></figcaption></figure>

On clicking Publish, a success message appears . Click on close to close the window.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-992600dc4c2714897272b82c35448a20b2877a3a%2Ftemp-pms-admin-image51.png?alt=media" alt=""><figcaption></figcaption></figure>

The given policy changes to 'Activated' status after being published. Once activated, the admin cannot edit the policy, hence the option is disabled.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-968aae4e4908dd80c0c307da8585f25918d4de72%2Ftemp-pms-admin-image52.png?alt=media" alt=""><figcaption></figcaption></figure>

**Clone Policy**

To clone any active policy onto another policy group, click on 'clone' in action menu. A popup window appears to select the policy group where the policy has to be cloned.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-5635503b56d2178d985e8ff70af5555b672e6aec%2Ftemp-pms-admin-image53.png?alt=media" alt=""><figcaption></figcaption></figure>

On selecting the policy group where policy has to be cloned, click on Clone and a success message appears.

Click on Close to navigate back to List of Authentication Policies screen.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-d4ec1f5fcc1ebdc967ff70f4e77614333d06546f%2Ftemp-pms-admin-image54.png?alt=media" alt=""><figcaption></figcaption></figure>

**Deactivate Policy**

To deactivate a policy, click on Deactivate option in action menu of any activated policy record. A popup window appears seeking for confirmation.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-aa0d382f545700d95b9b39660dff4292cfc53979%2Ftemp-pms-admin-image55.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note**:

If the Policy has active partners associated to it i.e. there are **Approved** partner policy requests, then on clicking Confirm, following error message is displayed and the admin will be restricted to deactivate such policy groups.
{% endhint %}

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-2a26f690971628b8f1f61342fe5bc565c9f77fa6%2Ftemp-pms-admin-image56.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:**

1. Policy can be deactivated if there are no policy requests associated with this policy.
2. Policy can be deactivated if there are Rejected policy requests associated with this policy.
3. Policy cannot be deactivated if there are pending policy requests associated with this policy. In this case , following error message is displayed- '\<title> Error: Partner - Policy Request Detected! \<Description> Pending policy requests are associated with this policy. Please take appropriate action in List of Partner Policy Linking screen'.
4. Once the policy is deactivated by partner admin/policy manager, the partner will not be able to fetch this policy in any of the screens in their PMS portal.
   {% endhint %}

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-4574dcd12d9628f05c0abc145710293e9d6aba8d%2Ftemp-pms-admin-image57.png?alt=media" alt=""><figcaption></figcaption></figure>

**Viewing Policy**

On clicking **View** option of any policy or by clicking the row item itself, admin is navigated to View Authentication Policy where policy details can be viewed. Also click on preview to view the policy data in json format.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-91bd5dadf33bd056e64a100fd9ad245b70772e31%2Ftemp-pms-admin-image58.png?alt=media" alt=""><figcaption></figcaption></figure>

On clicking preview, policy data can be viewed in json format and an option to Download the data in local system is provided.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-9fd77aa08f324285af7f461cb0c32070b31f1733%2Ftemp-pms-admin-image59.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Partner - Policy Linking:

The features provided to Partner Admin:

1. Approve/ Reject Policy requested by partner - clicking on 'Approve/ Reject' option in action menu of a policy record whose status is in pending for approval
2. Tabular view of Policies requested by partners along with the status
3. View individual policy request details : Either on clicking on view option in action menu of any of the active policy request in the tabular view or by clicking on the row item itself, it navigates to View Policy Request details page.

All the policy requests created by various partners are displayed in 'List of Partner - Partner Linkages' . The different statuses possible are: Pending for Approval, Approved, Rejected, Deactivated.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-d4a2b95f3dfb5c98c747cde625637e748060a2c8%2Ftemp-pms-admin-image60.png?alt=media" alt=""><figcaption></figcaption></figure>

The options provided for policy linking requests in 'Pending for Approval' are to Approve/ Reject. Also an option to view the policy request details is also provided.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-db665c06c840e162fc38bc89553eda7d2b7ab076%2Ftemp-pms-admin-image61.png?alt=media" alt=""><figcaption></figcaption></figure>

On clicking the Approve/ Reject option, the window appears - and partner admin can click on either Approve or Reject to take appropriate action

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-24f9c38f54eb8c0bc66ca98c428c4f6a11a8bd31%2Ftemp-pms-admin-image62.png?alt=media" alt=""><figcaption></figcaption></figure>

The status- Approved / Rejected gets updated in the tabular view.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-c8ab6ab68dc20e3d91adbfde5881549b61978f1c%2Ftemp-pms-admin-image63.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-535c128b3bedf6952d9d60db96624b1f632e020b%2Ftemp-pms-admin-image64.png?alt=media" alt=""><figcaption></figcaption></figure>

On clicking view of active record or the row item itself, the partner- policy linking view page is displayed along with comment history where partner comments and admin's approval status is displayed.

<figure><img src="https://1836199994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4EyCrLbFom7vj7UcMIUZ%2Fuploads%2Fgit-blob-535d1c35cc5ffb1d0b488ef316254a51cf646b79%2Ftemp-pms-admin-image65.png?alt=media" alt=""><figcaption></figcaption></figure>
