Skip to content
Snippets Groups Projects
Verified Commit 6df87f1a authored by Vijay Hawoldar's avatar Vijay Hawoldar Committed by GitLab
Browse files

Prevent User Caps from being available

Based on certain conditions, we will prevent the User Cap
functionality from being available. This commit sets up the foundation
for implementing this logic over coming iterations.
parent af5de3cf
No related branches found
No related tags found
1 merge request!147560Prevent User Caps from being available
......@@ -511,10 +511,15 @@ def root_storage_size
def user_cap_available?
return false unless group_namespace?
return false unless ::Gitlab.com?
return false if ramon?
::Feature.enabled?(:saas_user_caps, root_ancestor)
end
def ramon?
::Feature.enabled?(:ramon, self, type: :wip)
end
def block_seat_overages?
false
end
......
---
name: ramon
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/443705
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147560
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/451519
milestone: '16.11'
group: group::utilization
type: wip
default_enabled: false
......@@ -11,7 +11,7 @@
end
before do
stub_feature_flags(usage_quotas_for_all_editions: false)
stub_feature_flags(usage_quotas_for_all_editions: false, ramon: false)
group.add_owner(user)
sign_in(user)
......
......@@ -16,6 +16,10 @@
let_it_be(:developer) { create(:user) }
let_it_be(:subgroup_owner) { create(:user) }
before do
stub_feature_flags(ramon: false)
end
before_all do
group.add_owner(owner)
group.add_developer(developer)
......
......@@ -491,7 +491,7 @@
context 'when the :saas_user_caps feature flag is enabled for the root group' do
before do
stub_feature_flags(saas_user_caps: group)
stub_feature_flags(saas_user_caps: group, ramon: false)
end
context 'when the user cap has not been reached' do
......@@ -656,6 +656,8 @@ def webhook_data(group_member, event)
let(:root_ancestor) { group }
before do
stub_feature_flags(ramon: false)
allow(root_ancestor).to receive(:user_cap_reached?).and_return(user_cap_reached)
end
......
......@@ -1761,6 +1761,7 @@
context 'when :saas_user_caps is enabled' do
before do
stub_feature_flags(saas_user_caps: true)
stub_feature_flags(ramon: false)
end
it { is_expected.to be true }
......@@ -1771,6 +1772,14 @@
it { is_expected.to be false }
end
context 'when Ramon is available' do
before do
stub_feature_flags(ramon: true)
end
it { is_expected.to be false }
end
end
end
......@@ -2107,6 +2116,22 @@
end
end
describe '#ramon?' do
it 'returns true' do
expect(namespace.ramon?).to eq(true)
end
context 'when :ramon feature flag is disabled' do
before do
stub_feature_flags(ramon: false)
end
it 'returns false' do
expect(namespace.ramon?).to eq(false)
end
end
end
describe '#block_seat_overages?' do
it 'returns false' do
expect(namespace.block_seat_overages?).to eq(false)
......
......@@ -23,6 +23,8 @@
allow(Gitlab).to receive(:com?).and_return(true)
stub_cache(group)
stub_cache(other_group)
stub_feature_flags(ramon: false)
end
it 'renders a link to pending user approvals' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment