hydra-access-controls 9.2.2 → 9.3.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
  SHA1:
3
- metadata.gz: ea7c4aaad5d8b8a2a09302a4e4c72bef6ae4e4e7
4
- data.tar.gz: 48ec6139506893bd921326584e649e715806c41e
3
+ metadata.gz: 48df5495189420a7fcd2badef2493179edcc1560
4
+ data.tar.gz: 6b69996bbca5b1f33f233c4327fb58678bb118a8
5
5
  SHA512:
6
- metadata.gz: bbd45858a87ce422b304789f35330de95c6642c68e57ee8a07e2a881af4a7b92495e25a1427ddf6799c6cdb99a889a0666b97d4a2878a9427933755ebeedad1d
7
- data.tar.gz: 12ebdbb5cc2916346399453d12efad8cb9f4b78f720924061099624e31eefa66f4ffb112a0d1649fed1784fe45abd2ad187cd0167b068cf29e2cbc95dd737ea3
6
+ metadata.gz: 77f673207dda70cfc5401f7418cb8af5675cbec3b46afdf896bb04ac2b13cf69954e3b9a3d924ac597d3adb77897d20fb2158f53af085e468430ea37d6c14154
7
+ data.tar.gz: 8b9f3925485f1a3725815432bff9d63cf4a2cd8335ea59276c716b842b28b47e45e0d117993f7e263c8db44d727982eb8c78ce75dc5ffd8f4694a3eb3ef9f2be
data/README.textile CHANGED
@@ -23,7 +23,7 @@ The hydra generator handles part of this for you - it sets up the CatalogControl
23
23
  Beyond enabling gated discovery, *everything is done using "CanCan":https://github.com/ryanb/cancan*. For more information on CanCan, how to use it, and how to define access controls policies (aka "abilities":https://github.com/ryanb/cancan/wiki/Defining-Abilities), refer to the "CanCan documentation":https://github.com/ryanb/cancan/blob/master/README.rdoc.
24
24
 
25
25
  Within your CanCan ability definitions, app/models/ability.rb, the "Hydra::Ability":https://github.com/projecthydra/hydra-head/blob/master/hydra-access-controls/lib/hydra/ability.rb module is already included. This module has
26
- :read and :edit permissions defined for you, along with some convenience methods that help you evaluate permssions
26
+ :read, :edit, and :discover permissions defined for you, along with some convenience methods that help you evaluate permssions
27
27
  against info in the rightsMetadata datastream.
28
28
 
29
29
  In your custom controllers, you will need to enforce access controls using "CanCan":https://github.com/ryanb/cancan. There are a number of ways to do this. The easiest way is to use the cancan "controller action":https://github.com/ryanb/cancan/wiki/Authorizing-Controller-Actions 'load_and_authorize_resource', however on show and edit, this also causes a load the resource from fedora, which you may want to avoid. If you want to authorize from solr, you ought to be able to call the cancan methods `authorize!` or `can?` which just checks the solr permissions handler.
@@ -0,0 +1,11 @@
1
+ module Hydra::AccessControls
2
+ class EmbargoIndexer
3
+ def initialize(object)
4
+ @object = object
5
+ end
6
+
7
+ def generate_solr_document
8
+ @object.to_hash
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module Hydra::AccessControls
2
+ class LeaseIndexer
3
+ def initialize(object)
4
+ @object = object
5
+ end
6
+
7
+ def generate_solr_document
8
+ @object.to_hash
9
+ end
10
+ end
11
+ end
12
+
@@ -35,11 +35,19 @@ module Hydra
35
35
 
36
36
  def to_solr(solr_doc = {})
37
37
  super.tap do |doc|
38
- doc.merge!(embargo.to_hash) if embargo
39
- doc.merge!(lease.to_hash) if lease
38
+ doc.merge!(embargo_indexer_class.new(embargo).generate_solr_document) if embargo
39
+ doc.merge!(lease_indexer_class.new(lease).generate_solr_document) if lease
40
40
  end
41
41
  end
42
42
 
43
+ def embargo_indexer_class
44
+ EmbargoIndexer
45
+ end
46
+
47
+ def lease_indexer_class
48
+ LeaseIndexer
49
+ end
50
+
43
51
  def under_embargo?
44
52
  embargo && embargo.active?
45
53
  end
