# Security Rules

Security rules allows you to control the visibility of a resource based on conditions.\
\
You can create rules for the following resources:

* Groups
* Users

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FH1rz4mIhB2YrDyxZVlLw%2Fimage.png?alt=media\&token=0301ce4e-7587-432c-9b52-bcad7315fff0)

### Understanding rules scope

Once a rule is created, the rule will be applied to any area of the *Qommentary Admin Console* or any *Qommentary* *Extension* where the resource is displayed.

For example, if you setup a rule for groups, then you will be able to see only those groups which meet that condition.

### Creating a rule for a group

1\. Click on **Create rule**

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2F9HvrjUscEKpEZWQ1dtxp%2Fimage.png?alt=media\&token=62443e47-81b6-49f2-b6e5-e84d2e51e7fa)

2\. Enter the rule name and description (optional)

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FabtFED1kALFg22J9gnVU%2Fimage.png?alt=media\&token=102d88f5-3a9e-493d-9cc5-65b89391badd)

3\. Select **Group** as Resource Type

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2F3kdVBndsL52hJOEiIywK%2Fimage.png?alt=media\&token=2f01ba67-36c1-4dd6-9850-6685968aad8e)

4\. Check the Active check box

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FD3kDx40dk4hKVTgrFKBu%2Fimage.png?alt=media\&token=64f07769-39d8-494d-ad2d-83350ad25dc7)

{% hint style="info" %}
The Active check box indicates whether the rule is active or not. The rule is applied only if the check box is checked.
{% endhint %}

5\. In the Actions section, leave the Read option **checked**

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2Funnv5k3kKvvVxykMtxhB%2Fimage.png?alt=media\&token=237b3043-67a2-4eda-b82a-18aab5a84cfc)

6\. Add rule conditions

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FS9tqqhh0Q51VQl9hScwk%2Fimage.png?alt=media\&token=eef24c40-1284-4d90-ac5d-f8f6f1740124)

<table data-header-hidden><thead><tr><th width="258">Field</th><th>Description</th></tr></thead><tbody><tr><td>Field</td><td>Description</td></tr><tr><td>Logical Operator</td><td><p>Indicates if the conditions are exclusive or inclusive</p><p><br>If AND is selected, the conditions are concatenated using the logical operator AND.</p><p>e.g: <em>Condition1</em> AND <em>Condition2</em> AND <em>Condition3</em></p><p></p><p>If OR is selected, the conditions are concatenated using the logical operator OR.</p><p>e.g: <em>Condition1</em> OR <em>Condition2</em> OR <em>Condition3</em></p><p></p><p><strong>NOTE:</strong> AND and OR operators cannot be used on the same rule.</p></td></tr><tr><td>Resource</td><td>Indicates the resource that the condition will be targeting</td></tr><tr><td>Property</td><td>Indicates the Resource property used on the condition</td></tr><tr><td>Operator</td><td><p>Indicates the operator used on the condition.<br><br>Available operators:</p><ul><li><em>Equals</em>: indicates that the left hand side value of the expression (LH) has to be equal to the right hand side value of the expression (RH)</li><li><em>StartsWith</em>: indicates that LH has to start with the RH value</li><li><em>Contains</em>: indicates that LH contains the RH</li></ul><p><strong>NOTE:</strong> operators are case-sensitive</p></td></tr><tr><td>User</td><td>Represents the current user logged in when the rule is being evaluated</td></tr><tr><td>Attributes</td><td>Displays a list of Qlik Sense user attributes</td></tr></tbody></table>

&#x20;         6a. Select the resource property&#x20;

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FbCUZA0jYcthKowiu1m1m%2Fimage.png?alt=media\&token=ff74cbcf-5dfc-4628-b681-80763d08fcca)

&#x20;         6b. Select the operator, e.g. Equals

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2Fkn2tK35yhbsVDEGt299w%2Fimage.png?alt=media\&token=5faadb69-28cc-4358-961a-b3977e1dd37a)

