Commit aaa19aef authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'tpresa-user-without-project-license-seat' into 'master'

Users without projects use a license seat in a non-premium license

Closes #196531

See merge request gitlab-org/gitlab!20664
parents 59efa358 d3a629a9
---
title: Users without projects use a license seat in a non-premium license
merge_request: 20664
author:
type: fixed
...@@ -279,7 +279,7 @@ module EE ...@@ -279,7 +279,7 @@ module EE
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
highest_role > ::Gitlab::Access::NO_ACCESS true
end end
end end
......
...@@ -626,9 +626,9 @@ describe User do ...@@ -626,9 +626,9 @@ describe User do
end end
context 'when user is active' do context 'when user is active' do
let(:project_guest_user) { create(:project_member, :guest).user }
context 'user is guest' do context 'user is guest' do
let(:project_guest_user) { create(:project_member, :guest).user }
it 'returns false if license is ultimate' do it 'returns false if license is ultimate' do
create(:license, plan: License::ULTIMATE_PLAN) create(:license, plan: License::ULTIMATE_PLAN)
...@@ -641,6 +641,22 @@ describe User do ...@@ -641,6 +641,22 @@ describe User do
expect(project_guest_user.using_license_seat?).to eq true expect(project_guest_user.using_license_seat?).to eq true
end end
end end
context 'user is admin without projects' do
let(:user) { create(:user, admin: true) }
it 'returns false if license is ultimate' do
create(:license, plan: License::ULTIMATE_PLAN)
expect(user.using_license_seat?).to eq false
end
it 'returns true if license is not ultimate' do
create(:license, plan: License::STARTER_PLAN)
expect(user.using_license_seat?).to eq true
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