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
1cc701d2
Commit
1cc701d2
authored
Dec 14, 2020
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ajk-13984-minor-tidying' into 'master'
Minor resolver tidying See merge request gitlab-org/gitlab!49909
parents
0ef99bef
5e455a13
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
50 additions
and
59 deletions
+50
-59
.rubocop.yml
.rubocop.yml
+2
-0
.rubocop_manual_todo.yml
.rubocop_manual_todo.yml
+0
-8
app/graphql/mutations/snippets/create.rb
app/graphql/mutations/snippets/create.rb
+9
-22
app/graphql/mutations/snippets/update.rb
app/graphql/mutations/snippets/update.rb
+3
-3
app/graphql/resolvers/ci/jobs_resolver.rb
app/graphql/resolvers/ci/jobs_resolver.rb
+2
-0
app/graphql/resolvers/ci/pipeline_stages_resolver.rb
app/graphql/resolvers/ci/pipeline_stages_resolver.rb
+3
-0
app/graphql/resolvers/design_management/versions_resolver.rb
app/graphql/resolvers/design_management/versions_resolver.rb
+2
-0
app/graphql/resolvers/issue_status_counts_resolver.rb
app/graphql/resolvers/issue_status_counts_resolver.rb
+2
-0
app/graphql/resolvers/users/group_count_resolver.rb
app/graphql/resolvers/users/group_count_resolver.rb
+2
-0
app/graphql/types/ci/job_type.rb
app/graphql/types/ci/job_type.rb
+1
-0
app/graphql/types/terraform/state_type.rb
app/graphql/types/terraform/state_type.rb
+0
-1
app/graphql/types/terraform/state_version_type.rb
app/graphql/types/terraform/state_version_type.rb
+0
-2
ee/app/graphql/ee/types/project_type.rb
ee/app/graphql/ee/types/project_type.rb
+21
-21
ee/app/graphql/resolvers/security_report_summary_resolver.rb
ee/app/graphql/resolvers/security_report_summary_resolver.rb
+2
-0
ee/app/graphql/resolvers/vulnerabilities_base_resolver.rb
ee/app/graphql/resolvers/vulnerabilities_base_resolver.rb
+1
-0
ee/app/graphql/types/instance_security_dashboard_type.rb
ee/app/graphql/types/instance_security_dashboard_type.rb
+0
-1
ee/app/graphql/types/vulnerable_projects_by_grade_type.rb
ee/app/graphql/types/vulnerable_projects_by_grade_type.rb
+0
-1
No files found.
.rubocop.yml
View file @
1cc701d2
...
...
@@ -368,6 +368,8 @@ Cop/SidekiqOptionsQueue:
Graphql/ResolverType
:
Enabled
:
true
Exclude
:
-
'
app/graphql/resolvers/base_resolver.rb'
Include
:
-
'
app/graphql/resolvers/**/*'
-
'
ee/app/graphql/resolvers/**/*'
...
...
.rubocop_manual_todo.yml
View file @
1cc701d2
...
...
@@ -32,14 +32,6 @@ Graphql/IDType:
-
'
app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb'
-
'
app/graphql/resolvers/user_merge_requests_resolver.rb'
Graphql/ResolverType
:
Exclude
:
-
'
app/graphql/resolvers/base_resolver.rb'
-
'
app/graphql/resolvers/ci/jobs_resolver.rb'
-
'
app/graphql/resolvers/ci/pipeline_stages_resolver.rb'
-
'
app/graphql/resolvers/users/group_count_resolver.rb'
-
'
ee/app/graphql/resolvers/vulnerabilities_base_resolver.rb'
Gitlab/PolicyRuleBoolean
:
Exclude
:
-
'
ee/app/policies/ee/identity_provider_policy.rb'
...
...
app/graphql/mutations/snippets/create.rb
View file @
1cc701d2
...
...
@@ -4,7 +4,8 @@ module Mutations
module
Snippets
class
Create
<
BaseMutation
include
SpammableMutationFields
include
ResolvesProject
authorize
:create_snippet
graphql_name
'CreateSnippet'
...
...
@@ -37,17 +38,15 @@ module Mutations
description:
'Actions to perform over the snippet repository and blobs'
,
required:
false
def
resolve
(
args
)
project_path
=
args
.
delete
(
:project_path
)
def
resolve
(
project_path:
nil
,
**
args
)
if
project_path
.
present?
project
=
find_project!
(
project_path:
project_path
)
els
if
!
can_create_personal_snippet?
raise_resource_not_available_error!
project
=
authorized_find!
(
project_path
)
els
e
authorize!
(
:global
)
end
service_response
=
::
Snippets
::
CreateService
.
new
(
project
,
c
ontext
[
:current_user
]
,
c
urrent_user
,
create_params
(
args
)).
execute
snippet
=
service_response
.
payload
[
:snippet
]
...
...
@@ -67,20 +66,8 @@ module Mutations
private
def
find_project!
(
project_path
:)
authorized_find!
(
full_path:
project_path
)
end
def
find_object
(
full_path
:)
resolve_project
(
full_path:
full_path
)
end
def
authorized_resource?
(
project
)
Ability
.
allowed?
(
context
[
:current_user
],
:create_snippet
,
project
)
end
def
can_create_personal_snippet?
Ability
.
allowed?
(
context
[
:current_user
],
:create_snippet
)
def
find_object
(
full_path
)
Project
.
find_by_full_path
(
full_path
)
end
def
create_params
(
args
)
...
...
app/graphql/mutations/snippets/update.rb
View file @
1cc701d2
...
...
@@ -27,11 +27,11 @@ module Mutations
description:
'Actions to perform over the snippet repository and blobs'
,
required:
false
def
resolve
(
args
)
snippet
=
authorized_find!
(
id:
args
.
delete
(
:id
)
)
def
resolve
(
id
:,
**
args
)
snippet
=
authorized_find!
(
id:
id
)
result
=
::
Snippets
::
UpdateService
.
new
(
snippet
.
project
,
c
ontext
[
:current_user
]
,
c
urrent_user
,
update_params
(
args
)).
execute
(
snippet
)
snippet
=
result
.
payload
[
:snippet
]
...
...
app/graphql/resolvers/ci/jobs_resolver.rb
View file @
1cc701d2
...
...
@@ -5,6 +5,8 @@ module Resolvers
class
JobsResolver
<
BaseResolver
alias_method
:pipeline
,
:object
type
::
Types
::
Ci
::
JobType
.
connection_type
,
null:
true
argument
:security_report_types
,
[
Types
::
Security
::
ReportTypeEnum
],
required:
false
,
description:
'Filter jobs by the type of security report they produce'
...
...
app/graphql/resolvers/ci/pipeline_stages_resolver.rb
View file @
1cc701d2
...
...
@@ -5,6 +5,9 @@ module Resolvers
class
PipelineStagesResolver
<
BaseResolver
include
LooksAhead
type
Types
::
Ci
::
StageType
.
connection_type
,
null:
true
extras
[
:lookahead
]
alias_method
:pipeline
,
:object
def
resolve_with_lookahead
...
...
app/graphql/resolvers/design_management/versions_resolver.rb
View file @
1cc701d2
...
...
@@ -9,6 +9,8 @@ module Resolvers
VersionID
=
::
Types
::
GlobalIDType
[
::
DesignManagement
::
Version
]
extras
[
:parent
]
argument
:earlier_or_equal_to_sha
,
GraphQL
::
STRING_TYPE
,
as: :sha
,
required:
false
,
...
...
app/graphql/resolvers/issue_status_counts_resolver.rb
View file @
1cc701d2
...
...
@@ -6,6 +6,8 @@ module Resolvers
type
Types
::
IssueStatusCountsType
,
null:
true
extras
[
:lookahead
]
def
continue_issue_resolve
(
parent
,
finder
,
**
args
)
finder
.
parent_param
=
parent
apply_lookahead
(
Gitlab
::
IssuablesCountForState
.
new
(
finder
,
parent
))
...
...
app/graphql/resolvers/users/group_count_resolver.rb
View file @
1cc701d2
...
...
@@ -3,6 +3,8 @@
module
Resolvers
module
Users
class
GroupCountResolver
<
BaseResolver
type
GraphQL
::
INT_TYPE
,
null:
true
alias_method
:user
,
:object
def
resolve
(
**
args
)
...
...
app/graphql/types/ci/job_type.rb
View file @
1cc701d2
...
...
@@ -5,6 +5,7 @@ module Types
# rubocop: disable Graphql/AuthorizeTypes
class
JobType
<
BaseObject
graphql_name
'CiJob'
authorize
:read_build
field
:pipeline
,
Types
::
Ci
::
PipelineType
,
null:
true
,
description:
'Pipeline the job belongs to'
...
...
app/graphql/types/terraform/state_type.rb
View file @
1cc701d2
...
...
@@ -19,7 +19,6 @@ module Types
field
:locked_by_user
,
Types
::
UserType
,
null:
true
,
authorize: :read_user
,
description:
'The user currently holding a lock on the Terraform state'
field
:locked_at
,
Types
::
TimeType
,
...
...
app/graphql/types/terraform/state_version_type.rb
View file @
1cc701d2
...
...
@@ -15,7 +15,6 @@ module Types
field
:created_by_user
,
Types
::
UserType
,
null:
true
,
authorize: :read_user
,
description:
'The user that created this version'
field
:download_path
,
GraphQL
::
STRING_TYPE
,
...
...
@@ -24,7 +23,6 @@ module Types
field
:job
,
Types
::
Ci
::
JobType
,
null:
true
,
authorize: :read_build
,
description:
'The job that created this version'
field
:serial
,
GraphQL
::
INT_TYPE
,
...
...
ee/app/graphql/ee/types/project_type.rb
View file @
1cc701d2
...
...
@@ -126,35 +126,35 @@ module EE
null:
true
,
description:
'Incident Management On-call schedules of the project'
,
resolver:
::
Resolvers
::
IncidentManagement
::
OncallScheduleResolver
end
def
dast_scanner_profiles
DastScannerProfilesFinder
.
new
(
project_ids:
[
object
.
id
]).
execute
end
def
dast_scanner_profiles
DastScannerProfilesFinder
.
new
(
project_ids:
[
object
.
id
]).
execute
end
def
requirement_states_count
return
unless
Ability
.
allowed?
(
current_user
,
:read_requirement
,
object
)
def
requirement_states_count
return
unless
Ability
.
allowed?
(
current_user
,
:read_requirement
,
object
)
Hash
.
new
(
0
).
merge
(
object
.
requirements
.
counts_by_state
)
end
Hash
.
new
(
0
).
merge
(
object
.
requirements
.
counts_by_state
)
end
def
sast_ci_configuration
return
unless
Ability
.
allowed?
(
current_user
,
:download_code
,
object
)
def
sast_ci_configuration
return
unless
Ability
.
allowed?
(
current_user
,
:download_code
,
object
)
::
Security
::
CiConfiguration
::
SastParserService
.
new
(
object
).
configuration
end
::
Security
::
CiConfiguration
::
SastParserService
.
new
(
object
).
configuration
end
def
security_dashboard_path
Rails
.
application
.
routes
.
url_helpers
.
project_security_dashboard_index_path
(
object
)
end
def
security_dashboard_path
Rails
.
application
.
routes
.
url_helpers
.
project_security_dashboard_index_path
(
object
)
end
def
compliance_frameworks
BatchLoader
::
GraphQL
.
for
(
object
.
id
).
batch
(
default_value:
[])
do
|
project_ids
,
loader
|
results
=
::
ComplianceManagement
::
Framework
.
with_projects
(
project_ids
)
def
compliance_frameworks
BatchLoader
::
GraphQL
.
for
(
object
.
id
).
batch
(
default_value:
[])
do
|
project_ids
,
loader
|
results
=
::
ComplianceManagement
::
Framework
.
with_projects
(
project_ids
)
results
.
each
do
|
framework
|
framework
.
project_ids
.
each
do
|
project_id
|
loader
.
call
(
project_id
)
{
|
xs
|
xs
<<
framework
}
end
results
.
each
do
|
framework
|
framework
.
project_ids
.
each
do
|
project_id
|
loader
.
call
(
project_id
)
{
|
xs
|
xs
<<
framework
}
end
end
end
...
...
ee/app/graphql/resolvers/security_report_summary_resolver.rb
View file @
1cc701d2
...
...
@@ -4,6 +4,8 @@ module Resolvers
class
SecurityReportSummaryResolver
<
BaseResolver
type
Types
::
SecurityReportSummaryType
,
null:
true
extras
[
:lookahead
]
alias_method
:pipeline
,
:object
def
resolve
(
lookahead
:)
...
...
ee/app/graphql/resolvers/vulnerabilities_base_resolver.rb
View file @
1cc701d2
...
...
@@ -5,6 +5,7 @@
# to finding the object to get vulnerabilities from so that developers writing
# new resolvers don't have to repeat it.
# rubocop: disable Graphql/ResolverType
module
Resolvers
class
VulnerabilitiesBaseResolver
<
BaseResolver
include
Gitlab
::
Utils
::
StrongMemoize
...
...
ee/app/graphql/types/instance_security_dashboard_type.rb
View file @
1cc701d2
...
...
@@ -9,7 +9,6 @@ module Types
field
:projects
,
Types
::
ProjectType
.
connection_type
,
null:
false
,
authorize: :read_project
,
description:
'Projects selected in Instance Security Dashboard'
field
:vulnerability_scanners
,
...
...
ee/app/graphql/types/vulnerable_projects_by_grade_type.rb
View file @
1cc701d2
...
...
@@ -15,7 +15,6 @@ module Types
field
:projects
,
Types
::
ProjectType
.
connection_type
,
null:
false
,
description:
'Projects within this grade'
,
authorize: :read_project
,
complexity:
5
end
# rubocop: enable Graphql/AuthorizeTypes
...
...
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