For super admins with no role set, treat them as administrators #689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
As discussed in #658, there's currently no option to set Super Admins in our role-based access for individual Features. This can result in Super Admins not having access to Features if they haven't been added as an administrator (or other allowed role) on a specific site.
We could allow Super Admins to have access to all Features but this feels a little heavy-handed. The approach we landed on and what is implemented in this PR is that anytime we check if a user has access based on their role, if we are on a multisite and the current user is a Super Admin and that user has no specific role set for that site, we set their role to administrator for checking purposes.
If a Super Admin has already been granted a specific role on a site, we use that role for checking and don't add an additional role on top of that. In addition, if a Feature has not granted access to administrators, Super Admins also won't have access.
Closes #658
How to test the Change
Changelog Entry
Credits
Props @dkotter, @jeffpaul, @gsarig
Checklist: