Add grant to create website/team.

This commit is contained in:
Brian Cao 2023-08-22 15:37:22 -07:00
parent 84236c0cd9
commit 280f6a9113
3 changed files with 31 additions and 5 deletions

View file

@ -51,7 +51,7 @@ export const useAuth = createMiddleware(async (req, res, next) => {
const shareToken = await parseShareToken(req);
let user = null;
const { userId, authKey } = payload || {};
const { userId, authKey, grant } = payload || {};
if (isUuid(userId)) {
user = await getUserById(userId);
@ -72,7 +72,13 @@ export const useAuth = createMiddleware(async (req, res, next) => {
user.isAdmin = user.role === ROLES.admin;
}
(req as any).auth = { user, token, shareToken, authKey };
(req as any).auth = {
user,
grant,
token,
shareToken,
authKey,
};
next();
});