DataGrid Tab doesn't appear [Solved]

A place for users and developers of the Xataface to discuss and receive support.

DataGrid Tab doesn't appear [Solved]

Postby 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:
1. Extract the DataGrid-zip in a xataface-modules folder.
Code: Select all
...
lib/xataface
lib/xataface_modules
...


2. 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.

3. 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

4. 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
Last edited by ctrl on Thu May 20, 2010 8:21 am, edited 1 time in total.
ctrl
 
Posts: 4
Joined: Thu May 20, 2010 5:40 am

Re: DataGrid Tab doesn't appear

Postby 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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: DataGrid Tab doesn't appear

Postby 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/DataGrid

app/lib/xataface


regards,
Armin
ctrl
 
Posts: 4
Joined: Thu May 20, 2010 5:40 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 26 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved