mirror of
https://github.com/redmine/redmine.git
synced 2025-11-17 02:30:56 +01:00
Allow non-admin users to see group members (#12795).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@21072 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -21,7 +21,7 @@ class GroupsController < ApplicationController
|
|||||||
layout 'admin'
|
layout 'admin'
|
||||||
self.main_menu = false
|
self.main_menu = false
|
||||||
|
|
||||||
before_action :require_admin
|
before_action :require_admin, :except => [:show]
|
||||||
before_action :find_group, :except => [:index, :new, :create]
|
before_action :find_group, :except => [:index, :new, :create]
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy, :add_users, :remove_user
|
accept_api_auth :index, :show, :create, :update, :destroy, :add_users, :remove_user
|
||||||
|
|
||||||
@@ -50,8 +50,12 @@ class GroupsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
return render_404 unless @group.visible?
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html do
|
||||||
|
render :layout => 'base'
|
||||||
|
end
|
||||||
format.api
|
format.api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
<%= title [l(:label_group_plural), groups_path], @group.name %>
|
<div class="contextual">
|
||||||
|
<%= link_to(l(:button_edit), edit_group_path(@group), :class => 'icon icon-edit') if User.current.admin? %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2><%= @group.name %></h2>
|
||||||
|
|
||||||
<% if @group.custom_field_values.any? %>
|
<% if @group.custom_field_values.any? %>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -14,3 +18,4 @@
|
|||||||
<li><%= user %></li>
|
<li><%= user %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
<% html_title @group.name %>
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ class GroupsControllerTest < Redmine::ControllerTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_show
|
def test_show
|
||||||
|
Role.anonymous.update! :users_visibility => 'all'
|
||||||
|
|
||||||
|
@request.session[:user_id] = nil
|
||||||
get(:show, :params => {:id => 10})
|
get(:show, :params => {:id => 10})
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
@@ -70,6 +73,14 @@ class GroupsControllerTest < Redmine::ControllerTest
|
|||||||
assert_response 404
|
assert_response 404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_show_group_that_is_not_visible_should_return_404
|
||||||
|
Role.anonymous.update! :users_visibility => 'members_of_visible_projects'
|
||||||
|
|
||||||
|
@request.session[:user_id] = nil
|
||||||
|
get :show, :params => {:id => 10}
|
||||||
|
assert_response 404
|
||||||
|
end
|
||||||
|
|
||||||
def test_new
|
def test_new
|
||||||
get :new
|
get :new
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|||||||
Reference in New Issue
Block a user