home.js 507 Bytes
'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    this.ctx.body = 'hi, ' + this.app.plugins.ldapjs.name;
    const opts = {
      filter: '(objectclass=organizationalUnit)',
      scope: 'sub',
      attributes: [ 'dn', 'sn', 'cn', 'ou' ],
    };
    const result = await this.app.ldapjs.search('dc=dodokeroro,dc=cn', opts);
    console.log('result::::', JSON.stringify(result.objEntries));
  }
}

module.exports = HomeController;