lib/index.js
function addAcls(app, config) {
  config.acls = config.acls || []

  return Promise.resolve(Object.keys(app.models)).mapSeries(modelName => {
    const Model = app.models[modelName]

    if (typeof Model._templates !== 'function') {
      return null
    }

    return Promise.resolve(Object.keys(Model._templates()))
      .mapSeries(templateName => {
        const fnNameRemote = `_template_${templateName}_remote`

        return Promise.resolve(config.acls).mapSeries(acl => {
          const templateAcl = Object.assign({}, acl)

          templateAcl.model = modelName
          templateAcl.property = fnNameRemote
          debug('Create ACL entry for %s.%s ', modelName, fnNameRemote)
          return app.models.ACL.create(templateAcl)
        })
      })
  })
}
function addAcls(app, config) {
  config.acls = config.acls || []

  return Promise.resolve(Object.keys(app.models)).mapSeries(modelName => {
    const Model = app.models[modelName]

    if (typeof Model._templates !== 'function') {
      return null
    }

    return Promise.resolve(Object.keys(Model._templates()))
      .mapSeries(templateName => {
        const fnNameRemote = `_template_${templateName}_remote`

        return Promise.resolve(config.acls).mapSeries(acl => {
          const templateAcl = Object.assign({}, acl)

          templateAcl.model = modelName
          templateAcl.property = fnNameRemote
          debug('Create ACL entry for %s.%s ', modelName, fnNameRemote)
          return app.models.ACL.create(templateAcl)
        })
      })
  })
}
function addAcls ( app , config ) { config . acls = config . acls || [ ] return Promise . resolve ( Object . keys ( app . models ) ) . mapSeries ( modelName => { const Model = app . models [ modelName ] if ( typeof Model . _templates !== 'function' ) { return null } return Promise . resolve ( Object . keys ( Model . _templates ( ) ) ) . mapSeries ( templateName => { const fnNameRemote = ` ${ templateName } ` return Promise . resolve ( config . acls ) . mapSeries ( acl => { const templateAcl = Object . assign ( { } , acl ) templateAcl . model = modelName templateAcl . property = fnNameRemote debug ( 'Create ACL entry for %s.%s ' , modelName , fnNameRemote ) return app . models . ACL . create ( templateAcl ) } ) } ) } ) }
Add ACLs for each template.

@param {Object} app loopback application
@param {Object} config component configuration
Add ACLs for each template .