find form viewing records depending on logged in user

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

find form viewing records depending on logged in user

Postby PolderBoy » Thu Apr 15, 2010 8:11 am

Hello All,

On my find form the colum 'Betaald_NLE' should only be viewable by 1 role 'Boss'
So I made the next function:
Code: Select all
    function Betaald_NLE__permissions(&$record)
   {
      $auth =& Dataface_AuthenticationTool::getInstance();
      $user =& $auth->getLoggedInUser();
      $role = $user->val('Role');
      if ($role == "Boss")
      {
         return array('find' => 1);
         exit;
      }
      else
      {
         return array('find' => 0);
         exit;      
      }
   }

But this doesn't work. Everybody can view and fill in the pull down and find records.

In fields..ini I have:
[Betaald_NLE]
group=Status_info
widget:type = select
vocabulary = Betaald_NLE_Vocabulary
visibility:list = hidden
visibility:browse = hidden

Could somebody please help me?

PolderBoy.
PolderBoy
 
Posts: 72
Joined: Fri Apr 03, 2009 12:53 am

Re: find form viewing records depending on logged in user

Postby shannah » Tue May 04, 2010 9:12 am

The column permissions don't currently support fine-grained access on find. An approach that would work is to programmatically override the fields.ini directives for the field in the init() method of the delegate class for that table.

Code: Select all
function init(&$table){
    $fld =& $table->getField('Betaald_NLE');
    $fld['visibility']['find'] = 0;
}
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 20 guests

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