Skip to content

Commit 540ad49

Browse files
author
Chris Talib
committed
putting the curator test in all the relevant controllers
1 parent 4e79fcd commit 540ad49

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

app/controllers/points_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class PointsController < ApplicationController
22
before_action :authenticate_user!, except: [:index, :show]
3+
before_action :set_curator, except: [:index, :show]
34
before_action :set_point, only: [:show, :edit, :featured, :update, :destroy]
45
before_action :points_get, only: [:index]
56

@@ -98,4 +99,10 @@ def points_get
9899
@points = Point.all.where(status: "pending")
99100
end
100101
end
102+
103+
def set_curator
104+
unless current_user.curator?
105+
render :file => "public/401.html", :status => :unauthorized
106+
end
107+
end
101108
end

app/controllers/reasons_controller.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class ReasonsController < ApplicationController
22
before_action :authenticate_user!, except: [:index, :show]
3+
before_action :set_curator, except: [:index, :show]
34
before_action :set_point, only: [:new, :create]
45
before_action :set_admin
56
def new
@@ -38,7 +39,14 @@ def set_point
3839
def reason_params
3940
params.require(:reason).permit(:content)
4041
end
42+
4143
def point_params
4244
params.require(:point).permit(:status)
4345
end
46+
47+
def set_curator
48+
unless current_user.curator?
49+
render :file => "public/401.html", :status => :unauthorized
50+
end
51+
end
4452
end

app/controllers/topics_controller.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class TopicsController < ApplicationController
22
before_action :authenticate_user!, except: [:index, :show]
3+
before_action :set_curator, except: [:index, :show]
34
before_action :set_topic, only: [:show, :edit, :update, :destroy]
45

56
def index
@@ -61,4 +62,9 @@ def topic_params
6162
params.require(:topic).permit(:title, :subtitle, :description, :query, :privacy_related)
6263
end
6364

65+
def set_curator
66+
unless current_user.curator?
67+
render :file => "public/401.html", :status => :unauthorized
68+
end
69+
end
6470
end

0 commit comments

Comments
 (0)