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
e9481e4d
Commit
e9481e4d
authored
Feb 27, 2020
by
Rajendra Kadam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate vulnerability and feature entities into own class files
parent
1c6e59fa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
118 additions
and
83 deletions
+118
-83
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+0
-83
ee/lib/ee/api/entities/dependency.rb
ee/lib/ee/api/entities/dependency.rb
+25
-0
ee/lib/ee/api/entities/feature_flag.rb
ee/lib/ee/api/entities/feature_flag.rb
+28
-0
ee/lib/ee/api/entities/vulnerability.rb
ee/lib/ee/api/entities/vulnerability.rb
+37
-0
ee/lib/ee/api/entities/vulnerability_issue_link.rb
ee/lib/ee/api/entities/vulnerability_issue_link.rb
+13
-0
ee/lib/ee/api/entities/vulnerability_related_issue.rb
ee/lib/ee/api/entities/vulnerability_related_issue.rb
+15
-0
No files found.
ee/lib/ee/api/entities.rb
View file @
e9481e4d
...
@@ -832,89 +832,6 @@ module EE
...
@@ -832,89 +832,6 @@ module EE
expose
:id
,
:project_id
,
:name
expose
:id
,
:project_id
,
:name
end
end
class
Dependency
<
Grape
::
Entity
class
Vulnerability
<
Grape
::
Entity
expose
:name
,
:severity
end
expose
:name
,
:version
,
:package_manager
,
:dependency_file_path
expose
:dependency_file_path
do
|
dependency
|
dependency
[
:location
][
:path
]
end
expose
:vulnerabilities
,
using:
Vulnerability
,
if:
->
(
_
,
opts
)
{
can_read_vulnerabilities?
(
opts
[
:user
],
opts
[
:project
])
}
private
def
can_read_vulnerabilities?
(
user
,
project
)
Ability
.
allowed?
(
user
,
:read_vulnerability
,
project
)
end
end
class
FeatureFlag
<
Grape
::
Entity
class
Scope
<
Grape
::
Entity
expose
:id
expose
:active
expose
:environment_scope
expose
:strategies
expose
:created_at
expose
:updated_at
end
class
DetailedScope
<
Scope
expose
:name
end
expose
:name
expose
:description
expose
:created_at
expose
:updated_at
expose
:scopes
,
using:
Scope
end
class
Vulnerability
<
Grape
::
Entity
expose
:id
expose
:title
expose
:description
expose
:state
expose
:severity
expose
:confidence
expose
:report_type
expose
:project
,
using:
::
API
::
Entities
::
ProjectIdentity
expose
:finding
expose
:author_id
expose
:updated_by_id
expose
:last_edited_by_id
expose
:resolved_by_id
expose
:dismissed_by_id
expose
:start_date
expose
:due_date
expose
:created_at
expose
:updated_at
expose
:last_edited_at
expose
:resolved_at
expose
:dismissed_at
end
class
VulnerabilityRelatedIssue
<
::
API
::
Entities
::
IssueBasic
# vulnerability_link_* attributes come from joined Vulnerabilities::IssueLink record
expose
:vulnerability_link_id
expose
:vulnerability_link_type
do
|
related_issue
|
::
Vulnerabilities
::
IssueLink
.
link_types
.
key
(
related_issue
.
vulnerability_link_type
)
end
end
class
VulnerabilityIssueLink
<
Grape
::
Entity
expose
:vulnerability
,
using:
::
EE
::
API
::
Entities
::
Vulnerability
expose
:issue
,
using:
::
API
::
Entities
::
IssueBasic
expose
:link_type
end
module
Analytics
module
Analytics
module
CodeReview
module
CodeReview
class
MergeRequest
<
::
API
::
Entities
::
MergeRequestSimple
class
MergeRequest
<
::
API
::
Entities
::
MergeRequestSimple
...
...
ee/lib/ee/api/entities/dependency.rb
0 → 100644
View file @
e9481e4d
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
Dependency
<
Grape
::
Entity
class
Vulnerability
<
Grape
::
Entity
expose
:name
,
:severity
end
expose
:name
,
:version
,
:package_manager
,
:dependency_file_path
expose
:dependency_file_path
do
|
dependency
|
dependency
[
:location
][
:path
]
end
expose
:vulnerabilities
,
using:
Vulnerability
,
if:
->
(
_
,
opts
)
{
can_read_vulnerabilities?
(
opts
[
:user
],
opts
[
:project
])
}
private
def
can_read_vulnerabilities?
(
user
,
project
)
Ability
.
allowed?
(
user
,
:read_vulnerability
,
project
)
end
end
end
end
end
ee/lib/ee/api/entities/feature_flag.rb
0 → 100644
View file @
e9481e4d
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
FeatureFlag
<
Grape
::
Entity
class
Scope
<
Grape
::
Entity
expose
:id
expose
:active
expose
:environment_scope
expose
:strategies
expose
:created_at
expose
:updated_at
end
class
DetailedScope
<
Scope
expose
:name
end
expose
:name
expose
:description
expose
:created_at
expose
:updated_at
expose
:scopes
,
using:
Scope
end
end
end
end
ee/lib/ee/api/entities/vulnerability.rb
0 → 100644
View file @
e9481e4d
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
Vulnerability
<
Grape
::
Entity
expose
:id
expose
:title
expose
:description
expose
:state
expose
:severity
expose
:confidence
expose
:report_type
expose
:project
,
using:
::
API
::
Entities
::
ProjectIdentity
expose
:finding
expose
:author_id
expose
:updated_by_id
expose
:last_edited_by_id
expose
:resolved_by_id
expose
:closed_by_id
expose
:start_date
expose
:due_date
expose
:created_at
expose
:updated_at
expose
:last_edited_at
expose
:resolved_at
expose
:closed_at
end
end
end
end
ee/lib/ee/api/entities/vulnerability_issue_link.rb
0 → 100644
View file @
e9481e4d
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
VulnerabilityIssueLink
<
Grape
::
Entity
expose
:vulnerability
,
using:
::
EE
::
API
::
Entities
::
Vulnerability
expose
:issue
,
using:
::
API
::
Entities
::
IssueBasic
expose
:link_type
end
end
end
end
ee/lib/ee/api/entities/vulnerability_related_issue.rb
0 → 100644
View file @
e9481e4d
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
VulnerabilityRelatedIssue
<
::
API
::
Entities
::
IssueBasic
# vulnerability_link_* attributes come from joined Vulnerabilities::IssueLink record
expose
:vulnerability_link_id
expose
:vulnerability_link_type
do
|
related_issue
|
::
Vulnerabilities
::
IssueLink
.
link_types
.
key
(
related_issue
.
vulnerability_link_type
)
end
end
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