X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttRoleHelper.class.php;h=4a666cb61e93c4155a919797a9d0745493a09168;hb=6c7a98f61e74aeae700b523729abb49ff19d3704;hp=3e6e73e16ad4a42973f05e23009e803feb36dd59;hpb=e96a91f4cdd1bd25ffab2afdc7d90102b30a37ba;p=timetracker.git diff --git a/WEB-INF/lib/ttRoleHelper.class.php b/WEB-INF/lib/ttRoleHelper.class.php index 3e6e73e1..4a666cb6 100644 --- a/WEB-INF/lib/ttRoleHelper.class.php +++ b/WEB-INF/lib/ttRoleHelper.class.php @@ -83,33 +83,6 @@ class ttRoleHelper { return false; } - // The getLegacyRole obtains a legacy role value for a role_id. - // This is a temporary function to allow usage of both old and new roles - // while new role code is being written and deployed. - static function getLegacyRole($role_id) { - global $user; - $mdb2 = getConnection(); - - $sql = "select rank from tt_roles where team_id = $user->team_id and id = $role_id"; - $res = $mdb2->query($sql); - - if (!is_a($res, 'PEAR_Error')) { - $val = $res->fetchRow(); - if ($val['rank']) { - $rank = $val['rank']; - if ($rank >= ROLE_MANAGER) - return ROLE_MANAGER; - else if ($rank >= ROLE_COMANAGER) - return ROLE_COMANAGER; - else if ($rank >= ROLE_CLIENT) - return ROLE_CLIENT; - else - return ROLE_USER; - } - } - return false; - } - // isClientRole determines if the role is a "client" role. // This simply means the role has no "track_own_time" right. static function isClientRole($role_id) { @@ -129,13 +102,13 @@ class ttRoleHelper { } // getRoleByRank looks up a role by its rank. - static function getRoleByRank($rank) { + static function getRoleByRank($rank, $team_id) { global $user; $mdb2 = getConnection(); $rank = (int) $rank; // Cast to int just in case for better security. - $sql = "select id from tt_roles where team_id = $user->team_id and rank = $rank and (status = 1 or status = 0)"; + $sql = "select id from tt_roles where team_id = $team_id and rank = $rank and (status = 1 or status = 0)"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { @@ -195,22 +168,6 @@ class ttRoleHelper { return true; } - // rolesExist - checks whether roles for team already exist. - static function rolesExist() - { - $mdb2 = getConnection(); - global $user; - - $sql = "select count(*) as count from tt_roles where team_id = $user->team_id"; - $res = $mdb2->query($sql); - if (!is_a($res, 'PEAR_Error')) { - $val = $res->fetchRow(); - if ($val['count'] > 0) - return true; // Roles for team exist. - } - return false; - } - // createPredefinedRoles - creates a set of predefined roles for the team to use. static function createPredefinedRoles($team_id, $lang) {