Feature #12795 » 0001-Allow-non-admin-users-to-see-group-members-when-the-.patch
| app/controllers/groups_controller.rb | ||
|---|---|---|
|
layout 'admin'
|
||
|
self.main_menu = false
|
||
|
before_action :require_admin
|
||
|
before_action :require_admin, :except => [:show]
|
||
|
before_action :find_group, :except => [:index, :new, :create]
|
||
|
accept_api_auth :index, :show, :create, :update, :destroy, :add_users, :remove_user
|
||
| ... | ... | |
|
end
|
||
|
def show
|
||
|
return render_404 unless @group.visible?
|
||
|
respond_to do |format|
|
||
|
format.html
|
||
|
format.html do
|
||
|
render :layout => 'base'
|
||
|
end
|
||
|
format.api
|
||
|
end
|
||
|
end
|
||
| app/views/groups/show.html.erb | ||
|---|---|---|
|
<%= 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? %>
|
||
|
<ul>
|
||
| ... | ... | |
|
<li><%= user %></li>
|
||
|
<% end %>
|
||
|
</ul>
|
||
|
<% html_title @group.name %>
|
||
| test/functional/groups_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_show
|
||
|
Role.anonymous.update! :users_visibility => 'all'
|
||
|
@request.session[:user_id] = nil
|
||
|
get(:show, :params => {:id => 10})
|
||
|
assert_response :success
|
||
|
end
|
||
| ... | ... | |
|
assert_response 404
|
||
|
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
|
||
|
get :new
|
||
|
assert_response :success
|
||
- « Previous
- 1
- 2
- 3
- 4
- Next »