|
3 | 3 | DiscoveryService,
|
4 | 4 | } from '@golevelup/nestjs-discovery';
|
5 | 5 | import { Injectable, type OnModuleInit } from '@nestjs/common';
|
6 |
| -import { entries, mapEntries, mapValues } from '@seedcompany/common'; |
| 6 | +import { entries, mapEntries, mapValues, setOf } from '@seedcompany/common'; |
7 | 7 | import { pick, startCase } from 'lodash';
|
8 | 8 | import { type DeepWritable, type Writable } from 'ts-essentials';
|
9 | 9 | import { type EnhancedResource, many, type Role } from '~/common';
|
@@ -35,7 +35,7 @@ export interface Policy {
|
35 | 35 | /* Policy Name */
|
36 | 36 | name: string;
|
37 | 37 | /* Only applies to these roles */
|
38 |
| - roles?: readonly Role[]; |
| 38 | + roles?: ReadonlySet<Role>; |
39 | 39 | /* What the policy grants */
|
40 | 40 | grants: Grants;
|
41 | 41 | /* An optimization to determine Powers this policy contains */
|
@@ -103,7 +103,7 @@ export class PolicyFactory implements OnModuleInit {
|
103 | 103 | ): PlainPolicy {
|
104 | 104 | const name = startCase(discoveredClass.name.replace(/Policy$/, ''));
|
105 | 105 |
|
106 |
| - const roles = meta.role === 'all' ? undefined : many(meta.role); |
| 106 | + const roles = meta.role === 'all' ? undefined : setOf(many(meta.role)); |
107 | 107 |
|
108 | 108 | const grants: WritableGrants = new Map();
|
109 | 109 | const resultList = many(meta.def(resGranter)).flat();
|
|
0 commit comments