hydra-head
hydra-head copied to clipboard
Permissions attributes are incorrectly updated when multiple access levels are defined.
Descriptive summary
10.5.0
When a user or group has multiple access permissions on an object, the permissions are incorrectly updated when saving permission_attributes.
Rationale
If the permissions on an object are:
{:name=>"[email protected]", :type=>"person", :access=>"edit"}{:name=>"[email protected]", :type=>"person", :access=>"read"}
And the permissions attributes are set to the same the result is two permissions both with read access.
Expected behavior
Should maintain both access levels for the user or group.
Actual behavior
The first access level is overwritten by the access level of the last permission passed to permission_attributes=.
Steps to reproduce the behavior
fs = FileSet.create
fs.permissions_attributes = [{:name=>"[email protected]", :type=>"person", :access=>"edit"}, {:name=>"[email protected]", :type=>"person", :access=>"read"}]
fs.save
fs.permissions_attributes = [{:name=>"[email protected]", :type=>"person", :access=>"edit"}, {:name=>"[email protected]", :type=>"person", :access=>"read"}]
fs.save