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
26b478fa
Commit
26b478fa
authored
Jul 10, 2020
by
Philip Cunningham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stub out service for creating DAST site profiles
parent
6e065c62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
3 deletions
+64
-3
ee/app/graphql/mutations/dast_site_profiles/create.rb
ee/app/graphql/mutations/dast_site_profiles/create.rb
+8
-3
ee/app/services/dast_site_profiles/create_service.rb
ee/app/services/dast_site_profiles/create_service.rb
+15
-0
ee/spec/services/dast_site_profiles/create_service_spec.rb
ee/spec/services/dast_site_profiles/create_service_spec.rb
+41
-0
No files found.
ee/app/graphql/mutations/dast_site_profiles/create.rb
View file @
26b478fa
...
...
@@ -29,9 +29,14 @@ module Mutations
project
=
authorized_find!
(
full_path:
full_path
)
raise_resource_not_available_error!
unless
Feature
.
enabled?
(
:security_on_demand_scans_feature_flag
,
project
)
{
errors:
[
'Not implemented'
]
}
service
=
::
DastSiteProfiles
::
CreateService
.
new
(
project
,
current_user
)
dast_site_profile
=
service
.
execute
(
name:
profile_name
,
target_url:
target_url
)
if
dast_site_profile
.
success?
raise
'Not implemented'
else
{
errors:
dast_site_profile
.
errors
}
end
end
private
...
...
ee/app/services/dast_site_profiles/create_service.rb
0 → 100644
View file @
26b478fa
# frozen_string_literal: true
module
DastSiteProfiles
class
CreateService
<
BaseService
def
execute
(
name:
nil
,
target_url:
nil
)
return
ServiceResponse
.
error
(
message:
'Insufficient permissions'
)
unless
allowed?
ServiceResponse
.
error
(
message:
'Not implemented'
)
end
def
allowed?
Ability
.
allowed?
(
current_user
,
:run_ondemand_dast_scan
,
project
)
end
end
end
ee/spec/services/dast_site_profiles/create_service_spec.rb
0 → 100644
View file @
26b478fa
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
DastSiteProfiles
::
CreateService
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let
(
:name
)
{
FFaker
::
Company
.
catch_phrase
}
let
(
:target_url
)
{
FFaker
::
Internet
.
uri
(
:http
)
}
describe
'#execute'
do
subject
{
described_class
.
new
(
project
,
user
).
execute
(
name:
name
,
target_url:
target_url
)
}
let
(
:status
)
{
subject
.
status
}
let
(
:message
)
{
subject
.
message
}
context
'when the user does not have permission to run a dast scan'
do
it
'returns an error status'
do
expect
(
status
).
to
eq
(
:error
)
end
it
'populates message'
do
expect
(
message
).
to
eq
(
'Insufficient permissions'
)
end
end
context
'when the user can run a dast scan'
do
before
do
project
.
add_developer
(
user
)
end
it
'returns an error status'
do
expect
(
status
).
to
eq
(
:error
)
end
it
'populates message'
do
expect
(
message
).
to
eq
(
'Not implemented'
)
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