Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
85219d2a
Commit
85219d2a
authored
Jan 16, 2020
by
Corinna Wiesner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Users without a license do not use a seat
parent
9ff2ee0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
ee/app/models/ee/user.rb
ee/app/models/ee/user.rb
+2
-1
ee/changelogs/unreleased/no_seat_usage_for_free_plan_members.yml
...gelogs/unreleased/no_seat_usage_for_free_plan_members.yml
+5
-0
ee/spec/models/user_spec.rb
ee/spec/models/user_spec.rb
+12
-2
No files found.
ee/app/models/ee/user.rb
View file @
85219d2a
...
@@ -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
...
...
ee/changelogs/unreleased/no_seat_usage_for_free_plan_members.yml
0 → 100644
View file @
85219d2a
---
title
:
Users without a license do not use a seat
merge_request
:
23146
author
:
type
:
fixed
ee/spec/models/user_spec.rb
View file @
85219d2a
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment