示例#1
0
 /// <summary>
 /// LoadModel reloads the model from the model CONF file. Because the policy is
 /// attached to a model, so the policy is invalidated and needs to be reloaded by
 /// calling LoadPolicy().
 /// calling LoadPolicy().
 /// </summary>
 public void LoadModel()
 {
     model = NewModel();
     model.LoadModel(this.modelPath);
     fm = FunctionMap.LoadFunctionMap();
     InitializeInterpreter();
 }
示例#2
0
        public static FunctionMap LoadFunctionMap()
        {
            FunctionMap fm = new FunctionMap();

            fm._fm = new Dictionary <string, AbstractFunction>();
            fm.AddFunction("keyMatch", new KeyMatchFunc());
            fm.AddFunction("keyMatch2", new KeyMatch2Func());
            fm.AddFunction("regexMatch", new RegexMatchFunc());
            fm.AddFunction("ipMatch", new IPMatchFunc());
            return(fm);
        }
示例#3
0
        public Enforcer(Model.Model model, IAdapter adapter)
        {
            this.adapter = adapter;
            watcher      = null;

            this.model  = model;
            functionMap = FunctionMap.LoadFunctionMap();

            Initialize();
            LoadPolicy();
        }
示例#4
0
        public Enforcer(Model.Model m, IAdapter adapter)
        {
            this.adapter = adapter;
            this.watcher = null;

            model = m;
            fm    = FunctionMap.LoadFunctionMap();

            Initialize();

            if (this.adapter != null)
            {
                LoadPolicy();
            }
        }
示例#5
0
 /// <summary>
 /// LoadModel reloads the model from the model CONF file. Because the policy is
 /// attached to a model, so the policy is invalidated and needs to be reloaded by
 /// calling LoadPolicy().
 /// calling LoadPolicy().
 /// </summary>
 public void LoadModel()
 {
     model = NewModel();
     model.LoadModel(this.modelPath);
     fm = FunctionMap.LoadFunctionMap();
 }
示例#6
0
 /// <summary>
 /// sets the current model.
 /// </summary>
 /// <param name="model"> the model.</param>
 public void SetModel(Model model)
 {
     this.model = model;
     fm         = FunctionMap.LoadFunctionMap();
 }
示例#7
0
 /// <summary>
 /// sets the current model.
 /// </summary>
 /// <param name="model"> the model.</param>
 public void SetModel(Model.Model model)
 {
     this.model = model;
     fm         = FunctionMap.LoadFunctionMap();
     InitializeInterpreter();
 }
示例#8
0
 /// <summary>
 /// LoadModel reloads the model from the model CONF file. Because the policy is
 /// Attached to a model, so the policy is invalidated and needs to be reloaded by
 /// calling LoadPolicy().
 /// </summary>
 public void LoadModel()
 {
     model = NewModel();
     model.LoadModel(modelPath);
     functionMap = FunctionMap.LoadFunctionMap();
 }