Page 1 of 1

setSecurityFilter, fieldX=A or fieldY=A

PostPosted: Mon Apr 02, 2012 6:39 am
by hhkilis
Hi,

Using security filters, we can filter records to be listed for specific users as in the example below.

Code: Select all
function init(&$table) {
   $user=&Dataface_AuthenticationTool::getInstance()->getLoggedInUser();
   
   $table->setSecurityFilter(array('fieldX'=>$user->val('id')));
}


I want users to see only their records in a table. In my case, if fieldX or fieldY equals to the id of a user, then the record belongs to that user.

Is there a solution for this case?

Re: setSecurityFilter, fieldX=A or fieldY=A

PostPosted: Mon Apr 02, 2012 9:45 am
by shannah
Xataface can't do queries like fieldX=A OR fieldY=A, but you can create a calculated field fieldZ using the __sql__() method of the delegate class.
This thread should answer your question:
viewtopic.php?f=4&t=6593&p=29699&hilit=security+filters#p29699