From c138ab042a599beb780895e5a5f54a1b287d67ae Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Tue, 13 Mar 2018 22:30:55 +0000 Subject: [PATCH] Started to replace canManageTeam calls with right checks. --- WEB-INF/lib/ttExpenseHelper.class.php | 2 +- WEB-INF/lib/ttFavReportHelper.class.php | 4 ++-- WEB-INF/lib/ttUser.class.php | 2 +- WEB-INF/templates/footer.tpl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/WEB-INF/lib/ttExpenseHelper.class.php b/WEB-INF/lib/ttExpenseHelper.class.php index 533c438d..7d63ba41 100644 --- a/WEB-INF/lib/ttExpenseHelper.class.php +++ b/WEB-INF/lib/ttExpenseHelper.class.php @@ -70,7 +70,7 @@ class ttExpenseHelper { $invoice_id = $fields['invoice_id']; $paid_part = ''; - if ($user->canManageTeam() && $user->isPluginEnabled('ps')) { + if ($user->can('manage_invoices') && $user->isPluginEnabled('ps')) { $paid_part = $fields['paid'] ? ', paid = 1' : ', paid = 0'; } diff --git a/WEB-INF/lib/ttFavReportHelper.class.php b/WEB-INF/lib/ttFavReportHelper.class.php index 06b745cc..111e9b19 100644 --- a/WEB-INF/lib/ttFavReportHelper.class.php +++ b/WEB-INF/lib/ttFavReportHelper.class.php @@ -171,7 +171,7 @@ class ttFavReportHelper { // If all users are selected - use a null value (which means "all users"). $all_users_selected = true; - if ($user->canManageTeam()) { + if ($user->can('view_reports')) { $all = ttTeamHelper::getActiveUsers(); foreach ($all as $one) { if (!in_array($one['id'], $users_in_bean)) { @@ -260,7 +260,7 @@ class ttFavReportHelper { $bean->setAttribute('users', explode(',', $val['users'])); else { // Null users value means "all users". Add them to the bean. - if ($user->canManageTeam()) { + if ($user->can('view_reports')) { $all = ttTeamHelper::getActiveUsers(); foreach ($all as $one) { $all_user_ids[] = $one['id']; diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 2f7ff958..dd42a64c 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -154,7 +154,7 @@ class ttUser { // isAdmin - determines whether current user is admin (has right_administer_site). function isAdmin() { - return (right_administer_site & $this->role); + return $this->can('administer_site'); } // isManager - determines whether current user is team manager. diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 364fc349..304b4e27 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.43.4069 | Copyright © Anuko | +  Anuko Time Tracker 1.17.43.4070 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1