Allow manager orders access without team claim
Build and deploy Docker image / build (push) Successful in 2m4s
Build and deploy Docker image / build (push) Successful in 2m4s
This commit is contained in:
+6
-2
@@ -116,12 +116,16 @@ export async function managerContext(
|
||||
const teamUuid = (payload as Record<string, unknown>).team_uuid as
|
||||
| string
|
||||
| undefined;
|
||||
if (!payload.sub || !hasManagerClaim(payload) || !teamUuid) {
|
||||
if (!payload.sub || !hasManagerClaim(payload)) {
|
||||
throw new GraphQLError("Unauthorized", {
|
||||
extensions: { code: "UNAUTHENTICATED" },
|
||||
});
|
||||
}
|
||||
return { userId: payload.sub, teamUuid, scopes: ["teams:member", "manager"] };
|
||||
return {
|
||||
userId: payload.sub,
|
||||
teamUuid,
|
||||
scopes: [...new Set([...scopes, "manager"])],
|
||||
};
|
||||
}
|
||||
|
||||
export function requireScopes(ctx: AuthContext, ...required: string[]): void {
|
||||
|
||||
Reference in New Issue
Block a user