diff --git a/config/routes.rb b/config/routes.rb index 02a405a91f843294c3c3dc4b19c5de5f3325b8b5..a622ce268da41354f2a60127f5e0bc3ebc979fda 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -107,6 +107,7 @@ draw :instance_statistics Gitlab.ee do + draw :security draw :smartcard draw :jira_connect draw :username diff --git a/ee/app/assets/javascripts/pages/security/index.js b/ee/app/assets/javascripts/pages/security/index.js new file mode 100644 index 0000000000000000000000000000000000000000..db010145eec25058cfcf9d70a6b74609d3618a17 --- /dev/null +++ b/ee/app/assets/javascripts/pages/security/index.js @@ -0,0 +1,24 @@ +import Vue from 'vue'; +import createStore from 'ee/security_dashboard/store'; +import router from 'ee/security_dashboard/store/router'; +import DashboardComponent from 'ee/security_dashboard/components/app.vue'; + +if (gon.features && gon.features.securityDashboard) { + document.addEventListener( + 'DOMContentLoaded', + () => + new Vue({ + el: '#js-security', + store: createStore(), + router, + components: { + DashboardComponent, + }, + render(createElement) { + return createElement(DashboardComponent, { + props: {}, + }); + }, + }), + ); +} diff --git a/ee/app/controllers/security_controller.rb b/ee/app/controllers/security_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..95911c696c02f9b319074da241bbfb70ba2fd20a --- /dev/null +++ b/ee/app/controllers/security_controller.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class SecurityController < ApplicationController + before_action :authorize_read_security_dashboard! + before_action do + push_frontend_feature_flag(:security_dashboard) + end + + def authorize_read_security_dashboard! + render_404 unless Feature.enabled?(:security_dashboard) && + can?(current_user, :read_security_dashboard) + end +end diff --git a/ee/app/views/security/index.html.haml b/ee/app/views/security/index.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..48a2c63137292d597bfa152fdccfaba82e34f87b --- /dev/null +++ b/ee/app/views/security/index.html.haml @@ -0,0 +1,4 @@ +- page_title _('Security Dashboard') +- @hide_breadcrumbs = true + +#js-security diff --git a/ee/config/routes/security.rb b/ee/config/routes/security.rb new file mode 100644 index 0000000000000000000000000000000000000000..c5a263bd95f5e44e7b68b5d5c7d65eb967bab4ea --- /dev/null +++ b/ee/config/routes/security.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +get 'security' => 'security#index'