hydra-access-controls 12.1.0 → 13.1.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9ffdb463944fbf90c1e1b894dd1f25d4be83e18c1ae1ec3b2393a1c411a0528
|
4
|
+
data.tar.gz: 16207bb58ca3f13b1a3f7ceb2c1154a73c144f4494ed5c5286e39964417124af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e0161b3d4ca854caf3de3d69f91968c3343cc58d9a7096fb6cac0d2cbdb0e0a643d8a3577dc1b57f48ee00713740a2192b12226e435102b8fae28194c42dc38
|
7
|
+
data.tar.gz: 0ebcc1b9551e20431cc7520cdac61da660b04e3618df6c7856f359e51d52e66f10ab07588faa44a482d097b60687e78b8e3c374e2739936ce704f1da321097e8
|
@@ -8,69 +8,75 @@ module Hydra::AccessControls
|
|
8
8
|
define_attribute_methods :visibility
|
9
9
|
# instance variable needs to be initialized here based upon what is in read_groups
|
10
10
|
after_initialize { @visibility = visibility }
|
11
|
+
# Starting in Rails 7.2, define_attribute_methods creates a module that overrides accessor methods
|
12
|
+
# defined in this module. In order for the methods in this module to take precedence over those
|
13
|
+
# they need to be defined in a submodule and included after running define_attribute_methods.
|
14
|
+
include InstanceMethods
|
11
15
|
end
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
module InstanceMethods
|
18
|
+
def visibility=(value)
|
19
|
+
return if value.nil?
|
20
|
+
# only set explicit permissions
|
21
|
+
case value
|
22
|
+
when AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
23
|
+
public_visibility!
|
24
|
+
when AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
25
|
+
registered_visibility!
|
26
|
+
when AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
27
|
+
private_visibility!
|
28
|
+
else
|
29
|
+
raise ArgumentError, "Invalid visibility: #{value.inspect}"
|
30
|
+
end
|
31
|
+
@visibility = value
|
25
32
|
end
|
26
|
-
@visibility = value
|
27
|
-
end
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
def visibility
|
35
|
+
if read_groups.include? AccessRight::PERMISSION_TEXT_VALUE_PUBLIC
|
36
|
+
AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
37
|
+
elsif read_groups.include? AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED
|
38
|
+
AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
39
|
+
else
|
40
|
+
AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
41
|
+
end
|
36
42
|
end
|
37
|
-
end
|
38
43
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
# Overridden for ActiveModel::Dirty tracking of visibility
|
45
|
+
# Required by ActiveModel::AttributeMethods
|
46
|
+
# @see https://api.rubyonrails.org/classes/ActiveModel/AttributeMethods.html
|
47
|
+
# An instance variable is used to avoid infinite recursion caused by calling #visibility
|
48
|
+
# Using this approach requires setting visibility read groups through #visibility=
|
49
|
+
# instead of manipulating them directly if #visibility_changed? is expected to work correctly.
|
50
|
+
def attributes
|
51
|
+
super.merge({ 'visibility' => @visibility })
|
52
|
+
end
|
48
53
|
|
49
|
-
|
54
|
+
private
|
50
55
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
# Override represented_visibility if you want to add another visibility that is
|
57
|
+
# represented as a read group (e.g. on-campus)
|
58
|
+
# @return [Array] a list of visibility types that are represented as read groups
|
59
|
+
def represented_visibility
|
60
|
+
[AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED,
|
61
|
+
AccessRight::PERMISSION_TEXT_VALUE_PUBLIC]
|
62
|
+
end
|
58
63
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
+
def public_visibility!
|
65
|
+
visibility_will_change! unless visibility == AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
66
|
+
remove_groups = represented_visibility - [AccessRight::PERMISSION_TEXT_VALUE_PUBLIC]
|
67
|
+
set_read_groups([AccessRight::PERMISSION_TEXT_VALUE_PUBLIC], remove_groups)
|
68
|
+
end
|
64
69
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
+
def registered_visibility!
|
71
|
+
visibility_will_change! unless visibility == AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
72
|
+
remove_groups = represented_visibility - [AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED]
|
73
|
+
set_read_groups([AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED], remove_groups)
|
74
|
+
end
|
70
75
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
76
|
+
def private_visibility!
|
77
|
+
visibility_will_change! unless visibility == AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
78
|
+
set_read_groups([], represented_visibility)
|
79
|
+
end
|
80
|
+
end
|
75
81
|
end
|
76
82
|
end
|
@@ -17,14 +17,14 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.license = "APACHE-2.0"
|
18
18
|
gem.metadata = { "rubygems_mfa_required" => "true" }
|
19
19
|
|
20
|
-
gem.required_ruby_version = '>=
|
20
|
+
gem.required_ruby_version = '>= 3.1'
|
21
21
|
|
22
|
-
gem.add_dependency 'activesupport', '>=
|
22
|
+
gem.add_dependency 'activesupport', '>= 6.1', '< 8.1'
|
23
23
|
gem.add_dependency 'active-fedora', '>= 10.0.0'
|
24
24
|
gem.add_dependency 'blacklight-access_controls', '~> 6.0'
|
25
25
|
gem.add_dependency 'cancancan', '>= 1.8', '< 4'
|
26
26
|
gem.add_dependency 'deprecation', '~> 1.0'
|
27
27
|
|
28
28
|
gem.add_development_dependency 'rake', '>= 12.3.3'
|
29
|
-
gem.add_development_dependency 'rspec'
|
29
|
+
gem.add_development_dependency 'rspec'
|
30
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-access-controls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 13.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-05-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -18,20 +18,20 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '6.1'
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '
|
24
|
+
version: '8.1'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: '
|
31
|
+
version: '6.1'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '8.1'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: active-fedora
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0'
|
125
125
|
description: Access controls for project hydra
|
126
126
|
email:
|
127
127
|
- hydra-tech@googlegroups.com
|
@@ -135,7 +135,6 @@ files:
|
|
135
135
|
- app/indexers/hydra/access_controls/embargo_indexer.rb
|
136
136
|
- app/indexers/hydra/access_controls/lease_indexer.rb
|
137
137
|
- app/models/ability.rb
|
138
|
-
- app/models/concerns/hydra/access_controls.rb
|
139
138
|
- app/models/concerns/hydra/access_controls/access_right.rb
|
140
139
|
- app/models/concerns/hydra/access_controls/embargoable.rb
|
141
140
|
- app/models/concerns/hydra/access_controls/permissions.rb
|
@@ -217,14 +216,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
216
|
requirements:
|
218
217
|
- - ">="
|
219
218
|
- !ruby/object:Gem::Version
|
220
|
-
version: '
|
219
|
+
version: '3.1'
|
221
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
221
|
requirements:
|
223
222
|
- - ">="
|
224
223
|
- !ruby/object:Gem::Version
|
225
224
|
version: '0'
|
226
225
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
226
|
+
rubygems_version: 3.4.1
|
228
227
|
signing_key:
|
229
228
|
specification_version: 4
|
230
229
|
summary: Access controls for project hydra
|