Skip to content

Commit b513f49

Browse files
committed
Update impersonator permission check to use Session ALS
1 parent 53d81a3 commit b513f49

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/components/authentication/authentication.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,12 @@ export class AuthenticationService {
169169
: requesterSession;
170170

171171
if (impersonatee) {
172-
const p = this.privileges.for(requesterSession, AssignableRoles);
173-
const valid = impersonatee.roles.every((role) =>
174-
p.can('edit', withoutScope(role)),
175-
);
172+
const valid = this.sessionHost.withSession(requesterSession, () => {
173+
const p = this.privileges.for(AssignableRoles);
174+
return impersonatee.roles.every((role) =>
175+
p.can('edit', withoutScope(role)),
176+
);
177+
});
176178
if (!valid) {
177179
// Don't expose what the requester is unable to do as this could leak
178180
// private information.

0 commit comments

Comments
 (0)