mirror of
https://github.com/moparisthebest/kaiwa
synced 2025-02-21 05:21:47 -05:00
Only setup/call ldap methods if enabled
This commit is contained in:
parent
ad62e7dfd1
commit
fb479eed71
@ -24,6 +24,7 @@ module.exports = BaseCollection.extend({
|
||||
fetch: function (cb) {
|
||||
var self = this;
|
||||
|
||||
if(SERVER_CONFIG.ldapEnabled)
|
||||
$.post('/ldap/users', ldapUser.ldapData(), function(users) {
|
||||
var toRemove = [];
|
||||
for ( var i = 0; i < self.models.length; i++) {
|
||||
@ -52,6 +53,7 @@ module.exports = BaseCollection.extend({
|
||||
addUser: function (id) {
|
||||
var self = this;
|
||||
|
||||
if(SERVER_CONFIG.ldapEnabled)
|
||||
$.post('/ldap/users/add', ldapUser.ldapData({newUid: id}), function(result) {
|
||||
result = JSON.parse(result);
|
||||
if (result) {
|
||||
@ -62,6 +64,7 @@ module.exports = BaseCollection.extend({
|
||||
deleteUser: function (id) {
|
||||
var self = this;
|
||||
|
||||
if(SERVER_CONFIG.ldapEnabled)
|
||||
$.post('/ldap/users/delete', ldapUser.ldapData({removeUid: id}), function(result) {
|
||||
result = JSON.parse(result);
|
||||
if (result) {
|
||||
|
@ -8,6 +8,8 @@ var templatizer = require('templatizer');
|
||||
var async = require('async');
|
||||
var LDAP = require('ldapjs');
|
||||
|
||||
config.ldapEnabled = !(!config.ldap || !config.ldap.address || !config.ldap.base);
|
||||
|
||||
String.prototype.capitalize = function() {
|
||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
};
|
||||
@ -50,9 +52,11 @@ app.get('/sounds/*', function (req, res) {
|
||||
res.redirect("./public" + req.baseUrl);
|
||||
});
|
||||
|
||||
if (config.ldapEnabled) {
|
||||
|
||||
function connectLDAP(req, cb) {
|
||||
|
||||
if (!config.ldap || !config.ldap.address || !config.ldap.base) {
|
||||
if (!config.ldapEnabled) {
|
||||
cb(true);
|
||||
return;
|
||||
}
|
||||
@ -298,6 +302,8 @@ app.post('/ldap/users/delete', function (req, res) {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
app.get('/oauth/login', function (req, res) {
|
||||
res.redirect('https://apps.andyet.com/oauth/authorize?client_id=' + config.andyetAuth.id + '&response_type=token');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user