Description:
added 'user_setting_enabled' option
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@295 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r156:e751e4e9d100 - - 3 files changed: 18 inserted, 6 deleted
@@ -1,6 +1,6 | |||
|
1 | 1 | class UsersController < ApplicationController |
|
2 | 2 | |
|
3 | - before_filter :authenticate | |
|
3 | + before_filter :authenticate, :except => [:new, :register] | |
|
4 | 4 | |
|
5 | 5 | verify :method => :post, :only => [:chg_passwd], |
|
6 | 6 | :redirect_to => { :action => :index } |
@@ -9,10 +9,11 | |||
|
9 | 9 | in_place_edit_for :user, :email_for_editing |
|
10 | 10 | |
|
11 | 11 | def index |
|
12 | - # uncomment below to disable settings | |
|
13 |
- |
|
|
14 | - | |
|
15 | - @user = User.find(session[:user_id]) | |
|
12 | + if !Configuration['system.user_setting_enabled'] | |
|
13 | + redirect_to :controller => 'main', :action => 'list' | |
|
14 | + else | |
|
15 | + @user = User.find(session[:user_id]) | |
|
16 | + end | |
|
16 | 17 | end |
|
17 | 18 | |
|
18 | 19 | def chg_passwd |
@@ -30,7 +30,10 | |||
|
30 | 30 | append_to menu_items, '[Test]', 'test', 'index' |
|
31 | 31 | end |
|
32 | 32 | append_to menu_items, '[Help]', 'main', 'help' |
|
33 | - append_to menu_items, '[Settings]', 'users', 'index' | |
|
33 | + | |
|
34 | + if Configuration['system.user_setting_enabled'] | |
|
35 | + append_to menu_items, '[Settings]', 'users', 'index' | |
|
36 | + end | |
|
34 | 37 | append_to menu_items, '[Log out]', 'main', 'login' |
|
35 | 38 | |
|
36 | 39 | menu_items |
@@ -14,10 +14,18 | |||
|
14 | 14 | Configuration.create(:key => 'system.online_registration', |
|
15 | 15 | :value_type => 'boolean', |
|
16 | 16 | :value => 'false') |
|
17 | + | |
|
18 | + # If Configuration['system.user_setting_enabled'] is true, | |
|
19 | + # users can change their settings | |
|
20 | + | |
|
21 | + Configuration.create(:key => 'system.user_setting_enabled', | |
|
22 | + :value_type => 'boolean', | |
|
23 | + :value => 'true') | |
|
17 | 24 | end |
|
18 | 25 | |
|
19 | 26 | def self.down |
|
20 | 27 | Configuration.find_by_key('contest.multisites').destroy |
|
21 | 28 | Configuration.find_by_key('system.online_registration').destroy |
|
29 | + Configuration.find_by_key('system.user_setting_enabled').destroy | |
|
22 | 30 | end |
|
23 | 31 | end |
You need to be logged in to leave comments.
Login now