Merged LdapAuthSourceController into AuthSourceController.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9232 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-03-11 11:43:27 +00:00
parent 81185a8d93
commit bd47af098f
12 changed files with 82 additions and 258 deletions
+9 -16
View File
@@ -17,32 +17,31 @@
class AuthSourcesController < ApplicationController
layout 'admin'
menu_item :ldap_authentication
before_filter :require_admin
def index
@auth_source_pages, @auth_sources = paginate auth_source_class.name.tableize, :per_page => 10
render "auth_sources/index"
@auth_source_pages, @auth_sources = paginate AuthSource, :per_page => 10
end
def new
@auth_source = auth_source_class.new
render 'auth_sources/new'
klass_name = params[:type] || 'AuthSourceLdap'
@auth_source = AuthSource.new_subclass_instance(klass_name, params[:auth_source])
end
def create
@auth_source = auth_source_class.new(params[:auth_source])
@auth_source = AuthSource.new_subclass_instance(params[:type], params[:auth_source])
if @auth_source.save
flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'index'
else
render 'auth_sources/new'
render :action => 'new'
end
end
def edit
@auth_source = AuthSource.find(params[:id])
render 'auth_sources/edit'
end
def update
@@ -51,14 +50,14 @@ class AuthSourcesController < ApplicationController
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'index'
else
render 'auth_sources/edit'
render :action => 'edit'
end
end
def test_connection
@auth_method = AuthSource.find(params[:id])
@auth_source = AuthSource.find(params[:id])
begin
@auth_method.test_connection
@auth_source.test_connection
flash[:notice] = l(:notice_successful_connection)
rescue Exception => e
flash[:error] = l(:error_unable_to_connect, e.message)
@@ -74,10 +73,4 @@ class AuthSourcesController < ApplicationController
end
redirect_to :action => 'index'
end
protected
def auth_source_class
AuthSource
end
end
@@ -1,26 +0,0 @@
# Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# 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.
#
# 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.
#
# 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 LdapAuthSourcesController < AuthSourcesController
menu_item :ldap_authentication
protected
def auth_source_class
AuthSourceLdap
end
end