QuizzesAuthorisation and the Data Access Layer — Concept Check
intermediate
nextjs

Authorisation and the Data Access Layer — Concept Check

Questions on Authorisation and the Data Access Layer. Checks scattered across pages, actions and handlers get forgotten. Routing every read through one layer that requires the session makes forgetting impossible.

7 minutes 7 questions Pass at 70%
Time Limit
7 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

7 questions on Authorisation and the Data Access Layer — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer forgot to include an authorization check in a new API endpoint. What structural pattern can help prevent this oversight?

    • AHardcoding authorization in each component
    • BUsing a Data Access Layer that reads the session itself
    • CRelying on middleware for authorization checks
    • DImplementing client-side authorization checks
  2. 2.In the provided code snippet, why is it important to check ownership and not just role when accessing a submission?

    • ARole checks automatically verify ownership
    • BOwnership checks are redundant if role is verified
    • CRole checks are sufficient for all authorization needs
    • DOwnership checks ensure the user is accessing their own data
  3. 3.A developer implements a feature that hides content in the UI for non-Pro users. Why is this insufficient for security?

    • AClient-side checks are more secure than server-side
    • BHiding content in UI is equivalent to server-side control
    • CThe server must also refuse to send gated content
    • DUI changes automatically enforce server-side restrictions
  4. 4.A new handler is added to the application. How does the Data Access Layer pattern benefit this addition?

    • AThe new handler inherits authorization checks automatically
    • BThe handler requires manual authorization checks
    • CAuthorization checks must be added separately
    • DDAL patterns complicate new handler additions
  5. 5.Why should fields be stripped in the Data Access Layer rather than in the component?

    • AStripping fields in components is more efficient
    • BComponents are better suited for data manipulation
    • CTo prevent sensitive data from reaching client components
    • DField stripping is unnecessary if authorization is correct
  6. 6.A developer assumes that client-side counters are sufficient for metered limits. What is the flaw in this assumption?

    • AClient-side counters are always accurate
    • BClient-side counters are more reliable
    • CMetered limits are not necessary
    • DServer-side counts are the true limits
  7. 7.What is the primary role of the Data Access Layer in the context of authorization?

    • ATo centralize authorization checks and prevent bypass
    • BTo simplify client-side data fetching
    • CTo handle database connections efficiently
    • DTo manage user sessions across components