mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-22 16:31:12 +00:00
Fixed that new role does not have non member permissions as default (#23633).
git-svn-id: http://svn.redmine.org/redmine/trunk@15764 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
19109f6f64
commit
58c8c1ca9f
@ -74,7 +74,7 @@ module Redmine
|
|||||||
# # => {'title' => 'My book'}
|
# # => {'title' => 'My book'}
|
||||||
def delete_unsafe_attributes(attrs, user=User.current)
|
def delete_unsafe_attributes(attrs, user=User.current)
|
||||||
safe = safe_attribute_names(user)
|
safe = safe_attribute_names(user)
|
||||||
attrs.dup.delete_if {|k,v| !safe.include?(k)}
|
attrs.dup.delete_if {|k,v| !safe.include?(k.to_s)}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets attributes from attrs that are safe
|
# Sets attributes from attrs that are safe
|
||||||
|
|||||||
@ -39,6 +39,18 @@ class RolesControllerTest < Redmine::ControllerTest
|
|||||||
get :new
|
get :new
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'input[name=?]', 'role[name]'
|
assert_select 'input[name=?]', 'role[name]'
|
||||||
|
assert_select 'input[name=?]', 'role[permissions][]'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_new_should_prefill_permissions_with_non_member_permissions
|
||||||
|
role = Role.non_member
|
||||||
|
role.permissions = [:view_issues, :view_documents]
|
||||||
|
role.save!
|
||||||
|
|
||||||
|
get :new
|
||||||
|
assert_response :success
|
||||||
|
assert_equal %w(view_documents view_issues),
|
||||||
|
css_select('input[name="role[permissions][]"][checked=checked]').map {|e| e.attr('value')}.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_with_copy
|
def test_new_with_copy
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user