feature: rooms and events implemented on the backend
This commit is contained in:
parent
df00324e24
commit
85024c6e62
29 changed files with 1659 additions and 115 deletions
|
@ -1,4 +1,4 @@
|
|||
import { CANNED_RESPONSES } from '../../../../utils/canned_responses.ts';
|
||||
import * as CANNED_RESPONSES from '../../../../utils/canned_responses.ts';
|
||||
import { get_session, get_user, PRECHECK_TABLE, require_user } from '../../../../utils/prechecks.ts';
|
||||
|
||||
export const PERMISSIONS: Record<string, (req: Request, meta: Record<string, any>) => Promise<boolean>> = {};
|
||||
|
@ -6,15 +6,9 @@ export const PRECHECKS: PRECHECK_TABLE = {};
|
|||
|
||||
// GET /api/users/me - Get the current user
|
||||
PRECHECKS.GET = [get_session, get_user, require_user, (_req: Request, meta: Record<string, any>): Response | undefined => {
|
||||
const can_read_self = meta.user_permissions?.permissions.includes('self.read');
|
||||
const can_read_self = meta.user?.permissions.includes('self.read');
|
||||
|
||||
const has_permission = can_read_self;
|
||||
console.dir({
|
||||
meta,
|
||||
can_read_self,
|
||||
has_permission
|
||||
});
|
||||
if (!has_permission) {
|
||||
if (!can_read_self) {
|
||||
return CANNED_RESPONSES.permission_denied();
|
||||
}
|
||||
}];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue