Commit 83fe069e authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '321884-create-policies-new-route' into 'master'

Create policies_controller#new action and route

See merge request gitlab-org/gitlab!67795
parents edff3619 70bf4fa0
- add_to_breadcrumbs s_("SecurityPolicies|Policies"), project_security_policy_path(@project)
- breadcrumb_title s_("SecurityPolicies|Edit policy")
- page_title s_("SecurityPolicies|Edit policy")
- add_to_breadcrumbs s_("SecurityOrchestration|Policies"), project_security_policy_path(@project)
- breadcrumb_title s_("SecurityOrchestration|Edit policy")
- page_title s_("SecurityOrchestration|Edit policy")
#js-policy-builder-app{ data: { policy: @policy.to_json,
policy_type: @policy_type,
......
- 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 }
......@@ -8,6 +8,6 @@
disable_security_policy_project: disable_security_policy_project.to_s,
documentation_path: help_page_path('user/application_security/policies/index.md'),
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),
project_path: project.full_path } }
......@@ -62,7 +62,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
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
post :auto_fix, on: :collection
......
......@@ -23,6 +23,7 @@ RSpec.describe Projects::Security::PoliciesController, type: :request do
let_it_be(:type) { 'scan_execution_policy' }
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(:new) { new_project_security_policy_url(project) }
let_it_be(:feature_enabled) { true }
......@@ -155,6 +156,32 @@ RSpec.describe Projects::Security::PoliciesController, type: :request do
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
using RSpec::Parameterized::TableSyntax
......
......@@ -70,6 +70,10 @@ RSpec.describe 'EE-specific project routing' do
%w[test.1.2 test-policy test:policy]
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
expect(get('/gitlab/gitlabhq/-/security/policy')).to route_to('projects/security/policies#show', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
......
......@@ -29531,6 +29531,9 @@ msgstr ""
msgid "SecurityOrchestration|An error occurred assigning your security policy project"
msgstr ""
msgid "SecurityOrchestration|Edit policy"
msgstr ""
msgid "SecurityOrchestration|Edit policy project"
msgstr ""
......@@ -29546,6 +29549,9 @@ msgstr ""
msgid "SecurityOrchestration|Policies"
msgstr ""
msgid "SecurityOrchestration|Policy editor"
msgstr ""
msgid "SecurityOrchestration|Security policy project was linked successfully"
msgstr ""
......@@ -29570,9 +29576,6 @@ msgstr ""
msgid "SecurityPolicies|Description"
msgstr ""
msgid "SecurityPolicies|Edit policy"
msgstr ""
msgid "SecurityPolicies|Enforcement status"
msgstr ""
......@@ -29585,9 +29588,6 @@ msgstr ""
msgid "SecurityPolicies|Network"
msgstr ""
msgid "SecurityPolicies|Policies"
msgstr ""
msgid "SecurityPolicies|Policy type"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment