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
0e32b4aa
Commit
0e32b4aa
authored
Apr 22, 2020
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vulnerabilities method to user model
parent
a0f60907
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
ee/app/models/ee/user.rb
ee/app/models/ee/user.rb
+4
-0
ee/spec/models/user_spec.rb
ee/spec/models/user_spec.rb
+17
-0
No files found.
ee/app/models/ee/user.rb
View file @
0e32b4aa
...
...
@@ -349,6 +349,10 @@ module EE
gitlab_employee?
?
'GitLab'
:
super
end
def
vulnerabilities
InstanceSecurityDashboard
.
new
(
self
).
vulnerabilities
end
protected
override
:password_required?
...
...
ee/spec/models/user_spec.rb
View file @
0e32b4aa
...
...
@@ -1143,4 +1143,21 @@ describe User do
it
{
is_expected
.
to
eql
(
expected_result
)
}
end
end
describe
'#vulnerabilities'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:vulnerability_collection
)
{
instance_double
(
ActiveRecord
::
Relation
)
}
let
(
:mock_security_dashboard
)
{
instance_double
(
InstanceSecurityDashboard
,
vulnerabilities:
vulnerability_collection
)
}
subject
(
:vulnerabilities
)
{
user
.
vulnerabilities
}
before
do
allow
(
InstanceSecurityDashboard
).
to
receive
(
:new
).
and_return
(
mock_security_dashboard
)
end
it
'delegates the call to an instance of `InstanceSecurityDashboard`'
do
expect
(
vulnerabilities
).
to
eql
(
vulnerability_collection
)
expect
(
InstanceSecurityDashboard
).
to
have_received
(
:new
).
with
(
user
)
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