@@ -1,84 +1,79 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class AuthSourcesController < ApplicationController |
|
18 | class AuthSourcesController < ApplicationController | |
19 | layout 'admin' |
|
19 | layout 'admin' | |
20 |
|
20 | |||
21 | before_filter :require_admin |
|
21 | before_filter :require_admin | |
22 |
|
22 | |||
23 | def index |
|
|||
24 | list |
|
|||
25 | render :action => 'list' unless request.xhr? |
|
|||
26 | end |
|
|||
27 |
|
||||
28 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
23 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) | |
29 | verify :method => :post, :only => [ :destroy, :create, :update ], |
|
24 | verify :method => :post, :only => [ :destroy, :create, :update ], | |
30 | :redirect_to => { :action => :list } |
|
25 | :redirect_to => { :action => :list } | |
31 |
|
26 | |||
32 |
def |
|
27 | def index | |
33 | @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10 |
|
28 | @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10 | |
34 |
render :action => " |
|
29 | render :action => "index", :layout => false if request.xhr? | |
35 | end |
|
30 | end | |
36 |
|
31 | |||
37 | def new |
|
32 | def new | |
38 | @auth_source = AuthSourceLdap.new |
|
33 | @auth_source = AuthSourceLdap.new | |
39 | end |
|
34 | end | |
40 |
|
35 | |||
41 | def create |
|
36 | def create | |
42 | @auth_source = AuthSourceLdap.new(params[:auth_source]) |
|
37 | @auth_source = AuthSourceLdap.new(params[:auth_source]) | |
43 | if @auth_source.save |
|
38 | if @auth_source.save | |
44 | flash[:notice] = l(:notice_successful_create) |
|
39 | flash[:notice] = l(:notice_successful_create) | |
45 |
redirect_to :action => ' |
|
40 | redirect_to :action => 'index' | |
46 | else |
|
41 | else | |
47 | render :action => 'new' |
|
42 | render :action => 'new' | |
48 | end |
|
43 | end | |
49 | end |
|
44 | end | |
50 |
|
45 | |||
51 | def edit |
|
46 | def edit | |
52 | @auth_source = AuthSource.find(params[:id]) |
|
47 | @auth_source = AuthSource.find(params[:id]) | |
53 | end |
|
48 | end | |
54 |
|
49 | |||
55 | def update |
|
50 | def update | |
56 | @auth_source = AuthSource.find(params[:id]) |
|
51 | @auth_source = AuthSource.find(params[:id]) | |
57 | if @auth_source.update_attributes(params[:auth_source]) |
|
52 | if @auth_source.update_attributes(params[:auth_source]) | |
58 | flash[:notice] = l(:notice_successful_update) |
|
53 | flash[:notice] = l(:notice_successful_update) | |
59 |
redirect_to :action => ' |
|
54 | redirect_to :action => 'index' | |
60 | else |
|
55 | else | |
61 | render :action => 'edit' |
|
56 | render :action => 'edit' | |
62 | end |
|
57 | end | |
63 | end |
|
58 | end | |
64 |
|
59 | |||
65 | def test_connection |
|
60 | def test_connection | |
66 | @auth_method = AuthSource.find(params[:id]) |
|
61 | @auth_method = AuthSource.find(params[:id]) | |
67 | begin |
|
62 | begin | |
68 | @auth_method.test_connection |
|
63 | @auth_method.test_connection | |
69 | flash[:notice] = l(:notice_successful_connection) |
|
64 | flash[:notice] = l(:notice_successful_connection) | |
70 | rescue => text |
|
65 | rescue => text | |
71 | flash[:error] = "Unable to connect (#{text})" |
|
66 | flash[:error] = "Unable to connect (#{text})" | |
72 | end |
|
67 | end | |
73 |
redirect_to :action => ' |
|
68 | redirect_to :action => 'index' | |
74 | end |
|
69 | end | |
75 |
|
70 | |||
76 | def destroy |
|
71 | def destroy | |
77 | @auth_source = AuthSource.find(params[:id]) |
|
72 | @auth_source = AuthSource.find(params[:id]) | |
78 | unless @auth_source.users.find(:first) |
|
73 | unless @auth_source.users.find(:first) | |
79 | @auth_source.destroy |
|
74 | @auth_source.destroy | |
80 | flash[:notice] = l(:notice_successful_delete) |
|
75 | flash[:notice] = l(:notice_successful_delete) | |
81 | end |
|
76 | end | |
82 |
redirect_to :action => ' |
|
77 | redirect_to :action => 'index' | |
83 | end |
|
78 | end | |
84 | end |
|
79 | end |
1 | NO CONTENT: file renamed from app/views/auth_sources/list.rhtml to app/views/auth_sources/index.html.erb |
|
NO CONTENT: file renamed from app/views/auth_sources/list.rhtml to app/views/auth_sources/index.html.erb |
@@ -1,27 +1,27 | |||||
1 | <% form_tag({:action => 'edit', :tab => 'authentication'}) do %> |
|
1 | <% form_tag({:action => 'edit', :tab => 'authentication'}) do %> | |
2 |
|
2 | |||
3 | <div class="box tabular settings"> |
|
3 | <div class="box tabular settings"> | |
4 | <p><%= setting_check_box :login_required %></p> |
|
4 | <p><%= setting_check_box :login_required %></p> | |
5 |
|
5 | |||
6 | <p><%= setting_select :autologin, [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]}, :blank => :label_disabled %></p> |
|
6 | <p><%= setting_select :autologin, [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]}, :blank => :label_disabled %></p> | |
7 |
|
7 | |||
8 | <p><%= setting_select :self_registration, [[l(:label_disabled), "0"], |
|
8 | <p><%= setting_select :self_registration, [[l(:label_disabled), "0"], | |
9 | [l(:label_registration_activation_by_email), "1"], |
|
9 | [l(:label_registration_activation_by_email), "1"], | |
10 | [l(:label_registration_manual_activation), "2"], |
|
10 | [l(:label_registration_manual_activation), "2"], | |
11 | [l(:label_registration_automatic_activation), "3"]] %></p> |
|
11 | [l(:label_registration_automatic_activation), "3"]] %></p> | |
12 |
|
12 | |||
13 | <p><%= setting_text_field :password_min_length, :size => 6 %></p> |
|
13 | <p><%= setting_text_field :password_min_length, :size => 6 %></p> | |
14 |
|
14 | |||
15 | <p><%= setting_check_box :lost_password, :label => :label_password_lost %></p> |
|
15 | <p><%= setting_check_box :lost_password, :label => :label_password_lost %></p> | |
16 |
|
16 | |||
17 | <p><%= setting_check_box :openid, :disabled => !Object.const_defined?(:OpenID) %></p> |
|
17 | <p><%= setting_check_box :openid, :disabled => !Object.const_defined?(:OpenID) %></p> | |
18 |
|
18 | |||
19 | <p><%= setting_check_box :rest_api_enabled %></p> |
|
19 | <p><%= setting_check_box :rest_api_enabled %></p> | |
20 | </div> |
|
20 | </div> | |
21 |
|
21 | |||
22 | <div style="float:right;"> |
|
22 | <div style="float:right;"> | |
23 |
<%= link_to l(:label_ldap_authentication), :controller => 'auth_sources', :action => ' |
|
23 | <%= link_to l(:label_ldap_authentication), :controller => 'auth_sources', :action => 'index' %> | |
24 | </div> |
|
24 | </div> | |
25 |
|
25 | |||
26 | <%= submit_tag l(:button_save) %> |
|
26 | <%= submit_tag l(:button_save) %> | |
27 | <% end %> |
|
27 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now