Commit 37723dc6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

UI and controller for group members access reset

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 93874928
class Groups::LdapsController < ApplicationController
before_filter :group
before_filter :authorize_admin_group!
def reset_access
LdapGroupResetService.new.execute(group, current_user)
redirect_to members_group_path(@group), notice: 'Access reset complete'
end
private
def group
@group ||= Group.find_by(path: params[:group_id])
end
def authorize_admin_group!
unless can?(current_user, :manage_group, group)
return render_404
end
end
end
...@@ -233,4 +233,8 @@ module ApplicationHelper ...@@ -233,4 +233,8 @@ module ApplicationHelper
content_tag(:i, nil, class: 'icon-spinner icon-spin') + text content_tag(:i, nil, class: 'icon-spinner icon-spin') + text
end end
end end
def ldap_enabled?
Gitlab.config.ldap.enabled
end
end end
...@@ -76,4 +76,8 @@ class Group < Namespace ...@@ -76,4 +76,8 @@ class Group < Namespace
self.errors.add :avatar, "only images allowed" self.errors.add :avatar, "only images allowed"
end end
end end
def human_ldap_access
Gitlab::Access.options_with_owner.key ldap_access
end
end end
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
- if current_user.can? :manage_group, @group - if current_user.can? :manage_group, @group
.pull-right .pull-right
- if ldap_enabled? && @group.ldap_cn.present?
= link_to reset_access_group_ldap_path(@group), class: 'btn grouped', data: { confirm: "Reset all ldap group members access to '#{@group.human_ldap_access}'?" }, method: :put do
Reset access
= link_to '#', class: 'btn btn-new js-toggle-visibility-link' do = link_to '#', class: 'btn btn-new js-toggle-visibility-link' do
Add members Add members
%i.icon-chevron-down %i.icon-chevron-down
......
...@@ -159,6 +159,14 @@ Gitlab::Application.routes.draw do ...@@ -159,6 +159,14 @@ Gitlab::Application.routes.draw do
get :members get :members
end end
scope module: :groups do
resource :ldap, only: [] do
member do
put :reset_access
end
end
end
resources :users_groups, only: [:create, :update, :destroy] resources :users_groups, only: [:create, :update, :destroy]
scope module: :groups do scope module: :groups do
resource :avatar, only: [:destroy] resource :avatar, only: [:destroy]
......
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