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
0533f830
Commit
0533f830
authored
Sep 14, 2020
by
manojmj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in group security dashboard
parent
7ca0cc64
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
ee/app/helpers/groups/security_features_helper.rb
ee/app/helpers/groups/security_features_helper.rb
+1
-1
ee/spec/helpers/groups/security_features_helper_spec.rb
ee/spec/helpers/groups/security_features_helper_spec.rb
+4
-3
ee/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
ee/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
+11
-4
No files found.
ee/app/helpers/groups/security_features_helper.rb
View file @
0533f830
...
...
@@ -2,7 +2,7 @@
module
Groups::SecurityFeaturesHelper
def
group_level_security_dashboard_available?
(
group
)
group
.
feature_available?
(
:security_dashboard
)
can?
(
current_user
,
:read_group_security_dashboard
,
group
)
end
def
group_level_compliance_dashboard_available?
(
group
)
...
...
ee/spec/helpers/groups/security_features_helper_spec.rb
View file @
0533f830
...
...
@@ -9,18 +9,19 @@ RSpec.describe Groups::SecurityFeaturesHelper do
let_it_be
(
:user
,
refind:
true
)
{
create
(
:user
)
}
before
do
allow
(
helper
).
to
receive
(
:can?
)
{
|*
args
|
Ability
.
allowed?
(
*
args
)
}
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
describe
'#group_level_security_dashboard_available?'
do
where
(
:security_dashboard_feature_enabled
,
:result
)
do
true
|
true
where
(
:read_group_security_dashboard_permission
,
:result
)
do
false
|
false
true
|
true
end
with_them
do
before
do
stub_licensed_features
(
security_dashboard:
security_dashboard_feature_enabled
)
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:read_group_security_dashboard
,
group
).
and_return
(
read_group_security_dashboard_permission
)
end
it
'returns the expected result'
do
...
...
ee/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
View file @
0533f830
...
...
@@ -109,11 +109,18 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
stub_licensed_features
(
security_dashboard:
true
)
end
it
'is visible'
do
render
context
'when the user has access to Compliance dashboard'
do
before
do
group
.
add_developer
(
user
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
end
expect
(
rendered
).
to
have_link
'Security & Compliance'
expect
(
rendered
).
to
have_link
'Security'
it
'is visible'
do
render
expect
(
rendered
).
to
have_link
'Security & Compliance'
expect
(
rendered
).
to
have_link
'Security'
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