hydra-access-controls 6.4.0.rc4 → 6.4.0.rc5

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: b88206682c3c647370e3ad2a69f8f6c6966e8be1
4
- data.tar.gz: 9e41bdafc97dc0fdf4a537a885562de12dc3ec07
3
+ metadata.gz: 76381cfbb357cec68b454fdbd3063282f75eb4d4
4
+ data.tar.gz: 55598936df275fb7a52d2ff5d9395cd004914062
5
5
  SHA512:
6
- metadata.gz: 1b5464365e2272eecad05fa91e5c2038413cb36c770552e609f6a4a556d192922c944bfb97ea7abba1b795b97928cc295d9a22d98c27fa2a7c1ccd7ed388f7d2
7
- data.tar.gz: 8053315e645d78d4dc8de1868273cad335b7a2767a9911f0cefce3f9faa60898de4846578411822a4c5839af8388b53568f146560dd94c80eca4503e0c1c1bcd
6
+ metadata.gz: 3607135f5aa9afae8abb1d026a0379993461144a9aba78e881c5c39283161bff14b2b916923c0218ccad67a92f7da25452a209ef727d6d63c42fe4c119e0ce5f
7
+ data.tar.gz: cc97938c99770ca31edf253d21f660b8bb0e54954f4a5469f90e26e85c4c7472a5995c5a00fc3ae6ffc3b97d7e7c50ce87daef34d264aae1c2e8b5912860a807
@@ -15,7 +15,7 @@ module Hydra::User
15
15
  end
16
16
 
17
17
  def groups
18
- RoleMapper.roles(user_key)
18
+ RoleMapper.roles(self)
19
19
  end
20
20
 
21
21
  module ClassMethods
@@ -197,7 +197,7 @@ describe Ability do
197
197
  context "Then a collaborator with edit access (group permision)" do
198
198
  before do
199
199
  @user = FactoryGirl.build(:martia_morocco)
200
- RoleMapper.stub(:roles).with(@user.user_key).and_return(@user.roles)
200
+ RoleMapper.stub(:roles).with(@user).and_return(@user.roles)
201
201
  end
202
202
  subject { Ability.new(@user) }
203
203
 
@@ -233,7 +233,7 @@ describe Ability do
233
233
  context "Then someone whose role/group has read access" do
234
234
  before do
235
235
  @user = FactoryGirl.build(:martia_morocco)
236
- RoleMapper.stub(:roles).with(@user.user_key).and_return(@user.roles)
236
+ RoleMapper.stub(:roles).with(@user).and_return(@user.roles)
237
237
  end
238
238
  subject { Ability.new(@user) }
239
239
 
@@ -88,7 +88,7 @@ describe Hydra::AccessControlsEnforcement do
88
88
  describe "enforce_show_permissions" do
89
89
  it "should allow a user w/ edit permissions to view an embargoed object" do
90
90
  user = User.new :uid=>'testuser@example.com'
91
- RoleMapper.stub(:roles).with(user.user_key).and_return(["archivist"])
91
+ RoleMapper.stub(:roles).with(user).and_return(["archivist"])
92
92
  subject.stub(:current_user).and_return(user)
93
93
  subject.stub(:can?).with(:read, nil).and_return(true)
94
94
  stub_doc = Hydra::PermissionsSolrDocument.new({"edit_access_person_ssim"=>["testuser@example.com"], "embargo_release_date_dtsi"=>(Date.parse(Time.now.to_s)+2).to_s})
@@ -100,7 +100,7 @@ describe Hydra::AccessControlsEnforcement do
100
100
  end
101
101
  it "should prevent a user w/o edit permissions from viewing an embargoed object" do
102
102
  user = User.new :uid=>'testuser@example.com'
103
- RoleMapper.stub(:roles).with(user.user_key).and_return([])
103
+ RoleMapper.stub(:roles).with(user).and_return([])
104
104
  subject.stub(:current_user).and_return(user)
105
105
  subject.stub(:can?).with(:read, nil).and_return(true)
106
106
  subject.params = {}
@@ -113,7 +113,7 @@ describe Hydra::AccessControlsEnforcement do
113
113
  describe "apply_gated_discovery" do
114
114
  before(:each) do
115
115
  @stub_user = User.new :uid=>'archivist1@example.com'
116
- RoleMapper.stub(:roles).with(@stub_user.user_key).and_return(["archivist","researcher"])
116
+ RoleMapper.stub(:roles).with(@stub_user).and_return(["archivist","researcher"])
117
117
  subject.stub(:current_user).and_return(@stub_user)
