@@ -27,30 +27,18 @@ import { getLogger, logPrint } from './log';
27
27
export class CoreEnforcer {
28
28
protected modelPath : string ;
29
29
protected model : Model ;
30
- protected fm : FunctionMap ;
31
- private eft : Effector ;
32
- private matcherMap : Map < string , ( ( context : object ) => Promise < any > ) | ( ( context : object ) => any ) > ;
30
+ protected fm : FunctionMap = FunctionMap . loadFunctionMap ( ) ;
31
+ protected eft : Effector = new DefaultEffector ( ) ;
32
+ private matcherMap : Map < string , ( ( context : object ) => Promise < any > ) | ( ( context : object ) => any ) > = new Map ( ) ;
33
33
34
34
protected adapter : FilteredAdapter | Adapter ;
35
35
protected watcher : Watcher | null = null ;
36
- protected rm : RoleManager ;
37
-
38
- private enabled : boolean ;
39
- protected autoSave : boolean ;
40
- protected autoBuildRoleLinks : boolean ;
41
- protected autoNotifyWatcher : boolean ;
42
-
43
- public initialize ( ) : void {
44
- this . rm = new DefaultRoleManager ( 10 ) ;
45
- this . eft = new DefaultEffector ( ) ;
46
- this . matcherMap = new Map ( ) ;
47
- this . watcher = null ;
48
-
49
- this . enabled = true ;
50
- this . autoSave = true ;
51
- this . autoBuildRoleLinks = true ;
52
- this . autoNotifyWatcher = true ;
53
- }
36
+ protected rm : RoleManager = new DefaultRoleManager ( 10 ) ;
37
+
38
+ protected enabled = true ;
39
+ protected autoSave = true ;
40
+ protected autoBuildRoleLinks = true ;
41
+ protected autoNotifyWatcher = true ;
54
42
55
43
/**
56
44
* loadModel reloads the model from the model CONF file.
@@ -61,7 +49,6 @@ export class CoreEnforcer {
61
49
this . model = newModel ( ) ;
62
50
this . model . loadModel ( this . modelPath ) ;
63
51
this . model . printModel ( ) ;
64
- this . fm = FunctionMap . loadFunctionMap ( ) ;
65
52
}
66
53
67
54
/**
@@ -80,7 +67,6 @@ export class CoreEnforcer {
80
67
*/
81
68
public setModel ( m : Model ) : void {
82
69
this . model = m ;
83
- this . fm = FunctionMap . loadFunctionMap ( ) ;
84
70
}
85
71
86
72
/**
0 commit comments