@@ -143,15 +143,15 @@ export class CoreEnforcer {
143
143
this . model . clearPolicy ( ) ;
144
144
}
145
145
146
- // public initRmMap(): void {
147
- // this.rmMap = new Map<string, RoleManager>();
148
- // const rm = this.model.model.get('g');
149
- // if (rm) {
150
- // for (const ptype of rm.keys()) {
151
- // this.rmMap.set(ptype, new DefaultRoleManager(10));
152
- // }
153
- // }
154
- // }
146
+ public initRmMap ( ) : void {
147
+ this . rmMap = new Map < string , RoleManager > ( ) ;
148
+ const rm = this . model . model . get ( 'g' ) ;
149
+ if ( rm ) {
150
+ for ( const ptype of rm . keys ( ) ) {
151
+ this . rmMap . set ( ptype , new DefaultRoleManager ( 10 ) ) ;
152
+ }
153
+ }
154
+ }
155
155
156
156
/**
157
157
* loadPolicy reloads the policy from file/database.
@@ -160,6 +160,8 @@ export class CoreEnforcer {
160
160
this . model . clearPolicy ( ) ;
161
161
await this . adapter . loadPolicy ( this . model ) ;
162
162
163
+ this . initRmMap ( ) ;
164
+
163
165
if ( this . autoBuildRoleLinks ) {
164
166
await this . buildRoleLinksInternal ( ) ;
165
167
}
@@ -180,6 +182,8 @@ export class CoreEnforcer {
180
182
throw new Error ( 'filtered policies are not supported by this adapter' ) ;
181
183
}
182
184
185
+ this . initRmMap ( ) ;
186
+
183
187
if ( this . autoBuildRoleLinks ) {
184
188
await this . buildRoleLinksInternal ( ) ;
185
189
}
0 commit comments