Commit bcd225d7 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '218569-dont-show-import-from-jira-button-for-non-entitled-users' into 'master'

Hide "Import from Jira" option from non-entitled users

See merge request gitlab-org/gitlab!32685
parents f5d9a9c6 14c6d33a
- type = local_assigns.fetch(:type, :icon) - type = local_assigns.fetch(:type, :icon)
- can_edit = can?(current_user, :admin_project, @project)
.dropdown.btn-group .dropdown.btn-group
%button.btn.rounded-right.text-center{ class: ('has-tooltip' if type == :icon), title: (_('Import issues') if type == :icon), %button.btn.rounded-right.text-center{ class: ('has-tooltip' if type == :icon), title: (_('Import issues') if type == :icon),
...@@ -9,6 +10,7 @@ ...@@ -9,6 +10,7 @@
= _('Import issues') = _('Import issues')
%ul.dropdown-menu %ul.dropdown-menu
%li %li
%button.btn{ data: { toggle: 'modal', target: '.issues-import-modal' } } %button{ data: { toggle: 'modal', target: '.issues-import-modal' } }
= _('Import CSV') = _('Import CSV')
%li= link_to _('Import from Jira'), project_import_jira_path(@project) - if can_edit
%li= link_to _('Import from Jira'), project_import_jira_path(@project)
---
title: Hide "Import from Jira" option from non-entitled users
merge_request: 32685
author:
type: fixed
...@@ -49,6 +49,7 @@ Importing large projects may take several minutes depending on the size of the i ...@@ -49,6 +49,7 @@ Importing large projects may take several minutes depending on the size of the i
1. On the **{issues}** **Issues** page, click the **Import Issues** (**{import}**) button. 1. On the **{issues}** **Issues** page, click the **Import Issues** (**{import}**) button.
1. Select **Import from Jira**. 1. Select **Import from Jira**.
This option is only visible if you have the [correct permissions](#permissions).
![Import issues from Jira button](img/jira/import_issues_from_jira_button_v12_10.png) ![Import issues from Jira button](img/jira/import_issues_from_jira_button_v12_10.png)
......
# frozen_string_literal: true
require 'spec_helper'
describe 'projects/issues/import_csv/_button' do
include Devise::Test::ControllerHelpers
context 'when the user does not have edit permissions' do
before do
render
end
it 'shows a dropdown button to import CSV' do
expect(rendered).to have_text('Import CSV')
end
it 'does not show a button to import from Jira' do
expect(rendered).not_to have_text('Import from Jira')
end
end
context 'when the user has edit permissions' do
let(:project) { create(:project) }
let(:current_user) { create(:user, maintainer_projects: [project]) }
before do
allow(view).to receive(:project_import_jira_path).and_return('import/jira')
allow(view).to receive(:current_user).and_return(current_user)
assign(:project, project)
render
end
it 'shows a dropdown button to import CSV' do
expect(rendered).to have_text('Import CSV')
end
it 'shows a button to import from Jira' do
expect(rendered).to have_text('Import from Jira')
end
end
end
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