mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
basic authentication
This commit is contained in:
parent
f6e88b3ff6
commit
aa5f1ad157
5 changed files with 12 additions and 1 deletions
|
|
@ -9,4 +9,10 @@ class ApplicationController < ActionController::Base
|
|||
return false
|
||||
end
|
||||
|
||||
def authenticate(username, password)
|
||||
authenticate_or_request_with_http_basic do |u, p|
|
||||
u == username && p == password
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ class CategoriesController < ApplicationController
|
|||
# GET /categories/1
|
||||
# GET /categories/1.json
|
||||
def show
|
||||
district = @school.district
|
||||
authenticate(district.name.downcase, "#{district.name.downcase}!")
|
||||
@school_category = SchoolCategory.for(@school, @category).first
|
||||
@child_school_categories = SchoolCategory.for_parent_category(@school, @category)
|
||||
@questions = @category.questions
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class DistrictsController < ApplicationController
|
|||
# GET /districts/1
|
||||
# GET /districts/1.json
|
||||
def show
|
||||
authenticate(@district.name.downcase, "#{@district.name.downcase}!")
|
||||
@schools = @district.schools.alphabetic
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ class SchoolsController < ApplicationController
|
|||
# GET /schools/1
|
||||
# GET /schools/1.json
|
||||
def show
|
||||
district = @school.district
|
||||
authenticate(district.name.downcase, "#{district.name.downcase}!")
|
||||
@school_categories = @school.school_categories.for_parent_category(@school, nil).sort
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Category < ApplicationRecord
|
|||
"academic-learning",
|
||||
"citizenship-and-wellbeing",
|
||||
"pilot-family-questions"
|
||||
].index(root_identifier)
|
||||
].index(root_identifier) || 0
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue