Commit 8a80b873 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'no_seat_usage_for_free_plan_members' into 'master'

Users without a license do not use a seat

Closes #196824

See merge request gitlab-org/gitlab!23146
parents c6eaabd0 85219d2a
......@@ -275,8 +275,9 @@ module EE
def using_license_seat?
return false unless active?
return false unless License.current
if License.current&.exclude_guests_from_active_count?
if License.current.exclude_guests_from_active_count?
highest_role > ::Gitlab::Access::GUEST
else
true
......
---
title: Users without a license do not use a seat
merge_request: 23146
author:
type: fixed
......@@ -638,6 +638,16 @@ describe User do
end
context 'when user is active' do
context 'when license is nil (core/free/default)' do
before do
allow(License).to receive(:current).and_return(nil)
end
it 'returns false if license is nil (core/free/default)' do
expect(user.using_license_seat?).to eq false
end
end
context 'user is guest' do
let(:project_guest_user) { create(:project_member, :guest).user }
......@@ -647,7 +657,7 @@ describe User do
expect(project_guest_user.using_license_seat?).to eq false
end
it 'returns true if license is not ultimate' do
it 'returns true if license is not ultimate and not nil' do
create(:license, plan: License::STARTER_PLAN)
expect(project_guest_user.using_license_seat?).to eq true
......@@ -663,7 +673,7 @@ describe User do
expect(user.using_license_seat?).to eq false
end
it 'returns true if license is not ultimate' do
it 'returns true if license is not ultimate and not nil' do
create(:license, plan: License::STARTER_PLAN)
expect(user.using_license_seat?).to eq true
......
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