hydra-access-controls 8.0.0.beta1 → 8.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
  SHA1:
3
- metadata.gz: b0d98e3c908f1b964b513a14bcefa045555e2a4e
4
- data.tar.gz: e76217063ba9f7dc9135c9fd9a12f0c0df79a22d
3
+ metadata.gz: 40e759b7615b78617bcefe2142ae56d9e20fcdd3
4
+ data.tar.gz: 32093d9d2cd45ae6913644976cff53344be2532f
5
5
  SHA512:
6
- metadata.gz: 83eead2405cf85b0bf7c62e7b31eca5d40940e62ea59b2fdc841d1d7c7d82c5eb8eedfb7723915daf21ee2d949c73a372bdee513961cfb6fd4bdb08b082f64ca
7
- data.tar.gz: dc983e490624103a8eeeac6e6c8ee0745009ea35475d90b741a044551a52b6f2fa4b0032e89a9a3ae556e7be935e2b455b1e4fe4ff35d641337f65b7886919d3
6
+ metadata.gz: 268da443deb9bbc03cff733704a6517d17a3b0ec35ded2f03003b15b4bf97772fedd8bfe02f17bfa490e361400c886da3dd21a3213d36412e9daadd0c8611afc
7
+ data.tar.gz: bbb965bacc370f3b20e0d5c43e231ca321835228877c53f485e77e6b5a8eea249ec8356bb6d17672dd42e7f60db5388315f582929ee7365b7ba2d57ec03ea2bb
@@ -2,7 +2,6 @@ module Hydra
2
2
  module AccessControls
3
3
  module Permissions
4
4
  extend ActiveSupport::Concern
5
- extend Deprecation
6
5
 
7
6
  included do
8
7
  include Hydra::AccessControls::Visibility
@@ -18,8 +18,8 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.required_ruby_version = '>= 1.9.3'
20
20
 
21
- gem.add_dependency 'activesupport'
22
- gem.add_dependency "active-fedora", '~> 8.0.0.rc2'
21
+ gem.add_dependency 'activesupport', '~> 4.0'
22
+ gem.add_dependency "active-fedora", '~> 8.0.0'
23
23
  gem.add_dependency "om", '~> 3.0', '>= 3.0.7'
24
24
  gem.add_dependency 'cancancan'
25
25
  gem.add_dependency 'deprecation'
data/lib/hydra/ability.rb CHANGED
@@ -3,7 +3,6 @@ require 'cancan'
3
3
  module Hydra
4
4
  module Ability
5
5
  extend ActiveSupport::Concern
6
- extend Deprecation
7
6
 
8
7
  # once you include Hydra::Ability you can add custom permission methods by appending to ability_logic like so:
9
8
  #
@@ -155,20 +154,10 @@ module Hydra
155
154
  Hydra.config.permissions.read.group
156
155
  end
157
156
 
158
- def edit_person_field
159
- Deprecation.warn(Ability, "The edit_person_field class method is deprecated and will be removed from Hydra::Ability in hydra-head 8.0. Use edit_user_field instead.", caller)
160
- edit_user_field
161
- end
162
-
163
157
  def edit_user_field
164
158
  Hydra.config.permissions.edit.individual
165
159
  end
166
160
 
167
- def read_person_field
168
- Deprecation.warn(Ability, "The read_person_field class method is deprecated and will be removed from Hydra::Ability in hydra-head 8.0. Use read_user_field instead.", caller)
169
- read_user_field
170
- end
171
-
172
161
  def read_user_field
173
162
  Hydra.config.permissions.read.individual
174
163
  end
@@ -36,14 +36,6 @@ module Hydra::AccessControlsEnforcement
36
36
  false
37
37
  end
38
38
 
39
- def is_public?
40
- ActiveSupport::Deprecation.warn("Hydra::AccessControlsEnforcement.is_public? has been deprecated. Use can? instead.")
41
- load_permissions_from_solr
42
- access_key = ActiveFedora::SolrService.solr_name("access", Hydra::Datastream::RightsMetadata.indexer)
43
- @permissions_solr_document[access_key].present? && @permissions_solr_document[access_key].first.downcase == "public"
44
- end
45
-
46
-
47
39
  #
48
40
  # Action-specific enforcement
49
41
  #
@@ -2,7 +2,6 @@ class Hydra::AdminPolicy < ActiveFedora::Base
2
2
 
3
3
  include Hydra::AdminPolicyBehavior
4
4
  include Hydra::AccessControls::Permissions
5
- extend Deprecation
6
5
 
7
6
  has_metadata 'descMetadata', type: ActiveFedora::QualifiedDublinCoreDatastream do |m|
8
7
  m.title :type=> :text, :index_as=>[:searchable]
@@ -13,28 +12,4 @@ class Hydra::AdminPolicy < ActiveFedora::Base
13
12
  has_attributes :license_description, datastream: 'rightsMetadata', at: [:license, :description], multiple: false
14
13
  has_attributes :license_url, datastream: 'rightsMetadata', at: [:license, :url], multiple: false
15
14
 
16
- def self.readable_by_user(user)
17
- Deprecation.warn(Hydra::AdminPolicy, "The class method Hydra::AdminPolicy.readable_by_user(user) is deprecated and will be removed from hydra-head 8.0.", caller)
18
- where_user_has_permissions(user, [:read, :edit])
19
- end
20
-
21
- def self.editable_by_user(user)
22
- Deprecation.warn(Hydra::AdminPolicy, "The class method Hydra::AdminPolicy.editable_by_user(user) is deprecated and will be removed from hydra-head 8.0.", caller)
23
- where_user_has_permissions(user, [:edit])
24
- end
25
-
26
- def self.where_user_has_permissions(user, permissions=[:edit])
27
- Deprecation.warn(Hydra::AdminPolicy, "The class method Hydra::AdminPolicy.where_user_has_permissions(user) is deprecated and will be removed from hydra-head 8.0.", caller)
28
- or_query = []
29
- RoleMapper.roles(user).each do |group|
30
- permissions.each do |permission|
31
- or_query << ActiveFedora::SolrService.solr_name("#{permission}_access_group", indexer)+":#{group}"
32
- end
33
- end
34
- permissions.each do |permission|
35
- or_query << ActiveFedora::SolrService.solr_name("#{permission}_access_person", indexer)+":#{user.user_key}"
36
- end
37
- find_with_conditions(or_query.join(" OR "))
38
- end
39
-
40
15
  end
@@ -3,7 +3,6 @@ module Hydra
3
3
  module Datastream
4
4
  # Implements Hydra RightsMetadata XML terminology for asserting access permissions
5
5
  class RightsMetadata < ActiveFedora::OmDatastream
6
- extend Deprecation
7
6
 
8
7
  set_terminology do |t|
9
8
  t.root(:path=>"rightsMetadata", :xmlns=>"http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1", :schema=>"http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd")
@@ -152,11 +151,6 @@ module Hydra
152
151
  return quick_search_by_type(:group)
153
152
  end
154
153
 
155
- def individuals
156
- Deprecation.warn(RightsMetadata, "The method `individuals' is deprecated and will be removed from Hydra::Datastream::RightsMetadata in hydra-head 8.0. Use `users' instead.", caller)
157
- users
158
- end
159
-
160
154
  # Reports on which users have which permissions
161
155
  # @return Hash in format {user_name => user_permissions, user_name => user_permissions}
162
156
  def users
@@ -1,20 +1,13 @@
1
1
  class Hydra::PermissionsSolrDocument < SolrDocument
2
+
2
3
  def under_embargo?
3
- #permissions = permissions_doc(params[:id])
4
4
  embargo_key = ActiveFedora::SolrService.solr_name("embargo_release_date", Hydra::Datastream::RightsMetadata.date_indexer)
5
5
  if self[embargo_key]
6
6
  embargo_date = Date.parse(self[embargo_key].split(/T/)[0])
7
7
  return embargo_date > Date.parse(Time.now.to_s)
8
8
  end
9
9
  false
10
- end
11
-
12
- def is_public?
13
- ActiveSupport::Deprecation.warn("Hydra::PermissionsSolrDocument.is_public? has been deprecated. Use can? instead.")
14
- access_key = ActiveFedora::SolrService.solr_name("access", Hydra::Datastream::RightsMetadata.indexer)
15
- self[access_key].present? && self[access_key].first.downcase == "public"
16
- end
17
-
10
+ end
18
11
 
19
12
  end
20
13
 
@@ -1,7 +1,6 @@
1
1
  # Repeats access controls evaluation methods, but checks against a governing "Policy" object (or "Collection" object) that provides inherited access controls.
2
2
  module Hydra::PolicyAwareAbility
3
3
  extend ActiveSupport::Concern
4
- extend Deprecation
5
4
  include Hydra::Ability
6
5
 
7
6
  # Extends Hydra::Ability.test_edit to try policy controls if object-level controls deny access
@@ -94,11 +93,6 @@ module Hydra::PolicyAwareAbility
94
93
  return rg
95
94
  end
96
95
 
97
- def edit_persons_from_policy(policy_pid)
98
- Deprecation.warn(Hydra::PolicyAwareAbility, "The edit_persons_from_policy method is deprecated and will be removed from Hydra::PolicyAwareAbility in hydra-head 8.0. Use edit_users_from_policy instead.", caller)
99
- edit_users_from_policy(policy_pid)
100
- end
101
-
102
96
  # Returns the list of users granted edit access by the policy object identified by policy_pid
103
97
  def edit_users_from_policy(policy_pid)
104
98
  policy_permissions = policy_permissions_doc(policy_pid)
@@ -108,11 +102,6 @@ module Hydra::PolicyAwareAbility
108
102
  return eu
109
103
  end
110
104
 
111
- def read_persons_from_policy(policy_pid)
112
- Deprecation.warn(Hydra::PolicyAwareAbility, "The read_persons_from_policy method is deprecated and will be removed from Hydra::PolicyAwareAbility in hydra-head 8.0. Use read_users_from_policy instead.", caller)
113
- read_users_from_policy(policy_pid)
114
- end
115
-
116
105
  # Returns the list of users granted read access by the policy object identified by policy_pid
117
106
  # Note: edit implies read, so read_users is the union of edit and read users
118
107
  def read_users_from_policy(policy_pid)
@@ -1,6 +1,5 @@
1
1
  # Repeats access controls evaluation methods, but checks against a governing "Policy" object (or "Collection" object) that provides inherited access controls.
2
2
  module Hydra::PolicyAwareAccessControlsEnforcement
3
- extend Deprecation
4
3
 
5
4
  # Extends Hydra::AccessControlsEnforcement.apply_gated_discovery to reflect policy-provided access
6
5
  # appends the result of policy_clauses into the :fq
@@ -31,11 +30,6 @@ module Hydra::PolicyAwareAccessControlsEnforcement
31
30
  result.map {|h| h['id']}
32
31
  end
33
32
 
34
- def apply_policy_role_permissions(permission_types = discovery_permissions)
35
- Deprecation.warn(Hydra::PolicyAwareAccessControlsEnforcement, "The method apply_policy_role_permissions is deprecated and will be removed from Hydra::PolicyAwareAccessControlsEnforcement in hydra-head 8.0. Use apply_policy_group_permissions instead.", caller)
36
- apply_policy_group_permissions(permission_types)
37
- end
38
-
39
33
  def apply_policy_group_permissions(permission_types = discovery_permissions)
40
34
  # for groups
41
35
  user_access_filters = []
@@ -47,11 +41,6 @@ module Hydra::PolicyAwareAccessControlsEnforcement
47
41
  user_access_filters
48
42
  end
49
43
 
50
- def apply_policy_individual_permissions(permission_types = discovery_permissions)
51
- Deprecation.warn(Hydra::PolicyAwareAccessControlsEnforcement, "The method apply_policy_individual_permissions is deprecated and will be removed from Hydra::PolicyAwareAccessControlsEnforcement in hydra-head 8.0. Use apply_policy_user_permissions instead.", caller)
52
- apply_policy_user_permissions(permission_types)
53
- end
54
-
55
44
  def apply_policy_user_permissions(permission_types = discovery_permissions)
56
45
  # for individual user access
57
46
  user_access_filters = []
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: 8.0.0.beta1
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -10,36 +10,36 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-12-03 00:00:00.000000000 Z
13
+ date: 2015-02-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">="
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '4.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ">="
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '0'
28
+ version: '4.0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: active-fedora
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 8.0.0.rc2
35
+ version: 8.0.0
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: 8.0.0.rc2
42
+ version: 8.0.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: om
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -231,9 +231,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
231
  version: 1.9.3
232
232
  required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ">"
234
+ - - ">="
235
235
  - !ruby/object:Gem::Version
236
- version: 1.3.1
236
+ version: '0'
237
237
  requirements: []
238
238
  rubyforge_project:
239
239
  rubygems_version: 2.2.2