# Permission rules

## Read permission

To define which users that should have read permissions to the Komment object, go to the **Permission Rules** settings:

![Read Permission](/files/-MKjHqr2PFl8UjmWF09q)

In the **Rule Condition** you can define formulas based on the logged-in user to (e.g. a configuration table that holds the permissions for each user) define who can see the contents of the Komment object.&#x20;

{% hint style="info" %}
It works the same way as the Conditional/Show hide that can be defined for each widget
{% endhint %}

## Write permission

The setup of the Write permission works in the same way as the Read permission. Just go to the default Write permission section.

![Write permission](/files/-MKjJQtDoBqCUo5DuGrM)

## User permission example

It can be very handy to dynamically control which users can read and write in the Komment objects. As the Rule Conditions work based on Qlik logic there are many ways to achieve the same thing and here we give you one easy way of controlling the users who can read/write the Komment objects.

### 1. Load list of users

In the Qlik script you create a table holding the initials of the users that should be able to read or write in the Komment object. You can either load this data via the Active Directory or using an external file. You could also create another Komment object in which you can add relevant users and then reference this in your code.

Let's say you end up loading data from an Excel file and you name the field **Komment\_Users**.

### 2. Define Rule Condition

Now you are ready to define the logic for your read and write permissions via the **Rule Condition**.

One way of doing this is the following:

```sql
if(substringcount(concat(upper(Komment_Users),';'),upper(subfield(Osuser(),'UserId=',2)))=1, -1, 1)
```

Note that you should ensure that the  `subfield(Osuser(),'UserId=',2)` matches with how the Osuser() is returned on your Qlik system.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.extendbi.com/komment/optional-settings/permission-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
