Class: AuthSourcesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/auth_sources_controller.rb

Overview

– copyright ChiliProject is a project management system.

Copyright (C) 2010-2013 the ChiliProject Team

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.

See doc/COPYRIGHT.rdoc for more details. ++

Direct Known Subclasses

LdapAuthSourcesController

Instance Method Summary collapse

Methods included from Redmine::MenuManager::MenuController

#current_menu_item, included, #menu_items, #redirect_to_project_menu_item

Methods included from Redmine::Search::Controller

#default_search_scope, #default_search_scopes, included

Methods included from Redmine::I18n

#current_language, #day_name, #find_language, #format_date, #format_time, included, #l, #l_hours, #l_or_humanize, #ll, #month_name, #set_language_if_valid, #valid_languages

Instance Method Details

#createObject


34
35
36
37
38
39
40
41
42
# File 'app/controllers/auth_sources_controller.rb', line 34

def create
  @auth_source = auth_source_class.new(params[:auth_source])
  if @auth_source.save
    flash[:notice] = l(:notice_successful_create)
    redirect_to :action => 'index'
  else
    render 'auth_sources/new'
  end
end

#destroyObject


70
71
72
73
74
75
76
77
# File 'app/controllers/auth_sources_controller.rb', line 70

def destroy
  @auth_source = AuthSource.find(params[:id])
  unless @auth_source.users.find(:first)
    @auth_source.destroy
    flash[:notice] = l(:notice_successful_delete)
  end
  redirect_to :action => 'index'
end

#editObject


44
45
46
47
# File 'app/controllers/auth_sources_controller.rb', line 44

def edit
  @auth_source = AuthSource.find(params[:id])
  render 'auth_sources/edit'
end

#indexObject


24
25
26
27
# File 'app/controllers/auth_sources_controller.rb', line 24

def index
  @auth_source_pages, @auth_sources = paginate auth_source_class.name.tableize, :per_page => 10
  render "auth_sources/index"
end

#newObject


29
30
31
32
# File 'app/controllers/auth_sources_controller.rb', line 29

def new
  @auth_source = auth_source_class.new
  render 'auth_sources/new'
end

#test_connectionObject


59
60
61
62
63
64
65
66
67
68
# File 'app/controllers/auth_sources_controller.rb', line 59

def test_connection
  @auth_method = AuthSource.find(params[:id])
  begin
    @auth_method.test_connection
    flash[:notice] = l(:notice_successful_connection)
  rescue => text
    flash[:error] = l(:error_unable_to_connect, text.message)
  end
  redirect_to :action => 'index'
end

#updateObject


49
50
51
52
53
54
55
56
57
# File 'app/controllers/auth_sources_controller.rb', line 49

def update
  @auth_source = AuthSource.find(params[:id])
  if @auth_source.update_attributes(params[:auth_source])
    flash[:notice] = l(:notice_successful_update)
    redirect_to :action => 'index'
  else
    render 'auth_sources/edit'
  end
end