Renamed a User class property as part of roles revamp work.
authorNik Okuntseff <support@anuko.com>
Mon, 12 Mar 2018 13:46:17 +0000 (13:46 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 12 Mar 2018 13:46:17 +0000 (13:46 +0000)
WEB-INF/lib/common.lib.php
WEB-INF/lib/ttUser.class.php
WEB-INF/lib/ttUserHelper.class.php
WEB-INF/templates/footer.tpl
mobile/user_edit.php
user_edit.php

index ac0b682..ec21d67 100644 (file)
@@ -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;
index 5ead08b..0d31cb7 100644 (file)
@@ -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;
       }
 
 /*
index 53fd629..be46da3 100644 (file)
@@ -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";
index 56dcb6b..d14cee7 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.17.38.4056 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.38.4057 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index e8a116f..328b8fa 100644 (file)
@@ -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;
         }
index d8f49a7..f890282 100644 (file)
@@ -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;