private_person 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 270c8b3bc69026dbc7e3d8b889d032d4ecde66c2
4
- data.tar.gz: ea2baa6b580f97359fcbd04f79b11926c0d9474d
3
+ metadata.gz: 83ae9de02a72d032f9b41ad89fad651a3153de40
4
+ data.tar.gz: 8ae33b693b2aa66cb4026ad7cb09fc721d7664c5
5
5
  SHA512:
6
- metadata.gz: f2d93fa86a47477ab27f75af20ccfa3dea97546a11472ae1d694449fdb72d2a9d3d58c662bbe0861ac9936e3c1c4a8984dfd0a3b4752356ad0d4bac404143510
7
- data.tar.gz: 0ef6809ea5be6453c9a5b46c897ba6886c10b6ae2293b462a36591ae0d159dc2dda61e07d62d28396fdc3dad2f9f83fbb4e2a202ef63e80c7d42c12e554c4d2a
6
+ metadata.gz: 43461e8b9274eaecbc576d35912d2a8f52d4cc4fa7e492ec8383c592111608366196b5193cd7dfa93117f372a5dc558bc4b663f24b28ac6aa85a3a9b2f1b9cdc
7
+ data.tar.gz: bba75865148e11f401b98f58f01a7d4d8504363c50aa71140fdc4568e974b7a6f80d548b1cd28ed9ef8422e603526bc309948d58e3edcf4b18c441c378e62ec7
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.3.0
@@ -16,7 +16,7 @@ module PrivatePerson
16
16
  existing = self.permissions_as_permissor.by_relationship_type(whom).by_permissible(what)
17
17
 
18
18
  if existing.empty?
19
- self.permissions_as_permissor.create!({:relationship_type => whom, :permissible => what})
19
+ self.permissions_as_permissor.create!(permission_params(whom, what))
20
20
  end
21
21
  self.permissions_as_permissor.reload
22
22
  end
@@ -25,10 +25,20 @@ module PrivatePerson
25
25
  existing = self.permissions_as_permissor.by_relationship_type(whom).where(:permissible_type, what)
26
26
 
27
27
  if existing.empty?
28
- self.permissions_as_permissor.create!({:relationship_type => whom, :permissible_type => what})
28
+ self.permissions_as_permissor.create!(wildcard_permission_params(whom, what))
29
29
  end
30
30
  self.permissions_as_permissor.reload
31
31
  end
32
+
33
+ def permission_params(whom, what)
34
+ params = ActionController::Parameters.new({:relationship_type => whom, :permissible => what})
35
+ params.permit!
36
+ end
37
+
38
+ def wildcard_permission_params(whom, what)
39
+ params = ActionController::Parameters.new({:relationship_type => whom, :permissible_type => what})
40
+ params.permit!
41
+ end
32
42
  end
33
43
  end
34
44
  end
@@ -39,7 +39,7 @@ module PrivatePerson
39
39
  # Then check for a slow method
40
40
  for relationship_method in permissor.class.of
41
41
  relationship_members = permissor.send(relationship_method.to_sym)
42
- if relationship_members.present? and relationship_members.find(:id => self.id).exists?
42
+ if relationship_members.present? and relationship_members.exists?(:id => self.id)
43
43
  return relationship_method.to_s
44
44
  end
45
45
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "private_person"
8
- s.version = "0.2.9"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Karen Lundgren"]
12
- s.date = "2013-09-29"
12
+ s.date = "2013-09-30"
13
13
  s.description = "Private person is an active record extension gem that allows a model to be given privacy settings over arbitrary models and polymorphic relations, putting users' accounts in control of their own privacy policies."
14
14
  s.email = "webmaster@sourcherryweb.com"
15
15
  s.extra_rdoc_files = [
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
+ ".idea/scopes/scope_settings.xml",
21
22
  ".rspec",
22
23
  "Gemfile",
23
24
  "LICENSE.txt",
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: private_person
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Lundgren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-29 00:00:00.000000000 Z
11
+ date: 2013-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -189,6 +189,7 @@ extra_rdoc_files:
189
189
  - README.rdoc
190
190
  files:
191
191
  - .document
192
+ - .idea/scopes/scope_settings.xml
192
193
  - .rspec
193
194
  - Gemfile
194
195
  - LICENSE.txt