@@ -63,7 +71,7 @@ module Hydra
63
71
  self.visibility_during_embargo = visibility_during unless visibility_during.nil?
64
72
  self.visibility_after_embargo = visibility_after unless visibility_after.nil?
65
73
  embargo_visibility!
66
- visibility_will_change!
74
+ visibility_will_change! if embargo.changed?
67
75
  end
68
76
 
69
77
  def deactivate_embargo!
@@ -134,7 +142,7 @@ module Hydra
134
142
  self.visibility_during_lease = visibility_during unless visibility_during.nil?
135
143
  self.visibility_after_lease = visibility_after unless visibility_after.nil?
136
144
  lease_visibility!
137
- visibility_will_change!
145
+ visibility_will_change! if lease.changed?
138
146
  end
139
147
 
140
148
  def deactivate_lease!
data/lib/hydra/ability.rb CHANGED
@@ -13,7 +13,7 @@ module Hydra
13
13
  include Hydra::PermissionsQuery
14
14
  include Blacklight::SearchHelper
15
15
  class_attribute :ability_logic
16
- self.ability_logic = [:create_permissions, :edit_permissions, :read_permissions, :download_permissions, :custom_permissions]
16
+ self.ability_logic = [:create_permissions, :edit_permissions, :read_permissions, :discover_permissions, :download_permissions, :custom_permissions]
17
17
  end
18
18
 
19
19
  def self.user_class
@@ -87,6 +87,21 @@ module Hydra
87
87
  end
88
88
  end
89
89
 
90
+ def discover_permissions
91
+ can :discover, String do |id|
92
+ test_discover(id)
93
+ end
94
+
95
+ can :discover, ActiveFedora::Base do |obj|
96
+ test_discover(obj.id)
97
+ end
98
+
99
+ can :discover, SolrDocument do |obj|
100
+ cache.put(obj.id, obj)
101
+ test_discover(obj.id)
102
+ end
103
+ end
104
+
90
105
  # Download permissions are exercised in Hydra::Controller::DownloadBehavior
91
106
  def download_permissions
92
107
  can :download, ActiveFedora::File do |file|
@@ -117,6 +132,13 @@ module Hydra
117
132
  result
118
133
  end
119
134
 
135
+ def test_discover(id)
136
+ Rails.logger.debug("[CANCAN] Checking discover permissions for user: #{current_user.user_key} with groups: #{user_groups.inspect}")
137
+ group_intersection = user_groups & discover_groups(id)
138
+ result = !group_intersection.empty? || discover_users(id).include?(current_user.user_key)
139
+ result
140
+ end
141
+
120
142
  def edit_groups(id)
121
143
  doc = permissions_doc(id)
122
144
  return [] if doc.nil?
@@ -134,6 +156,15 @@ module Hydra
134
156
  return rg
135
157
  end
136
158
 
159
+ # read implies discover, so discover_groups is the union of read and discover groups
160
+ def discover_groups(id)
161
+ doc = permissions_doc(id)
162
+ return [] if doc.nil?
163
+ dg = read_groups(id) | (doc[self.class.discover_group_field] || [])
164
+ Rails.logger.debug("[CANCAN] discover_groups: #{dg.inspect}")
165
+ dg
166
+ end
167
+
137
168
  def edit_users(id)
138
169
  doc = permissions_doc(id)
139
170
  return [] if doc.nil?
@@ -151,6 +182,15 @@ module Hydra
151
182
  return rp
152
183
  end
153
184
 
185
+ # read implies discover, so discover_users is the union of read and discover users
186
+ def discover_users(id)
187
+ doc = permissions_doc(id)
188
+ return [] if doc.nil?
189
+ dp = read_users(id) | (doc[self.class.discover_user_field] || [])
190
+ Rails.logger.debug("[CANCAN] discover_users: #{dp.inspect}")
191
+ dp
192
+ end
193
+
154
194
  module ClassMethods
155
195
  def read_group_field
156
196
  Hydra.config.permissions.read.group
@@ -167,6 +207,14 @@ module Hydra
167
207
  def edit_group_field
168
208
  Hydra.config.permissions.edit.group
169
209
  end
210
+
211
+ def discover_group_field
212
+ Hydra.config.permissions.discover.group
213
+ end
214
+
215
+ def discover_user_field
216
+ Hydra.config.permissions.discover.individual
217
+ end
170
218
  end
