I have 3 aggregates, User, Role and Permission. User has a list of granted role ids, Role has a list of granted role ids and permission ids. We support at most 3 levels of roles in the hierarchy.
Is that possible to write an index to query permissions by user id? and what does the index look like?