mirror of
https://github.com/moparisthebest/kaiwa
synced 2025-02-22 05:51:51 -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) {
|
fetch: function (cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
if(SERVER_CONFIG.ldapEnabled)
|
||||||
$.post('/ldap/users', ldapUser.ldapData(), function(users) {
|
$.post('/ldap/users', ldapUser.ldapData(), function(users) {
|
||||||
var toRemove = [];
|
var toRemove = [];
|
||||||
for ( var i = 0; i < self.models.length; i++) {
|
for ( var i = 0; i < self.models.length; i++) {
|
||||||
@ -52,6 +53,7 @@ module.exports = BaseCollection.extend({
|
|||||||
addUser: function (id) {
|
addUser: function (id) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
if(SERVER_CONFIG.ldapEnabled)
|
||||||
$.post('/ldap/users/add', ldapUser.ldapData({newUid: id}), function(result) {
|
$.post('/ldap/users/add', ldapUser.ldapData({newUid: id}), function(result) {
|
||||||
result = JSON.parse(result);
|
result = JSON.parse(result);
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -62,6 +64,7 @@ module.exports = BaseCollection.extend({
|
|||||||
deleteUser: function (id) {
|
deleteUser: function (id) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
if(SERVER_CONFIG.ldapEnabled)
|
||||||
$.post('/ldap/users/delete', ldapUser.ldapData({removeUid: id}), function(result) {
|
$.post('/ldap/users/delete', ldapUser.ldapData({removeUid: id}), function(result) {
|
||||||
result = JSON.parse(result);
|
result = JSON.parse(result);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -8,6 +8,8 @@ var templatizer = require('templatizer');
|
|||||||
var async = require('async');
|
var async = require('async');
|
||||||
var LDAP = require('ldapjs');
|
var LDAP = require('ldapjs');
|
||||||
|
|
||||||
|
config.ldapEnabled = !(!config.ldap || !config.ldap.address || !config.ldap.base);
|
||||||
|
|
||||||
String.prototype.capitalize = function() {
|
String.prototype.capitalize = function() {
|
||||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||||
};
|
};
|
||||||
@ -50,9 +52,11 @@ app.get('/sounds/*', function (req, res) {
|
|||||||
res.redirect("./public" + req.baseUrl);
|
res.redirect("./public" + req.baseUrl);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (config.ldapEnabled) {
|
||||||
|
|
||||||
function connectLDAP(req, cb) {
|
function connectLDAP(req, cb) {
|
||||||
|
|
||||||
if (!config.ldap || !config.ldap.address || !config.ldap.base) {
|
if (!config.ldapEnabled) {
|
||||||
cb(true);
|
cb(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -298,6 +302,8 @@ app.post('/ldap/users/delete', function (req, res) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
app.get('/oauth/login', 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');
|
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