[#27307] Rework how permissions are provided to prevent failures if modu...

...les are disabled. Also makes permissions simpler.

No functional changes. This patch simply reworks the structure of the permissions provider.