1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 class AuthSourcesController < ApplicationController
19 before_filter :require_admin
23 render :action => 'list' unless request.xhr?
26 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
27 verify :method => :post, :only => [ :destroy, :create, :update ],
28 :redirect_to => { :action => :list }
31 @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
32 render :action => "list", :layout => false if request.xhr?
36 @auth_source = AuthSourceLdap.new
40 @auth_source = AuthSourceLdap.new(params[:auth_source])
42 flash[:notice] = l(:notice_successful_create)
43 redirect_to :action => 'list'
45 render :action => 'new'
50 @auth_source = AuthSource.find(params[:id])
54 @auth_source = AuthSource.find(params[:id])
55 if @auth_source.update_attributes(params[:auth_source])
56 flash[:notice] = l(:notice_successful_update)
57 redirect_to :action => 'list'
59 render :action => 'edit'
64 @auth_method = AuthSource.find(params[:id])
66 @auth_method.test_connection
67 flash[:notice] = l(:notice_successful_connection)
69 flash[:error] = "Unable to connect (#{text})"
71 redirect_to :action => 'list'
75 @auth_source = AuthSource.find(params[:id])
76 unless @auth_source.users.find(:first)
78 flash[:notice] = l(:notice_successful_delete)
80 redirect_to :action => 'list'