Security Filter wont work

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

Security Filter wont work

Postby Philipp Wenzel » Tue Jun 26, 2012 1:24 pm

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?
Philipp Wenzel
 
Posts: 15
Joined: Sat May 05, 2012 7:10 am

Re: Security Filter wont work

Postby shannah » Tue Jun 26, 2012 11:01 pm

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.
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 16 guests

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