mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Cannot create a custom query visibility is "to these roles only" (#20427).
git-svn-id: http://svn.redmine.org/redmine/trunk@14472 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
14d3a11542
commit
279e4b7aa0
@ -108,6 +108,7 @@ private
|
|||||||
@query.name = params[:query] && params[:query][:name]
|
@query.name = params[:query] && params[:query][:name]
|
||||||
if User.current.allowed_to?(:manage_public_queries, @query.project) || User.current.admin?
|
if User.current.allowed_to?(:manage_public_queries, @query.project) || User.current.admin?
|
||||||
@query.visibility = (params[:query] && params[:query][:visibility]) || IssueQuery::VISIBILITY_PRIVATE
|
@query.visibility = (params[:query] && params[:query][:visibility]) || IssueQuery::VISIBILITY_PRIVATE
|
||||||
|
@query.role_ids = params[:query] && params[:query][:role_ids]
|
||||||
else
|
else
|
||||||
@query.visibility = IssueQuery::VISIBILITY_PRIVATE
|
@query.visibility = IssueQuery::VISIBILITY_PRIVATE
|
||||||
end
|
end
|
||||||
|
|||||||
@ -92,6 +92,22 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
assert q.valid?
|
assert q.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_create_project_roles_query
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
post :create,
|
||||||
|
:project_id => 'ecookbook',
|
||||||
|
:default_columns => '1',
|
||||||
|
:fields => ["status_id", "assigned_to_id"],
|
||||||
|
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
|
||||||
|
:values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
|
||||||
|
:query => {"name" => "test_create_project_roles_query", "visibility" => "1", "role_ids" => ["1", "2", ""]}
|
||||||
|
|
||||||
|
q = Query.find_by_name('test_create_project_roles_query')
|
||||||
|
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
|
||||||
|
assert_equal Query::VISIBILITY_ROLES, q.visibility
|
||||||
|
assert_equal [1, 2], q.roles.ids.sort
|
||||||
|
end
|
||||||
|
|
||||||
def test_create_global_private_query_with_custom_columns
|
def test_create_global_private_query_with_custom_columns
|
||||||
@request.session[:user_id] = 3
|
@request.session[:user_id] = 3
|
||||||
post :create,
|
post :create,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user