Description:
[web] disable sites_controller from normal users git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@247 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r119:cf9b6fbe5680 - - 1 file changed: 3 inserted, 0 deleted

@@ -1,87 +1,90
1 1 class SitesController < ApplicationController
2 +
3 + before_filter :admin_authorization
4 +
2 5 # GET /sites
3 6 # GET /sites.xml
4 7 def index
5 8 @sites = Site.find(:all)
6 9
7 10 respond_to do |format|
8 11 format.html # index.html.erb
9 12 format.xml { render :xml => @sites }
10 13 end
11 14 end
12 15
13 16 # GET /sites/1
14 17 # GET /sites/1.xml
15 18 def show
16 19 @site = Site.find(params[:id])
17 20
18 21 respond_to do |format|
19 22 format.html # show.html.erb
20 23 format.xml { render :xml => @site }
21 24 end
22 25 end
23 26
24 27 # GET /sites/new
25 28 # GET /sites/new.xml
26 29 def new
27 30 @site = Site.new
28 31
29 32 respond_to do |format|
30 33 format.html # new.html.erb
31 34 format.xml { render :xml => @site }
32 35 end
33 36 end
34 37
35 38 # GET /sites/1/edit
36 39 def edit
37 40 @site = Site.find(params[:id])
38 41 end
39 42
40 43 # POST /sites
41 44 # POST /sites.xml
42 45 def create
43 46 @site = Site.new(params[:site])
44 47 @site.clear_start_time_if_not_started
45 48
46 49 respond_to do |format|
47 50 if @site.save
48 51 flash[:notice] = 'Site was successfully created.'
49 52 format.html { redirect_to(@site) }
50 53 format.xml { render :xml => @site, :status => :created, :location => @site }
51 54 else
52 55 format.html { render :action => "new" }
53 56 format.xml { render :xml => @site.errors, :status => :unprocessable_entity }
54 57 end
55 58 end
56 59 end
57 60
58 61 # PUT /sites/1
59 62 # PUT /sites/1.xml
60 63 def update
61 64 @site = Site.find(params[:id])
62 65 @site.clear_start_time_if_not_started
63 66
64 67 respond_to do |format|
65 68 if @site.update_attributes(params[:site])
66 69 flash[:notice] = 'Site was successfully updated.'
67 70 format.html { redirect_to(@site) }
68 71 format.xml { head :ok }
69 72 else
70 73 format.html { render :action => "edit" }
71 74 format.xml { render :xml => @site.errors, :status => :unprocessable_entity }
72 75 end
73 76 end
74 77 end
75 78
76 79 # DELETE /sites/1
77 80 # DELETE /sites/1.xml
78 81 def destroy
79 82 @site = Site.find(params[:id])
80 83 @site.destroy
81 84
82 85 respond_to do |format|
83 86 format.html { redirect_to(sites_url) }
84 87 format.xml { head :ok }
85 88 end
86 89 end
87 90 end
You need to be logged in to leave comments. Login now