Browse Source

new ad ldap datasource with ldapts

pull/7620/head
Hervé de CHAVIGNY 4 years ago
parent
commit
33f78793cf
  1. 90
      packages/server/src/integrations/adldap.ts

90
packages/server/src/integrations/adldap.ts

@ -39,57 +39,19 @@ module AdLdapModule {
}, },
query: { query: {
command: {
readable: true,
displayName: "Get Ldap users",
type: QueryType.JSON,
},
create: {
type: QueryType.FIELDS,
fields: {
key: {
type: DatasourceFieldType.STRING,
required: true,
},
value: {
type: DatasourceFieldType.STRING,
required: true,
}
},
},
read: { read: {
readable: true,
type: QueryType.FIELDS, type: QueryType.FIELDS,
fields: { fields: {
key: { bucket: {
type: DatasourceFieldType.STRING, type: "string",
required: true, required: true,
}, },
}, },
}, },
update: {
readable: true,
type: QueryType.FIELDS,
fields: {
key: {
type: DatasourceFieldType.STRING,
required: true,
},
},
},
delete: {
type: QueryType.FIELDS,
fields: {
key: {
type: DatasourceFieldType.STRING,
required: true,
},
},
}
}, },
} }
class AdLdapIntegration { class AdLdapIntegration implements IntegrationBase {
private readonly config: AdLdapConfig private readonly config: AdLdapConfig
private client:Client; private client:Client;
@ -108,46 +70,12 @@ module AdLdapModule {
} }
async ldapContext(query: Function) {
try {
return await query()
} catch (err) {
throw new Error(`AD Ldap error: ${err}`)
} finally {
console.log("end")
}
}
async create(query: { key: string; value: string; ttl: number }) {
return this.ldapContext(async () => {
const response = null
return response
})
}
async read(query: { key: string }) {
return this.ldapContext(async () => {
const response = null
return response
})
}
async update(query: { key: string }) {
return this.ldapContext(async () => {
const response = null
return response
})
}
async delete(query: { key: string }) {
return this.ldapContext(async () => { async read(query: { bucket: string }) {
const response = null
return response
})
}
async command(query: { bucket: string }) {
return this.ldapContext(async () => {
console.log("Client crée :",this.client) console.log("Client crée :",this.client)
@ -167,7 +95,7 @@ module AdLdapModule {
response = JSON.stringify(searchEntries) response = JSON.stringify(searchEntries)
console.log("Ldap users :",response) console.log("Ldap users :",response)
} catch (ex) { } catch (ex) {
throw ex; throw new Error(`AD Ldap error: ${ex}`)
} finally { } finally {
await this.client.unbind() await this.client.unbind()
} }
@ -175,7 +103,7 @@ module AdLdapModule {
return response return response
})
} }
} }

Loading…
Cancel
Save