Page 1 of 1

Security Filter wont work

PostPosted: Tue Jun 26, 2012 1:24 pm
by Philipp Wenzel
Hi there,
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?

Re: Security Filter wont work

PostPosted: Tue Jun 26, 2012 11:01 pm
by shannah
Do some debugging to find out why it won't work. Check the values of your security filter and variables in this function at various steps to see why your filter is not what you expect.