From: Nik Okuntseff Date: Mon, 12 Mar 2018 13:46:17 +0000 (+0000) Subject: Renamed a User class property as part of roles revamp work. X-Git-Tag: timetracker_1.19-1~1055 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7ea057af633d933eb5b39cceb112c3cc98c55a1d;p=timetracker.git Renamed a User class property as part of roles revamp work. --- diff --git a/WEB-INF/lib/common.lib.php b/WEB-INF/lib/common.lib.php index ac0b6825..ec21d675 100644 --- a/WEB-INF/lib/common.lib.php +++ b/WEB-INF/lib/common.lib.php @@ -339,7 +339,7 @@ function ttAccessCheck($required_rights) } // Check rights. - if (!($required_rights & $user->rights)) + if (!($required_rights & $user->rights_mask)) return false; return true; diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 5ead08bc..0d31cb70 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -60,8 +60,8 @@ class ttUser { var $custom_logo = 0; // Whether to use a custom logo for team. var $lock_spec = null; // Cron specification for record locking. var $workday_minutes = 480; // Number of work minutes in a regular day. - var $rights = 0; // A mask of user rights. - var $rights_array = array(); // An array of user rights, planned replacement of array mask. + var $rights_mask = 0; // A mask of user rights. TODO: remove after roles revamp. + var $rights_array = array(); // An array of user rights, planned replacement of $rights_mask. // Constructor. function __construct($login, $id = null) { @@ -140,18 +140,18 @@ class ttUser { // Set user rights. if ($this->role == ROLE_USER) { - $this->rights = right_data_entry|right_view_charts|right_view_reports; + $this->rights_mask = right_data_entry|right_view_charts|right_view_reports; // TODO: get customized rights from the database instead. // $this->rights_array[] = "data_entry"; // Enter time and expense records into Time Tracker. // $this->rights_array[] = "view_own_data"; // View own reports and charts. // $this->rights_array[] = "manage_own_settings"; // Edit own settings. // $this->rights_array[] = "view_users"; // View user names and roles in a group. } elseif ($this->role == ROLE_CLIENT) { - $this->rights = right_view_reports|right_view_invoices; // TODO: how about right_view_charts, too? + $this->rights_mask = right_view_reports|right_view_invoices; // TODO: how about right_view_charts, too? // $this->rights_array[] = "view_own_data"; // View own reports, charts, and invoices. // $this->rights_array[] = "manage_own_settings"; // Edit own settings. } elseif ($this->role == ROLE_COMANAGER) { - $this->rights = right_data_entry|right_view_charts|right_view_reports|right_view_invoices|right_manage_team; + $this->rights_mask = right_data_entry|right_view_charts|right_view_reports|right_view_invoices|right_manage_team; // $this->rights_array[] = "data_entry"; // Enter time and expense records into Time Tracker. // $this->rights_array[] = "view_own_data"; // View own reports and charts. // $this->rights_array[] = "manage_own_settings"; // Edit own settings. @@ -161,10 +161,10 @@ class ttUser { $this->rights_array[] = "override_punch_mode"; // Can input any start and finish times for self and lower roles. // TODO: get rights from the database instead. } elseif ($this->role == ROLE_MANAGER) { - $this->rights = right_data_entry|right_view_charts|right_view_reports|right_view_invoices|right_manage_team|right_assign_roles|right_export_team; + $this->rights_mask = right_data_entry|right_view_charts|right_view_reports|right_view_invoices|right_manage_team|right_assign_roles|right_export_team; $this->rights_array[] = "override_punch_mode"; // Can input any start and finish times for self and lower roles. } elseif ($this->role == ROLE_SITE_ADMIN) { - $this->rights = right_administer_site; + $this->rights_mask = right_administer_site; } /* diff --git a/WEB-INF/lib/ttUserHelper.class.php b/WEB-INF/lib/ttUserHelper.class.php index 53fd6295..be46da3a 100644 --- a/WEB-INF/lib/ttUserHelper.class.php +++ b/WEB-INF/lib/ttUserHelper.class.php @@ -167,7 +167,7 @@ class ttUserHelper { // Prepare query parts. if (isset($fields['password'])) $pass_part = ', password = md5('.$mdb2->quote($fields['password']).')'; - if (right_assign_roles & $user->rights) { + if (right_assign_roles & $user->rights_mask) { if (isset($fields['role'])) { $role = (int) $fields['role']; $role_part = ", role = $role"; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 56dcb6b0..d14cee72 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.38.4056 | Copyright © Anuko | +  Anuko Time Tracker 1.17.38.4057 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/mobile/user_edit.php b/mobile/user_edit.php index e8a116ff..328b8fab 100644 --- a/mobile/user_edit.php +++ b/mobile/user_edit.php @@ -188,7 +188,7 @@ if ($request->isPost()) { 'status' => $cl_status, 'rate' => $cl_rate, 'projects' => $assigned_projects); - if (right_assign_roles & $user->rights) { + if (right_assign_roles & $user->rights_mask) { $fields['role'] = $cl_role; $fields['client_id'] = $cl_client_id; } diff --git a/user_edit.php b/user_edit.php index d8f49a78..f890282d 100644 --- a/user_edit.php +++ b/user_edit.php @@ -192,7 +192,7 @@ if ($request->isPost()) { 'status' => $cl_status, 'rate' => $cl_rate, 'projects' => $assigned_projects); - if (right_assign_roles & $user->rights && $cl_role) { + if (right_assign_roles & $user->rights_mask && $cl_role) { // Get legacy role value. $legacy_role = ttRoleHelper::getLegacyRole($cl_role); // TODO: remove after roles revamp. $fields['role'] = $legacy_role;