X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/6c7a98f61e74aeae700b523729abb49ff19d3704..f16c4f8b2a5b9b196fdfe46f329e54c89a861f7b:/WEB-INF/lib/ttUser.class.php diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index f7b62344..0d62749b 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -223,4 +223,16 @@ class ttUser { } return false; } + + // canOverridePunchMode checks whether a user can override punch mode in a situation. + function canOverridePunchMode() + { + if (!$this->behalf_id && !$this->can('override_own_punch_mode')) + return false; // User is working as self and cannot override for self. + + if ($this->behalf_id && !$this->can('override_punch_mode')) + return false; // User is working on behalf of someone else and cannot override. + + return true; + } }