##// END OF EJS Templates
set default category_id instead of the object (#11665)...
set default category_id instead of the object (#11665) Rails 2.3 still has issues with synchronizing the association_id and association attributes of an object. That means, if you set the association with an object first and then just set the id afterwards, the object wins and the setting of the id gets lost. This is not an issue in Rails >= 3.1 anymore. Contributed by Holger Just. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10226 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r9112:bd47af098fef
r10043:14dcefaa97f9
Show More
auth_sources_controller.rb
76 lines | 2.3 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
# Copyright (C) 2006-2011 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
Eric Davis
Refactor: Merged AuthSourcesController#list and #index...
r3322 def index
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 @auth_source_pages, @auth_sources = paginate AuthSource, :per_page => 10
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
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)
Eric Davis
Refactor: Merged AuthSourcesController#list and #index...
r3322 redirect_to :action => 'index'
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
@auth_source = AuthSource.find(params[:id])
end
def update
@auth_source = AuthSource.find(params[:id])
if @auth_source.update_attributes(params[:auth_source])
flash[:notice] = l(:notice_successful_update)
Eric Davis
Refactor: Merged AuthSourcesController#list and #index...
r3322 redirect_to :action => 'index'
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
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 @auth_source = AuthSource.find(params[:id])
Jean-Philippe Lang
0.3 unstable...
r10 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
Eric Davis
Refactor: Merged AuthSourcesController#list and #index...
r3322 redirect_to :action => 'index'
Jean-Philippe Lang
0.3 unstable...
r10 end
def destroy
@auth_source = AuthSource.find(params[:id])
unless @auth_source.users.find(:first)
@auth_source.destroy
flash[:notice] = l(:notice_successful_delete)
end
Eric Davis
Refactor: Merged AuthSourcesController#list and #index...
r3322 redirect_to :action => 'index'
Jean-Philippe Lang
0.3 unstable...
r10 end
end