Add UI to change user directory domain

This commit is contained in:
Johannes Zellner
2022-08-16 10:22:51 +02:00
parent 4207ba59ef
commit 1bf06c6350
2 changed files with 31 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
$scope.groupsById = { };
$scope.config = Client.getConfig();
$scope.userInfo = Client.getUserInfo();
$scope.domains = [];
$scope.openSubscriptionSetup = function () {
Client.openSubscriptionSetup($scope.$parent.subscription);
@@ -888,6 +889,9 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
secret: '',
allowlist: '',
error: null,
currentLocation: { domain: null, subdomain: '' },
domain: null,
subdomain: '',
refresh: function () {
Client.getUserDirectoryConfig(function (error, result) {
@@ -896,6 +900,9 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
$scope.userDirectoryConfig.enabled = !!result.enabled;
$scope.userDirectoryConfig.allowlist = result.allowlist;
$scope.userDirectoryConfig.secret = result.secret;
$scope.userDirectoryConfig.currentLocation.subdomain = result.subdomain;
$scope.userDirectoryConfig.currentLocation.domain = $scope.domains.find(function (d) { return result.domain === d.domain; });
});
},
@@ -1190,11 +1197,20 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
});
}
function getAllDomains() {
Client.getDomains(function (error, domains) {
if (error) return console.error('Unable to get domains:', error);
$scope.domains = domains;
});
}
Client.onReady(function () {
refresh();
if ($scope.user.isAtLeastAdmin) loadExternalLdapConfig();
if ($scope.user.isAtLeastAdmin) $scope.profileConfig.refresh();
if ($scope.user.isAtLeastAdmin) $scope.userDirectoryConfig.refresh();
if ($scope.user.isAtLeastAdmin) getAllDomains();
refreshAllUsers();
// Order matters for permissions used in canEdit