From 25c8bf93ec29e278dda2700003aa9037c4cad9ca Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Tue, 27 Mar 2018 15:48:58 -0400 Subject: [PATCH 1/2] Add AUTH_LDAP_GROUP_TYPE_PARAMS field to LDAP form --- .../configuration/auth-form/sub-forms/auth-ldap.form.js | 7 +++++++ .../configuration/auth-form/sub-forms/auth-ldap1.form.js | 7 +++++++ .../configuration/auth-form/sub-forms/auth-ldap2.form.js | 7 +++++++ .../configuration/auth-form/sub-forms/auth-ldap3.form.js | 7 +++++++ .../configuration/auth-form/sub-forms/auth-ldap4.form.js | 7 +++++++ .../configuration/auth-form/sub-forms/auth-ldap5.form.js | 7 +++++++ 6 files changed, 42 insertions(+) diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap.form.js index f810729baa..598aa1d3e5 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap.form.js @@ -54,6 +54,13 @@ export default ['i18n', function(i18n) { reset: 'AUTH_LDAP_GROUP_TYPE', ngOptions: 'group.label for group in AUTH_LDAP_GROUP_TYPE_options track by group.value', }, + AUTH_LDAP_GROUP_TYPE_PARAMS: { + type: 'textarea', + reset: 'AUTH_LDAP_GROUP_TYPE_PARAMS', + codeMirror: true, + rows: 6, + class: 'Form-textAreaLabel Form-formGroup--fullWidth', + }, AUTH_LDAP_REQUIRE_GROUP: { type: 'text', reset: 'AUTH_LDAP_REQUIRE_GROUP' diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap1.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap1.form.js index 8430fecee3..c8869c6ce4 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap1.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap1.form.js @@ -54,6 +54,13 @@ export default ['i18n', function(i18n) { reset: 'AUTH_LDAP_1_GROUP_TYPE', ngOptions: 'group.label for group in AUTH_LDAP_1_GROUP_TYPE_options track by group.value', }, + AUTH_LDAP_1_GROUP_TYPE_PARAMS: { + type: 'textarea', + reset: 'AUTH_LDAP_1_GROUP_TYPE_PARAMS', + codeMirror: true, + rows: 6, + class: 'Form-textAreaLabel Form-formGroup--fullWidth', + }, AUTH_LDAP_1_REQUIRE_GROUP: { type: 'text', reset: 'AUTH_LDAP_1_REQUIRE_GROUP' diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap2.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap2.form.js index 09230cb802..a7d4a8769f 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap2.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap2.form.js @@ -54,6 +54,13 @@ export default ['i18n', function(i18n) { reset: 'AUTH_LDAP_2_GROUP_TYPE', ngOptions: 'group.label for group in AUTH_LDAP_2_GROUP_TYPE_options track by group.value', }, + AUTH_LDAP_2_GROUP_TYPE_PARAMS: { + type: 'textarea', + reset: 'AUTH_LDAP_2_GROUP_TYPE_PARAMS', + codeMirror: true, + rows: 6, + class: 'Form-textAreaLabel Form-formGroup--fullWidth', + }, AUTH_LDAP_2_REQUIRE_GROUP: { type: 'text', reset: 'AUTH_LDAP_2_REQUIRE_GROUP' diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap3.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap3.form.js index 9c26c22829..029974500f 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap3.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap3.form.js @@ -54,6 +54,13 @@ export default ['i18n', function(i18n) { reset: 'AUTH_LDAP_3_GROUP_TYPE', ngOptions: 'group.label for group in AUTH_LDAP_3_GROUP_TYPE_options track by group.value', }, + AUTH_LDAP_3_GROUP_TYPE_PARAMS: { + type: 'textarea', + reset: 'AUTH_LDAP_3_GROUP_TYPE_PARAMS', + codeMirror: true, + rows: 6, + class: 'Form-textAreaLabel Form-formGroup--fullWidth', + }, AUTH_LDAP_3_REQUIRE_GROUP: { type: 'text', reset: 'AUTH_LDAP_3_REQUIRE_GROUP' diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap4.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap4.form.js index 95c9f6d175..fa8195c5dc 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap4.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap4.form.js @@ -54,6 +54,13 @@ export default ['i18n', function(i18n) { reset: 'AUTH_LDAP_4_GROUP_TYPE', ngOptions: 'group.label for group in AUTH_LDAP_4_GROUP_TYPE_options track by group.value', }, + AUTH_LDAP_4_GROUP_TYPE_PARAMS: { + type: 'textarea', + reset: 'AUTH_LDAP_4_GROUP_TYPE_PARAMS', + codeMirror: true, + rows: 6, + class: 'Form-textAreaLabel Form-formGroup--fullWidth', + }, AUTH_LDAP_4_REQUIRE_GROUP: { type: 'text', reset: 'AUTH_LDAP_4_REQUIRE_GROUP' diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap5.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap5.form.js index fa93437367..9fe6dbb796 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap5.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap5.form.js @@ -54,6 +54,13 @@ export default ['i18n', function(i18n) { reset: 'AUTH_LDAP_5_GROUP_TYPE', ngOptions: 'group.label for group in AUTH_LDAP_5_GROUP_TYPE_options track by group.value', }, + AUTH_LDAP_5_GROUP_TYPE_PARAMS: { + type: 'textarea', + reset: 'AUTH_LDAP_5_GROUP_TYPE_PARAMS', + codeMirror: true, + rows: 6, + class: 'Form-textAreaLabel Form-formGroup--fullWidth', + }, AUTH_LDAP_5_REQUIRE_GROUP: { type: 'text', reset: 'AUTH_LDAP_5_REQUIRE_GROUP' From 471248e66c8305abd5dfdd461944696b6d522d6a Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Thu, 29 Mar 2018 13:33:17 -0400 Subject: [PATCH 2/2] Fix LDAP_GROUP_TYPE_PARAMS revert value --- .../client/src/configuration/configuration.controller.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/configuration/configuration.controller.js b/awx/ui/client/src/configuration/configuration.controller.js index fec8c23227..90a2b554d8 100644 --- a/awx/ui/client/src/configuration/configuration.controller.js +++ b/awx/ui/client/src/configuration/configuration.controller.js @@ -338,7 +338,6 @@ export default [ Wait('start'); var payload = {}; payload[key] = $scope.configDataResolve[key].default; - ConfigurationService.patchConfiguration(payload) .then(function() { $scope[key] = $scope.configDataResolve[key].default; @@ -361,10 +360,13 @@ export default [ else if($scope[key + '_field'].hasOwnProperty('codeMirror')){ const isLdap = (key.indexOf("AUTH_LDAP") !== -1); + const isLdapGroupTypeParams = isLdap && (key.indexOf("GROUP_TYPE_PARAMS") !== -1); const isLdapUserSearch = isLdap && (key.indexOf("USER_SEARCH") !== -1); const isLdapGroupSearch = isLdap && (key.indexOf("GROUP_SEARCH") !== -1); - if (isLdapUserSearch || isLdapGroupSearch) { + if (isLdapGroupTypeParams) { + $scope[key] = JSON.stringify($scope.configDataResolve[key].default); + } else if (isLdapUserSearch || isLdapGroupSearch) { $scope[key] = '[]'; } else { $scope[key] = '{}'; @@ -456,7 +458,6 @@ export default [ } } }); - return payload; };