From ea80612af0054c2abdc9c2b422fe3f1038f4b2c0 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Wed, 11 Apr 2018 13:32:44 +0000 Subject: [PATCH] A bit of ongoing cleanup after roles revamp. --- WEB-INF/lib/ttUserHelper.class.php | 29 +++++------------------------ WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/WEB-INF/lib/ttUserHelper.class.php b/WEB-INF/lib/ttUserHelper.class.php index 3d4ead9f..848c9539 100644 --- a/WEB-INF/lib/ttUserHelper.class.php +++ b/WEB-INF/lib/ttUserHelper.class.php @@ -240,35 +240,16 @@ class ttUserHelper { $mdb2 = getConnection(); global $user; - // Preliminary checks. Only managers, co-managers, and admin can do this. - if (!$user->canManageTeam() && !$user->isAdmin()) + // Preliminary checks. Only managers and co-managers can do this. + if (!$user->canManageTeam()) return false; // Tho logic is different depending on who is doing the operation. - // Co-manager and admin - mark user deleted. + // Co-manager - mark user deleted. // Manager - mark user deleted. If manager is the only account in group, mark group items deleted. - // admin part. - if ($user->isAdmin()) { - // Mark user binds as deleted. - $sql = "update tt_user_project_binds set status = NULL where user_id = $user_id"; - $affected = $mdb2->exec($sql); - if (is_a($affected, 'PEAR_Error')) - return false; - - // Mark favorite reports as deleted. - $sql = "update tt_fav_reports set status = NULL where user_id = $user_id"; - $affected = $mdb2->exec($sql); - if (is_a($affected, 'PEAR_Error')) - return false; - - // Mark user as deleted. - $sql = "update tt_users set status = NULL where id = $user_id"; - $affected = $mdb2->exec($sql); - if (is_a($affected, 'PEAR_Error')) - return false; - - } elseif ($user->isCoManager()) { + // Co-manager part. + if ($user->isCoManager()) { // Mark user binds as deleted. $sql = "update tt_user_project_binds set status = NULL where user_id = $user_id"; $affected = $mdb2->exec($sql); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 8eed912a..6b0ca4eb 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.87.4250 | Copyright © Anuko | +  Anuko Time Tracker 1.17.87.4251 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1