Commit 7f1848ac authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'user_permission_frontend' into 'master'

Frontend changes for User Permission export

See merge request gitlab-org/gitlab!51251
parents c5c57643 0facca8b
......@@ -44,6 +44,7 @@
%small.badge.badge-pill= limited_counter_with_delimiter(User.without_projects)
.nav-controls
= render_if_exists 'admin/users/admin_email_users'
= render_if_exists 'admin/users/admin_export_user_permissions'
= link_to s_('AdminUsers|New user'), new_admin_user_path, class: 'btn gl-button btn-success btn-search float-right'
.filtered-search-block.row-content-block.border-top-0
......
- return unless send_emails_from_admin_area_feature_available?
= link_to s_('AdminUsers|Send email to users'), admin_email_path, class: 'btn gl-button'
= link_to admin_email_path, { class: 'gl-button btn btn-default', data: { toggle: "tooltip", placement: "top", container: "body" }, title: s_("AdminUsers|Send email to users") } do
.gl-button-icon
= sprite_icon('mail')
- return unless current_user&.can?(:export_user_permissions)
= link_to admin_user_permission_exports_path(format: :csv), { class: 'gl-button btn btn-default', data: { toggle: "tooltip", placement: "top", container: "body" }, title: s_("AdminUsers|Export permissions as CSV") } do
.gl-button-icon
= sprite_icon('upload')
......@@ -27,7 +27,7 @@ RSpec.describe "Admin::Users" do
it "shows the 'Send email to users' link" do
visit admin_users_path
expect(page).to have_link('Send email to users', href: admin_email_path)
expect(page).to have_link(href: admin_email_path)
end
end
......@@ -39,7 +39,33 @@ RSpec.describe "Admin::Users" do
it "does not show the 'Send email to users' link" do
visit admin_users_path
expect(page).not_to have_link('Send email to users', href: admin_email_path)
expect(page).not_to have_link(href: admin_email_path)
end
end
end
describe 'user permission export' do
context 'when `export_user_permissions` feature is available' do
before do
stub_licensed_features(export_user_permissions: true)
end
it "shows the 'Export Permissions' link" do
visit admin_users_path
expect(page).to have_link(href: admin_user_permission_exports_path(format: :csv))
end
end
context 'when `export_user_permissions` feature is disabled' do
before do
stub_licensed_features(export_user_permissions: false)
end
it "does not show the 'Export Permissions' link" do
visit admin_users_path
expect(page).not_to have_link(href: admin_user_permission_exports_path(format: :csv))
end
end
end
......
......@@ -16,14 +16,14 @@ RSpec.describe 'admin/users/index' do
end
it 'includes "Send email to users" link' do
expect(rendered).to have_link 'Send email to users', href: admin_email_path
expect(rendered).to have_link href: admin_email_path
end
context 'when Gitlab::CurrentSettings.should_check_namespace_plan is true' do
let(:should_check_namespace_plan) { true }
it 'includes "Send email to users" link' do
expect(rendered).to have_link 'Send email to users', href: admin_email_path
expect(rendered).to have_link href: admin_email_path
end
end
end
......@@ -2215,6 +2215,9 @@ msgstr ""
msgid "AdminUsers|Delete user and contributions"
msgstr ""
msgid "AdminUsers|Export permissions as CSV"
msgstr ""
msgid "AdminUsers|External"
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