##// END OF EJS Templates
Typo that breaks with ruby1.8....
Typo that breaks with ruby1.8. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11337 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r10939:e396a0eebe07
r11107:0d93b6dc3cb8
Show More
auth_sources_controller.rb
96 lines | 2.8 KiB | text/x-ruby | RubyLexer
/ app / controllers / auth_sources_controller.rb
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/auth_sources_controller.rb....
r6779 # Redmine - project management software
Jean-Philippe Lang
Copyright for 2013 (#12788)....
r10939 # Copyright (C) 2006-2013 Jean-Philippe Lang
Jean-Philippe Lang
0.3 unstable...
r10 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/auth_sources_controller.rb....
r6779 #
Jean-Philippe Lang
0.3 unstable...
r10 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/auth_sources_controller.rb....
r6779 #
Jean-Philippe Lang
0.3 unstable...
r10 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class AuthSourcesController < ApplicationController
Jean-Philippe Lang
Adds an admin layout that displays the admin menu in the sidebar....
r3062 layout 'admin'
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 menu_item :ldap_authentication
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/auth_sources_controller.rb....
r6779
Jean-Philippe Lang
0.3 unstable...
r10 before_filter :require_admin
Jean-Philippe Lang
Code cleanup in AuthSource controller and views....
r10767 before_filter :find_auth_source, :only => [:edit, :update, :test_connection, :destroy]
Jean-Philippe Lang
0.3 unstable...
r10
Eric Davis
Refactor: Merged AuthSourcesController#list and #index...
r3322 def index
Jean-Philippe Lang
Display 25 items....
r10799 @auth_source_pages, @auth_sources = paginate AuthSource, :per_page => 25
Jean-Philippe Lang
0.3 unstable...
r10 end
def new
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 klass_name = params[:type] || 'AuthSourceLdap'
@auth_source = AuthSource.new_subclass_instance(klass_name, params[:auth_source])
Jean-Philippe Lang
Code cleanup in AuthSource controller and views....
r10767 render_404 unless @auth_source
Jean-Philippe Lang
0.3 unstable...
r10 end
def create
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 @auth_source = AuthSource.new_subclass_instance(params[:type], params[:auth_source])
Jean-Philippe Lang
0.3 unstable...
r10 if @auth_source.save
flash[:notice] = l(:notice_successful_create)
Jean-Philippe Lang
Use named routes in controllers....
r10752 redirect_to auth_sources_path
Jean-Philippe Lang
0.3 unstable...
r10 else
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 render :action => 'new'
Jean-Philippe Lang
0.3 unstable...
r10 end
end
def edit
end
def update
if @auth_source.update_attributes(params[:auth_source])
flash[:notice] = l(:notice_successful_update)
Jean-Philippe Lang
Use named routes in controllers....
r10752 redirect_to auth_sources_path
Jean-Philippe Lang
0.3 unstable...
r10 else
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 render :action => 'edit'
Jean-Philippe Lang
0.3 unstable...
r10 end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/auth_sources_controller.rb....
r6779
Jean-Philippe Lang
0.3 unstable...
r10 def test_connection
begin
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 @auth_source.test_connection
Jean-Philippe Lang
Added LDAPS support migration and fixed connection test flash messages....
r832 flash[:notice] = l(:notice_successful_connection)
Jean-Philippe Lang
Adds functional test for #test_connection....
r8933 rescue Exception => e
flash[:error] = l(:error_unable_to_connect, e.message)
Jean-Philippe Lang
0.3 unstable...
r10 end
Jean-Philippe Lang
Use named routes in controllers....
r10752 redirect_to auth_sources_path
Jean-Philippe Lang
0.3 unstable...
r10 end
def destroy
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 unless @auth_source.users.exists?
Jean-Philippe Lang
0.3 unstable...
r10 @auth_source.destroy
flash[:notice] = l(:notice_successful_delete)
end
Jean-Philippe Lang
Use named routes in controllers....
r10752 redirect_to auth_sources_path
Jean-Philippe Lang
0.3 unstable...
r10 end
Jean-Philippe Lang
Code cleanup in AuthSource controller and views....
r10767
Jean-Philippe Lang
Auto-populate fields while creating a new user with LDAP (#10286)....
r10850 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
Jean-Philippe Lang
Code cleanup in AuthSource controller and views....
r10767 private
def find_auth_source
@auth_source = AuthSource.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
Jean-Philippe Lang
0.3 unstable...
r10 end