- 27 Dec 2017, 05:50
#3475
Hi,
Just was playing around with OpenCats to see if I can turn off / on tabs for different permissions. This is a way for tabs not to appear (but users may still access them)
At any time - you can get the permission of the logged in user with $loggedInAccessLevel = $_SESSION['CATS']->getRealAccessLevel();
Real Access level returns the logged in user access:, Read Only - 100, Add / Edit - 200, Add / Edit / Delete (Default) - 300, Site Administrator - 400, Root - 500
Adding this code to printTabs in TemplateUtility.php in the foreach ($modules as $moduleName => $parameters) loop will hide certain tabs if a user does not meet the appropriate permissions. Module names are: home, activity, joborders, candidates, companies, contacts, lists, calendar, reports, settings
$loggedInAccessLevel = $_SESSION['CATS']->getRealAccessLevel();
$minimumAccessLevel = array ("lists" => 400, "companies" => 400);
if (array_key_exists($moduleName, $minimumAccessLevel)) {
if ($loggedInAccessLevel < $minimumAccessLevel[$moduleName])
{
continue; //Disabling module for the user by not showing it - if they do not have the minium access level
}
}
Just was playing around with OpenCats to see if I can turn off / on tabs for different permissions. This is a way for tabs not to appear (but users may still access them)
At any time - you can get the permission of the logged in user with $loggedInAccessLevel = $_SESSION['CATS']->getRealAccessLevel();
Real Access level returns the logged in user access:, Read Only - 100, Add / Edit - 200, Add / Edit / Delete (Default) - 300, Site Administrator - 400, Root - 500
Adding this code to printTabs in TemplateUtility.php in the foreach ($modules as $moduleName => $parameters) loop will hide certain tabs if a user does not meet the appropriate permissions. Module names are: home, activity, joborders, candidates, companies, contacts, lists, calendar, reports, settings
$loggedInAccessLevel = $_SESSION['CATS']->getRealAccessLevel();
$minimumAccessLevel = array ("lists" => 400, "companies" => 400);
if (array_key_exists($moduleName, $minimumAccessLevel)) {
if ($loggedInAccessLevel < $minimumAccessLevel[$moduleName])
{
continue; //Disabling module for the user by not showing it - if they do not have the minium access level
}
}