From: bonnedav Date: Tue, 3 Apr 2018 12:53:55 +0000 (-0600) Subject: More refactoring of rights checks (#61) X-Git-Tag: timetracker_1.19-1~879 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2df50105b46a5cbd6493271b137a136ccfe2ea5a;p=timetracker.git More refactoring of rights checks (#61) * Refactor predefined_expenses.tpl to use rights checks * Refactor notifications.tpl to use rights checks * Refactor invoices.tpl to use rights checks * Refactor projects.tpl to use rights checks * Update users.php * Refactor desktop projects.tpl to use rights checks * Refactor expenses.php to remove stray canManageTeam() call * Refactor mobile users.php to remove stray canManageTeam call * Refactor mobile expenses.php to remove stray canManageTeam() call * Refactor time.php to remove stray canManageTeam call --- diff --git a/WEB-INF/templates/invoices.tpl b/WEB-INF/templates/invoices.tpl index 32d09544..b966f9e2 100644 --- a/WEB-INF/templates/invoices.tpl +++ b/WEB-INF/templates/invoices.tpl @@ -5,7 +5,7 @@
-{if $user->canManageTeam() || $user->isClient()} +{if $user->can('manage_invoices') || $user->can('view_own_invoices')} diff --git a/WEB-INF/templates/mobile/projects.tpl b/WEB-INF/templates/mobile/projects.tpl index 5e488133..96dcce10 100644 --- a/WEB-INF/templates/mobile/projects.tpl +++ b/WEB-INF/templates/mobile/projects.tpl @@ -5,7 +5,7 @@
{$i18n.label.invoice}
-{if $user->canManageTeam()} +{if $user->can('manage_projects')} {if $inactive_projects} diff --git a/WEB-INF/templates/notifications.tpl b/WEB-INF/templates/notifications.tpl index 021ff921..72854190 100644 --- a/WEB-INF/templates/notifications.tpl +++ b/WEB-INF/templates/notifications.tpl @@ -2,7 +2,7 @@
{$i18n.form.projects.active_projects}
-{if $user->canManageTeam()} +{if $user->can('manage_advanced_settings')} diff --git a/WEB-INF/templates/predefined_expenses.tpl b/WEB-INF/templates/predefined_expenses.tpl index 265bdf1b..147230dc 100644 --- a/WEB-INF/templates/predefined_expenses.tpl +++ b/WEB-INF/templates/predefined_expenses.tpl @@ -2,7 +2,7 @@
{$i18n.label.thing_name}
-{if $user->canManageTeam()} +{if $user->can('manage_advanced_settings')} diff --git a/WEB-INF/templates/projects.tpl b/WEB-INF/templates/projects.tpl index 31967218..58999365 100644 --- a/WEB-INF/templates/projects.tpl +++ b/WEB-INF/templates/projects.tpl @@ -5,7 +5,7 @@
{$i18n.label.thing_name}
-{if $user->canManageTeam()} +{if $user->can('manage_projects')} {if $inactive_projects} diff --git a/expenses.php b/expenses.php index fee81205..7d7295d2 100644 --- a/expenses.php +++ b/expenses.php @@ -196,7 +196,7 @@ if ($request->isPost()) { $err->add($i18n->get('error.db')); } } elseif ($request->getParameter('onBehalfUser')) { - if($user->canManageTeam()) { + if($user->can('track_expenses')) { unset($_SESSION['behalf_id']); unset($_SESSION['behalf_name']); diff --git a/mobile/expenses.php b/mobile/expenses.php index 815a4fc3..c853a2ca 100644 --- a/mobile/expenses.php +++ b/mobile/expenses.php @@ -200,7 +200,7 @@ if ($request->isPost()) { $err->add($i18n->get('error.db')); } } elseif ($request->getParameter('onBehalfUser')) { - if($user->canManageTeam()) { + if($user->can('track_expenses')) { unset($_SESSION['behalf_id']); unset($_SESSION['behalf_name']); diff --git a/mobile/users.php b/mobile/users.php index 4723543d..b531d7a4 100644 --- a/mobile/users.php +++ b/mobile/users.php @@ -40,7 +40,7 @@ if (!(ttAccessAllowed('view_users') || ttAccessAllowed('manage_users'))) { // Get users. $active_users = ttTeamHelper::getActiveUsers(array('getAllFields'=>true)); -if($user->canManageTeam()) { +if($user->can('manage_users')) { $can_delete_manager = (1 == count($active_users)); $inactive_users = ttTeamHelper::getInactiveUsers($user->group_id, true); } diff --git a/time.php b/time.php index 24cc7c8a..d4caad2b 100644 --- a/time.php +++ b/time.php @@ -347,7 +347,7 @@ if ($request->isPost()) { } } elseif ($request->getParameter('onBehalfUser')) { - if($user->canManageTeam()) { + if($user->can('track_time')) { unset($_SESSION['behalf_id']); unset($_SESSION['behalf_name']);
{$i18n.form.projects.active_projects}