Add basic settings form for exposed LDAP
This commit is contained in:
@@ -660,7 +660,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
|
||||
mandatory2FA: false,
|
||||
errorMessage: '',
|
||||
|
||||
loadDirectoryConfig: function () {
|
||||
refresh: function () {
|
||||
Client.getDirectoryConfig(function (error, result) {
|
||||
if (error) return console.error('Unable to get directory config.', error);
|
||||
|
||||
@@ -694,6 +694,42 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
|
||||
}
|
||||
};
|
||||
|
||||
$scope.exposedLdapConfig = {
|
||||
enabled: false,
|
||||
errorMessage: '',
|
||||
|
||||
refresh: function () {
|
||||
Client.getExposedLdapConfig(function (error, result) {
|
||||
if (error) return console.error('Unable to get exposed ldap config.', error);
|
||||
|
||||
$scope.exposedLdapConfig.enabled = !!result.enabled;
|
||||
});
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.exposedLdapConfig.error = '';
|
||||
$scope.exposedLdapConfig.busy = true;
|
||||
$scope.exposedLdapConfig.success = false;
|
||||
|
||||
var data = {
|
||||
enabled: $scope.exposedLdapConfig.enabled
|
||||
};
|
||||
|
||||
Client.setExposedLdapConfig(data, function (error) {
|
||||
if (error) $scope.exposedLdapConfig.errorMessage = error.message;
|
||||
|
||||
$scope.exposedLdapConfig.success = true;
|
||||
|
||||
$scope.exposedLdapConfigForm.$setUntouched();
|
||||
$scope.exposedLdapConfigForm.$setPristine();
|
||||
|
||||
$timeout(function () {
|
||||
$scope.exposedLdapConfig.busy = false;
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.externalLdap = {
|
||||
busy: false,
|
||||
percent: 0,
|
||||
@@ -932,7 +968,8 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
|
||||
|
||||
Client.onReady(refresh);
|
||||
Client.onReady(function () { if ($scope.user.isAtLeastAdmin) loadExternalLdapConfig(); });
|
||||
Client.onReady(function () { if ($scope.user.isAtLeastAdmin) $scope.directoryConfig.loadDirectoryConfig(); });
|
||||
Client.onReady(function () { if ($scope.user.isAtLeastAdmin) $scope.directoryConfig.refresh(); });
|
||||
Client.onReady(function () { if ($scope.user.isAtLeastAdmin) $scope.exposedLdapConfig.refresh(); });
|
||||
Client.onReady(refreshAllUsers);
|
||||
Client.onReady(function () {
|
||||
// Order matters for permissions used in canEdit
|
||||
|
||||
Reference in New Issue
Block a user