Skip to content

Improve ProtectedRefAccess#type logic

Joe Woodward requested to merge chore/461213-refactor-type into master

What does this MR do and why?

Related to branchRuleUpdate mutation bug - unexpected Acc... (#461213)

Improve ProtectedRefAccess#type logic

Prior to this change we only checked if user or group was present. This is not sufficient to ensure the correct type is returned. If a ProtectedRefAccess level has a user_id or group_id assigned and the user or group is not loaded (or doesn't exist) then :role would be returned incorrectly.

This change checks both user_id and user, and group_id and group when inferring the type.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Joe Woodward

Merge request reports