Commit 4781a626 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'issue_280' into 'master'

Discourage users from clicking 'Clear LDAP permission cache'.

Reference: https://dev.gitlab.org/gitlab/gitlab-ee/issues/280

See merge request !61
parents 80a12e64 1278a1fb
......@@ -195,7 +195,8 @@ $ ->
e.preventDefault()
btn = $(e.target)
text = btn.data("confirm-danger-message")
warningMessage = btn.data("warning-message")
form = btn.closest("form")
new ConfirmDangerModal(form, text)
new ConfirmDangerModal(form, text, warningMessage: warningMessage)
new Aside()
class @ConfirmDangerModal
constructor: (form, text) ->
constructor: (form, text, {warningMessage} = {}) ->
@form = form
$('.js-confirm-text').text(text || '')
$('.js-confirm-text').html(text || '')
$('.js-warning-text').html(warningMessage) if warningMessage
$('.js-confirm-danger-input').val('')
$('#modal-confirm-danger').modal('show')
project_path = $('.js-confirm-danger-match').text()
......
module GroupMembersHelper
def clear_ldap_permission_cache_message
markdown(<<-EOT.strip_heredoc
Be careful, all members of this group (except you) will have their
**access level temporarily downgraded** to `Guest`. The next time that a group member
signs in to GitLab (or after one hour, whichever occurs first) their access level will
be updated to the one specified on the Group settings page.
EOT
)
end
end
......@@ -18,8 +18,10 @@
- if current_user && current_user.can?(:admin_group_member, @group)
.pull-right
- if @group.ldap_synced?
= link_to reset_access_group_ldap_path(@group), class: 'btn btn-grouped', data: { confirm: "Force GitLab to do LDAP permission checks for all group members? All members besides yourself will be reduced to 'Guest' access until their next interaction with GitLab." }, method: :put do
Clear LDAP permission cache
= form_tag(reset_access_group_ldap_path(@group), method: :put, class: 'inline') do
= button_to 'Clear LDAP permission cache', '#', class: "btn btn-remove js-confirm-danger",
data: { "confirm-danger-message" => clear_ldap_permission_cache_message,
'warning-message' => 'If you made manual permission tweaks for some group members they will be lost.' }
= button_tag class: 'btn btn-new js-toggle-button', type: 'button' do
Add members
......@@ -52,6 +54,7 @@
= render 'groups/group_members/group_member', member: member, show_roles: show_roles, show_controls: true
= paginate @members, theme: 'gitlab'
= render 'shared/confirm_modal', phrase: 'reset'
:javascript
$('form.member-search-form').on('submit', function(event) {
......
......@@ -9,8 +9,9 @@
%p.cred.lead.js-confirm-text
%p
This action can lead to data loss.
To prevent accidental actions we ask you to confirm your intention.
%span.js-warning-text
This action can lead to data loss.
To prevent accidental actions we ask you to confirm your intention.
%br
Please type
%code.js-confirm-danger-match #{phrase}
......
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