The function below returns admin-only "secret" content to any authenticated user, with no role check at all.
The bug: this is the real behavior of OWASP's PyGoat (a deliberately-vulnerable Django app used for security training) — its a1_broken_access_lab3_secret view checks only request.user.is_authenticated before rendering admin-only content. The source literally contains the comment # no checking applied here. Any logged-in user, not just admins, sees the secret page.
Your task: fix solve(user, resource_owner_id) so access is only granted when:
user['id'] == resource_owner_id)Otherwise, return {'allowed': False}.
solve({'id': 'u1', 'is_admin': False}, 'u1')
# → {'allowed': True, 'user_id': 'u1'} (own resource)
solve({'id': 'u1', 'is_admin': False}, 'u2')
# → {'allowed': False} (regular user trying to access someone else's resource)Sample tests