171
219
  end
172
220
  end
@@ -5,23 +5,23 @@ module Hydra::RoleMapperBehavior
5
5
  def role_names
6
6
  map.keys
7
7
  end
8
-
9
- #
8
+
9
+ ##
10
10
  # @param user_or_uid either the User object or user id
11
11
  # If you pass in a nil User object (ie. user isn't logged in), or a uid that doesn't exist, it will return an empty array
12
12
  def roles(user_or_uid)
13
13
  if user_or_uid.kind_of?(String)
14
14
  user = Hydra::Ability.user_class.find_by_user_key(user_or_uid)
15
15
  user_id = user_or_uid
16
- elsif user_or_uid.kind_of?(Hydra::Ability.user_class) && user_or_uid.user_key
16
+ elsif user_or_uid.kind_of?(Hydra::Ability.user_class) && user_or_uid.user_key
17
17
  user = user_or_uid
18
18
  user_id = user.user_key
19
19
  end
20
20
  array = byname[user_id].dup || []
21
- array = array << 'registered' unless (user.nil? || user.new_record?)
21
+ array = array << 'registered' unless (user.nil? || user.new_record?)
22
22
  array
23
23
  end
24
-
24
+
25
25
  def whois(r)
26
26
  map[r] || []
27
27
  end
@@ -32,7 +32,7 @@ module Hydra::RoleMapperBehavior
32
32
 
33
33
 
34
34
  def byname
35
- @byname ||= map.each_with_object(Hash.new{ |h,k| h[k] = [] }) do |(role, usernames), memo|
35
+ @byname ||= map.each_with_object(Hash.new{ |h,k| h[k] = [] }) do |(role, usernames), memo|
36
36
  Array(usernames).each { |x| memo[x] << role}
37
37
  end
38
38
  end
@@ -60,9 +60,12 @@ module Hydra::RoleMapperBehavior
60
60
  rescue
61
61
  raise("#{filename} was found, but could not be parsed.\n")
62
62
  end
63
- return yml[Rails.env] if yml.is_a? Hash
63
+ unless yml.is_a? Hash
64
+ raise("#{filename} was found, but was blank or malformed.\n")
65
+ end
66
+
67
+ yml.fetch(Rails.env)
64
68
 
65
- raise("#{filename} was found, but was blank or malformed.\n")
66
69
  end
67
70
  end
68
71
  end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Hydra::AccessControls::EmbargoIndexer do
4
+ let(:attrs) do
5
+ {
6
+ visibility_during_embargo: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED,
7
+ visibility_after_embargo: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC,
8
+ embargo_release_date: Date.parse('2010-10-10')
9
+ }
10
+ end
11
+ let(:embargo) { Hydra::AccessControls::Embargo.new(attrs) }
12
+ let(:indexer) { described_class.new(embargo) }
13
+ subject { indexer.generate_solr_document }
14
+
15
+ it "has the fields" do
16
+ expect(subject['visibility_during_embargo_ssim']).to eq 'authenticated'
17
+ expect(subject['visibility_after_embargo_ssim']).to eq 'open'
18
+ expect(subject['embargo_release_date_dtsi']).to eq '2010-10-10T00:00:00Z'
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Hydra::AccessControls::LeaseIndexer do
4
+ let(:attrs) do
5
+ {
6
+ visibility_during_lease: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC,
7
+ visibility_after_lease: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED,
8
+ lease_expiration_date: Date.parse('2010-10-10')
9
+ }
10
+ end
11
+ let(:lease) { Hydra::AccessControls::Lease.new(attrs) }
12
+ let(:indexer) { described_class.new(lease) }
13
+ subject { indexer.generate_solr_document }
14
+
15
+ it "has the fields" do
16
+ expect(subject['visibility_during_lease_ssim']).to eq 'open'
17
+ expect(subject['visibility_after_lease_ssim']).to eq 'authenticated'
18
+ expect(subject['lease_expiration_date_dtsi']).to eq '2010-10-10T00:00:00Z'
19
+ end
20
+ end
data/spec/spec_helper.rb CHANGED
@@ -26,6 +26,8 @@ require_relative '../app/vocabularies/acl'
26
26
  require_relative '../app/vocabularies/hydra/acl'
27
27
  require_relative '../app/models/role_mapper'
