X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttRoleHelper.class.php;h=35374469932c15b7a8a2a3732fb70e93477a1aae;hb=fa6508ac21c30d6bfef008387fabd29a843d7b66;hp=53fe571a909a100cde01d01a5339e2eab61e0a71;hpb=fec6ce6d32cc779e350a65c641f1b1eafa096ea8;p=timetracker.git diff --git a/WEB-INF/lib/ttRoleHelper.class.php b/WEB-INF/lib/ttRoleHelper.class.php index 53fe571a..35374469 100644 --- a/WEB-INF/lib/ttRoleHelper.class.php +++ b/WEB-INF/lib/ttRoleHelper.class.php @@ -37,7 +37,7 @@ class ttRoleHelper { $mdb2 = getConnection(); $sql = "select id, name, description, rank, rights, status from tt_roles - where id = $id and group_id = ".$user->getActiveGroup()." and (status = 0 or status = 1)"; + where id = $id and group_id = ".$user->getGroup()." and (status = 0 or status = 1)"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { @@ -56,7 +56,7 @@ class ttRoleHelper { $mdb2 = getConnection(); global $user; - $sql = "select id from tt_roles where group_id = ".$user->getActiveGroup(). + $sql = "select id from tt_roles where group_id = ".$user->getGroup(). " and name = ".$mdb2->quote($role_name)." and (status = 1 or status = 0)"; $res = $mdb2->query($sql); @@ -89,7 +89,7 @@ class ttRoleHelper { global $user; $mdb2 = getConnection(); - $sql = "select rights from tt_roles where group_id = ".$user->getActiveGroup()." and id = $role_id"; + $sql = "select rights from tt_roles where group_id = ".$user->getGroup()." and id = $role_id"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { @@ -124,6 +124,9 @@ class ttRoleHelper { global $user; $mdb2 = getConnection(); + $group_id = $user->getGroup(); + $org_id = $user->org_id; + $id = (int)$fields['id']; if (isset($fields['name'])) $name_part = 'name = '.$mdb2->quote($fields['name']); if (isset($fields['rank'])) $rank_part = ', rank = '.(int)$fields['rank']; @@ -131,7 +134,7 @@ class ttRoleHelper { if (isset($fields['status'])) $status_part = ', status = '.(int)$fields['status']; if (isset($fields['rights'])) $rights_part = ', rights = '.$mdb2->quote($fields['rights']); $parts = trim($name_part.$rank_part.$descr_part.$status_part.$rights_part, ','); - $sql = "update tt_roles set $parts where id = $id and group_id = $user->group_id"; + $sql = "update tt_roles set $parts where id = $id and group_id = $group_id and org_id = $org_id"; $affected = $mdb2->exec($sql); return (!is_a($affected, 'PEAR_Error')); } @@ -141,9 +144,11 @@ class ttRoleHelper { global $user; $mdb2 = getConnection(); + $group_id = $user->getGroup(); + $org_id = $user->org_id; // Mark the task as deleted. - $sql = "update tt_roles set status = NULL where id = $role_id and group_id = $user->group_id"; + $sql = "update tt_roles set status = NULL where id = $role_id and group_id = $group_id and org_id = $org_id"; $affected = $mdb2->exec($sql); return (!is_a($affected, 'PEAR_Error')); } @@ -314,7 +319,7 @@ class ttRoleHelper { return false; } - // copyRoles copies roles from one group to another. + // copyRolesToGroup copies roles from current on behalf group to another. static function copyRolesToGroup($group_id) { global $user; $mdb2 = getConnection();