Commit e64f72c9 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch '330937-remove-allow_group_deploy_token-ff' into 'master'

Remove allow_group_deploy_token feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!63727
parents e09872c2 0317654a
...@@ -9,8 +9,6 @@ class GroupDeployToken < ApplicationRecord ...@@ -9,8 +9,6 @@ class GroupDeployToken < ApplicationRecord
validates :deploy_token_id, uniqueness: { scope: [:group_id] } validates :deploy_token_id, uniqueness: { scope: [:group_id] }
def has_access_to?(requested_project) def has_access_to?(requested_project)
return false unless Feature.enabled?(:allow_group_deploy_token, default_enabled: true)
requested_project_group = requested_project&.group requested_project_group = requested_project&.group
return false unless requested_project_group return false unless requested_project_group
return true if requested_project_group.id == group_id return true if requested_project_group.id == group_id
......
---
name: allow_group_deploy_token
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23460
rollout_issue_url:
milestone: '12.8'
type: development
group: group::release
default_enabled: true
...@@ -248,68 +248,54 @@ RSpec.describe DeployToken do ...@@ -248,68 +248,54 @@ RSpec.describe DeployToken do
deploy_token.groups << group deploy_token.groups << group
end end
context 'and the allow_group_deploy_token feature flag is turned off' do context 'and the passed-in project does not belong to any group' do
it 'is false' do it { is_expected.to be_falsy }
stub_feature_flags(allow_group_deploy_token: false)
is_expected.to be_falsy
end
end end
context 'and the allow_group_deploy_token feature flag is turned on' do context 'and the passed-in project belongs to the token group' do
before do it 'is true' do
stub_feature_flags(allow_group_deploy_token: true) group.projects << project
end
context 'and the passed-in project does not belong to any group' do is_expected.to be_truthy
it { is_expected.to be_falsy }
end end
end
context 'and the passed-in project belongs to the token group' do context 'and the passed-in project belongs to a subgroup' do
it 'is true' do let(:child_group) { create(:group, parent_id: group.id) }
group.projects << project let(:grandchild_group) { create(:group, parent_id: child_group.id) }
is_expected.to be_truthy before do
end grandchild_group.projects << project
end end
context 'and the passed-in project belongs to a subgroup' do context 'and the token group is an ancestor (grand-parent) of this group' do
let(:child_group) { create(:group, parent_id: group.id) } it { is_expected.to be_truthy }
let(:grandchild_group) { create(:group, parent_id: child_group.id) } end
before do
grandchild_group.projects << project
end
context 'and the token group is an ancestor (grand-parent) of this group' do
it { is_expected.to be_truthy }
end
context 'and the token group is not ancestor of this group' do context 'and the token group is not ancestor of this group' do
let(:child2_group) { create(:group, parent_id: group.id) } let(:child2_group) { create(:group, parent_id: group.id) }
it 'is false' do it 'is false' do
deploy_token.groups = [child2_group] deploy_token.groups = [child2_group]
is_expected.to be_falsey is_expected.to be_falsey
end
end end
end end
end
context 'and the passed-in project does not belong to the token group' do context 'and the passed-in project does not belong to the token group' do
it { is_expected.to be_falsy } it { is_expected.to be_falsy }
end end
context 'and the project belongs to a group that is parent of the token group' do context 'and the project belongs to a group that is parent of the token group' do
let(:super_group) { create(:group) } let(:super_group) { create(:group) }
let(:deploy_token) { create(:deploy_token, :group) } let(:deploy_token) { create(:deploy_token, :group) }
let(:group) { create(:group, parent_id: super_group.id) } let(:group) { create(:group, parent_id: super_group.id) }
it 'is false' do it 'is false' do
super_group.projects << project super_group.projects << project
is_expected.to be_falsey is_expected.to be_falsey
end
end end
end end
end end
......
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