Following the 'Disabling Unnecssary Fetures" tutorial, I've added a getPreferences function to my ApplicationDelegate.php aiming to hide the tables menu/tabs depending on the user's role--so 'admin' users should see the tabs while others should not. Here's what I've got:
- Code: Select all
function getPreferences(){
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
// check to see if user's logged in; if not, no tables menu
if ( !isset($user) ) {
return array('show_tables_menu'=>0); }
// first branch: if logged in and an admin, show tables menu
elseif
( $user && ($user->val('role') == 'ADMIN') ) {
return array(
'show_tables_menu'=>1,
'show_table_tabs'=>1 );
} else {
// second branch, if not an ADMIN, no tables menu
return array(
'show_table_tabs'=>0,
'show_tables_menu'=>0 );
}
}
But though this hides tables menu well enough when the log-in page first appears, it doesn't restore those tabs after the user has logged in, regardless whether that user has the admin role or not. I'm not seeing where I'm amiss, so any and all help most welcome!