28
28
  require_relative '../app/models/ability'
29
+ require_relative '../app/indexers/hydra/access_controls/embargo_indexer'
30
+ require_relative '../app/indexers/hydra/access_controls/lease_indexer'
29
31
  require_relative '../app/models/hydra/access_controls/access_control_list'
30
32
  require_relative '../app/models/hydra/access_controls/permission'
31
33
  require_relative '../app/models/hydra/access_controls/embargo'
@@ -8,6 +8,8 @@ describe Ability do
8
8
  its(:read_user_field) { should == 'read_access_person_ssim'}
9
9
  its(:edit_group_field) { should == 'edit_access_group_ssim'}
10
10
  its(:edit_user_field) { should == 'edit_access_person_ssim'}
11
+ its(:discover_group_field) { should == 'discover_access_group_ssim'}
12
+ its(:discover_user_field) { should == 'discover_access_person_ssim'}
11
13
  end
12
14
 
13
15
  context "for a not-signed in user" do
@@ -37,6 +39,35 @@ describe Ability do
37
39
  # See spec/requests/... for test coverage describing WHAT should appear on a page based on access permissions
38
40
  # Test coverage for discover permission is in spec/requests/gated_discovery_spec.rb
39
41
 
42
+ describe "Given an asset that has been made publicly discoverable" do
43
+ let(:asset) { FactoryGirl.create(:asset) }
44
+ before do
45
+ asset.permissions_attributes = [{ name: "public", access: "discover", type: "group" }, { name: "joe_creator", access: "edit", type: "person" }, { name: "calvin_collaborator", access: "edit", type: "person" }]
46
+ asset.save
47
+ end
48
+
49
+ context "Then a not-signed-in user" do
50
+ subject { Ability.new(nil) }
51
+ it { should be_able_to(:discover, asset) }
52
+ it { should_not be_able_to(:read, asset) }
53
+ it { should_not be_able_to(:edit, asset) }
54
+ it { should_not be_able_to(:update, asset) }
55
+ it { should_not be_able_to(:destroy, asset) }
56
+ end
57
+
58
+ context "Then a registered user" do
59
+ before do
60
+ @user = FactoryGirl.build(:registered_user)
61
+ end
62
+ subject { Ability.new(@user) }
63
+ it { should be_able_to(:discover, asset) }
64
+ it { should_not be_able_to(:read, asset) }
65
+ it { should_not be_able_to(:edit, asset) }
66
+ it { should_not be_able_to(:update, asset) }
67
+ it { should_not be_able_to(:destroy, asset) }
68
+ end
69
+ end
70
+
40
71
  describe "Given an asset that has been made publicly available (ie. open access)" do
41
72
  #let(:asset) { FactoryGirl.create(:open_access_asset) }
42
73
  let(:asset) { FactoryGirl.create(:asset) }
@@ -47,6 +78,7 @@ describe Ability do
47
78
 
48
79
  context "Then a not-signed-in user" do
49
80
  subject { Ability.new(nil) }
81
+ it { should be_able_to(:discover, asset) }
50
82
  it { should be_able_to(:read, asset) }
51
83
  it { should_not be_able_to(:edit, asset) }
52
84
  it { should_not be_able_to(:update, asset) }
@@ -58,6 +90,7 @@ describe Ability do
58
90
  @user = FactoryGirl.build(:registered_user)
59
91
  end
60
92
  subject { Ability.new(@user) }
93
+ it { should be_able_to(:discover, asset) }
61
94
  it { should be_able_to(:read, asset) }
62
95
  it { should_not be_able_to(:edit, asset) }
63
96
  it { should_not be_able_to(:update, asset) }
@@ -76,6 +109,7 @@ describe Ability do
76
109
  context "Then a not-signed-in user" do
77
110
  let(:user) { User.new.tap {|u| u.new_record = true } }
78
111
  subject { Ability.new(user) }
112
+ it { should_not be_able_to(:discover, asset) }
79
113
  it { should_not be_able_to(:read, asset) }
80
114
  it { should_not be_able_to(:edit, asset) }
81
115
  it { should_not be_able_to(:update, asset) }
@@ -83,6 +117,7 @@ describe Ability do
83
117
  end
84
118
  context "Then a registered user" do
85
119
  subject { Ability.new(FactoryGirl.build(:registered_user)) }
