Access and evidence policies · Original fictional data · Free files and full answers
List access attempts backed only by expired direct grants
Return request_id,expired_grant_id when an exact-resource direct allow to that user exists but expires<=request day. This is an expired-evidence report even if a group separately allows access. Sort both.
Use this fixed business case to build a checked CSV and a replayable SQL handoff. No account required. Scenario datasets are shared across related exercises; each exercise has its own decision and output contract.
Your output contract
- Return request_id,expired_grant_id when an exact-resource direct allow to that user exists but expires<=request day. This is an expired-evidence report even if a group separately allows access. Sort both.
- Return exactly the declared columns and order. Money uses integer cents; time and date units follow the task and field dictionary. NULL is unknown and differs from numeric zero.
- These are original fictional records and exercise policies. Scenario data may be shared with related tasks, whose decisions and output contracts differ.
Return columns exactly as request_id, expired_grant_id. Sort order follows the task. Output has 1 rows; an empty CSV field means NULL.
Source data
grants
10 source rows · Download grants CSV
| id INTEGER | principal TEXT | resource TEXT | effect TEXT | expires INTEGER | mask INTEGER |
|---|---|---|---|---|---|
| 1 | alice | docs | allow | 20 | 1 |
| 2 | team | docs | allow | 50 | 2 |
| 3 | alice | secret | deny | 50 | 3 |
| 4 | team | secret | allow | 50 | 1 |
| 5 | bob | docs | allow | 5 | 0 |
| 6 | reviewer | finance | allow | 50 | 2 |
| 7 | public | open | allow | 50 | 0 |
| 8 | team | old | allow | 8 | 1 |
| 9 | alice | finance | allow | 50 | 1 |
| 10 | alice | archive | allow | 50 | 1 |
members
3 source rows · Download members CSV
| member TEXT | parent TEXT |
|---|---|
| alice | team |
| bob | team |
| team | reviewer |
requests
8 source rows · Download requests CSV
| id INTEGER | user TEXT | resource TEXT | day INTEGER |
|---|---|---|---|
| 1 | alice | docs | 10 |
| 2 | alice | secret | 10 |
| 3 | bob | docs | 10 |
| 4 | bob | finance | 10 |
| 5 | alice | old | 10 |
| 6 | outsider | open | 10 |
| 7 | outsider | docs | 10 |
| 8 | alice | finance | 10 |
approvals
4 source rows · Download approvals CSV
| id INTEGER | requester TEXT | approver TEXT | resource TEXT |
|---|---|---|---|
| 1 | alice | alice | finance |
| 2 | alice | bob | finance |
| 3 | bob | outsider | docs |
| 4 | bob | alice | secret |
Field dictionary and schema
grants: id INTEGER — Stable source record identifier; not a row position. principal TEXT — Literal business key or category label. Match exactly and retain NULL where present. resource TEXT — Literal business key or category label. Match exactly and retain NULL where present. effect TEXT — Permission outcome, allow or deny. expires INTEGER — Expiry boundary; the goal declares whether equality is eligible. mask INTEGER — Privacy mask level; higher values require stricter masking. members: member TEXT — Literal business key or category label. Match exactly and retain NULL where present. parent TEXT — Immediate parent identifier, or NULL for a hierarchy root. requests: id INTEGER — Stable source record identifier; not a row position. user TEXT — Literal business key or category label. Match exactly and retain NULL where present. resource TEXT — Literal business key or category label. Match exactly and retain NULL where present. day INTEGER — Integer day index, or ISO YYYY-MM-DD date when stored as text; the task declares cutoff semantics. approvals: id INTEGER — Stable source record identifier; not a row position. requester TEXT — Literal business key or category label. Match exactly and retain NULL where present. approver TEXT — Literal business key or category label. Match exactly and retain NULL where present. resource TEXT — Literal business key or category label. Match exactly and retain NULL where present.
A method you can reuse
- Return request_id,expired_grant_id when an exact-resource direct allow to that user exists but expires<=request day. This is an expired-evidence report even if a group separately allows access. Sort both.
- For the first output record, request_id = 3; expired_grant_id = 5.
- Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.
Watch for this wrong turn
Checking only final access decisions hides expired direct credentials that are still being presented.
Run and check in SQLite
Your SQL runs locally in the existing SQLite worker. The checker compares every column, row, type, value and row order with this fixed output. It accepts equivalent SELECT or WITH queries. Browser storage keeps your SQL on this device when available.
Complete worked SQL and expected output
SELECT r.id request_id,g.id expired_grant_id FROM requests r JOIN grants g ON g.principal=r.user AND g.resource=r.resource AND g.effect='allow' AND g.expires<=r.day ORDER BY r.id,g.id;
"request_id","expired_grant_id" "3","5"Reference SQL · Complete expected CSV · Empty answer CSV
Choose another SQL task · Original data exception cases · Larger workplace projects