summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-26 11:23:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-26 11:23:53 +0000
commit7b8ebb7e3ffc62e28396fadbd009216eb0e53c5f (patch)
tree43269790cccebe4e886064e897b9cb0d59edb31b /app/controllers
parenteba4efc9d0ad6222818a32a5bac2190cef0d45b0 (diff)
downloadredmine-7b8ebb7e3ffc62e28396fadbd009216eb0e53c5f.tar.gz
redmine-7b8ebb7e3ffc62e28396fadbd009216eb0e53c5f.zip
Auto-populate fields while creating a new user with LDAP (#10286).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11080 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/auth_sources_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb
index 8e2e1f001..e94df3c0e 100644
--- a/app/controllers/auth_sources_controller.rb
+++ b/app/controllers/auth_sources_controller.rb
@@ -72,6 +72,20 @@ class AuthSourcesController < ApplicationController
redirect_to auth_sources_path
end
+ def autocomplete_for_new_user
+ results = AuthSource.search(params[:term])
+
+ render :json => results.map {|result| {
+ 'value' => result[:login],
+ 'label' => "#{result[:login]} (#{result[:firstname]} #{result[:lastname]})",
+ 'login' => result[:login].to_s,
+ 'firstname' => result[:firstname].to_s,
+ 'lastname' => result[:lastname].to_s,
+ 'mail' => result[:mail].to_s,
+ 'auth_source_id' => result[:auth_source_id].to_s
+ }}
+ end
+
private
def find_auth_source