X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/993450e17195b87dc406c3135ee22dafe9b825fb..05e0f5266a2959a452adfcae9d53c9729d3a3668:/WEB-INF/lib/ttUser.class.php diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index ad179eaa..84b229fc 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -31,8 +31,8 @@ class ttUser { var $name = null; // User name. var $id = null; // User id. var $team_id = null; // Team id. - var $role = null; // User role (user, client, comanager, manager, admin). - var $client_id = null; // Client id for client user role. + var $role = null; // User role (user, client, comanager, manager, admin). + var $client_id = null; // Client id for client user role. var $behalf_id = null; // User id, on behalf of whom we are working. var $behalf_name = null; // User name, on behalf of whom we are working. var $email = null; // User email. @@ -45,10 +45,10 @@ class ttUser { var $record_type = 0; // Record type (duration vs start and finish, or both). var $currency = null; // Currency. var $plugins = null; // Comma-separated list of enabled plugins. - var $team = null; // Team name. + var $team = null; // Team name. var $custom_logo = 0; // Whether to use a custom logo for team. - var $address = null; // Address for invoices. - var $lock_interval = 0; // Lock interval in days for time records. + var $address = null; // Address for invoices. + var $lock_interval = 0; // Lock interval in days for time records. var $rights = 0; // A mask of user rights. // Constructor. @@ -107,13 +107,13 @@ class ttUser { // Set user rights. if ($this->role == ROLE_USER) { $this->rights = right_data_entry|right_view_charts|right_view_reports; - } else if ($this->role == ROLE_CLIENT) { + } elseif ($this->role == ROLE_CLIENT) { $this->rights = right_view_reports|right_view_invoices; // TODO: how about right_view_charts, too? - } else if ($this->role == ROLE_COMANAGER) { + } elseif ($this->role == ROLE_COMANAGER) { $this->rights = right_data_entry|right_view_charts|right_view_reports|right_view_invoices|right_manage_team; - } else if ($this->role == ROLE_MANAGER) { + } 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; - } else if ($this->role == ROLE_SITE_ADMIN) { + } elseif ($this->role == ROLE_SITE_ADMIN) { $this->rights = right_administer_site; } } @@ -149,6 +149,12 @@ class ttUser { return (right_manage_team & $this->role); } + // isPluginEnabled checks whether a plugin is enabled for user. + function isPluginEnabled($plugin) + { + return in_array($plugin, explode(',', $this->plugins)); + } + // getAssignedProjects - returns an array of assigned projects. function getAssignedProjects() {