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
70bf4fa0
Commit
70bf4fa0
authored
Aug 13, 2021
by
Alexander Turinske
Committed by
Alex Kalderimis
Aug 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create policies_controller#new action and route
- add tests - update locale
parent
51398378
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
11 deletions
+48
-11
ee/app/views/projects/security/policies/edit.html.haml
ee/app/views/projects/security/policies/edit.html.haml
+3
-3
ee/app/views/projects/security/policies/new.html.haml
ee/app/views/projects/security/policies/new.html.haml
+6
-0
ee/app/views/projects/security/policies/show.html.haml
ee/app/views/projects/security/policies/show.html.haml
+1
-1
ee/config/routes/project.rb
ee/config/routes/project.rb
+1
-1
ee/spec/requests/projects/security/policies_controller_spec.rb
...ec/requests/projects/security/policies_controller_spec.rb
+27
-0
ee/spec/routing/project_routing_spec.rb
ee/spec/routing/project_routing_spec.rb
+4
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-6
No files found.
ee/app/views/projects/security/policies/edit.html.haml
View file @
70bf4fa0
-
add_to_breadcrumbs
s_
(
"Security
Policies
|Policies"
),
project_security_policy_path
(
@project
)
-
add_to_breadcrumbs
s_
(
"Security
Orchestration
|Policies"
),
project_security_policy_path
(
@project
)
-
breadcrumb_title
s_
(
"Security
Policies
|Edit policy"
)
-
breadcrumb_title
s_
(
"Security
Orchestration
|Edit policy"
)
-
page_title
s_
(
"Security
Policies
|Edit policy"
)
-
page_title
s_
(
"Security
Orchestration
|Edit policy"
)
#js-policy-builder-app
{
data:
{
policy:
@policy
.
to_json
,
#js-policy-builder-app
{
data:
{
policy:
@policy
.
to_json
,
policy_type:
@policy_type
,
policy_type:
@policy_type
,
...
...
ee/app/views/projects/security/policies/new.html.haml
0 → 100644
View file @
70bf4fa0
-
add_to_breadcrumbs
s_
(
"SecurityOrchestration|Policies"
),
project_security_policy_path
(
@project
)
-
breadcrumb_title
s_
(
"SecurityOrchestration|New policy"
)
-
page_title
s_
(
"SecurityOrchestration|Policy editor"
)
-
policy_details
=
policy_details
(
@project
)
#js-policy-builder-app
{
data:
policy_details
}
ee/app/views/projects/security/policies/show.html.haml
View file @
70bf4fa0
...
@@ -8,6 +8,6 @@
...
@@ -8,6 +8,6 @@
disable_security_policy_project:
disable_security_policy_project
.
to_s
,
disable_security_policy_project:
disable_security_policy_project
.
to_s
,
documentation_path:
help_page_path
(
'user/application_security/policies/index.md'
),
documentation_path:
help_page_path
(
'user/application_security/policies/index.md'
),
empty_state_svg_path:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
empty_state_svg_path:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
new_policy_path:
new_project_
threat_monitoring
_policy_path
(
project
),
new_policy_path:
new_project_
security
_policy_path
(
project
),
environments_endpoint:
project_environments_path
(
project
),
environments_endpoint:
project_environments_path
(
project
),
project_path:
project
.
full_path
}
}
project_path:
project
.
full_path
}
}
ee/config/routes/project.rb
View file @
70bf4fa0
...
@@ -62,7 +62,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
...
@@ -62,7 +62,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resource
:policy
,
only:
[
:show
]
resource
:policy
,
only:
[
:show
]
resources
:policies
,
only:
[
:edit
],
controller: :policies
,
constraints:
{
id:
%r{[^/]+}
}
resources
:policies
,
only:
[
:
new
,
:
edit
],
controller: :policies
,
constraints:
{
id:
%r{[^/]+}
}
resource
:configuration
,
only:
[],
controller: :configuration
do
resource
:configuration
,
only:
[],
controller: :configuration
do
post
:auto_fix
,
on: :collection
post
:auto_fix
,
on: :collection
...
...
ee/spec/requests/projects/security/policies_controller_spec.rb
View file @
70bf4fa0
...
@@ -23,6 +23,7 @@ RSpec.describe Projects::Security::PoliciesController, type: :request do
...
@@ -23,6 +23,7 @@ RSpec.describe Projects::Security::PoliciesController, type: :request do
let_it_be
(
:type
)
{
'scan_execution_policy'
}
let_it_be
(
:type
)
{
'scan_execution_policy'
}
let_it_be
(
:show
)
{
project_security_policy_url
(
project
)
}
let_it_be
(
:show
)
{
project_security_policy_url
(
project
)
}
let_it_be
(
:edit
)
{
edit_project_security_policy_url
(
project
,
id:
policy
[
:name
],
type:
type
)
}
let_it_be
(
:edit
)
{
edit_project_security_policy_url
(
project
,
id:
policy
[
:name
],
type:
type
)
}
let_it_be
(
:new
)
{
new_project_security_policy_url
(
project
)
}
let_it_be
(
:feature_enabled
)
{
true
}
let_it_be
(
:feature_enabled
)
{
true
}
...
@@ -155,6 +156,32 @@ RSpec.describe Projects::Security::PoliciesController, type: :request do
...
@@ -155,6 +156,32 @@ RSpec.describe Projects::Security::PoliciesController, type: :request do
end
end
end
end
describe
'GET #new'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:feature_flag
,
:license
,
:status
)
do
true
|
true
|
:ok
false
|
false
|
:not_found
false
|
true
|
:not_found
true
|
false
|
:not_found
end
subject
(
:request
)
{
get
new
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
}
with_them
do
before
do
stub_feature_flags
(
security_orchestration_policies_configuration:
feature_flag
)
stub_licensed_features
(
security_orchestration_policies:
license
)
end
specify
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
status
)
end
end
end
describe
'GET #show'
do
describe
'GET #show'
do
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
...
...
ee/spec/routing/project_routing_spec.rb
View file @
70bf4fa0
...
@@ -70,6 +70,10 @@ RSpec.describe 'EE-specific project routing' do
...
@@ -70,6 +70,10 @@ RSpec.describe 'EE-specific project routing' do
%w[test.1.2 test-policy test:policy]
%w[test.1.2 test-policy test:policy]
end
end
it
"to #new"
do
expect
(
get
(
"/gitlab/gitlabhq/-/security/policies/new"
)).
to
route_to
(
'projects/security/policies#new'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
end
it
'to #show'
do
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/-/security/policy'
)).
to
route_to
(
'projects/security/policies#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
expect
(
get
(
'/gitlab/gitlabhq/-/security/policy'
)).
to
route_to
(
'projects/security/policies#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
end
end
...
...
locale/gitlab.pot
View file @
70bf4fa0
...
@@ -29528,6 +29528,9 @@ msgstr ""
...
@@ -29528,6 +29528,9 @@ msgstr ""
msgid "SecurityOrchestration|An error occurred assigning your security policy project"
msgid "SecurityOrchestration|An error occurred assigning your security policy project"
msgstr ""
msgstr ""
msgid "SecurityOrchestration|Edit policy"
msgstr ""
msgid "SecurityOrchestration|Edit policy project"
msgid "SecurityOrchestration|Edit policy project"
msgstr ""
msgstr ""
...
@@ -29543,6 +29546,9 @@ msgstr ""
...
@@ -29543,6 +29546,9 @@ msgstr ""
msgid "SecurityOrchestration|Policies"
msgid "SecurityOrchestration|Policies"
msgstr ""
msgstr ""
msgid "SecurityOrchestration|Policy editor"
msgstr ""
msgid "SecurityOrchestration|Security policy project was linked successfully"
msgid "SecurityOrchestration|Security policy project was linked successfully"
msgstr ""
msgstr ""
...
@@ -29567,9 +29573,6 @@ msgstr ""
...
@@ -29567,9 +29573,6 @@ msgstr ""
msgid "SecurityPolicies|Description"
msgid "SecurityPolicies|Description"
msgstr ""
msgstr ""
msgid "SecurityPolicies|Edit policy"
msgstr ""
msgid "SecurityPolicies|Enforcement status"
msgid "SecurityPolicies|Enforcement status"
msgstr ""
msgstr ""
...
@@ -29582,9 +29585,6 @@ msgstr ""
...
@@ -29582,9 +29585,6 @@ msgstr ""
msgid "SecurityPolicies|Network"
msgid "SecurityPolicies|Network"
msgstr ""
msgstr ""
msgid "SecurityPolicies|Policies"
msgstr ""
msgid "SecurityPolicies|Policy type"
msgid "SecurityPolicies|Policy type"
msgstr ""
msgstr ""
...
...
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