_compileRules() {
    // for each type in global rules...
    Object.keys(this._globalRules.types).forEach(type => {
      // for each policy in type
      Object.keys(this._globalRules.types[type], policy => {
        // if the policy described is * or is exactly for this policy, or applies for one of its parents
        if (policy === '*' || policy === this.name || this.parents.includes(policy)) {
          // then add this rule to this policy's rules
          this._rawRules[type] = this._rawRules[type] || {};
          this._rawRules[type] = merge(this._rawRules[type], this._globalRules.types[type][policy]);
        }
      });
    });

    // for each type in this policy's rules
    Object.keys(this._rawRules).forEach(type => {
      let rules = {};

      // for each verb for this type
      Object.keys(this._rawRules[type]).forEach(verb => {
        // extract the rules
        const _rules = this._rawRules[type][verb];
        let verbRules = [];
        // for each rule
        _rules.forEach(_rule => {
          if (this._is[_rule]) {
            // if the rule exists, add it to the rules list of this verb
            verbRules.push(this._is[_rule]);
          } else {
            this.yggdrasil.fire('log', 'warn', `The rule ${_rule} do not exists (for type ${type} and verb ${verb})`);
          }
        });
        // create a ruleset for this verb
        rules[verb] = params => { return verbRules.some(r => r(params));};
      });
      // add the rules for this type to this policy's rules
      this.rules[type] = {...baseCapabilities, ...rules};
    });
  }
/**
   * Compile the rules for this policy
   * @private
   */
Compile the rules for this policy
@private
Compile the rules for this policy @private
_compileRules() {
    Object.keys(this._globalRules.types).forEach(type => {
      Object.keys(this._globalRules.types[type], policy => {
        if (policy === '*' || policy === this.name || this.parents.includes(policy)) {
          this._rawRules[type] = this._rawRules[type] || {};
          this._rawRules[type] = merge(this._rawRules[type], this._globalRules.types[type][policy]);
        }
      });
    });
    Object.keys(this._rawRules).forEach(type => {
      let rules = {};
      Object.keys(this._rawRules[type]).forEach(verb => {
        const _rules = this._rawRules[type][verb];
        let verbRules = [];
        _rules.forEach(_rule => {
          if (this._is[_rule]) {
            verbRules.push(this._is[_rule]);
          } else {
            this.yggdrasil.fire('log', 'warn', `The rule ${_rule} do not exists (for type ${type} and verb ${verb})`);
          }
        });
        rules[verb] = params => { return verbRules.some(r => r(params));};
      });
      this.rules[type] = {...baseCapabilities, ...rules};
    });
  }
_compileRules ( ) { Object . keys ( this . _globalRules . types ) . forEach ( type => { Object . keys ( this . _globalRules . types [ type ] , policy => { if ( policy === '*' || policy === this . name || this . parents . includes ( policy ) ) { this . _rawRules [ type ] = this . _rawRules [ type ] || { } ; this . _rawRules [ type ] = merge ( this . _rawRules [ type ] , this . _globalRules . types [ type ] [ policy ] ) ; } } ) ; } ) ; Object . keys ( this . _rawRules ) . forEach ( type => { let rules = { } ; Object . keys ( this . _rawRules [ type ] ) . forEach ( verb => { const _rules = this . _rawRules [ type ] [ verb ] ; let verbRules = [ ] ; _rules . forEach ( _rule => { if ( this . _is [ _rule ] ) { verbRules . push ( this . _is [ _rule ] ) ; } else { this . yggdrasil . fire ( 'log' , 'warn' , ` ${ _rule } ${ type } ${ verb } ` ) ; } } ) ; rules [ verb ] = params => { return verbRules . some ( r => r ( params ) ) ; } ; } ) ; this . rules [ type ] = { ... baseCapabilities , ... rules } ; } ) ; }
Compile the rules for this policy
 @private
Compile the rules for this policy @private
// for each type in global rules... // for each policy in type // if the policy described is * or is exactly for this policy, or applies for one of its parents // then add this rule to this policy's rules // for each type in this policy's rules // for each verb for this type // extract the rules // for each rule // if the rule exists, add it to the rules list of this verb // create a ruleset for this verb // add the rules for this type to this policy's rules