118
118
  @solr_parameters = {}
119
119
  @user_parameters = {}
@@ -133,7 +133,7 @@ describe Hydra::AccessControlsEnforcement do
133
133
  end
134
134
 
135
135
  it "should escape slashes in the group names" do
136
- RoleMapper.stub(:roles).with(@stub_user.user_key).and_return(["abc/123","cde/567"])
136
+ RoleMapper.stub(:roles).with(@stub_user).and_return(["abc/123","cde/567"])
137
137
  subject.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
138
138
  ["discover","edit","read"].each do |type|
139
139
  @solr_parameters[:fq].first.should match(/#{type}_access_group_ssim\:abc\\\/123/)
@@ -141,7 +141,7 @@ describe Hydra::AccessControlsEnforcement do
141
141
  end
142
142
  end
143
143
  it "should escape spaces in the group names" do
144
- RoleMapper.stub(:roles).with(@stub_user.user_key).and_return(["abc 123","cd/e 567"])
144
+ RoleMapper.stub(:roles).with(@stub_user).and_return(["abc 123","cd/e 567"])
145
145
  subject.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
146
146
  ["discover","edit","read"].each do |type|
147
147
  @solr_parameters[:fq].first.should match(/#{type}_access_group_ssim\:abc\\ 123/)
@@ -127,7 +127,7 @@ describe Hydra::AdminPolicy do
127
127
  describe "When accessing assets with Policies associated" do
128
128
  before do
129
129
  @user = FactoryGirl.build(:martia_morocco)
130
- RoleMapper.stub(:roles).with(@user.user_key).and_return(@user.roles)
130
+ RoleMapper.stub(:roles).with(@user).and_return(@user.roles)
131
131
  end
132
132
  before(:all) do
133
133
  class TestAbility
@@ -95,7 +95,7 @@ describe Hydra::PolicyAwareAccessControlsEnforcement do
95
95
  describe "policies_with_access" do
96
96
  context "Authenticated user" do
97
97
  before do
98
- RoleMapper.stub(:roles).with(@user.user_key).and_return(@user.roles)
98
+ RoleMapper.stub(:roles).with(@user).and_return(@user.roles)
99
99
  subject.stub(:current_user).and_return(@user)
100
100
  end
101
101
  it "should return the policies that provide discover permissions" do
@@ -120,7 +120,7 @@ describe Hydra::PolicyAwareAccessControlsEnforcement do
120
120
 
121
121
  describe "apply_gated_discovery" do
122
122
  before do
123
- RoleMapper.stub(:roles).with(@user.user_key).and_return(@user.roles)
123
+ RoleMapper.stub(:roles).with(@user).and_return(@user.roles)
124
124
  subject.stub(:current_user).and_return(@user)
125
125
  end
126
126
  it "should include policy-aware query" do
@@ -140,7 +140,7 @@ describe Hydra::PolicyAwareAccessControlsEnforcement do
140
140
 
141
141
  describe "apply_policy_role_permissions" do
142
142
  it "should escape slashes in the group names" do
143
- RoleMapper.stub(:roles).with(@user.user_key).and_return(["abc/123","cde/567"])
143
+ RoleMapper.stub(:roles).with(@user).and_return(["abc/123","cde/567"])
144
144
  subject.stub(:current_user).and_return(@user)
145
145
  user_access_filters = subject.apply_policy_role_permissions
146
146
  ["edit","discover","read"].each do |type|
@@ -149,7 +149,7 @@ describe Hydra::PolicyAwareAccessControlsEnforcement do
149
149
  end
150
150
  end
151
151
  it "should escape spaces in the group names" do
152
- RoleMapper.stub(:roles).with(@user.user_key).and_return(["abc 123","cd/e 567"])
152
+ RoleMapper.stub(:roles).with(@user).and_return(["abc 123","cd/e 567"])
153
153
  subject.stub(:current_user).and_return(@user)
154
154
  user_access_filters = subject.apply_policy_role_permissions
155
155
  ["edit","discover","read"].each do |type|
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: 6.4.0.rc4
4
+ version: 6.4.0.rc5
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: 2013-10-04 00:00:00.000000000 Z
13
+ date: 2013-10-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: 1.3.1
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.0.5
194
+ rubygems_version: 2.1.7
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Access controls for project hydra