diff --git a/ee/app/controllers/projects/compliance_frameworks_controller.rb b/ee/app/controllers/projects/compliance_frameworks_controller.rb deleted file mode 100644 index 94c8fe257817bef55993348d161204cb4240a492..0000000000000000000000000000000000000000 --- a/ee/app/controllers/projects/compliance_frameworks_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module Projects - class ComplianceFrameworksController < Projects::ApplicationController - feature_category :compliance_management - - before_action :authorize_admin_compliance_framework! - - def create - result = ComplianceManagement::Frameworks::AssignProjectService - .new(project, current_user, compliance_framework_params) - .execute - - handle_update_result(result) - end - - private - - def compliance_framework_params - params.permit(:framework) - end - end -end diff --git a/ee/config/routes/project.rb b/ee/config/routes/project.rb index c6996769089732971681141474ead7c1a54dfd13..3a3148e9fa20dd663ec23b7f716c7fdcf46aa676 100644 --- a/ee/config/routes/project.rb +++ b/ee/config/routes/project.rb @@ -155,8 +155,6 @@ resources :agents, path: 'agents(/*vueroute)', action: :index end - resources :compliance_frameworks, only: [:create] - resources :merge_trains, only: [:index] end # End of the /-/ scope. diff --git a/ee/spec/requests/custom_roles/admin_compliance_framework/request_spec.rb b/ee/spec/requests/custom_roles/admin_compliance_framework/request_spec.rb index 037183c8ea782720b2d69c92632f068d015788b4..66f8592a07146be80f1d387facb98d764a4900a0 100644 --- a/ee/spec/requests/custom_roles/admin_compliance_framework/request_spec.rb +++ b/ee/spec/requests/custom_roles/admin_compliance_framework/request_spec.rb @@ -45,15 +45,4 @@ expect(response).to render_template(:edit) end end - - describe Projects::ComplianceFrameworksController do - it 'user can assign a compliance framework to a project via a custom role' do - params = { framework: framework.id } - - post project_compliance_frameworks_path(project), params: params - - expect(response).to have_gitlab_http_status(:redirect) - expect(flash[:notice]).to eq("Project '#{project.name}' was successfully updated.") - end - end end diff --git a/ee/spec/requests/projects/compliance_frameworks_controller_spec.rb b/ee/spec/requests/projects/compliance_frameworks_controller_spec.rb deleted file mode 100644 index afc98c9cd3c44caaa651485aa28d9dfc455509e8..0000000000000000000000000000000000000000 --- a/ee/spec/requests/projects/compliance_frameworks_controller_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Projects::ComplianceFrameworksController, feature_category: :compliance_management do - let_it_be(:group) { create(:group) } - let_it_be(:project) { create(:project, group: group) } - let_it_be(:user) { create(:user) } - let_it_be(:framework) { create(:compliance_framework, namespace: group) } - - before do - stub_licensed_features(compliance_framework: true, custom_compliance_frameworks: true, custom_roles: true) - - login_as(user) - end - - describe 'POST #create' do - let(:params) { { framework: framework.id } } - - subject(:assign_framework) { post project_compliance_frameworks_path(project), params: params } - - shared_examples 'setting compliance framework' do - it 'redirects with notice message' do - assign_framework - - expect(response).to redirect_to(edit_project_path(project, anchor: 'js-general-project-settings')) - expect(flash[:notice]).to eq("Project '#{project.name}' was successfully updated.") - end - - it 'sets the compliance framework' do - assign_framework - - expect(project.reload.compliance_framework_settings.first.compliance_management_framework).to eq(framework) - end - end - - context 'when user is a project owner' do - before_all do - project.add_owner(user) - end - - it_behaves_like 'setting compliance framework' - end - - context 'when user has the permission because of a custom role' do - let_it_be(:role) { create(:member_role, :guest, namespace: group, admin_compliance_framework: true) } - let_it_be(:membership) { create(:group_member, :guest, member_role: role, user: user, group: group) } - - it_behaves_like 'setting compliance framework' - end - - context 'when user does not have permissions to update the framework' do - it 'returns a 404' do - assign_framework - - expect(response).to have_gitlab_http_status(:not_found) - end - end - end -end