mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Updates 5 of many
This commit is contained in:
@@ -20,10 +20,14 @@ export const handler = async (req: Request, res: Response, next: NextFunction) =
|
||||
admin: false,
|
||||
app: false,
|
||||
ip: getIPFromReq(req),
|
||||
userAgent: req.get('user-agent'),
|
||||
origin: req.get('origin'),
|
||||
};
|
||||
|
||||
const userAgent = req.get('user-agent');
|
||||
if (userAgent) defaultAccountability.userAgent = userAgent;
|
||||
|
||||
const origin = req.get('origin');
|
||||
if (origin) defaultAccountability.origin = origin;
|
||||
|
||||
const database = getDatabase();
|
||||
|
||||
const customAccountability = await emitter.emitFilter(
|
||||
@@ -50,12 +54,13 @@ export const handler = async (req: Request, res: Response, next: NextFunction) =
|
||||
if (isDirectusJWT(req.token)) {
|
||||
const payload = verifyAccessJWT(req.token, env.SECRET);
|
||||
|
||||
req.accountability.share = payload.share;
|
||||
req.accountability.share_scope = payload.share_scope;
|
||||
req.accountability.user = payload.id;
|
||||
req.accountability.role = payload.role;
|
||||
req.accountability.admin = payload.admin_access === true || payload.admin_access == 1;
|
||||
req.accountability.app = payload.app_access === true || payload.app_access == 1;
|
||||
|
||||
if (payload.share) req.accountability.share = payload.share;
|
||||
if (payload.share_scope) req.accountability.share_scope = payload.share_scope;
|
||||
if (payload.id) req.accountability.user = payload.id;
|
||||
} else {
|
||||
// Try finding the user with the provided token
|
||||
const user = await database
|
||||
|
||||
@@ -48,7 +48,7 @@ export const respond: RequestHandler = asyncHandler(async (req, res) => {
|
||||
}
|
||||
|
||||
if (req.sanitizedQuery.export) {
|
||||
const exportService = new ExportService({ accountability: req.accountability, schema: req.schema });
|
||||
const exportService = new ExportService({ accountability: req.accountability ?? null, schema: req.schema });
|
||||
|
||||
let filename = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user