Skip to content

Commit

Permalink
limit the explosure of the permissions_attributes deprecation warning…
Browse files Browse the repository at this point in the history
… for collections

Moved the deprecation down so users will only see it if they pass in read/edit permissions in the permissions_attributes.  This deprecation will never be triggered through the UI.

It is triggered through tests that confirm the older style permission parameters (e.g. read, edit) are correctly converted to the new style (e.g. manage, deposit, view).
  • Loading branch information
elrayle committed Apr 18, 2018
1 parent 0d39af0 commit 2f13f01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/hyrax/dashboard/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,10 @@ def collection_params

def extract_old_style_permission_attributes(attributes)
# TODO: REMOVE in 3.0 - part of deprecation of permission attributes
Deprecation.warn(self, "passing in permissions with a new collection is deprecated and will be removed from Hyrax 3.0 ()") # TODO: elr - add alternative in ()
permissions = attributes.delete("permissions_attributes")
return [] unless permissions
Deprecation.warn(self, "Passing in permissions_attributes parameter with a new collection is deprecated and support will be removed from Hyrax 3.0. " \
"Use Hyrax::PermissionTemplate instead to grant Manage, Deposit, or View access.")
participants = []
permissions.each do |p|
access = access(p)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
post :create, params: {
collection: collection_attrs.merge(
visibility: 'open',
# TODO: Tests with old approach to sharing a collection which is deprecated and
# will be removed in 3.0. New approach creates a PermissionTemplate with
# source_id = the collection's id.
permissions_attributes: [{ type: 'person',
name: 'archivist1',
access: 'edit' }]
Expand Down

0 comments on commit 2f13f01

Please sign in to comment.