mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
adding more authentication, fixing category bug
This commit is contained in:
parent
60a2982724
commit
42fd3edbae
10 changed files with 28 additions and 93 deletions
|
|
@ -1,12 +1,9 @@
|
|||
class SchedulesController < ApplicationController
|
||||
before_action :authenticate_user!, except: [:show]
|
||||
before_action :set_school
|
||||
before_action :verify_admin
|
||||
before_action :set_schedule, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET schools/1/schedules
|
||||
def index
|
||||
@schedules = @school.schedules
|
||||
end
|
||||
|
||||
# GET schools/1/schedules/1
|
||||
def show
|
||||
end
|
||||
|
|
@ -61,4 +58,11 @@ class SchedulesController < ApplicationController
|
|||
def schedule_params
|
||||
params.require(:schedule).permit(:name, :description, :school_id, :frequency_hours, :start_date, :end_date, :active, :random, :recipient_list_id, :question_list_id)
|
||||
end
|
||||
|
||||
def verify_admin
|
||||
return true if current_user.admin?(@school)
|
||||
|
||||
redirect_to root_path, notice: 'You must be logged in as an admin of that school to access that page.'
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue