We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5a1c34d commit 4bcac05Copy full SHA for 4bcac05
1 file changed
config/initializers/good_job.rb
@@ -0,0 +1,17 @@
1
+Rails.application.config.to_prepare do
2
+ GoodJob::ApplicationController.class_eval do
3
+ def current_user
4
+ @current_user ||= User.find_by(canvas_uid: session[:user_id])
5
+ end
6
+
7
+ before_action :require_admin
8
9
+ def require_admin
10
+ if current_user.nil?
11
+ redirect_to '/', alert: 'You must be logged in.'
12
+ elsif !current_user.admin?
13
+ redirect_to '/', alert: 'You are not authorized to view this page.'
14
15
16
17
+end
0 commit comments