hydra-access-controls 6.4.1 → 6.4.2

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: 1c7889e840d3022c5487081cbb7e11c7abad06ab
4
- data.tar.gz: b8323dbda12665dc1ee7d29bcc5b194dcd09f7fa
3
+ metadata.gz: d210d30d1d16eaf9fd257ca3e3f4a62ff3366842
4
+ data.tar.gz: 77eb224f39e50722244cf75fc32c95ad07546208
5
5
  SHA512:
6
- metadata.gz: b8e37c30ce82f7a2ac0c5f3d737ccc76ac0001675486d5bce88212b65ab786af187df510552ab05329f5da2e90da036e0e2022430d9c53f5c48aae4fd01198e9
7
- data.tar.gz: 8b6be814f5af9b0c997c2dff7bbaa2c1a0f568135da51bc6411f92ef3555fa2271fd0228187d1f4d9d1111c9b5c2bb0104659f6197357bb31f3dbb08f7ec5bd8
6
+ metadata.gz: 073cfb5759b3d8be62cbf3f27804d66279920de562655a2ad94d89136f74cc9134a334bef828837db602e71680a852b79f9d9c5a5400f91d9f6ac1b986305f0c
7
+ data.tar.gz: d1e6d9284a74f9776c544060ceb8b401a9f705ad02aabc68d689cad00b0bff4733f403bf01ce16177e5164ff2096ea1fea05f2228d4e66955591aac2845ef30c
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.required_ruby_version = '>= 1.9.3'
20
20
 
21
21
  gem.add_dependency 'activesupport'
22
- gem.add_dependency "active-fedora", '~> 6.6'
22
+ gem.add_dependency "active-fedora", '~> 6.7'
23
23
  gem.add_dependency 'cancan'
24
24
  gem.add_dependency 'deprecation'
25
25
  gem.add_dependency 'blacklight', '~> 4.0'
@@ -1,5 +1,6 @@
1
1
  module Hydra::AccessControls
2
2
  class Permission
3
+
3
4
  def initialize(args)
4
5
  @vals = {name: args[:name], access: args[:access], type: args[:type]}
5
6
  end
@@ -8,8 +9,12 @@ module Hydra::AccessControls
8
9
  false
9
10
  end
10
11
 
12
+ def to_hash
13
+ @vals
14
+ end
15
+
11
16
  def [] var
12
- @vals[var]
17
+ to_hash[var]
13
18
  end
14
19
 
15
20
  def name
@@ -14,10 +14,10 @@ class Hydra::AdminPolicy < ActiveFedora::Base
14
14
 
15
15
  end
16
16
 
17
- delegate_to :descMetadata, [:title, :description], multiple: false
18
- delegate :license_title, to: 'rightsMetadata', at: [:license, :title], multiple: false
19
- delegate :license_description, to: 'rightsMetadata', at: [:license, :description], multiple: false
20
- delegate :license_url, to: 'rightsMetadata', at: [:license, :url], multiple: false
17
+ has_attributes :title, :description, datastream: :descMetadata, multiple: false
18
+ has_attributes :license_title, datastream: 'rightsMetadata', at: [:license, :title], multiple: false
19
+ has_attributes :license_description, datastream: 'rightsMetadata', at: [:license, :description], multiple: false
20
+ has_attributes :license_url, datastream: 'rightsMetadata', at: [:license, :url], multiple: false
21
21
 
22
22
  # easy access to edit_groups, etc
23
23
  include Hydra::AccessControls::Permissions
@@ -170,7 +170,7 @@ module Hydra
170
170
  def embargo_release_date=(release_date)
171
171
  release_date = release_date.to_s if release_date.is_a? Date
172
172
  begin
173
- Date.parse(release_date)
173
+ release_date.nil? || Date.parse(release_date)
174
174
  rescue
175
175
  return "INVALID DATE"
176
176
  end
@@ -176,6 +176,11 @@ describe Hydra::Datastream::RightsMetadata do
176
176
  it "should only accept valid date values" do
177
177
 
178
178
  end
179
+ it "should accept a nil value after having a date value" do
180
+ @sample.embargo_release_date=("2010-12-01")
181
+ @sample.embargo_release_date=(nil)
182
+ @sample.embargo_release_date.should == nil
183
+ end
179
184
  end
180
185
  describe "embargo_release_date" do
181
186
  it "should return solr formatted date" do
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Hydra::AccessControls::Permission do
4
+ describe "hash-like key access" do
5
+ let(:perm) { described_class.new(type: 'user', name: 'bob', access: 'read') }
6
+ it "should return values" do
7
+ perm[:type].should == 'user'
8
+ perm[:name].should == 'bob'
9
+ perm[:access].should == 'read'
10
+ end
11
+ end
12
+ describe "#to_hash" do
13
+ subject { described_class.new(type: 'user', name: 'bob', access: 'read') }
14
+ its(:to_hash) { should == {type: 'user', name: 'bob', access: 'read'} }
15
+ end
16
+ describe "equality comparison" do
17
+ let(:perm1) { described_class.new(type: 'user', name: 'bob', access: 'read') }
18
+ let(:perm2) { described_class.new(type: 'user', name: 'bob', access: 'read') }
19
+ let(:perm3) { described_class.new(type: 'user', name: 'jane', access: 'read') }
20
+ it "should be equal if all values are equal" do
21
+ perm1.should == perm2
22
+ end
23
+ it "should be unequal if some values are unequal" do
24
+ perm1.should_not == perm3
25
+ perm2.should_not == perm3
26
+ end
27
+ end
28
+ 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: 6.4.1
4
+ version: 6.4.2
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-11-26 00:00:00.000000000 Z
13
+ date: 2014-05-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - ~>
34
34
  - !ruby/object:Gem::Version
35
- version: '6.6'
35
+ version: '6.7'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ~>
41
41
  - !ruby/object:Gem::Version
42
- version: '6.6'
42
+ version: '6.7'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: cancan
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -163,6 +163,7 @@ files:
163
163
  - spec/unit/hydra_rights_metadata_persistence_spec.rb
164
164
  - spec/unit/hydra_rights_metadata_spec.rb
165
165
  - spec/unit/inheritable_rights_metadata_spec.rb
166
+ - spec/unit/permission.rb
166
167
  - spec/unit/permissions_spec.rb
167
168
  - spec/unit/policy_aware_ability_spec.rb
168
169
  - spec/unit/policy_aware_access_controls_enforcement_spec.rb
@@ -191,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
192
  version: '0'
192
193
  requirements: []
193
194
  rubyforge_project:
194
- rubygems_version: 2.0.3
195
+ rubygems_version: 2.0.14
195
196
  signing_key:
196
197
  specification_version: 4
197
198
  summary: Access controls for project hydra
@@ -212,6 +213,7 @@ test_files:
212
213
  - spec/unit/hydra_rights_metadata_persistence_spec.rb
213
214
  - spec/unit/hydra_rights_metadata_spec.rb
214
215
  - spec/unit/inheritable_rights_metadata_spec.rb
216
+ - spec/unit/permission.rb
215
217
  - spec/unit/permissions_spec.rb
216
218
  - spec/unit/policy_aware_ability_spec.rb
217
219
  - spec/unit/policy_aware_access_controls_enforcement_spec.rb