Commit 762f5222 authored by Corinna Wiesner's avatar Corinna Wiesner

Exclude bot users from using a license seat

GitLab generated bot users do not use license seat.
parent e01f24f8
......@@ -275,7 +275,7 @@ module EE
def using_license_seat?
return false unless active?
return false if support_bot? || ghost?
return false if internal?
return false unless License.current
if License.current.exclude_guests_from_active_count?
......
---
title: Exclude GitLab generated bot users from using a license seat
merge_request: 24275
author:
type: changed
......@@ -638,13 +638,22 @@ describe User do
end
context 'when user is active' do
context 'when user is a support bot' do
let(:user) { create(:user, bot_type: 'support_bot') }
context 'when user is internal' do
using RSpec::Parameterized::TableSyntax
where(:bot_type) do
User.bot_types.keys
end
with_them do
context 'when user is a bot' do
let(:user) { create(:user, bot_type: bot_type) }
it 'returns false' do
expect(user.using_license_seat?).to eq false
end
end
end
context 'when user is a ghost' do
let(:user) { create(:user, ghost: true) }
......@@ -653,7 +662,9 @@ describe User do
expect(user.using_license_seat?).to eq false
end
end
end
context 'when user is not internal' do
context 'when license is nil (core/free/default)' do
before do
allow(License).to receive(:current).and_return(nil)
......@@ -697,6 +708,7 @@ describe User do
end
end
end
end
describe '#using_gitlab_com_seat?' do
let(:user) { create(:user) }
......
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