sequel-privacy 0.2.0 → 0.3
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 +4 -4
- data/lib/sequel/plugins/privacy.rb +10 -2
- data/lib/sequel/privacy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd27576a058e95f92fd4c50fc1f5da0e058d0b7f93c3f114b88757a08651dd29
|
|
4
|
+
data.tar.gz: f429f5fc246fcd7cb043170a8166b7bc06fa04125aa4c89d6fe196b4c5bead31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c58b5116d0b2a0ac0acf829612cdf46ee3ec1ef08879d189bbf94170248ac8cbf6a540601de6794bf6f03086e5af4e2f555291ac5d2de22a5405f1fb61ab066a
|
|
7
|
+
data.tar.gz: bf580a74fcb95fc328f7d0564877804ef642783442254af86d436ae853b89d88f71cd5abb6cff95ba56ed38992261557049350081bad9d35d63a80ce7ebbde96
|
|
@@ -123,7 +123,7 @@ module Sequel
|
|
|
123
123
|
# can :remove, AllowGroupAdmin, AllowSelfRemove
|
|
124
124
|
# can :remove_all, AllowGroupAdmin
|
|
125
125
|
# end
|
|
126
|
-
sig { params(name: Symbol, block: T.proc.void).void }
|
|
126
|
+
sig { params(name: Symbol, block: T.proc.bind(AssociationPrivacyDSL).void).void }
|
|
127
127
|
def association(name, &block)
|
|
128
128
|
resolver = ->(policies) { resolve_policies(policies) }
|
|
129
129
|
dsl = AssociationPrivacyDSL.new(@model_class, name, resolver)
|
|
@@ -260,7 +260,7 @@ module Sequel
|
|
|
260
260
|
# can :edit, P::AllowSelf, P::AllowAdmins
|
|
261
261
|
# field :email, P::AllowSelf
|
|
262
262
|
# end
|
|
263
|
-
sig { params(block: T.proc.void).void }
|
|
263
|
+
sig { params(block: T.proc.bind(PrivacyDSL).void).void }
|
|
264
264
|
def privacy(&block)
|
|
265
265
|
if privacy_finalized?
|
|
266
266
|
Kernel.raise Sequel::Privacy::PrivacyAlreadyFinalizedError, "Privacy already finalized for #{self}"
|
|
@@ -302,6 +302,8 @@ module Sequel
|
|
|
302
302
|
vc = instance_variable_get(:@viewer_context)
|
|
303
303
|
|
|
304
304
|
unless vc
|
|
305
|
+
return original_method.bind(self).() if T.unsafe(self.class).allow_unsafe_access?
|
|
306
|
+
|
|
305
307
|
Kernel.raise Sequel::Privacy::MissingViewerContext,
|
|
306
308
|
"#{self.class}##{field} requires a ViewerContext"
|
|
307
309
|
end
|
|
@@ -518,6 +520,8 @@ module Sequel
|
|
|
518
520
|
vc = instance_variable_get(:@viewer_context)
|
|
519
521
|
|
|
520
522
|
unless vc
|
|
523
|
+
return original.bind(self).(obj) if T.unsafe(self.class).allow_unsafe_access?
|
|
524
|
+
|
|
521
525
|
Kernel.raise Sequel::Privacy::MissingViewerContext,
|
|
522
526
|
"Cannot #{method_name} without a viewer context"
|
|
523
527
|
end
|
|
@@ -548,6 +552,8 @@ module Sequel
|
|
|
548
552
|
vc = instance_variable_get(:@viewer_context)
|
|
549
553
|
|
|
550
554
|
unless vc
|
|
555
|
+
return original.bind(self).(obj) if T.unsafe(self.class).allow_unsafe_access?
|
|
556
|
+
|
|
551
557
|
Kernel.raise Sequel::Privacy::MissingViewerContext,
|
|
552
558
|
"Cannot #{method_name} without a viewer context"
|
|
553
559
|
end
|
|
@@ -578,6 +584,8 @@ module Sequel
|
|
|
578
584
|
vc = instance_variable_get(:@viewer_context)
|
|
579
585
|
|
|
580
586
|
unless vc
|
|
587
|
+
return original.bind(self).() if T.unsafe(self.class).allow_unsafe_access?
|
|
588
|
+
|
|
581
589
|
Kernel.raise Sequel::Privacy::MissingViewerContext,
|
|
582
590
|
"Cannot #{method_name} without a viewer context"
|
|
583
591
|
end
|