&#x20;         6c. Select user

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FAXgGxDUqjTv3QMUfjRHc%2Fimage.png?alt=media\&token=8a1c6828-64a2-4b9e-ae30-bdd5cc5cf2ec)

&#x20;         6d. Select the user attribute, e.g: business\_unit

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2F5V6PhRNza8WFBT8FE2S9%2Fimage.png?alt=media\&token=a856b541-7d21-4e1b-b0fe-8be18a618995)

Now if the system needs to display a list of groups, it will interpret the rule as follows: \
\
"*When the group name is equal to the business unit attribute value from the logged in user*\
*Then display the group"*

8\. To add more conditions, click on the **Add condition** button and repeat steps 6a to 6.d.

9\. Click on **Save** button

### Creating a rule for a user

1\. Click on **Create rule**

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FokCEW9mM7AFyJZHK6IWB%2Fimage.png?alt=media\&token=9b19e912-2b03-4c85-9caa-7762e2b89545)

2\. Enter the rule name and description (optional)

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FzxdDuqoiJ27fy9dvPj4R%2Fimage.png?alt=media\&token=06453fd6-35c5-4b5a-ae0f-ceaee660bfac)

3\. Select **User** as Resource Type

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2Fl7vtfTo7Xk3TMNyNAzpw%2Fimage.png?alt=media\&token=9bb4c553-7a64-4054-8071-f496a94bfaf6)

4\. Check the Active check box

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FwMGVAbV20iWzWBLE1o7W%2Fimage.png?alt=media\&token=b02d9b4e-8981-4d9a-8dbb-e58890c2d08e)

{% hint style="info" %}
The Active check box indicates whether the rule is active or not. The rule is applied only if the check box is checked.
{% endhint %}

5\. In the Actions section, leave the Read option checked

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FXwllTrkLgLgts0vDr6k9%2Fimage.png?alt=media\&token=c190f208-617c-4fc4-9b42-991ba9a2d201)

6\. Add rule conditions

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FUg19KmyiPhRbrzihOb7s%2Fimage.png?alt=media\&token=4db2a08f-d23d-4b54-9117-4155ab019a42)

{% hint style="warning" %}
Rule conditions for users are based on the group name of the groups that the user created or belongs to.
{% endhint %}

7\. Click on **Save** button

### Disabling a rule

If you wish to de-activate a security rule when no longer in use, please follow these steps:

1\. Click on the the **Security Rules** left menu option

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FoWkyxQbxcyIKmyT1XP9S%2Fimage.png?alt=media\&token=f3df55db-89f1-4bf6-9f2e-b9fed0f6a933)

2\. Click on the **Edit** icon&#x20;

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2F1yYSW8oO47mU0b0sZ3Kt%2Fimage.png?alt=media\&token=2f8a8cd1-50e0-4a18-9000-e37eaed950d0)

3\. Uncheck the Active check box

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FHDVpwH2ZziGDkDbhBRzo%2Fimage.png?alt=media\&token=422a13bc-6538-447a-a820-d507306f5890)

4\. Click on **Save** button

### Deleting a rule

1\. Click on the the **Security Rules** left menu option

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2FmJHEvCHYLWqmtiIyODBl%2Fimage.png?alt=media\&token=d10d905b-e905-4773-afa3-60da43b20d76)

2\. Click on the **Delete** icon&#x20;

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2Fhj6y2NK5yX0BnOY3IlVA%2Fimage.png?alt=media\&token=958f914b-9496-4e8d-93e7-9705a1477369)

3\. A confirmation modal will be displayed. Click on **Delete** button

![](https://3420298761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M43RhGzV8Plu0tfknia-3537362534%2Fuploads%2Fc9NA3oIFx7naX7XTfH0P%2Fimage.png?alt=media\&token=52540b78-6be2-4b43-bdb5-7e39f0785af0)
