Access Control to Information

In addition, you can hide entries in the components TableGrid and ComboBox, that the user should not see.

For this, the Roles component property has a Data Filter subkey in which you can write for each role a condition for filtering records. The syntax of the condition is similar to that of the SQL query language of the WHERE clause.


Example

Suppose you have a database of documents. Each document is given its importance: "High", "Medium", "Low". We make sure that:

  • a user with the role "User" can only see documents with the importance of "Low".
  • a user with the role "Manager" will see the documents with the importance of "Medium" and "Low".
  • a user with the role "Director" will see all documents.


 This is what the structure of the document database looks like and the data it contains.

 


Setting up the TableGrid component will look like this:

For the Director role we leave the field empty, so this role will have access to any documents.

For the Manager role, list the document importance identifiers, so this role will have access to documents of Medium and Low importance.

For the User role, only documents with a Importance ID of 3 will be available, which corresponds to documents of Low importance.


This setting is also acceptable


But this has several disadvantages:

  1. The field "level.name" must be present in the settings of the component "TableGrid"
  2. If you change the type of importance, for example from "Low" to "Minor", you will need to correct the condition.
  3. Work more slowly.


Users with the "Director" role can see all documents, so there is no requirement for data filtering.

The "ComboBox"  component is configured in the same way.



Next: Users creation