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
7ca0cc64
Commit
7ca0cc64
authored
Sep 14, 2020
by
manojmj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address code review remarks
parent
59e1999b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
13 deletions
+22
-13
ee/app/models/ee/user.rb
ee/app/models/ee/user.rb
+2
-1
ee/spec/models/user_spec.rb
ee/spec/models/user_spec.rb
+20
-12
No files found.
ee/app/models/ee/user.rb
View file @
7ca0cc64
...
...
@@ -414,7 +414,8 @@ module EE
end
def
available_minimal_access_groups
return
minimal_access_groups
if
!::
Gitlab
::
CurrentSettings
.
should_check_namespace_plan?
&&
License
.
feature_available?
(
:minimal_access_role
)
return
::
Group
.
none
unless
License
.
feature_available?
(
:minimal_access_role
)
return
minimal_access_groups
unless
::
Gitlab
::
CurrentSettings
.
should_check_namespace_plan?
minimal_access_groups
.
with_feature_available_in_plan
(
:minimal_access_role
)
end
...
...
ee/spec/models/user_spec.rb
View file @
7ca0cc64
...
...
@@ -1134,28 +1134,36 @@ RSpec.describe User do
subject
{
user
.
authorized_groups
}
context
'with minimal access role feature
switched off
'
do
context
'with minimal access role feature
unavailable
'
do
it
{
is_expected
.
to
contain_exactly
private_group
,
project_group
}
end
context
'with minimal access feature
switched on
'
do
context
'with minimal access feature
available
'
do
before
do
stub_licensed_features
(
minimal_access_role:
true
)
allow
(
Gitlab
::
CurrentSettings
)
.
to
receive
(
:should_check_namespace_plan?
)
.
and_return
(
false
)
end
it
{
is_expected
.
to
contain_exactly
private_group
,
project_group
,
minimal_access_group
}
end
context
'feature turned on for all groups'
do
before
do
allow
(
Gitlab
::
CurrentSettings
)
.
to
receive
(
:should_check_namespace_plan?
)
.
and_return
(
false
)
end
context
'with minimal access feature switched on for one group only'
do
before
do
create
(
:gitlab_subscription
,
:gold
,
namespace:
minimal_access_group
)
create
(
:group_member
,
:minimal_access
,
user:
user
,
source:
create
(
:group
))
it
{
is_expected
.
to
contain_exactly
private_group
,
project_group
,
minimal_access_group
}
end
it
{
is_expected
.
to
contain_exactly
private_group
,
project_group
,
minimal_access_group
}
context
'feature available for specific groups only'
do
before
do
allow
(
Gitlab
::
CurrentSettings
)
.
to
receive
(
:should_check_namespace_plan?
)
.
and_return
(
true
)
create
(
:gitlab_subscription
,
:gold
,
namespace:
minimal_access_group
)
create
(
:group_member
,
:minimal_access
,
user:
user
,
source:
create
(
:group
))
end
it
{
is_expected
.
to
contain_exactly
private_group
,
project_group
,
minimal_access_group
}
end
end
end
...
...
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