hydra-access-controls 12.1.0 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ff7d89f80e476ffc0fb19c5149d560b680c1ab197a43a21dc240f4368c029a0
|
4
|
+
data.tar.gz: 41c6476c6f4f56ac92b4572d3c6c698e667c9802bcd11bed90b28d2f80b10a6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1c18d26af1a1cdbac16fb34bc0bd38b2a56d6599b3a4a5e5447a19b374a2aaac779b10d13f09aae9da17c14bc633e13b3f79e0161ac10fa43808c03f7aa0e16
|
7
|
+
data.tar.gz: 328e34ff6d1429bf05c116717794df6acd8bb1d5e43bdc41f190fc231ade9f162fd0fd87a2e469f9664d12f2be45bbb9a2d2de1b9602fc2af46135b197c1e464
|
@@ -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,9 +17,9 @@ 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.0'
|
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'
|
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.0.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: 2024-10-01 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.0'
|
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.0'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: active-fedora
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|