register(name, defaultRoles=null, objectModel=null) {
    this.log.info("Registering permission", name, "for", defaultRoles, objectModel)
    this._permissions[name] = {
      name,
      objectModel,
    }
    if(defaultRoles) {
      if (!_.isArray(defaultRoles)) {
        defaultRoles = [defaultRoles]
      }
      for (let role of defaultRoles) {
        if (!this._defaultRoles[role]) {
          this._defaultRoles[role] = []
        }
        this._defaultRoles[role].push(name)
      }
    }
  }
/*
   * Register a permission
   * @param {string} name Permission name
   * @param {string|array} [defaultRoles] Default role name(s) to contain this permission
   * @param {object} [objectModel] Collection of ObjectRoleModel for object permissions, or function (objectId, user) to return the roles a user has for a given object
   */
Register a permission
@param {string} name Permission name
@param {string|array} [defaultRoles] Default role name(s) to contain this permission
@param {object} [objectModel] Collection of ObjectRoleModel for object permissions, or function (objectId, user) to return the roles a user has for a given object
Register a permission @param { string } name Permission name @param { string|array } [ defaultRoles ] Default role name ( s ) to contain this permission @param { object } [ objectModel ] Collection of ObjectRoleModel for object permissions or function ( objectId user ) to return the roles a user has for a given object
register(name, defaultRoles=null, objectModel=null) {
    this.log.info("Registering permission", name, "for", defaultRoles, objectModel)
    this._permissions[name] = {
      name,
      objectModel,
    }
    if(defaultRoles) {
      if (!_.isArray(defaultRoles)) {
        defaultRoles = [defaultRoles]
      }
      for (let role of defaultRoles) {
        if (!this._defaultRoles[role]) {
          this._defaultRoles[role] = []
        }
        this._defaultRoles[role].push(name)
      }
    }
  }
register ( name , defaultRoles = null , objectModel = null ) { this . log . info ( "Registering permission" , name , "for" , defaultRoles , objectModel ) this . _permissions [ name ] = { name , objectModel , } if ( defaultRoles ) { if ( ! _ . isArray ( defaultRoles ) ) { defaultRoles = [ defaultRoles ] } for ( let role of defaultRoles ) { if ( ! this . _defaultRoles [ role ] ) { this . _defaultRoles [ role ] = [ ] } this . _defaultRoles [ role ] . push ( name ) } } }
Register a permission
 @param {string} name Permission name
 @param {string|array} [defaultRoles] Default role name(s) to contain this permission
 @param {object} [objectModel] Collection of ObjectRoleModel for object permissions, or function (objectId, user) to return the roles a user has for a given object
Register a permission @param { string } name Permission name @param { string|array } [ defaultRoles ] Default role name ( s ) to contain this permission @param { object } [ objectModel ] Collection of ObjectRoleModel for object permissions or function ( objectId user ) to return the roles a user has for a given object