}
}
+ // The getGroup returns group id on behalf of which the current user is operating.
+ function getGroup() {
+ return ($this->behalfGroup ? $this->behalfGroup->id : $this->group_id);
+ }
+
// getDecimalMark returns decimal mark for active group.
function getDecimalMark() {
return ($this->behalfGroup ? $this->behalfGroup->decimal_mark : $this->decimal_mark);
return ($this->behalf_id ? $this->behalf_id : $this->id);
}
- // The getActiveGroup returns group id on behalf of which the current user is operating.
- function getActiveGroup() {
- return ($this->behalf_group_id ? $this->behalf_group_id : $this->group_id);
- }
-
// can - determines whether user has a right to do something.
function can($do_something) {
return in_array($do_something, $this->rights);
function getUsers($options) {
$mdb2 = getConnection();
- $group_id = $this->getActiveGroup();
+ $group_id = $this->getGroup();
$org_id = $this->org_id;
$skipClients = !isset($options['include_clients']);
// Start with subgroups.
$groups = array();
- $group_id = $this->getActiveGroup();
+ $group_id = $this->getGroup();
$sql = "select id, name from tt_groups where org_id = $this->org_id and parent_id = $group_id and status = 1";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
function getSubgroups($group_id = null) {
$mdb2 = getConnection();
- if (!$group_id) $group_id = $this->getActiveGroup();
+ if (!$group_id) $group_id = $this->getGroup();
$sql = "select id, name, description from tt_groups where org_id = $this->org_id".
" and parent_id = $group_id and status is not null order by upper(name)";
if (!$this->can('manage_users')) return false;
$mdb2 = getConnection();
- $group_id = $this->getActiveGroup();
+ $group_id = $this->getGroup();
$org_id = $this->org_id;
$sql = "select u.id, u.name, u.login, u.role_id, u.client_id, u.status, u.rate, u.email from tt_users u".
if ($group_id && !$this->isGroupValid($group_id)) return false;
$mdb2 = getConnection();
- if (!$group_id) $group_id = $this->getActiveGroup();
+ if (!$group_id) $group_id = $this->getGroup();
if (isset($fields['name'])) $name_part = ', name = '.$mdb2->quote($fields['name']);
if (isset($fields['description'])) $description_part = ', description = '.$mdb2->quote($fields['description']);
if (!$user_details) return false;
$mdb2 = getConnection();
- $group_id = $this->getActiveGroup();
+ $group_id = $this->getGroup();
$org_id = $this->org_id;
// Mark user to project binds as deleted.