From: Nik Okuntseff Date: Tue, 27 Nov 2018 22:14:54 +0000 (+0000) Subject: A few fixes for subgroup support. X-Git-Tag: timetracker_1.19-1~535 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1e7092b2a85592240048d9622a6f619aa2a7c68a;p=timetracker.git A few fixes for subgroup support. --- diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 241c92c0..5a3dd2fb 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -296,7 +296,11 @@ class ttTeamHelper { $group_id = $user->getGroup(); $org_id = $user->org_id; - $sql = "select id, name, description, rank, rights from tt_roles where group_id = $group_id and org_id = $org_id and rank < $user->rank and status = 1 order by rank"; + // Determine max rank. If we are working in on behalf group + // then rank restriction does not apply. + $max_rank = $user->behalfGroup ? MAX_RANK : $user->rank; + + $sql = "select id, name, description, rank, rights from tt_roles where group_id = $group_id and org_id = $org_id and rank < $max_rank and status = 1 order by rank"; $res = $mdb2->query($sql); $result = array(); if (!is_a($res, 'PEAR_Error')) { @@ -357,7 +361,11 @@ class ttTeamHelper { $group_id = $user->getGroup(); $org_id = $user->org_id; - $sql = "select id, name, description, rank, rights from tt_roles where group_id = $group_id and org_id = $org_id and rank < $user->rank and status = 0 order by rank"; + // Determine max rank. If we are working in on behalf group + // then rank restriction does not apply. + $max_rank = $user->behalfGroup ? MAX_RANK : $user->rank; + + $sql = "select id, name, description, rank, rights from tt_roles where group_id = $group_id and org_id = $org_id and rank < $max_rank and status = 0 order by rank"; $res = $mdb2->query($sql); $result = array(); if (!is_a($res, 'PEAR_Error')) { diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 82a31958..457d2302 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -344,7 +344,7 @@ class ttUser { $skipClients = !isset($options['include_clients']); $includeSelf = isset($options['include_self']); - $select_part = 'select u.id, u.name'; + $select_part = 'select u.id, u.group_id, u.name'; if (isset($options['include_login'])) $select_part .= ', u.login'; if (!isset($options['include_clients'])) $select_part .= ', r.rights'; if (isset($options['include_role'])) $select_part .= ', r.name as role_name, r.rank'; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 1f6329b1..aba47ce4 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - {if $u.rank < $user->rank || ($u.rank == $user->rank && $u.id == $user->id)} + {if $u.group_id != $user->group_id || $u.rank < $user->rank || ($u.rank == $user->rank && $u.id == $user->id)} {if $u.id != $user->id}{else}{/if} {else} @@ -73,7 +73,7 @@ - {if $u.rank < $user->rank} + {if $u.rank < $user->rank || $u.group_id != $user->group_id} {else}
 Anuko Time Tracker 1.18.28.4530 | Copyright © Anuko | +  Anuko Time Tracker 1.18.28.4531 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/users.tpl b/WEB-INF/templates/users.tpl index d729c41c..d539f8d5 100644 --- a/WEB-INF/templates/users.tpl +++ b/WEB-INF/templates/users.tpl @@ -38,7 +38,7 @@ {$u.login|escape} {$u.role_name|escape}{$i18n.label.edit}{$i18n.label.delete}{$u.name|escape} {$u.login|escape} {$u.role_name|escape}{$i18n.label.edit} {$i18n.label.delete}