diff --git a/app/portainer/settings/authentication/ldap/ad-settings/ad-settings.html b/app/portainer/settings/authentication/ldap/ad-settings/ad-settings.html
index ffe36a0f4..0f022ae7c 100644
--- a/app/portainer/settings/authentication/ldap/ad-settings/ad-settings.html
+++ b/app/portainer/settings/authentication/ldap/ad-settings/ad-settings.html
@@ -153,5 +153,14 @@
limited-feature-id="$ctrl.limitedFeatureId"
>
+
+
diff --git a/app/portainer/settings/authentication/ldap/index.js b/app/portainer/settings/authentication/ldap/index.js
index 2b3612be8..fae32a5a1 100644
--- a/app/portainer/settings/authentication/ldap/index.js
+++ b/app/portainer/settings/authentication/ldap/index.js
@@ -14,6 +14,7 @@ import { ldapUserSearchItem } from './ldap-user-search-item';
import { ldapSettingsDnBuilder } from './ldap-settings-dn-builder';
import { ldapSettingsGroupDnBuilder } from './ldap-settings-group-dn-builder';
import { ldapCustomGroupSearch } from './ldap-custom-group-search';
+import { ldapCustomAdminGroup } from './ldap-custom-admin-group';
import { ldapSettingsSecurity } from './ldap-settings-security';
import { ldapSettingsTestLogin } from './ldap-settings-test-login';
import { ldapCustomUserSearch } from './ldap-custom-user-search';
@@ -37,6 +38,7 @@ export default angular
.component('ldapSettingsDnBuilder', ldapSettingsDnBuilder)
.component('ldapSettingsGroupDnBuilder', ldapSettingsGroupDnBuilder)
.component('ldapCustomGroupSearch', ldapCustomGroupSearch)
+ .component('ldapCustomAdminGroup', ldapCustomAdminGroup)
.component('ldapSettingsOpenLdap', ldapSettingsOpenLdap)
.component('ldapSettingsSecurity', ldapSettingsSecurity)
.component('ldapSettingsTestLogin', ldapSettingsTestLogin)
diff --git a/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/index.js b/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/index.js
new file mode 100644
index 000000000..c2c2d043d
--- /dev/null
+++ b/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/index.js
@@ -0,0 +1,13 @@
+import controller from './ldap-custom-admin-group.controller';
+
+export const ldapCustomAdminGroup = {
+ templateUrl: './ldap-custom-admin-group.html',
+ controller,
+ bindings: {
+ settings: '=',
+ selectedAdminGroups: '=',
+ defaultAdminGroupSearchFilter: '<',
+ onSearchClick: '<',
+ limitedFeatureId: '<',
+ },
+};
diff --git a/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/ldap-custom-admin-group.controller.js b/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/ldap-custom-admin-group.controller.js
new file mode 100644
index 000000000..138be0b6a
--- /dev/null
+++ b/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/ldap-custom-admin-group.controller.js
@@ -0,0 +1,49 @@
+export default class LdapCustomAdminGroupController {
+ /* @ngInject */
+ constructor($async, Notifications, LDAPService) {
+ Object.assign(this, { $async, Notifications, LDAPService });
+
+ this.groups = null;
+ this.groupstest = null;
+ this.enableAssignAdminGroup = false;
+
+ this.onRemoveClick = this.onRemoveClick.bind(this);
+ this.onAddClick = this.onAddClick.bind(this);
+ this.search = this.search.bind(this);
+ }
+
+ onAddClick() {
+ this.settings.AdminGroupSearchSettings.push({ GroupBaseDN: '', GroupAttribute: '', GroupFilter: '' });
+ }
+
+ onRemoveClick(index) {
+ this.settings.AdminGroupSearchSettings.splice(index, 1);
+ }
+
+ search() {
+ return this.$async(async () => {
+ try {
+ this.groups = null;
+ this.groups = await this.onSearchClick();
+ this.enableAssignAdminGroup = this.groups && this.groups.length > 0;
+ } catch (error) {
+ this.Notifications.error('Failure', error, 'Failed to search groups');
+ }
+ });
+ }
+
+ async $onInit() {
+ if (this.settings.AdminAutoPopulate && this.settings.AdminGroups && this.settings.AdminGroups.length > 0) {
+ const settings = {
+ ...this.settings,
+ AdminGroupSearchSettings: this.settings.AdminGroupSearchSettings.map((search) => ({ ...search, GroupFilter: search.GroupFilter || this.defaultAdminGroupSearchFilter })),
+ };
+
+ this.groups = await this.LDAPService.adminGroups(settings);
+ }
+
+ if (this.groups && this.groups.length > 0) {
+ this.enableAssignAdminGroup = true;
+ }
+ }
+}
diff --git a/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/ldap-custom-admin-group.html b/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/ldap-custom-admin-group.html
new file mode 100644
index 000000000..705e6e003
--- /dev/null
+++ b/app/portainer/settings/authentication/ldap/ldap-custom-admin-group/ldap-custom-admin-group.html
@@ -0,0 +1,95 @@
+
+ Auto-populate team admins
+
+
+
+
+
+
+ Extra search configuration
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/portainer/settings/authentication/ldap/ldap-custom-group-search/ldap-custom-group-search.html b/app/portainer/settings/authentication/ldap/ldap-custom-group-search/ldap-custom-group-search.html
index 66ec9b640..7ae2ff302 100644
--- a/app/portainer/settings/authentication/ldap/ldap-custom-group-search/ldap-custom-group-search.html
+++ b/app/portainer/settings/authentication/ldap/ldap-custom-group-search/ldap-custom-group-search.html
@@ -1,5 +1,5 @@
- Teams auto-population configurations
+ Group search configurations
diff --git a/app/portainer/settings/authentication/ldap/ldap-group-search/ldap-group-search.html b/app/portainer/settings/authentication/ldap/ldap-group-search/ldap-group-search.html
index 473aade4b..7b50f27e0 100644
--- a/app/portainer/settings/authentication/ldap/ldap-group-search/ldap-group-search.html
+++ b/app/portainer/settings/authentication/ldap/ldap-group-search/ldap-group-search.html
@@ -1,5 +1,5 @@
- Teams auto-population configurations
+ Group search configurations
diff --git a/app/portainer/settings/authentication/ldap/ldap-settings-custom/ldap-settings-custom.html b/app/portainer/settings/authentication/ldap/ldap-settings-custom/ldap-settings-custom.html
index 00690e750..f14977907 100644
--- a/app/portainer/settings/authentication/ldap/ldap-settings-custom/ldap-settings-custom.html
+++ b/app/portainer/settings/authentication/ldap/ldap-settings-custom/ldap-settings-custom.html
@@ -114,6 +114,17 @@
limited-feature-id="$ctrl.limitedFeatureId"
>
+
+
+
+
diff --git a/app/portainer/settings/authentication/ldap/ldap-settings.model.js b/app/portainer/settings/authentication/ldap/ldap-settings.model.js
index d14711eec..9334a6a98 100644
--- a/app/portainer/settings/authentication/ldap/ldap-settings.model.js
+++ b/app/portainer/settings/authentication/ldap/ldap-settings.model.js
@@ -23,6 +23,13 @@ export function buildLdapSettingsModel() {
GroupAttribute: '',
},
],
+ AdminGroupSearchSettings: [
+ {
+ GroupBaseDN: '',
+ GroupFilter: '',
+ GroupAttribute: '',
+ },
+ ],
AutoCreateUsers: true,
};
}
diff --git a/app/portainer/views/settings/authentication/settingsAuthenticationController.js b/app/portainer/views/settings/authentication/settingsAuthenticationController.js
index 820dae8d3..02b05c88e 100644
--- a/app/portainer/views/settings/authentication/settingsAuthenticationController.js
+++ b/app/portainer/views/settings/authentication/settingsAuthenticationController.js
@@ -221,7 +221,7 @@ function SettingsAuthenticationController($q, $scope, $state, Notifications, Set
if (settings.LDAPSettings.ServerType === 2) {
$scope.formValues.ldap.adSettings = settings.LDAPSettings;
} else {
- $scope.formValues.ldap.ldapSettings = settings.LDAPSettings;
+ $scope.formValues.ldap.ldapSettings = Object.assign($scope.formValues.ldap.ldapSettings, settings.LDAPSettings);
}
if (settings.LDAPSettings.URL) {