Skip to content

Commit

Permalink
Merge branch 'mark_during_bulk' into adventist_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Sep 21, 2023
2 parents 6538238 + 3d713e3 commit 395d4d9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/actors/hyrax/environment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

# OVERRIDE Hyrax 2.9 to add in import flag
module Hyrax
module Actors
class Environment
# @param [ActiveFedora::Base] curation_concern work to operate on
# @param [Ability] current_ability the authorizations of the acting user
# @param [ActionController::Parameters] attributes user provided form attributes
def initialize(curation_concern, current_ability, attributes, importing = false)
@curation_concern = curation_concern
@current_ability = current_ability
@attributes = attributes.to_h.with_indifferent_access
@importing = importing
end

attr_reader :curation_concern, :current_ability, :attributes, :importing

# @return [User] the user from the current_ability
def user
current_ability.current_user
end
end
end
end
14 changes: 14 additions & 0 deletions app/factories/bulkrax/object_factory_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

# Add ability to mark environment as from bulk import
module Bulkrax
module ObjectFactoryDecorator
# @param [Hash] attrs the attributes to put in the environment
# @return [Hyrax::Actors::Environment]
def environment(attrs)
Hyrax::Actors::Environment.new(object, Ability.new(@user), attrs, true)
end
end
end

::Bulkrax::ObjectFactory.prepend(Bulkrax::ObjectFactoryDecorator)

0 comments on commit 395d4d9

Please sign in to comment.