Fix approval group logging and approval group being bypassed #154
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.
LogDebug
Message that is logging the wrong group in the message. It's currently logging the group that the user is a member of and not the approval groups that can approve the command.Description
Fixed the LogDebug line that was showing the Groups that the user belonged in, and not the approval groups.
Next, changed the logic on the Approval Group check to say Hey, are you in the ApprovalGroup? Yeah? Ok, is Peerapproval enabled? Yeah? Then we better get a buddy to approve. Otherwise, you don't need approval, let's execute!
Conversely, Oh you aren't in the Approval Group? Then you definitly need to have approval to run this command.
The reason this logic works is because its already been determined that you have permission to execute this command before the
ApprovalNeeded
function is even called. Meaning, you wouldn't have gotten here if you didn't, so we're just trying to figure out if:Related Issue
#153
Motivation and Context
This bug allows any user with permission to execute a command even when the command has an approval configuration setup.
How Has This Been Tested?
We tested by running through the scenarios layed out in the corresponding issue link.
Screenshots (if appropriate):
Types of changes
Checklist: