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

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: 58e7c3a8cd4a77e2f9b2073a85d97c300f3dc343
4
- data.tar.gz: fe6533eaf0c9871b46fbb6efc917416e935cec29
3
+ metadata.gz: b88206682c3c647370e3ad2a69f8f6c6966e8be1
4
+ data.tar.gz: 9e41bdafc97dc0fdf4a537a885562de12dc3ec07
5
5
  SHA512:
6
- metadata.gz: ef489f66366bd1fc17710b42939d55315973dead5eea64345f9f7cb5d510346ed76447b495ad95a529dcdf31c057ebc0665108170cb6dd93fd83c05faba7755e
7
- data.tar.gz: d4a5b2ed08337e07003ed55cc06be0e051c0b71e8e8e405816271ffc1753177a4565f2ec4066a565bd218a3c6b4334c434578cceda7421e066f2599324c925f1
6
+ metadata.gz: 1b5464365e2272eecad05fa91e5c2038413cb36c770552e609f6a4a556d192922c944bfb97ea7abba1b795b97928cc295d9a22d98c27fa2a7c1ccd7ed388f7d2
7
+ data.tar.gz: 8053315e645d78d4dc8de1868273cad335b7a2767a9911f0cefce3f9faa60898de4846578411822a4c5839af8388b53568f146560dd94c80eca4503e0c1c1bcd
@@ -2,12 +2,18 @@ module Hydra
2
2
  module AccessControls
3
3
  module Permissions
4
4
  extend ActiveSupport::Concern
5
+ extend Deprecation
5
6
  include Hydra::AccessControls::Visibility
6
7
 
7
8
  included do
8
9
  has_metadata "rightsMetadata", type: Hydra::Datastream::RightsMetadata
9
10
  end
10
11
 
12
+ # permissions= added for backward compatibility of Hydra::AdminPolicy for hydra-head < 6.4
13
+ def permissions= attributes_collection
14
+ Deprecation.warn(Permissions, "The permissions= method is deprecated and will be removed from Hydra::AccessControls::Permissions in hydra-head 7.0", caller)
15
+ self.permissions_attributes = attributes_collection
16
+ end
11
17
 
12
18
  ## Updates those permissions that are provided to it. Does not replace any permissions unless they are provided
13
19
  # @example
@@ -9,29 +9,6 @@ module Hydra
9
9
  Deprecation.warn(RightsMetadata, "Hydra::ModelMixins::RightsMetadata has been deprecated and will be removed in hydra-head 7.0. Use Hydra::AccessControls::Permissions instead", caller(3));
10
10
  end
11
11
 
12
-
13
-
14
- ## Updates those permissions that are provided to it. Does not replace any permissions unless they are provided
15
- # @example
16
- # obj.permissions= [{:name=>"group1", :access=>"discover", :type=>'group'},
17
- # {:name=>"group2", :access=>"discover", :type=>'group'}]
18
- def permissions=(params)
19
- perm_hash = {'person' => rightsMetadata.individuals, 'group'=> rightsMetadata.groups}
20
-
21
- params.each do |row|
22
- if row[:type] == 'user' || row[:type] == 'person'
23
- perm_hash['person'][row[:name]] = row[:access]
24
- elsif row[:type] == 'group'
25
- perm_hash['group'][row[:name]] = row[:access]
26
- else
27
- raise ArgumentError, "Permission type must be 'user', 'person' (alias for 'user'), or 'group'"
28
- end
29
- end
30
-
31
- rightsMetadata.update_permissions(perm_hash)
32
- end
33
-
34
-
35
12
  ## Returns a list with all the permissions on the object.
36
13
  # @example
37
14
  # [{:name=>"group1", :access=>"discover", :type=>'group'},
@@ -111,4 +111,13 @@ describe Hydra::AccessControls::Permissions do
111
111
  subject.rightsMetadata.individuals.should == {"person1"=>"read","person2"=>"discover"}
112
112
  end
113
113
  end
114
+ describe "#permissions=" do
115
+ it "should behave like #permissions_attributes=" do
116
+ foo1 = Foo.new
117
+ foo2 = Foo.new
118
+ foo1.permissions = [{type: "user", access: "edit", name: "editor"}]
119
+ foo2.permissions_attributes = [{type: "user", access: "edit", name: "editor"}]
120
+ foo1.permissions.should == foo2.permissions
121
+ end
122
+ end
114
123
  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.0.rc3
4
+ version: 6.4.0.rc4
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-03 00:00:00.000000000 Z
13
+ date: 2013-10-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport