sufia-models 3.3.1 → 3.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/app/models/batch.rb +5 -6
- data/lib/sufia/models/generic_file.rb +3 -4
- data/lib/sufia/models/generic_file/characterization.rb +2 -2
- data/lib/sufia/models/generic_file/permissions.rb +9 -4
- data/lib/sufia/models/version.rb +1 -1
- data/sufia-models.gemspec +6 -2
- metadata +19 -19
- data/lib/sufia/models/generic_file/visibility.rb +0 -65
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YmIyNzdkOGRjNzRhZTY3NmMxZDhjNGE4N2FmMWE0MjQwODk0NjY0NA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 864fcf836acb9a34187c342354bf943a736988f5
|
4
|
+
data.tar.gz: 02fa325f9ec39f51169643e79d6ed0a5dc41de89
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MzU1NjY5MzBkMTJhNzhjNTQwMDUyOTgxMmQxMWU5MDJhYzk3MjBhZTI2MDAw
|
11
|
-
NTU0Y2EyOTI0MDg1NDRjZTMxNGU3ZmYyNzdhN2Y4OTFhYTdjZjE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZTBiYzI1ZjE1MjVmY2I4NWEzOGVlM2QwYmQ5ZjE2ZDEyZTFiNDE4MGQwY2M4
|
14
|
-
OGFjZTQ4Y2U5MzExY2VmMjU1MmM3OGVlZTU2NTc1MjNiNmE4OTA3NDkzYWQ5
|
15
|
-
MTFjZWQ3NDIwYmI3Zjc3ZTEyYzkyYjFiNmE5NDg4YmZkNzJiMTg=
|
6
|
+
metadata.gz: fa522802062007fedff7c959cb3b1b5da39c2d61fab46fc81a86f982a5c67fa8c5267b0110fe50beec4f803266ac672ca5e69c041c02a061832bfc40f4e290f9
|
7
|
+
data.tar.gz: 9f6713b40affc73f74b88140ac3755c8909a22ed88ac60647f28b4b009f502293a3602a67e8f06d243d52e6f4e0c4615e68753cc35e9f146239ed490ee0d908e
|
data/app/models/batch.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
class Batch < ActiveFedora::Base
|
2
|
-
include Hydra::
|
3
|
-
include Hydra::ModelMixins::RightsMetadata
|
2
|
+
include Hydra::AccessControls::Permissions
|
4
3
|
include Sufia::ModelMethods
|
5
4
|
include Sufia::Noid
|
6
5
|
|
@@ -9,10 +8,10 @@ class Batch < ActiveFedora::Base
|
|
9
8
|
belongs_to :user, :property => "creator"
|
10
9
|
has_many :generic_files, :property => :is_part_of
|
11
10
|
|
12
|
-
delegate :title, :to => :descMetadata
|
13
|
-
delegate :creator, :to => :descMetadata
|
14
|
-
delegate :part, :to => :descMetadata
|
15
|
-
delegate :status, :to => :descMetadata
|
11
|
+
delegate :title, :to => :descMetadata, multiple: true
|
12
|
+
delegate :creator, :to => :descMetadata, multiple: true
|
13
|
+
delegate :part, :to => :descMetadata, multiple: true
|
14
|
+
delegate :status, :to => :descMetadata, multiple: true
|
16
15
|
|
17
16
|
def self.find_or_create(pid)
|
18
17
|
begin
|
@@ -4,7 +4,6 @@ module Sufia
|
|
4
4
|
extend ActiveSupport::Autoload
|
5
5
|
autoload :Actions, 'sufia/models/generic_file/actions'
|
6
6
|
autoload :Permissions, 'sufia/models/generic_file/permissions'
|
7
|
-
autoload :Visibility, 'sufia/models/generic_file/visibility'
|
8
7
|
autoload :WebForm, 'sufia/models/generic_file/web_form'
|
9
8
|
autoload :AccessibleAttributes, 'sufia/models/generic_file/accessible_attributes'
|
10
9
|
include Sufia::ModelMethods
|
@@ -26,12 +25,12 @@ module Sufia
|
|
26
25
|
|
27
26
|
belongs_to :batch, :property => :is_part_of
|
28
27
|
|
29
|
-
delegate_to :properties, [:relative_path, :depositor, :import_url], :
|
30
|
-
delegate_to :descMetadata, [:date_uploaded, :date_modified], :
|
28
|
+
delegate_to :properties, [:relative_path, :depositor, :import_url], multiple: false
|
29
|
+
delegate_to :descMetadata, [:date_uploaded, :date_modified], multiple: false
|
31
30
|
delegate_to :descMetadata, [:related_url, :based_near, :part_of, :creator,
|
32
31
|
:contributor, :title, :tag, :description, :rights,
|
33
32
|
:publisher, :date_created, :subject,
|
34
|
-
:resource_type, :identifier, :language]
|
33
|
+
:resource_type, :identifier, :language], multiple: true
|
35
34
|
|
36
35
|
around_save :characterize_if_changed, :retry_warming
|
37
36
|
before_destroy :cleanup_trophies
|
@@ -4,7 +4,7 @@ module Sufia
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
included do
|
6
6
|
has_metadata :name => "characterization", :type => FitsDatastream
|
7
|
-
delegate :mime_type, :to => :characterization, :
|
7
|
+
delegate :mime_type, :to => :characterization, multiple: false
|
8
8
|
delegate_to :characterization, [:format_label, :file_size, :last_modified,
|
9
9
|
:filename, :original_checksum, :rights_basis,
|
10
10
|
:copyright_basis, :copyright_note,
|
@@ -20,7 +20,7 @@ module Sufia
|
|
20
20
|
:gps_timestamp, :latitude, :longitude,
|
21
21
|
:character_set, :markup_basis,
|
22
22
|
:markup_language, :duration, :bit_depth,
|
23
|
-
:sample_rate, :channels, :data_format, :offset]
|
23
|
+
:sample_rate, :channels, :data_format, :offset], multiple: true
|
24
24
|
|
25
25
|
end
|
26
26
|
|
@@ -2,12 +2,12 @@ module Sufia
|
|
2
2
|
module GenericFile
|
3
3
|
module Permissions
|
4
4
|
extend ActiveSupport::Concern
|
5
|
-
#we're overriding the permissions= method which is in
|
6
|
-
include Hydra::
|
7
|
-
include
|
5
|
+
#we're overriding the permissions= method which is in Hydra::AccessControls::Permissions
|
6
|
+
include Hydra::AccessControls::Permissions
|
7
|
+
include Hydra::AccessControls::Visibility
|
8
8
|
|
9
9
|
included do
|
10
|
-
has_metadata
|
10
|
+
has_metadata "rightsMetadata", :type => ParanoidRightsDatastream
|
11
11
|
validate :paranoid_permissions
|
12
12
|
end
|
13
13
|
|
@@ -29,6 +29,11 @@ module Sufia
|
|
29
29
|
rightsMetadata.update_permissions(perm_hash)
|
30
30
|
end
|
31
31
|
|
32
|
+
def permissions
|
33
|
+
perms = super
|
34
|
+
perms.map {|p| { name: p.name, access: p.access, type:p.type } }
|
35
|
+
end
|
36
|
+
|
32
37
|
private
|
33
38
|
|
34
39
|
def permission_hash
|
data/lib/sufia/models/version.rb
CHANGED
data/sufia-models.gemspec
CHANGED
@@ -29,8 +29,12 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_dependency 'rails', '>= 3.2.13', '< 5.0'
|
31
31
|
spec.add_dependency 'activeresource' # No longer a dependency of rails 4.0
|
32
|
-
|
33
|
-
spec.add_dependency
|
32
|
+
|
33
|
+
# spec.add_dependency "hydra", "6.1.0.rc1"
|
34
|
+
# Since hydra 6.1 isn't out yet, we'll just build it so that it's compatible
|
35
|
+
# without an explicit dependency
|
36
|
+
spec.add_dependency "hydra-head", "~> 6.4.0.rc1"
|
37
|
+
spec.add_dependency 'active-fedora', "~> 6.6.0.rc1"
|
34
38
|
|
35
39
|
spec.add_dependency 'nest', '~> 1.1.1'
|
36
40
|
spec.add_dependency 'resque', '~> 1.23.0'#, :require => 'resque/server'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sufia-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,21 +28,21 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 3.2.13
|
48
48
|
- - <
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - '>='
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: 3.2.13
|
58
58
|
- - <
|
@@ -62,14 +62,14 @@ dependencies:
|
|
62
62
|
name: activeresource
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
@@ -78,28 +78,28 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - ~>
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 6.
|
81
|
+
version: 6.4.0.rc1
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 6.
|
88
|
+
version: 6.4.0.rc1
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: active-fedora
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ~>
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 6.
|
95
|
+
version: 6.6.0.rc1
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ~>
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 6.
|
102
|
+
version: 6.6.0.rc1
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: nest
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +174,7 @@ dependencies:
|
|
174
174
|
name: acts_as_follower
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
|
-
- -
|
177
|
+
- - '>='
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: 0.1.1
|
180
180
|
- - <
|
@@ -184,7 +184,7 @@ dependencies:
|
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- -
|
187
|
+
- - '>='
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: 0.1.1
|
190
190
|
- - <
|
@@ -303,7 +303,6 @@ files:
|
|
303
303
|
- lib/sufia/models/generic_file/mime_types.rb
|
304
304
|
- lib/sufia/models/generic_file/permissions.rb
|
305
305
|
- lib/sufia/models/generic_file/thumbnail.rb
|
306
|
-
- lib/sufia/models/generic_file/visibility.rb
|
307
306
|
- lib/sufia/models/generic_file/web_form.rb
|
308
307
|
- lib/sufia/models/id_service.rb
|
309
308
|
- lib/sufia/models/jobs/active_fedora_pid_based_job.rb
|
@@ -336,18 +335,19 @@ require_paths:
|
|
336
335
|
- lib
|
337
336
|
required_ruby_version: !ruby/object:Gem::Requirement
|
338
337
|
requirements:
|
339
|
-
- -
|
338
|
+
- - '>='
|
340
339
|
- !ruby/object:Gem::Version
|
341
340
|
version: '0'
|
342
341
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
343
342
|
requirements:
|
344
|
-
- -
|
343
|
+
- - '>'
|
345
344
|
- !ruby/object:Gem::Version
|
346
|
-
version:
|
345
|
+
version: 1.3.1
|
347
346
|
requirements: []
|
348
347
|
rubyforge_project:
|
349
|
-
rubygems_version: 2.
|
348
|
+
rubygems_version: 2.0.5
|
350
349
|
signing_key:
|
351
350
|
specification_version: 4
|
352
351
|
summary: Models and services for sufia
|
353
352
|
test_files: []
|
353
|
+
has_rdoc:
|
@@ -1,65 +0,0 @@
|
|
1
|
-
module Sufia
|
2
|
-
module GenericFile
|
3
|
-
module Visibility
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
extend Deprecation
|
6
|
-
|
7
|
-
def visibility=(value)
|
8
|
-
return if value.nil?
|
9
|
-
# only set explicit permissions
|
10
|
-
case value
|
11
|
-
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
12
|
-
public_visibility!
|
13
|
-
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
14
|
-
registered_visibility!
|
15
|
-
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
16
|
-
private_visibility!
|
17
|
-
else
|
18
|
-
raise ArgumentError, "Invalid visibility: #{value.inspect}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def visibility
|
23
|
-
if read_groups.include? Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC
|
24
|
-
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
25
|
-
elsif read_groups.include? Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED
|
26
|
-
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
27
|
-
else
|
28
|
-
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def set_visibility(visibility)
|
33
|
-
Deprecation.warn Visibility, "set_visibility is deprecated, use visibility= instead. set_visibility will be removed in sufia 3.0", caller
|
34
|
-
self.visibility= visibility
|
35
|
-
end
|
36
|
-
|
37
|
-
def visibility_changed?
|
38
|
-
@visibility_will_change
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
def visibility_will_change!
|
43
|
-
@visibility_will_change = true
|
44
|
-
end
|
45
|
-
|
46
|
-
def public_visibility!
|
47
|
-
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
48
|
-
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "read")
|
49
|
-
end
|
50
|
-
|
51
|
-
def registered_visibility!
|
52
|
-
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
53
|
-
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "read")
|
54
|
-
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
|
55
|
-
end
|
56
|
-
|
57
|
-
def private_visibility!
|
58
|
-
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
59
|
-
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "none")
|
60
|
-
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|