mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 00:10:13 +01:00
Include to Wekan packages directory contents, so that meteor command would build all directly.
This also simplifies build scripts. Thanks to xet7 !
This commit is contained in:
parent
6117097a93
commit
73e265d8fd
354 changed files with 36977 additions and 106 deletions
39
packages/wekan-ldap/server/testConnection.js
Normal file
39
packages/wekan-ldap/server/testConnection.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import LDAP from './ldap';
|
||||
|
||||
Meteor.methods({
|
||||
ldap_test_connection() {
|
||||
const user = Meteor.user();
|
||||
if (!user) {
|
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'ldap_test_connection' });
|
||||
}
|
||||
|
||||
//TODO: This needs to be fixed - security issue -> alanning:meteor-roles
|
||||
//if (!RocketChat.authz.hasRole(user._id, 'admin')) {
|
||||
// throw new Meteor.Error('error-not-authorized', 'Not authorized', { method: 'ldap_test_connection' });
|
||||
//}
|
||||
|
||||
if (LDAP.settings_get(LDAP_ENABLE) !== true) {
|
||||
throw new Meteor.Error('LDAP_disabled');
|
||||
}
|
||||
|
||||
let ldap;
|
||||
try {
|
||||
ldap = new LDAP();
|
||||
ldap.connectSync();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new Meteor.Error(error.message);
|
||||
}
|
||||
|
||||
try {
|
||||
ldap.bindIfNecessary();
|
||||
} catch (error) {
|
||||
throw new Meteor.Error(error.name || error.message);
|
||||
}
|
||||
|
||||
return {
|
||||
message: 'Connection_success',
|
||||
params: [],
|
||||
};
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue