mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-28 17:44:24 +01:00
Remove 'user' from AppContext
This commit is contained in:
@@ -34,9 +34,8 @@ type UserRole = 'user' | 'admin';
|
||||
|
||||
/** Require the user to prove their role before invoking the controller. */
|
||||
function requireRole(role: UserRole, opts?: ParseAuthRequestOpts): AppMiddleware {
|
||||
return withProof(async (c, proof, next) => {
|
||||
return withProof(async (_c, proof, next) => {
|
||||
const user = await findUser({ pubkey: proof.pubkey });
|
||||
c.set('user', user);
|
||||
|
||||
if (user && matchesRole(user, role)) {
|
||||
await next();
|
||||
|
||||
Reference in New Issue
Block a user