DataGrid Tab doesn’t appear [Solved]
Archived from the Xataface Users forum.
ctrl — Thu May 20, 2010 6:50 am
Hi,
first I have to congratulate you, xataface is a really great tool!
Currently I try to use the DataGrid module but the Tab doesn’t appear and I don’t know why.
This is what I have done so far:
- Extract the DataGrid-zip in a xataface-modules folder.
- Code: Select all
... lib/xataface lib/xataface_modules ...
- Add the following line in my conf.ini file
- Code: Select all
[_modules] modules_DataGrid=../lib/xataface_modules/DataGrid/DataGrid.php
This works fine. If I change the path an error appears.
- Add a permissions.ini file (I didn’t use the permissions.ini file so far) with the following lines
- Code: Select all
[ADMIN] DataGrid:view_grid=1 DataGrid:update=1 [admin] DataGrid:view_grid=1 DataGrid:update=1
‘ADMIN’ is a predefined role and ‘admin’ a role name in my user table
- I enabled the xataface security/authentication mode and wrote a ApplicationDelegate class (as described in the docs) to implement a specific permission function. It allows to
disable access to specific tables for roles (works fine):
- Code: Select all
function getPermissions(&$record) { $table = ($record->_tablename); $app =& Dataface_Application::getInstance(); $config = $app->_conf; // $record is a Dataface_Record object $auth =& Dataface_AuthenticationTool::getInstance(); $user =& $auth->getLoggedInUser(); $permission; if ($user) { // perform logged in user $config = $app->conf(); $role = $user->val('role_'); $role_disallow_arr = $config['disallow_table']; //print_r($role_disallow_arr[$role]); if($role_disallow_arr[$role]) { if(in_array($table, $role_disallow_arr[$role])) { $permission = Dataface_PermissionsTool::getRolePermissions('NO ACCESS'); //echo "Not allowed"; } } if($role == 'admin' OR $role == 'user') { $permission = Dataface_PermissionsTool::getRolePermissions('ADMIN'); //echo "admin rights"; } else if ($role == 'guest') { $permission = Dataface_PermissionsTool::getRolePermissions('READ ONLY'); } else { //unkown role, search for match in predefined roles $permission = Dataface_PermissionsTool::getRolePermissions($role); } } else { // not logged in $permission = Dataface_PermissionsTool::getRolePermissions('NO ACCESS'); } return $permission; }
In the conf.ini file I added the following lines:
- Code: Select all
;Disallow table access for specific roles ;First set the role name with [] as suffix as key and the table name as value [disallow_table] user[]=event_type user[]=period_type user[]=user guest[]=event_type guest[]=period_type guest[]=user
Any hints what I do wrong?
regards,
Armin
shannah — Thu May 20, 2010 7:57 am
The xataface modules should be inside the xataface directory.
i.e. xataface/modules/DataGrid
not
xataface_modules/DataGrid
ctrl — Thu May 20, 2010 8:17 am
wow, fast reply.
yeah! Now it works! Thanks!
Have to move the module into the xataface application directory.
Moving it to the xataface library the tab appears but it cause an error on click.
- Code: Select all
- `app/manage/conf.ini
app/manage/index.php
…
app/manage/modules/DataGridapp/lib/xataface`
regards,
Armin