setSecurityFilter, fieldX=A or fieldY=A
Archived from the Xataface Users forum.
hhkilis — Mon Apr 02, 2012 6:39 am
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?
shannah — Mon Apr 02, 2012 9:45 am
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