From 65443b3768de3ea5f6da80ede345eca333fe77aa Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 10 May 2017 09:50:48 +0200 Subject: [PATCH] Working on issue #981 - Make user filter and role assignments default behaviour configurable. --- .../app/controllers/_integration/ldap.coffee | 14 ++ .../app/views/integration/ldap_wizard.jst.eco | 20 ++- lib/import/ldap/user.rb | 98 ++++++------- lib/import/ldap/user_factory.rb | 7 +- spec/lib/import/ldap/user_spec.rb | 138 ++++++++++++++---- 5 files changed, 199 insertions(+), 78 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_integration/ldap.coffee b/app/assets/javascripts/app/controllers/_integration/ldap.coffee index e10f2d03b..d861005ca 100644 --- a/app/assets/javascripts/app/controllers/_integration/ldap.coffee +++ b/app/assets/javascripts/app/controllers/_integration/ldap.coffee @@ -158,6 +158,7 @@ class ConnectionWizard extends App.WizardModal '.modal-body': 'body' '.js-userMappingForm': 'userMappingForm' '.js-groupRoleForm': 'groupRoleForm' + '.js-expertForm': 'expertForm' constructor: -> super @@ -368,6 +369,14 @@ class ConnectionWizard extends App.WizardModal @groupRoleForm.find('tbody tr.js-entry').remove() @groupRoleForm.find('tbody tr').before(@buildRowsGroupRole(@wizardConfig.group_role_map)) + @$('.js-mapping input[name="user_filter"]').val(@wizardConfig.user_filter) + + unassigned_users_choices = + sigup_roles: App.i18n.translatePlain('Assign signup roles') + skip_sync: App.i18n.translatePlain('Don\'t synchronize') + + @$('.js-unassignedUsers').html(@createSelection('unassigned_users', unassigned_users_choices, @wizardConfig.unassigned_users || 'sigup_roles')) + mappingChange: (e) => e.preventDefault() @@ -396,6 +405,11 @@ class ConnectionWizard extends App.WizardModal group_role_map_local[group_role_map.source[count]] = group_role_map.dest[count] @wizardConfig.group_role_map = group_role_map_local + expertSettings = @formParam(@expertForm) + + @wizardConfig.user_filter = expertSettings.user_filter + @wizardConfig.unassigned_users = expertSettings.unassigned_users + @tryShow() buildRowsUserMap: (user_attribute_map) => diff --git a/app/assets/javascripts/app/views/integration/ldap_wizard.jst.eco b/app/assets/javascripts/app/views/integration/ldap_wizard.jst.eco index b09550537..1918d3eed 100644 --- a/app/assets/javascripts/app/views/integration/ldap_wizard.jst.eco +++ b/app/assets/javascripts/app/views/integration/ldap_wizard.jst.eco @@ -169,7 +169,6 @@

<%- @T('Roles') %>

-

<%- @T('Note: All not mapped users will get the default signup roles.') %>

@@ -193,6 +192,25 @@
+

<%- @T('Expert') %>

+
+ + + + + + + + +
<%- @T('Name') %> + <%- @T('Value') %> +
<%- @T('User filter') %> + +
<%- @T('Users without assigned LDAP groups') %> + +
+
+