Implemented Permission template for table and fields

eugenio

Administrator
Staff member
A permission template would allow to specify, for tables or fields, default permission rules to apply e.g. give all permissions to the group “admin” and give just read permissions to the group “secretary”.
 
Upvote 1
This suggestion has been implemented. Votes are no longer accepted.

eugenio

Administrator
Staff member
One of the most boring task when I develop a DaDaBIK app having many user groups is to set the permissions for all of them when I create a new table. Sure, you can use the config parameter $grant_permissions_after_table_installation but it's a YES/NO assignment for all the permissions. I am seriously thinking about implementing a more sophisticated permissions template system so I am replying to this old suggestion to give more details.

The idea is to have a config parameter $permissions_template; let's say, for example, that I want to assign all the table permissions and field permissions to the group 1 (admin), all the permissions except delete to the group 2 and only read permissions to the group 3.

My config_custom.php file will look like this

Code:
...
$permissions_template['table'][1] = '111111'; // all the table permissions set to "1", means YES
$permissions_template['field'][1] = '1111111'; // all the field permissions set to "1", means YES

$permissions_template['table'][2] = '101111'; // all the table permissions set to "1", except DELETE
$permissions_template['field'][2] = '1111111'; // all the field permissions set to "1"

$permissions_template['table'][3] = '100010'; // only search and details permissions
$permissions_template['field'][3] = '1001111'; // all the field permissions set to "1", except edit and create
...

The order of the 0s and 1s is the order of the permissions you see in the permissions page.

An improvement would be the possibility to have several templates, each one with a different name, that you can select when you add a table.

Any feedback is welcome!
 
Last edited:
Top