LEARN. PRACTICE. EXPLAIN.
Learning paths & interview practiceP
← Build a support-ticket app
BUILD → VERIFY → EXPLAIN · STEP 3 OF 6

Enforce ownership and staff permissions

Evaluate the requested record against trusted server identity.

UNDERSTAND

Bring these concepts with you

BUILD

Your implementation

  1. Implement getTicket with a scope predicate: organization must match, and the caller must be the owner or staff.
  2. Use alice and bob to test customer isolation, support to test staff access, and outsider to test isolation across organizations. All use the displayed fake demo password.
  3. Return the same 404 for missing and inaccessible records. Roles come from seeded server records; no public form can grant staff access.
function getTicket(actor, id) { /* SELECT with owner and tenant scope */ }
Need a hint?
  • A valid cookie proves a session, not permission to every ticket.
  • Apply the scope to the SQL query itself. Do not fetch an unrestricted record and trust a browser-provided owner ID.

Saved on this device · 0 / 6000 · Do not include passwords or private data.

VERIFY

Acceptance checks

From the folder containing your downloaded files, run:

node checks.mjs ./starter.mjs 3

This runs checks up to this step. Earlier steps must work first. Mark each result only after checking your implementation; the website does not run or grade it.

Record your attempt to enable the checklist and reference comparison.

Compare with the reference

Attempt the step first, then compare decisions and behavior. There can be more than one correct implementation.

EXPLAIN

Your interviewer asks

A customer changes the ticket ID in the URL. What prevents disclosure, including for staff from another tenant?

Say your answer aloud, then record the trade-offs and evidence in your notes above.

LOCAL VOICE REHEARSAL

Rehearse your step walkthrough aloud

Target pacing: 02:00 · Stays in this browser only; never uploaded.

00:00/ 02:00
AlifBay Prep