i tried to give my users only access to their own records. Im using the security filter how-to (http://xataface.com/documentation/how-t ... ty_filters) but i wont work...
my users table with UserID, Role and my table nation with nation_owner as identifier
this is my nation/nation.php
- Code: Select all
<?PHP
class tables_nation{
function getTitle(&$record){
return $record->val('nation_name');
}
function getPreferences(){
$mytable =& Dataface_Table::loadTable('nation'); // load the table named 'nation'
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( $user and $user->val('rol') != 'MANAGER' ){
//We apply the security filter to non manager users.
$mytable->setSecurityFilter(array('nation_owner'=>$user->val('UserID')));
}
return array(); // Mandatory!! getPreferences() must return array.
}
}
?>
a clue?