perm 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/perm/authorized.rb +10 -4
- data/lib/perm/version.rb +1 -1
- data/test/authorized_test.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd2e6f359691f587e02ea0174671618215214eed242d935c20ad182a6a470db5
|
4
|
+
data.tar.gz: e264e7dad3fedfe072b2e5857587bf6c09efba62042b6c29356b1fb8718edc47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f645c62a65dc11c7f84359b75cb97eac1ff13c6dd42df1f884472737a8b162bdac0c64db4cf4185deae17c8e250a6cd0df3b12201da76c9d60342f2292f529a
|
7
|
+
data.tar.gz: 7ba5cab103b113133e3490a9841730aa173e10934403947f08f5c2205029e268b7c62c7a195d1932a183467270efb2f2555fe6a61efba71cf034636ec119accb
|
data/lib/perm/authorized.rb
CHANGED
@@ -2,11 +2,17 @@
|
|
2
2
|
require "delegate"
|
3
3
|
|
4
4
|
class Perm::Authorized < SimpleDelegator
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :subject
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
raise ArgumentError.new("
|
9
|
-
super @
|
7
|
+
def initialize(subject)
|
8
|
+
raise ArgumentError.new("subject cannot be nil") if subject.nil?
|
9
|
+
super @subject = subject
|
10
|
+
end
|
11
|
+
|
12
|
+
# @deprecated Please use #subject instead
|
13
|
+
def user
|
14
|
+
warn "The #user method has been deprecated in favor of #subject"
|
15
|
+
subject
|
10
16
|
end
|
11
17
|
|
12
18
|
def method_missing(name, *args)
|
data/lib/perm/version.rb
CHANGED
data/test/authorized_test.rb
CHANGED
@@ -34,8 +34,8 @@ module Perm
|
|
34
34
|
assert !@authorized_mary.respond_to?(:can_do_anything)
|
35
35
|
end
|
36
36
|
|
37
|
-
test "authorizers expose the wrapped
|
38
|
-
assert @authorized_mary.
|
37
|
+
test "authorizers expose the wrapped subject" do
|
38
|
+
assert @authorized_mary.subject == @mary
|
39
39
|
end
|
40
40
|
|
41
41
|
test "authorizers forward non-can_*? messages to wrapped object" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.7.
|
90
|
+
rubygems_version: 2.7.6
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: Simple permission management
|