Refactor and Add Specs to Test Inherited Permissions for Commits See merge request gitlab-org/gitlab!96713