From d368d8cfe50268648a7c9f94a031c9aa8f0f4549 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Thu, 6 Dec 2018 15:06:05 +0000 Subject: [PATCH] Fixed editing org by admin, added a comment for imported subgroups. --- WEB-INF/lib/ttAdmin.class.php | 13 +++++++++++-- WEB-INF/lib/ttGroup.class.php | 2 +- WEB-INF/templates/footer.tpl | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/WEB-INF/lib/ttAdmin.class.php b/WEB-INF/lib/ttAdmin.class.php index 0e0532ce..383eb44c 100644 --- a/WEB-INF/lib/ttAdmin.class.php +++ b/WEB-INF/lib/ttAdmin.class.php @@ -143,7 +143,7 @@ class ttAdmin { $password_part = ', password = md5('.$mdb2->quote($fields['password1']).')'; $name_part = ', name = '.$mdb2->quote($fields['user_name']); $email_part = ', email = '.$mdb2->quote($fields['email']); - $sql = 'update tt_users set '.$login_part.$password_part.$name_part.$email_part.$modified_part.'where id = '.$user_id; + $sql = 'update tt_users set '.$login_part.$password_part.$name_part.$email_part.$modified_part.' where id = '.$user_id; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) return false; @@ -189,10 +189,19 @@ class ttAdmin { $result = array(); $mdb2 = getConnection(); + // Note: current code works with properly set top manager (rank 512). + // However, we now allow export and import of subgroups, which seems to work well. + // In this situation, imported role is no longer "Top manager", and this call fails. + // Setting role id manually in database for top user to Top manager resolves the issue. + // + // TODO: assess whether it is safe / reasonable to promote role during export or import. + // The problem is that user having 'export_data' right is not necessarily top user. + // And if we do it by rank, what to do for multiple managers situation? First found? + // Leaving to manual fixing for now. $sql = "select g.name as group_name, u.id as manager_id, u.name as manager_name, u.login as manager_login, u.email as manager_email". " from tt_groups g". " inner join tt_users u on (u.group_id = g.id)". - " inner join tt_roles r on (r.id = u.role_id and r.rank = 512)". + " inner join tt_roles r on (r.id = u.role_id and r.rank = 512)". // Fails for partially imported org. See comment above. " where g.id = $group_id"; $res = $mdb2->query($sql); diff --git a/WEB-INF/lib/ttGroup.class.php b/WEB-INF/lib/ttGroup.class.php index fe8c8a98..1aa422c7 100644 --- a/WEB-INF/lib/ttGroup.class.php +++ b/WEB-INF/lib/ttGroup.class.php @@ -124,7 +124,7 @@ class ttGroup { } // Determine active user count in a separate query. - // TODO: If performance becomes an issue, ivestigate combining 2 queries in one. + // TODO: If performance becomes an issue, investigate combining 2 queries in one. // At this time we only need to know if at least 1 active user exists. $sql = "select count(*) as user_count from tt_users". " where group_id = $id and org_id = $org_id and status = 1"; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index d59ff9e7..9d8323c4 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4596 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4597 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1