app/controllers/class_lists_controller.rb
# Shows student profile information beyond what's used in the class list creating
# directly.
# Authorization is checked differently here, and is more permissive than the
# standard approach but with log trails to see how these queries fit within the class list
# creating process.
Shows student profile information beyond what's used in the class list creating
directly.
Authorization is checked differently here, and is more permissive than the
standard approach but with log trails to see how these queries fit within the class list
creating process.
Shows student profile information beyond what ' s used in the class list creating directly . Authorization is checked differently here and is more permissive than the standard approach but with log trails to see how these queries fit within the class list creating process .
def profile_json
    params.require(:workspace_id)
    params.require(:student_id)
    params.require(:limit)
    params.permit(:time_now)
    workspace_id = params[:workspace_id]
    student_id = params[:student_id].to_i
    student = Student.find(student_id)
    raise Exceptions::EducatorNotAuthorized unless queries.is_authorized_for_grade_level_now?(student.school_id, student.grade)
    class_list = queries.read_authorized_class_list(workspace_id)
    raise Exceptions::EducatorNotAuthorized if class_list.nil?
    raise Exceptions::EducatorNotAuthorized if class_list.school_id != student.school_id
    raise Exceptions::EducatorNotAuthorized if class_list.grade_level_next_year != GradeLevels.new.next(student.grade)
    time_now = time_now_or_param(params[:time_now])
    limit = params[:limit].to_i
    feed = Feed.new([student])
    feed_cards = feed.all_cards(time_now, limit)
    render json: {
      feed_cards: feed_cards
    }
  end
def profile_json params . require ( :workspace_id ) params . require ( :student_id ) params . require ( :limit ) params . permit ( :time_now ) workspace_id = params [ :workspace_id ] student_id = params [ :student_id ] . to_i student = Student . find ( student_id ) raise Exceptions :: EducatorNotAuthorized unless queries . is_authorized_for_grade_level_now? ( student . school_id , student . grade ) class_list = queries . read_authorized_class_list ( workspace_id ) raise Exceptions :: EducatorNotAuthorized if class_list . nil? raise Exceptions :: EducatorNotAuthorized if class_list . school_id != student . school_id raise Exceptions :: EducatorNotAuthorized if class_list . grade_level_next_year != GradeLevels . new . next ( student . grade ) time_now = time_now_or_param ( params [ :time_now ] ) limit = params [ :limit ] . to_i feed = Feed . new ( [ student ] ) feed_cards = feed . all_cards ( time_now , limit ) render json : { feed_cards : feed_cards } end
Shows student profile information beyond what's used in the class list creating
directly.
Shows student profile information beyond what ' s used in the class list creating directly .
# Check that the educator is authorized to see the grade and school for this student # Check that they gave a valid `workspace_id` and that it matches # the school and grade level for the student they're asking about. # Load feed cards just for this student