Exposed ldap got renamed to user directory

This commit is contained in:
Johannes Zellner
2022-01-07 14:22:07 +01:00
parent 346dc4f861
commit 8bb4e947a0
3 changed files with 28 additions and 28 deletions

View File

@@ -867,8 +867,8 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
Client.prototype.setExposedLdapConfig = function (config, callback) {
post('/api/v1/settings/exposed_ldap_config', config, null, function (error, data, status) {
Client.prototype.setUserDirectoryConfig = function (config, callback) {
post('/api/v1/settings/user_directory_config', config, null, function (error, data, status) {
if (error) return callback(error);
if (status !== 200) return callback(new ClientError(status, data));
@@ -876,8 +876,8 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
Client.prototype.getExposedLdapConfig = function (callback) {
get('/api/v1/settings/exposed_ldap_config', null, function (error, data, status) {
Client.prototype.getUserDirectoryConfig = function (callback) {
get('/api/v1/settings/user_directory_config', null, function (error, data, status) {
if (error) return callback(error);
if (status !== 200) return callback(new ClientError(status, data));

View File

@@ -877,18 +877,18 @@
<br/>
<form name="exposedLdapConfigForm" role="form" novalidate ng-submit="exposedLdapConfig.submit()" autocomplete="off">
<form name="userDirectoryConfigForm" role="form" novalidate ng-submit="userDirectoryConfig.submit()" autocomplete="off">
<fieldset>
<div class="checkbox">
<label>
<input type="checkbox" ng-model="exposedLdapConfig.enabled" ng-disabled="exposedLdapConfig.busy"> {{ 'users.exposedLdap.enabled' | tr }} <sup><a ng-href="https://docs.cloudron.io/user-management/#exposed-ldap" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup>
<input type="checkbox" ng-model="userDirectoryConfig.enabled" ng-disabled="userDirectoryConfig.busy"> {{ 'users.exposedLdap.enabled' | tr }} <sup><a ng-href="https://docs.cloudron.io/user-management/#exposed-ldap" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup>
</label>
</div>
<div class="form-group">
<label class="control-label">{{ 'users.exposedLdap.ipRestriction.label' | tr }}</label>
<p class="small">{{ 'users.exposedLdap.ipRestriction.description' | tr }}</p>
<textarea ng-model="exposedLdapConfig.allowlist" ng-disabled="!exposedLdapConfig.enabled || exposedLdapConfig.busy" placeholder="{{ 'users.exposedLdap.ipRestriction.placeholder' | tr }}" name="allowlist" class="form-control" ng-class="{ 'has-error': !exposedLdapConfigForm.allowlist.$dirty && exposedLdapConfig.error.allowlist }" rows="4"></textarea>
<div class="has-error" ng-show="exposedLdapConfig.error.allowlist">{{ exposedLdapConfig.error.allowlist }}</div>
<textarea ng-model="userDirectoryConfig.allowlist" ng-disabled="!userDirectoryConfig.enabled || userDirectoryConfig.busy" placeholder="{{ 'users.exposedLdap.ipRestriction.placeholder' | tr }}" name="allowlist" class="form-control" ng-class="{ 'has-error': !userDirectoryConfigForm.allowlist.$dirty && userDirectoryConfig.error.allowlist }" rows="4"></textarea>
<div class="has-error" ng-show="userDirectoryConfig.error.allowlist">{{ userDirectoryConfig.error.allowlist }}</div>
</div>
</fieldset>
</form>
@@ -896,10 +896,10 @@
<br/>
<div>
<span class="has-error" ng-show="exposedLdapConfig.error.generic">{{ exposedLdapConfig.error.generic }}</span>
<span class="has-error" ng-show="userDirectoryConfig.error.generic">{{ userDirectoryConfig.error.generic }}</span>
<button class="btn btn-outline btn-primary pull-right" ng-click="exposedLdapConfig.submit()" ng-disabled="!exposedLdapConfigForm.$dirty || exposedLdapConfig.busy">
<i class="fa fa-circle-notch fa-spin" ng-show="exposedLdapConfig.busy"></i> {{ 'users.settings.saveAction' | tr }}
<button class="btn btn-outline btn-primary pull-right" ng-click="userDirectoryConfig.submit()" ng-disabled="!userDirectoryConfigForm.$dirty || userDirectoryConfig.busy">
<i class="fa fa-circle-notch fa-spin" ng-show="userDirectoryConfig.busy"></i> {{ 'users.settings.saveAction' | tr }}
</button>
</div>
</div>

View File

@@ -689,40 +689,40 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
}
};
$scope.exposedLdapConfig = {
$scope.userDirectoryConfig = {
enabled: false,
allowlist: '',
error: null,
refresh: function () {
Client.getExposedLdapConfig(function (error, result) {
Client.getUserDirectoryConfig(function (error, result) {
if (error) return console.error('Unable to get exposed ldap config.', error);
$scope.exposedLdapConfig.enabled = !!result.enabled;
$scope.exposedLdapConfig.allowlist = result.allowlist;
$scope.userDirectoryConfig.enabled = !!result.enabled;
$scope.userDirectoryConfig.allowlist = result.allowlist;
});
},
submit: function () {
$scope.exposedLdapConfig.error = null;
$scope.exposedLdapConfig.busy = true;
$scope.exposedLdapConfig.success = false;
$scope.userDirectoryConfig.error = null;
$scope.userDirectoryConfig.busy = true;
$scope.userDirectoryConfig.success = false;
var data = {
enabled: $scope.exposedLdapConfig.enabled,
allowlist: $scope.exposedLdapConfig.allowlist
enabled: $scope.userDirectoryConfig.enabled,
allowlist: $scope.userDirectoryConfig.allowlist
};
Client.setExposedLdapConfig(data, function (error) {
$scope.exposedLdapConfig.busy = false;
Client.setUserDirectoryConfig(data, function (error) {
$scope.userDirectoryConfig.busy = false;
if (error && error.statusCode === 400) return $scope.exposedLdapConfig.error = { allowlist: error.message };
if (error) return $scope.exposedLdapConfig.error = { generic: error.message };
if (error && error.statusCode === 400) return $scope.userDirectoryConfig.error = { allowlist: error.message };
if (error) return $scope.userDirectoryConfig.error = { generic: error.message };
$scope.exposedLdapConfigForm.$setUntouched();
$scope.exposedLdapConfigForm.$setPristine();
$scope.userDirectoryConfigForm.$setUntouched();
$scope.userDirectoryConfigForm.$setPristine();
$scope.exposedLdapConfig.success = true;
$scope.userDirectoryConfig.success = true;
});
}
};
@@ -965,7 +965,7 @@ 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.refresh(); });
Client.onReady(function () { if ($scope.user.isAtLeastAdmin) $scope.exposedLdapConfig.refresh(); });
Client.onReady(function () { if ($scope.user.isAtLeastAdmin) $scope.userDirectoryConfig.refresh(); });
Client.onReady(refreshAllUsers);
Client.onReady(function () {
// Order matters for permissions used in canEdit