120
+ it { should_not be_able_to(:discover, asset) }
86
121
  it { should_not be_able_to(:read, asset) }
87
122
  it { should_not be_able_to(:edit, asset) }
88
123
  it { should_not be_able_to(:update, asset) }
@@ -90,6 +125,7 @@ describe Ability do
90
125
  end
91
126
  context "Then the Creator" do
92
127
  subject { Ability.new(FactoryGirl.build(:joe_creator)) }
128
+ it { should be_able_to(:discover, asset) }
93
129
  it { should be_able_to(:read, asset) }
94
130
  it { should be_able_to(:edit, asset) }
95
131
  it { should be_able_to(:edit, solr_doc) }
@@ -114,6 +150,7 @@ describe Ability do
114
150
  end
115
151
  subject { Ability.new(@user) }
116
152
 
153
+ it { should be_able_to(:discover, asset) }
117
154
  it { should be_able_to(:read, asset) }
118
155
  it { should_not be_able_to(:edit, asset) }
119
156
  it { should_not be_able_to(:update, asset) }
@@ -136,6 +173,7 @@ describe Ability do
136
173
  end
137
174
  subject { Ability.new(@user) }
138
175
 
176
+ it { should be_able_to(:discover, asset) }
139
177
  it { should be_able_to(:read, asset) }
140
178
  it { should be_able_to(:edit, asset) }
141
179
  it { should be_able_to(:update, asset) }
@@ -167,6 +205,7 @@ describe Ability do
167
205
  end
168
206
  subject { Ability.new(@user) }
169
207
 
208
+ it { should_not be_able_to(:discover, asset) }
170
209
  it { should_not be_able_to(:read, asset) }
171
210
  it { should_not be_able_to(:edit, asset) }
172
211
  it { should_not be_able_to(:update, asset) }
@@ -181,6 +220,7 @@ describe Ability do
181
220
  end
182
221
  subject { Ability.new(@user) }
183
222
 
223
+ it { should be_able_to(:discover, asset) }
184
224
  it { should be_able_to(:read, asset) }
185
225
  it { should_not be_able_to(:edit, asset) }
186
226
  it { should_not be_able_to(:update, asset) }
@@ -16,7 +16,18 @@ describe Hydra::AccessControls::Embargoable do
16
16
 
17
17
  let(:future_date) { Date.today+2 }
18
18
  let(:past_date) { Date.today-2 }
19
- subject { TestModel.new }
19
+ let(:model) { TestModel.new }
20
+ subject { model }
21
+
22
+ describe '#embargo_indexer_class' do
23
+ subject { model.embargo_indexer_class }
24
+ it { is_expected.to eq Hydra::AccessControls::EmbargoIndexer }
25
+ end
26
+
27
+ describe '#lease_indexer_class' do
28
+ subject { model.lease_indexer_class }
29
+ it { is_expected.to eq Hydra::AccessControls::LeaseIndexer }
30
+ end
20
31
 
21
32
  describe 'validations' do
22
33
  context "with dates" do
@@ -77,7 +88,7 @@ describe Hydra::AccessControls::Embargoable do
77
88
  end
78
89
  end
79
90
 
80
- context 'apply_embargo' do
91
+ describe '#apply_embargo' do
81
92
  it "applies appropriate embargo_visibility settings" do
