To define which users that should have read permissions to the Komment object, go to the Permission Rules settings:
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.
The setup of the Write permission works in the same way as the Read permission. Just go to the default Write permission section.
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.
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.
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:
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.