Move static methods for user ID lookup, loading, and resolution
into UserRepository class.
Add an instance of the UserRepository class to the context.
Authentication methods and workspace-related code are updated to call
these methods via the context or pass the database directly.
[ Next steps ]
From dependency injection point of view, this change is "part 1":
it replaces global variables with context-based usage,
but $context still acts a service locator.
From separation of concern standpoint, the plan is to move
all database-related methods into the UserRepository class.