Practice ยท 1 of 3
Ownership Guard
Write canRead(record, user) โ record is { id, ownerId, visibility } where visibility is "public" | "private"; user is { id, role } with role "admin" | "user". Return true when: record is public; OR the user owns it; OR the user is an admin. Otherwise false.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Authorization Guards โ Practice