##// END OF EJS Templates
Prevent admin users from locking their own account (#1276)....
Jean-Philippe Lang -
r1434:7f134a8c6795
parent child
Show More
@@ -1,57 +1,57
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module UsersHelper
19 19 def status_options_for_select(selected)
20 20 options_for_select([[l(:label_all), ''],
21 21 [l(:status_active), 1],
22 22 [l(:status_registered), 2],
23 23 [l(:status_locked), 3]], selected)
24 24 end
25 25
26 26 # Options for the new membership projects combo-box
27 27 def projects_options_for_select(projects)
28 28 options = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---")
29 29 projects_by_root = projects.group_by(&:root)
30 30 projects_by_root.keys.sort.each do |root|
31 31 options << content_tag('option', h(root.name), :value => root.id, :disabled => (!projects.include?(root)))
32 32 projects_by_root[root].sort.each do |project|
33 33 next if project == root
34 34 options << content_tag('option', '&#187; ' + h(project.name), :value => project.id)
35 35 end
36 36 end
37 37 options
38 38 end
39 39
40 40 def change_status_link(user)
41 41 url = {:action => 'edit', :id => user, :page => params[:page], :status => params[:status]}
42 42
43 43 if user.locked?
44 44 link_to l(:button_unlock), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :post, :class => 'icon icon-unlock'
45 45 elsif user.registered?
46 46 link_to l(:button_activate), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :post, :class => 'icon icon-unlock'
47 else
47 elsif user != User.current
48 48 link_to l(:button_lock), url.merge(:user => {:status => User::STATUS_LOCKED}), :method => :post, :class => 'icon icon-lock'
49 49 end
50 50 end
51 51
52 52 def user_settings_tabs
53 53 tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general},
54 54 {:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural}
55 55 ]
56 56 end
57 57 end
General Comments 0
You need to be logged in to leave comments. Login now