82
93
  expect {
83
94
  subject.apply_embargo(future_date.to_s, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)
@@ -87,12 +98,31 @@ describe Hydra::AccessControls::Embargoable do
87
98
  expect(subject.embargo_release_date).to eq future_date
88
99
  expect(subject.visibility_after_embargo).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
89
100
  end
90
- it "relies on default before/after visibility if none provided" do
91
- subject.apply_embargo(future_date.to_s)
92
- expect(subject).to be_under_embargo
93
- expect(subject.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
94
- expect(subject.embargo_release_date).to eq future_date
95
- expect(subject.visibility_after_embargo).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
101
+
102
+ context "when no before/after visibility is provided" do
103
+ it "relies on defaults" do
104
+ subject.apply_embargo(future_date.to_s)
105
+ expect(subject).to be_under_embargo
106
+ expect(subject.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
107
+ expect(subject.embargo_release_date).to eq future_date
108
+ expect(subject.visibility_after_embargo).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
109
+ end
110
+ end
111
+
112
+ context "when the same embargo is applied" do
113
+ before do
114
+ subject.apply_embargo(future_date.to_s)
115
+ if ActiveModel.version < Gem::Version.new('4.2.0')
116
+ subject.embargo.send(:reset_changes)
117
+ else
118
+ subject.embargo.send(:clear_changes_information)
119
+ end
120
+ end
121
+
122
+ it "doesn't call visibility_will_change!" do
123
+ expect(subject).not_to receive(:visibility_will_change!)
124
+ subject.apply_embargo(future_date.to_s)
125
+ end
96
126
  end
97
127
  end
98
128
 
@@ -152,11 +182,30 @@ describe Hydra::AccessControls::Embargoable do
152
182
  expect(subject.lease_expiration_date).to eq future_date
153
183
  expect(subject.visibility_after_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
154
184
  end
155
- it "relies on default before/after visibility if none provided" do
156
- subject.apply_lease(future_date.to_s)
157
- expect(subject.visibility_during_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
158
- expect(subject.lease_expiration_date).to eq future_date
159
- expect(subject.visibility_after_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
185
+
186
+ context "when before/after visibility is not provided" do
187
+ it "sets default values" do
188
+ subject.apply_lease(future_date.to_s)
189
+ expect(subject.visibility_during_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
190
+ expect(subject.lease_expiration_date).to eq future_date
191
+ expect(subject.visibility_after_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
192
+ end
193
+ end
194
+
195
+ context "when the same lease is applied" do
196
+ before do
197
+ subject.apply_lease(future_date.to_s)
198
+ if ActiveModel.version < Gem::Version.new('4.2.0')
199
+ subject.lease.send(:reset_changes)
200
+ else
201
+ subject.lease.send(:clear_changes_information)
202
+ end
203
+ end
204
+
205
+ it "doesn't call visibility_will_change!" do
206
+ expect(subject).not_to receive(:visibility_will_change!)
207
+ subject.apply_lease(future_date.to_s)
208
+ end
160
209
  end
161
210
  end
162
211
 
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe RoleMapper do
4
4
  it "should define the 4 roles" do
5
- expect(RoleMapper.role_names.sort).to eq %w(admin_policy_object_editor archivist donor patron researcher)
5
+ expect(RoleMapper.role_names.sort).to eq %w(admin_policy_object_editor archivist donor patron researcher)
6
6
  end
7
7
  it "should quer[iy]able for roles for a given user" do
8
8
  expect(RoleMapper.roles('leland_himself@example.com').sort).to eq ['archivist', 'donor', 'patron']
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: 9.2.2
4
+ version: 9.3.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: 2015-08-03 00:00:00.000000000 Z
13
+ date: 2015-10-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -134,6 +134,8 @@ files:
134
134
  - ".rspec"
135
135
  - README.textile
136
136
  - Rakefile
137
+ - app/indexers/hydra/access_controls/embargo_indexer.rb
138
+ - app/indexers/hydra/access_controls/lease_indexer.rb
137
139
  - app/models/ability.rb
138
140
  - app/models/concerns/hydra/access_controls.rb
139
141
  - app/models/concerns/hydra/access_controls/access_right.rb
@@ -172,6 +174,8 @@ files:
172
174
  - lib/hydra/role_mapper_behavior.rb
173
175
  - lib/hydra/user.rb
174
176
  - spec/factories.rb
177
+ - spec/indexers/embargo_indexer_spec.rb
178
+ - spec/indexers/lease_indexer_spec.rb
175
179
  - spec/services/embargo_service_spec.rb
176
180
  - spec/services/lease_service_spec.rb
177
181
  - spec/spec_helper.rb
@@ -218,12 +222,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
222
  version: '0'
219
223
  requirements: []
220
224
  rubyforge_project:
221
- rubygems_version: 2.4.6
225
+ rubygems_version: 2.4.5.1
222
226
  signing_key:
223
227
  specification_version: 4
224
228
  summary: Access controls for project hydra
225
229
  test_files:
226
230
  - spec/factories.rb
231
+ - spec/indexers/embargo_indexer_spec.rb
232
+ - spec/indexers/lease_indexer_spec.rb
227
233
  - spec/services/embargo_service_spec.rb
228
234
  - spec/services/lease_service_spec.rb
229
235
  - spec/spec_helper.rb