apiphobic-authorization 1.2.0 → 1.2.1
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/apiphobic/authorization/authorizers/scope.rb +14 -6
- data/lib/apiphobic/authorization/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 936fbde0291882daeb50f81249a28d4c50a9762b659049c6495385703c61ab06
|
|
4
|
+
data.tar.gz: 65febd7701bada72341db5628e500983752376513720f44eb0cf6a9be4dab0cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2de1a7afe900c518b888bd9f1231d76fcc47208450452c313e06767d259a3470a290d3acf869a6b2dd6c9c3f732f572f0bbed437320e44ecd01f827238c60971
|
|
7
|
+
data.tar.gz: 23afc8e9bd16eb52fe96b3e93122aef1decdf59e5bd12a8e50a67e1055a1a89c61d075e7781fc133509177d5cb9ac02d6738ab26484b1c76b875079e06a93d2d
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
|
@@ -37,19 +37,17 @@ class Scope
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def call
|
|
40
|
-
if
|
|
41
|
-
user_scope
|
|
42
|
-
else
|
|
40
|
+
if user.nil?
|
|
43
41
|
public_scope
|
|
42
|
+
else
|
|
43
|
+
user_scope
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
private
|
|
48
48
|
|
|
49
49
|
def scope_user_id
|
|
50
|
-
|
|
51
|
-
.fetch(:filter, {})
|
|
52
|
-
.fetch(user_underscored_class_name, nil)
|
|
50
|
+
authorized_scope_id(name: user_underscored_class_name, default: user.id)
|
|
53
51
|
end
|
|
54
52
|
|
|
55
53
|
def user_underscored_class_name
|
|
@@ -59,6 +57,16 @@ class Scope
|
|
|
59
57
|
base_user_class_name.underscore.downcase
|
|
60
58
|
end
|
|
61
59
|
end
|
|
60
|
+
|
|
61
|
+
def authorized_scope_id(name:, default:)
|
|
62
|
+
if token.admin?
|
|
63
|
+
raw_parameters
|
|
64
|
+
.fetch(:filter, {})
|
|
65
|
+
.fetch("#{name}_id", default)
|
|
66
|
+
else
|
|
67
|
+
default
|
|
68
|
+
end
|
|
69
|
+
end
|
|
62
70
|
end
|
|
63
71
|
end
|
|
64
72
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apiphobic-authorization
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thegranddesign
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
Y2GAoHKstmfIVhc4XHOPpmTd2o/C29O9oaRgjrkfQEhF/KvJ/PhoV5hvokzsCyI5
|
|
32
32
|
iUeXPfvrGD/itYIBCgk+fnzyQQ4QtE5hTQaWQ3o2
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2018-05-
|
|
34
|
+
date: 2018-05-19 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: apiphobic-resource
|
metadata.gz.sig
CHANGED
|
Binary file
|