I have created groups or profiles to set up permissions. My aim is to change the view in several specific tables according to the profiles and to set up the permissions to modify or delete records according to the groups, the user belongs to.
So I began creating several columns in the users tables groupe1, ..., groupe4 related to the groupes tables. Eventually I created a permission for each group like MIAL, ARBIZON, the normalized name of groups with capitals and underscores.
In the permissions.ini file I added
- Code: Select all
[USER extends USER]
new=1
edit=1
[MIAL extends USER]
[ARBIZON extends USER]...
Then in the DelegateClass, i bound the permission to the first group (groupe1). Here I plan to hve it like a basis. I inserted :
- Code: Select all
if (!isset($user) ) {
return Dataface_PermissionsTool::NO_ACCESS();
}
else {
$groupe1 = $user->val('groupe1');
if ($groupe1>0){
$sql = "select permission FROM groupes WHERE id_groupes==$groupe1";
$res = @mysql_query($sql, $this->app->db());
$rang=mysql_fetch_row($res);
$permission=$rang['permission'];
return Dataface_PermissionsTool::getRolePermissions($permission);
}
}...
Well now I am stuck because every user may belong to several groups and have permission profiles according to these groups.
Besides, each profile sees different records in the table.
Help!
Jean