Commit 85219d2a authored by Corinna Wiesner's avatar Corinna Wiesner

Users without a license do not use a seat

parent 9ff2ee0c
...@@ -275,8 +275,9 @@ module EE ...@@ -275,8 +275,9 @@ module EE
def using_license_seat? def using_license_seat?
return false unless active? 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 highest_role > ::Gitlab::Access::GUEST
else else
true true
......
---
title: Users without a license do not use a seat
merge_request: 23146
author:
type: fixed
...@@ -638,6 +638,16 @@ describe User do ...@@ -638,6 +638,16 @@ describe User do
end end
context 'when user is active' do 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 context 'user is guest' do
let(:project_guest_user) { create(:project_member, :guest).user } let(:project_guest_user) { create(:project_member, :guest).user }
...@@ -647,7 +657,7 @@ describe User do ...@@ -647,7 +657,7 @@ describe User do
expect(project_guest_user.using_license_seat?).to eq false expect(project_guest_user.using_license_seat?).to eq false
end 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) create(:license, plan: License::STARTER_PLAN)
expect(project_guest_user.using_license_seat?).to eq true expect(project_guest_user.using_license_seat?).to eq true
...@@ -663,7 +673,7 @@ describe User do ...@@ -663,7 +673,7 @@ describe User do
expect(user.using_license_seat?).to eq false expect(user.using_license_seat?).to eq false
end 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) create(:license, plan: License::STARTER_PLAN)
expect(user.using_license_seat?).to eq true 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