Fixed: cannot retrieve members for closed projects through the REST API (#15848).
git-svn-id: http://svn.redmine.org/redmine/trunk@12650 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
de19424ea5
commit
9ad2ca61da
|
@ -86,6 +86,7 @@ Redmine::AccessControl.map do |map|
|
||||||
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member
|
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member
|
||||||
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true
|
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true
|
||||||
map.permission :select_project_modules, {:projects => :modules}, :require => :member
|
map.permission :select_project_modules, {:projects => :modules}, :require => :member
|
||||||
|
map.permission :view_members, {:members => [:index, :show]}, :public => true, :read => true
|
||||||
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member
|
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member
|
||||||
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
|
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
|
||||||
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
|
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
|
||||||
|
|
|
@ -60,7 +60,7 @@ module Redmine
|
||||||
!perm.nil? && perm.read?
|
!perm.nil? && perm.read?
|
||||||
else
|
else
|
||||||
s = "#{action[:controller]}/#{action[:action]}"
|
s = "#{action[:controller]}/#{action[:action]}"
|
||||||
permissions.detect {|p| p.actions.include?(s) && !p.read?}.nil?
|
permissions.detect {|p| p.actions.include?(s) && p.read?}.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,14 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base
|
||||||
json)
|
json)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "GET /projects/:project_id/memberships.xml should succeed for closed project" do
|
||||||
|
project = Project.find(1)
|
||||||
|
project.close
|
||||||
|
assert !project.reload.active?
|
||||||
|
get '/projects/1/memberships.json', {}, credentials('jsmith')
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
test "POST /projects/:project_id/memberships.xml should create the membership" do
|
test "POST /projects/:project_id/memberships.xml should create the membership" do
|
||||||
assert_difference 'Member.count' do
|
assert_difference 'Member.count' do
|
||||||
post '/projects/1/memberships.xml', {:membership => {:user_id => 7, :role_ids => [2,3]}}, credentials('jsmith')
|
post '/projects/1/memberships.xml', {:membership => {:user_id => 7, :role_ids => [2,3]}}, credentials('jsmith')
|
||||||
|
|
Loading…
Reference in New Issue