Started to replace canManageTeam calls with right checks.
[timetracker.git] / initialize.php
index 5d721b8..5dcd6ff 100644 (file)
@@ -199,6 +199,13 @@ if (!$lang) {
 // Load i18n file.
 $i18n->load($lang);
 
+// Temporary code to assign role_id to users who don't yet have it.
+if ($user->login && !$user->role_id) {
+  $user->migrateLegacyRole(); // Note: this requires initialized $i18n.
+  // Recycle User object, now with proper role_id.
+  $user = new ttUser(null, $auth->getUserId());
+}
+
 // Assign things for smarty to use in template files.
 $smarty->assign('i18n', $i18n->keys);
 $smarty->assign('err', $err);