$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')) {
$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')) {
$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';
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.28.4530 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.28.4531 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
</td>
<td>{$u.login|escape}</td>
<td>{$u.role_name|escape}</td>
- {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)}
<td><a href="user_edit.php?id={$u.id}">{$i18n.label.edit}</a></td>
{if $u.id != $user->id}<td><a href="user_delete.php?id={$u.id}">{$i18n.label.delete}</a></td>{else}<td></td>{/if}
{else}
<td>{$u.name|escape}</td>
<td>{$u.login|escape}</td>
<td>{$u.role_name|escape}</td>
- {if $u.rank < $user->rank}
+ {if $u.rank < $user->rank || $u.group_id != $user->group_id}
<td><a href="user_edit.php?id={$u.id}">{$i18n.label.edit}</a></td>
<td><a href="user_delete.php?id={$u.id}">{$i18n.label.delete}</a></td>
{else}