Setting a default table based on the user logged in
Posted: Tue Apr 26, 2011 7:40 am
Using the beforeHandleRequest() function works but only when each user has one table. If I were to click on TableB, TableA would show instead since beforeHandleRequest() is called on every request. How should I approach this problem? My tables are hidden from user to user using the getNavItem() method. Ive also tried the after_action_login() method but that didn't work.
Here's what I have at the moment
Here's what I have at the moment
- Code: Select all
function after_action_login()
{
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
$app = Dataface_Application::getInstance();
$query =& $app->getQuery();
switch($user->val('role'))
{
case 'ADMIN':
$query['-table'] = 'TableA';
break;
case 'UserA':
$query['-table'] = 'TableA';
break;
case 'UserB':
$query['-table'] = 'TableB';
break;
}
}