flimper_poncho 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/flimper_poncho.rb +1 -0
- data/lib/flimper_poncho/users/queries/find.rb +27 -0
- data/lib/flimper_poncho/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77fb1fc47468d3a16fa802f29af229e410789edc3635791e60ef5e92160f3f34
|
4
|
+
data.tar.gz: 83b51e47a380b52391db26599d86457dec97de7a36c0f8d316b43451704ad388
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 300ec4e340859e539bfc00dc605ccf233f2af6564777044ce50917ad0fbf14fbc5fe561ba99e1a772a4ffe91d7d9f9488dd3cb9f8be93f5e3af71dc491332a13
|
7
|
+
data.tar.gz: 491c7303b4f50bc5ad562a02b2002fa48be759910cd112876bcf9de945d358f500745dcbfa61d4708956f8d7b2bab0603b9b64ac03d24d22ab46d3d73dc9b79c
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/flimper_poncho.rb
CHANGED
@@ -3,6 +3,7 @@ require 'flimper_poncho/jwts/issuers/for_api_clients'
|
|
3
3
|
require 'flimper_poncho/jwts/issuers/for_users'
|
4
4
|
require 'flimper_poncho/permissions/checkers/for_api_clients'
|
5
5
|
require 'flimper_poncho/permissions/checkers/for_users'
|
6
|
+
require 'flimper_poncho/users/queries/find'
|
6
7
|
|
7
8
|
module FlimperPoncho
|
8
9
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module FlimperPoncho
|
2
|
+
module Users
|
3
|
+
module Queries
|
4
|
+
class Find
|
5
|
+
def initialize(jwt_token:)
|
6
|
+
@jwt_token = jwt_token
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
OpenStruct.new(id: decoded_jwt['id'], email: decoded_jwt['email'], permissions: permissions)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def decoded_jwt
|
16
|
+
@decoded_jwt ||= JWT.decode(@jwt_token, ENV.fetch('PONCHO_API_SIGNATURE_KEY'), true, algorithm: 'HS256')[0]
|
17
|
+
end
|
18
|
+
|
19
|
+
def permissions
|
20
|
+
@permissions ||= decoded_jwt.dig('permissions').map do |perm|
|
21
|
+
OpenStruct.new(email: perm['email'], resource_code: perm['resource_code'], level: perm['level'])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flimper_poncho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Gonzaga
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/flimper_poncho/permissions/checkers/for_api_clients.rb
|
164
164
|
- lib/flimper_poncho/permissions/checkers/for_users.rb
|
165
165
|
- lib/flimper_poncho/permissions/checkers/template.rb
|
166
|
+
- lib/flimper_poncho/users/queries/find.rb
|
166
167
|
- lib/flimper_poncho/version.rb
|
167
168
|
homepage: https://github.com/flimperapp/poncho_gem
|
168
169
|
licenses:
|