TruPath Admin Dashboard Guide

The admin dashboard (dashboard/) is a separate, session-authenticated area used to manage reference data, review generated reports, and manage dashboard accounts. It is unrelated to the report-generation API's shared-secret key (see API docs) - dashboard pages are gated by a logged-in session, not by X-API-Key/Basic Auth.

Logging in

dashboard/login.php checks the submitted username/password against the users table with PHP's password_verify() against a bcrypt hash stored in password_hash. There is no password-reset-by-email flow - resetting a password means editing the row directly, via the Users page below or SQL.

A default account is seeded by database/schema.sql:

username: admin
password: TruPath@2026
Change this before any production deployment. The seeded password is documented in plaintext in dashboard/login.php and this guide - treat it as a known value, not a secret, until it's rotated.

Session mechanics

All session handling lives in includes/dashboard_session.php:

FunctionPurpose
dashboard_start_session()Starts the PHP session if one isn't active yet. Called internally by the functions below.
dashboard_current_user(): ?arrayReturns the logged-in user's session data (id, username, full_name, role), or null if nobody is logged in.
dashboard_require_login(): arrayRedirects to login and exits if nobody is logged in; otherwise returns the current user. Every dashboard page calls this first.
dashboard_require_role(string $role): arrayCalls dashboard_require_login(), then responds 403 and exits if the user's role doesn't match. Only dashboard/users.php uses this today (gated to 'admin') - the only page with role-based access control.
dashboard_login(array $user): voidCalled by login.php after a successful password_verify(). Regenerates the session id first, to prevent session fixation.
dashboard_logout(): voidClears and destroys the session. dashboard/logout.php calls this then redirects to login.

Dashboard pages

All pages share a common header/nav/footer via dashboard/_layout.php, and a common list+modal CRUD pattern (POST action=create|update|delete handled at the top of the same file, ?edit=<id>/?new=1 opening an add/edit dialog, a DataTables-enhanced list). dashboard/pathogens.php is the clearest example of this pattern.

PagePurpose
dashboard/index.phpOverview - record counts and data-library metadata.
dashboard/reports.phpBrowse/filter previously generated reports (status, type, source, date range, and on this instance a Sample filter - see below), download their PDFs.
dashboard/pathogens.phpManage the pathogens table.
dashboard/resistance_genes.phpManage the resistance_genes table.
dashboard/antimicrobials.phpManage the antimicrobials table.
dashboard/recommendations.phpManage per-organism antimicrobial recommendation rankings.
dashboard/users.php admin onlyManage dashboard accounts - see below.

How this instance (tp7) differs from tpl6

This is the tpl7.robbiekohli.com instance, cloned from tpl6 with client-requested report-content changes per Dr. Sweazy's feedback. Two differences are relevant to dashboard admins:

Users (add/remove dashboard accounts)

dashboard/users.php is an admin-role-only page for managing who can log into the dashboard:

There is currently only one permission distinction: admin (can access the Users page) vs. everything else (cannot). No per-page/per-action granularity beyond that single check.

What the Admin Dashboard does NOT do

← Back to dashboard