Refactoring to avoid the use of `json_query`. As a bonus point, we now also ensure `NoAccess` role has no provilege.