X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fcommon.lib.php;h=7086fe298243667a99991461e8236739ae136ddb;hb=e59d57b1fcf105382028dcfc0157a6ca84b0dc46;hp=ac0b6825f77c7b69c3be8f7c793b59da03d35dd6;hpb=4af7dd7e10968588fe4c2828be5402f41d53ebc5;p=timetracker.git diff --git a/WEB-INF/lib/common.lib.php b/WEB-INF/lib/common.lib.php index ac0b6825..7086fe29 100644 --- a/WEB-INF/lib/common.lib.php +++ b/WEB-INF/lib/common.lib.php @@ -325,22 +325,26 @@ function ttValidCondition($val, $emptyValid = true) return true; } -// ttAccessCheck is used to check whether user is allowed to proceed. This function is used -// as an initial check on all publicly available pages. -function ttAccessCheck($required_rights) +// ttAccessAllowed checks whether user is allowed access to a particular page. +// It is used as an initial check on all publicly available pages +// (except login.php, register.php, and others where we don't have to check). +function ttAccessAllowed($required_right) { global $auth; global $user; - + // Redirect to login page if user is not authenticated. if (!$auth->isAuthenticated()) { header('Location: login.php'); exit(); } - - // Check rights. - if (!($required_rights & $user->rights)) - return false; - - return true; + + // Check if user has the right. + if (in_array($required_right, $user->rights)) { + import('ttUserHelper'); + ttUserHelper::updateLastAccess(); + return true; + } + + return false; }