Refactor header to use user rights. (#57)
[timetracker.git] / clients.php
index 61c6658..6ac6f5a 100644 (file)
@@ -30,15 +30,18 @@ require_once('initialize.php');
 import('form.Form');
 import('ttTeamHelper');
 
-// Access check.
-if (!ttAccessCheck(right_manage_team)) {
+// Access checks.
+if (!ttAccessAllowed('manage_clients')) {
   header('Location: access_denied.php');
   exit();
 }
+if (!$user->isPluginEnabled('cl')) {
+  header('Location: feature_disabled.php');
+  exit();
+}
 
 $smarty->assign('active_clients', ttTeamHelper::getActiveClients($user->team_id, true));
 $smarty->assign('inactive_clients', ttTeamHelper::getInactiveClients($user->team_id, true));
-$smarty->assign('title', $i18n->getKey('title.clients'));
+$smarty->assign('title', $i18n->get('title.clients'));
 $smarty->assign('content_page_name', 'clients.tpl');
 $smarty->display('index.tpl');
-?>
\ No newline at end of file