We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50205ef commit 723aaf1Copy full SHA for 723aaf1
1 file changed
test/hasRole.test.ts
@@ -26,6 +26,19 @@ describe('hasRole', () => {
26
expect(hasRole(user, 'admin')).toBe(false);
27
});
28
29
+ it('should return true for project-scoped role claims', () => {
30
+ const user = {
31
+ profile: {
32
+ sub: 'user-1',
33
+ 'urn:zitadel:iam:org:project:306217913633734659:roles': {
34
+ admin: { '306130699507728387': 'my-org.localhost' },
35
+ },
36
37
+ } as unknown as User;
38
+
39
+ expect(hasRole(user, 'admin')).toBe(true);
40
+ });
41
42
it('should return false when there is no user', () => {
43
expect(hasRole(null, 'admin')).toBe(false);
44
0 commit comments