-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mark_during_bulk' into adventist_dev
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |