curation_concerns 0.12.0.pre4 → 0.12.0.pre5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/actors/curation_concerns/actor_stack.rb +27 -0
- data/app/actors/curation_concerns/file_set_actor.rb +4 -4
- data/app/models/concerns/curation_concerns/ability.rb +12 -3
- data/app/models/concerns/curation_concerns/file_set_behavior.rb +6 -1
- data/app/services/curation_concerns/actor_factory.rb +24 -0
- data/app/services/curation_concerns/curation_concern.rb +10 -41
- data/lib/curation_concerns/version.rb +1 -1
- data/solr/config/schema.xml +1 -1
- data/spec/actors/curation_concerns/add_to_collections_actor_spec.rb +4 -4
- data/spec/actors/curation_concerns/interpret_visibility_actor_spec.rb +4 -4
- data/spec/models/file_set_spec.rb +1 -1
- data/spec/services/curation_concern_spec.rb +11 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cc5f2766beec4a47127cd43e76cd15789ea7edf
|
4
|
+
data.tar.gz: 0d1eccaf7b536f7a4c7d51d575f9828e4f2f7ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 775fd8bd118db29f56b3a12b8aee3f36e02dcb108cefcd4da104413b042c0b38fd3983102cd55b49824b26acc0c2fdd3448909edcb734cb89018f8fccf0d7d12
|
7
|
+
data.tar.gz: 697fe8253127b5cfa3ab326458b944a44d09693af59710d629d1a65f59fa5ff49ae558fe5ef82848f18fc0fbc7221cdf37c60390e08f5b9c48dfd949c4e7cd4d
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
class ActorStack
|
3
|
+
attr_reader :curation_concern, :user, :first_actor_class, :more_actors
|
4
|
+
def initialize(curation_concern, user, more_actors)
|
5
|
+
@curation_concern = curation_concern
|
6
|
+
@user = user
|
7
|
+
@more_actors = more_actors
|
8
|
+
@first_actor_class = @more_actors.shift || RootActor
|
9
|
+
end
|
10
|
+
|
11
|
+
def inner_stack
|
12
|
+
ActorStack.new(curation_concern, user, more_actors)
|
13
|
+
end
|
14
|
+
|
15
|
+
def actor
|
16
|
+
first_actor_class.new(curation_concern, user, inner_stack)
|
17
|
+
end
|
18
|
+
|
19
|
+
def create(attributes)
|
20
|
+
actor.create(attributes.with_indifferent_access)
|
21
|
+
end
|
22
|
+
|
23
|
+
def update(attributes)
|
24
|
+
actor.update(attributes.with_indifferent_access)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -26,7 +26,7 @@ module CurationConcerns
|
|
26
26
|
file_set.date_modified = now
|
27
27
|
file_set.creator = [user.user_key]
|
28
28
|
|
29
|
-
|
29
|
+
ActorStack.new(file_set, user, [InterpretVisibilityActor]).create(file_set_params) if assign_visibility?(file_set_params)
|
30
30
|
attach_file_to_work(work, file_set, file_set_params) if work
|
31
31
|
yield(file_set) if block_given?
|
32
32
|
end
|
@@ -66,9 +66,9 @@ module CurationConcerns
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def update_metadata(attributes)
|
69
|
-
stack =
|
70
|
-
|
71
|
-
|
69
|
+
stack = ActorStack.new(file_set,
|
70
|
+
user,
|
71
|
+
[InterpretVisibilityActor, BaseActor])
|
72
72
|
if result = stack.update(attributes)
|
73
73
|
CurationConcerns.config.callback.run(:after_update_metadata, file_set, user)
|
74
74
|
end
|
@@ -22,7 +22,11 @@ module CurationConcerns
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def admin_permissions
|
25
|
-
|
25
|
+
alias_action :edit, to: :update
|
26
|
+
alias_action :show, to: :read
|
27
|
+
alias_action :discover, to: :read
|
28
|
+
|
29
|
+
can :manage, curation_concerns_models
|
26
30
|
end
|
27
31
|
|
28
32
|
def admin?
|
@@ -42,8 +46,13 @@ module CurationConcerns
|
|
42
46
|
# to submit content
|
43
47
|
def everyone_can_create_curation_concerns
|
44
48
|
return unless registered_user?
|
45
|
-
can :create,
|
46
|
-
can :create, [CurationConcerns.config.curation_concerns]
|
49
|
+
can :create, curation_concerns_models
|
47
50
|
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def curation_concerns_models
|
55
|
+
[::FileSet, ::Collection] + CurationConcerns.config.curation_concerns
|
56
|
+
end
|
48
57
|
end
|
49
58
|
end
|
@@ -1,6 +1,12 @@
|
|
1
1
|
module CurationConcerns
|
2
2
|
module FileSetBehavior
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
# BasicMetadata needs to be included before Characterization since
|
5
|
+
# both of them declare properties with the same predicate (dc:creator
|
6
|
+
# and dc:language.) Loading BasicMetadata first allows Characterization
|
7
|
+
# to detect the duplicate (via the AlreadyThereStrategy) and prevents
|
8
|
+
# the warning.
|
9
|
+
include CurationConcerns::BasicMetadata
|
4
10
|
include Hydra::Works::FileSetBehavior
|
5
11
|
include Hydra::Works::VirusCheck
|
6
12
|
include Hydra::Works::Characterization
|
@@ -9,7 +15,6 @@ module CurationConcerns
|
|
9
15
|
include CurationConcerns::Noid
|
10
16
|
include CurationConcerns::FileSet::Derivatives
|
11
17
|
include CurationConcerns::Permissions
|
12
|
-
include CurationConcerns::BasicMetadata
|
13
18
|
include CurationConcerns::FileSet::FullTextIndexing
|
14
19
|
include CurationConcerns::FileSet::Indexing
|
15
20
|
include CurationConcerns::FileSet::BelongsToWorks
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
class ActorFactory
|
3
|
+
def self.build(curation_concern, current_user)
|
4
|
+
ActorStack.new(curation_concern,
|
5
|
+
current_user,
|
6
|
+
stack_actors(curation_concern))
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.stack_actors(curation_concern)
|
10
|
+
[AddToCollectionActor,
|
11
|
+
AssignRepresentativeActor,
|
12
|
+
AttachFilesActor,
|
13
|
+
ApplyOrderActor,
|
14
|
+
InterpretVisibilityActor,
|
15
|
+
model_actor(curation_concern),
|
16
|
+
AssignIdentifierActor]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.model_actor(curation_concern)
|
20
|
+
actor_identifier = curation_concern.class.to_s.split('::').last
|
21
|
+
"CurationConcerns::#{actor_identifier}Actor".constantize
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,46 +1,15 @@
|
|
1
1
|
module CurationConcerns
|
2
|
-
|
3
|
-
|
2
|
+
class CurationConcern
|
3
|
+
class_attribute :actor_factory
|
4
|
+
self.actor_factory = CurationConcerns::ActorFactory
|
5
|
+
|
6
|
+
# A consumer of this method can inject a different factory
|
7
|
+
# into this class in order to change the behavior of this method.
|
8
|
+
# @param [ActiveFedora::Base] curation_concern a work to be updated
|
9
|
+
# @param [User] current_user the depositor/updater of the work
|
10
|
+
# @return [#create, #update] an actor that can create and update the work
|
4
11
|
def self.actor(curation_concern, current_user)
|
5
|
-
|
6
|
-
[AddToCollectionActor,
|
7
|
-
AssignRepresentativeActor,
|
8
|
-
AttachFilesActor,
|
9
|
-
ApplyOrderActor,
|
10
|
-
InterpretVisibilityActor,
|
11
|
-
model_actor(curation_concern),
|
12
|
-
AssignIdentifierActor])
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.model_actor(curation_concern)
|
16
|
-
actor_identifier = curation_concern.class.to_s.split('::').last
|
17
|
-
"CurationConcerns::#{actor_identifier}Actor".constantize
|
18
|
-
end
|
19
|
-
|
20
|
-
class ActorStack
|
21
|
-
attr_reader :curation_concern, :user, :first_actor_class, :more_actors
|
22
|
-
def initialize(curation_concern, user, more_actors)
|
23
|
-
@curation_concern = curation_concern
|
24
|
-
@user = user
|
25
|
-
@more_actors = more_actors
|
26
|
-
@first_actor_class = @more_actors.shift || RootActor
|
27
|
-
end
|
28
|
-
|
29
|
-
def inner_stack
|
30
|
-
ActorStack.new(curation_concern, user, more_actors)
|
31
|
-
end
|
32
|
-
|
33
|
-
def actor
|
34
|
-
first_actor_class.new(curation_concern, user, inner_stack)
|
35
|
-
end
|
36
|
-
|
37
|
-
def create(attributes)
|
38
|
-
actor.create(attributes.with_indifferent_access)
|
39
|
-
end
|
40
|
-
|
41
|
-
def update(attributes)
|
42
|
-
actor.update(attributes.with_indifferent_access)
|
43
|
-
end
|
12
|
+
actor_factory.build(curation_concern, current_user)
|
44
13
|
end
|
45
14
|
end
|
46
15
|
end
|
data/solr/config/schema.xml
CHANGED
@@ -103,7 +103,7 @@
|
|
103
103
|
http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4
|
104
104
|
-->
|
105
105
|
<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
|
106
|
-
geo="true" distErrPct="0.025" maxDistErr="0.000009"
|
106
|
+
geo="true" distErrPct="0.025" maxDistErr="0.000009" distanceUnits="degrees" />
|
107
107
|
|
108
108
|
<fieldType name="text" class="solr.TextField" omitNorms="false">
|
109
109
|
<analyzer>
|
@@ -4,10 +4,10 @@ describe CurationConcerns::AddToCollectionActor do
|
|
4
4
|
let(:curation_concern) { GenericWork.new }
|
5
5
|
let(:attributes) { {} }
|
6
6
|
subject do
|
7
|
-
CurationConcerns::
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
CurationConcerns::ActorStack.new(curation_concern,
|
8
|
+
user,
|
9
|
+
[described_class,
|
10
|
+
CurationConcerns::GenericWorkActor])
|
11
11
|
end
|
12
12
|
describe 'the next actor' do
|
13
13
|
let(:root_actor) { double }
|
@@ -4,10 +4,10 @@ describe CurationConcerns::InterpretVisibilityActor do
|
|
4
4
|
let(:curation_concern) { GenericWork.new }
|
5
5
|
let(:attributes) { {} }
|
6
6
|
subject do
|
7
|
-
CurationConcerns::
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
CurationConcerns::ActorStack.new(curation_concern,
|
8
|
+
user,
|
9
|
+
[described_class,
|
10
|
+
CurationConcerns::GenericWorkActor])
|
11
11
|
end
|
12
12
|
let(:date) { Date.today + 2 }
|
13
13
|
|
@@ -105,7 +105,7 @@ describe FileSet do
|
|
105
105
|
expect(subject).to respond_to(:well_formed)
|
106
106
|
expect(subject).to respond_to(:page_count)
|
107
107
|
expect(subject).to respond_to(:file_title)
|
108
|
-
expect(subject).to respond_to(:
|
108
|
+
expect(subject).to respond_to(:creator)
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'redefines to_param to make redis keys more recognizable' do
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CurationConcerns::CurationConcern do
|
4
|
+
let(:work) { GenericWork.new }
|
5
|
+
let(:user) { double }
|
6
|
+
|
7
|
+
describe ".actor" do
|
8
|
+
subject { described_class.actor(work, user) }
|
9
|
+
it { is_expected.to be_kind_of CurationConcerns::ActorStack }
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curation_concerns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.0.
|
4
|
+
version: 0.12.0.pre5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-04-
|
13
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hydra-head
|
@@ -615,6 +615,7 @@ files:
|
|
615
615
|
- Rakefile
|
616
616
|
- app/actors/concerns/curation_concerns/manages_embargoes_actor.rb
|
617
617
|
- app/actors/curation_concerns/abstract_actor.rb
|
618
|
+
- app/actors/curation_concerns/actor_stack.rb
|
618
619
|
- app/actors/curation_concerns/add_to_collection_actor.rb
|
619
620
|
- app/actors/curation_concerns/apply_order_actor.rb
|
620
621
|
- app/actors/curation_concerns/assign_identifier_actor.rb
|
@@ -787,6 +788,7 @@ files:
|
|
787
788
|
- app/search_builders/curation_concerns/single_result.rb
|
788
789
|
- app/search_builders/curation_concerns/single_use_link_search_builder.rb
|
789
790
|
- app/search_builders/curation_concerns/work_search_builder.rb
|
791
|
+
- app/services/curation_concerns/actor_factory.rb
|
790
792
|
- app/services/curation_concerns/curation_concern.rb
|
791
793
|
- app/services/curation_concerns/derivative_path.rb
|
792
794
|
- app/services/curation_concerns/embargo_service.rb
|
@@ -1152,6 +1154,7 @@ files:
|
|
1152
1154
|
- spec/search_builders/curation_concerns/lease_search_builder_spec.rb
|
1153
1155
|
- spec/search_builders/curation_concerns/search_builder_spec.rb
|
1154
1156
|
- spec/search_builders/resource_types_service_spec.rb
|
1157
|
+
- spec/services/curation_concern_spec.rb
|
1155
1158
|
- spec/services/derivative_path_spec.rb
|
1156
1159
|
- spec/services/embargo_service_spec.rb
|
1157
1160
|
- spec/services/file_set_audit_service_spec.rb
|
@@ -1229,7 +1232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1229
1232
|
version: 1.3.1
|
1230
1233
|
requirements: []
|
1231
1234
|
rubyforge_project:
|
1232
|
-
rubygems_version: 2.
|
1235
|
+
rubygems_version: 2.5.1
|
1233
1236
|
signing_key:
|
1234
1237
|
specification_version: 4
|
1235
1238
|
summary: A Rails Engine that allows an application to CRUD CurationConcern objects
|
@@ -1352,6 +1355,7 @@ test_files:
|
|
1352
1355
|
- spec/search_builders/curation_concerns/lease_search_builder_spec.rb
|
1353
1356
|
- spec/search_builders/curation_concerns/search_builder_spec.rb
|
1354
1357
|
- spec/search_builders/resource_types_service_spec.rb
|
1358
|
+
- spec/services/curation_concern_spec.rb
|
1355
1359
|
- spec/services/derivative_path_spec.rb
|
1356
1360
|
- spec/services/embargo_service_spec.rb
|
1357
1361
|
- spec/services/file_set_audit_service_spec.rb
|