The solution I came up with was to create a beforeHandleRequest function in my ApplicationDelegate.php:
- Code: Select all
function beforeHandleRequest() {
if ($this->isLoggedIn()) {
if ($this->getLoggedInUsername() !== 'admin') {
$app =& Dataface_Application::getInstance();
// Makes sure that the NavMenu cannot see these tables
unset($app->_conf['_tables']['phone_types']);
unset($app->_conf['_tables']['address_types']);
unset($app->_conf['_tables']['email_types']);
unset($app->_conf['_tables']['users']);
// Makes sure that a non-admin user cannot access the tables
// from the browser.
$app->_conf['_disallowed_tables']['hide_admin1'] = 'phone_types';
$app->_conf['_disallowed_tables']['hide_admin2'] = 'address_types';
$app->_conf['_disallowed_tables']['hide_admin3'] = 'email_types';
$app->_conf['_disallowed_tables']['hide_admin4'] = 'users';
}
}
}
Although this works, I was wondering if there's a better way to be doing this.
Thank you,
-Rob