Commit 2c0ebb9c authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Skip shared group validation for approval format

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/350596

**Problem**

User access to shared group validation applies only to the group
itself and does not check if the user has inherited access rights.

**Solution**

Skip validation before we find a way to correctly verify user
permissions.
parent b711569d
......@@ -50,6 +50,10 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:usage_data_diff_searches, @project, default_enabled: :yaml)
end
before_action do
push_frontend_feature_flag(:permit_all_shared_groups_for_approval, @project, default_enabled: :yaml)
end
around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions]
after_action :log_merge_request_show, only: [:show]
......
---
name: permit_all_shared_groups_for_approval
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80655
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/352766
milestone: '14.8'
type: development
group: group::source code
default_enabled: false
......@@ -5,6 +5,7 @@ import Api from 'ee/api';
import { renderAvatar } from '~/helpers/avatar_helper';
import { loadCSSFile } from '~/lib/utils/css_utils';
import { __ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { TYPE_USER, TYPE_GROUP } from '../constants';
function addType(type) {
......@@ -54,6 +55,7 @@ function formatResult(result) {
}
export default {
mixins: [glFeatureFlagsMixin()],
props: {
value: {
type: Array,
......@@ -80,6 +82,11 @@ export default {
default: false,
},
},
computed: {
isFeatureEnabled() {
return this.glFeatures.permitAllSharedGroupsForApproval;
},
},
watch: {
value(val) {
if (val.length > 0) {
......@@ -142,7 +149,7 @@ export default {
skip_groups: this.skipGroupIds,
...(hasTerm ? { search: term } : {}),
with_shared: true,
shared_visible_only: true,
shared_visible_only: !this.isFeatureEnabled,
shared_min_access_level: DEVELOPER_ACCESS_LEVEL,
});
},
......
......@@ -61,6 +61,9 @@ describe('Approvals ApproversSelect', () => {
...options,
propsData,
attachTo: document.body,
provide: {
...options.provide,
},
});
await waitForPromises();
......@@ -139,6 +142,34 @@ describe('Approvals ApproversSelect', () => {
});
});
describe('with permitAllSharedGroupsForApproval', () => {
beforeEach(async () => {
await factory({
provide: {
glFeatures: {
permitAllSharedGroupsForApproval: true,
},
},
});
});
it('fetches all available groups including non-visible shared groups', async (done) => {
waitForEvent($input, 'select2-loaded')
.then(jest.runOnlyPendingTimers)
.then(done)
.catch(done.fail);
search();
expect(Api.projectGroups).toHaveBeenCalledWith(TEST_PROJECT_ID, {
skip_groups: [],
with_shared: true,
shared_visible_only: false,
shared_min_access_level: 30,
});
});
});
describe('with empty seach term and skips', () => {
const skipGroupIds = [7, 8];
const skipUserIds = [9, 10];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment