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
e899dbf4
Commit
e899dbf4
authored
Oct 25, 2021
by
Nicolò Maria Mezzopera
Committed by
Dylan Griffith
Oct 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dependency proxy menu when user is not authorised
parent
6ffc0491
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
lib/sidebars/groups/menus/packages_registries_menu.rb
lib/sidebars/groups/menus/packages_registries_menu.rb
+1
-1
spec/lib/sidebars/groups/menus/packages_registries_menu_spec.rb
...ib/sidebars/groups/menus/packages_registries_menu_spec.rb
+17
-6
No files found.
lib/sidebars/groups/menus/packages_registries_menu.rb
View file @
e899dbf4
...
@@ -52,7 +52,7 @@ module Sidebars
...
@@ -52,7 +52,7 @@ module Sidebars
end
end
def
dependency_proxy_menu_item
def
dependency_proxy_menu_item
unless
c
ontext
.
group
.
dependency_proxy_feature_available?
unless
c
an?
(
context
.
current_user
,
:read_dependency_proxy
,
context
.
group
)
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :dependency_proxy
)
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :dependency_proxy
)
end
end
...
...
spec/lib/sidebars/groups/menus/packages_registries_menu_spec.rb
View file @
e899dbf4
...
@@ -137,16 +137,27 @@ RSpec.describe Sidebars::Groups::Menus::PackagesRegistriesMenu do
...
@@ -137,16 +137,27 @@ RSpec.describe Sidebars::Groups::Menus::PackagesRegistriesMenu do
stub_config
(
dependency_proxy:
{
enabled:
dependency_enabled
})
stub_config
(
dependency_proxy:
{
enabled:
dependency_enabled
})
end
end
context
'when config dependency_proxy is enabled'
do
context
'when user can read dependency proxy'
do
let
(
:dependency_enabled
)
{
true
}
context
'when config dependency_proxy is enabled'
do
let
(
:dependency_enabled
)
{
true
}
it
'the menu item is added to list of menu items'
do
it
'the menu item is added to list of menu items'
do
is_expected
.
not_to
be_nil
is_expected
.
not_to
be_nil
end
end
context
'when config dependency_proxy is not enabled'
do
let
(
:dependency_enabled
)
{
false
}
it
'the menu item is not added to list of menu items'
do
is_expected
.
to
be_nil
end
end
end
end
end
context
'when config dependency_proxy is not enabled'
do
context
'when user cannot read dependency proxy'
do
let
(
:dependency_enabled
)
{
false
}
let
(
:user
)
{
nil
}
let
(
:dependency_enabled
)
{
true
}
it
'the menu item is not added to list of menu items'
do
it
'the menu item is not added to list of menu items'
do
is_expected
.
to
be_nil
is_expected
.
to
be_nil
...
...
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