mirror of
https://github.com/wekan/wekan.git
synced 2026-02-26 09:54:08 +01:00
Migrate wekan-ldap to async API for Meteor 3.0
- Replace Meteor.wrapAsync with native Promises - Convert all sync methods to async - Use async DB operations (findOneAsync, updateAsync) - Bump version 0.0.2 → 0.1.0
This commit is contained in:
parent
eb0c9ac1e6
commit
7d56dca80b
6 changed files with 102 additions and 83 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import LDAP from './ldap';
|
||||
|
||||
Meteor.methods({
|
||||
ldap_test_connection() {
|
||||
async ldap_test_connection() {
|
||||
const user = Meteor.user();
|
||||
if (!user) {
|
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'ldap_test_connection' });
|
||||
|
|
@ -19,14 +19,14 @@ Meteor.methods({
|
|||
let ldap;
|
||||
try {
|
||||
ldap = new LDAP();
|
||||
ldap.connectSync();
|
||||
await ldap.connect();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new Meteor.Error(error.message);
|
||||
}
|
||||
|
||||
try {
|
||||
ldap.bindIfNecessary();
|
||||
await ldap.bindIfNecessary();
|
||||
} catch (error) {
|
||||
throw new Meteor.Error(error.name || error.message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue