cafmal 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cafmal/auth.rb +6 -5
- data/lib/cafmal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7538cbd3446a01fa4cba36d7b6b6b0d074f7d2e7
|
4
|
+
data.tar.gz: 58f9df9e4247c5192e55f3779d8c763454e0d26f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88227c3a8fa2657f990a8d2819634ccf46f9a934c15040d801ed8e8eeb6d024d4c8ce98b493f90529df634ce02fea5a28c8dc267bd13f97cb7a78ff9f51a718e
|
7
|
+
data.tar.gz: 3dd60239cd1a18b264a182e4a6d2d2a9e534e355d8c048c3a4d155b8eadb69c4333baa28baa1fd620cef099f01063ecc8e905fa3753f8bd3f304421036271f85
|
data/lib/cafmal/auth.rb
CHANGED
@@ -38,12 +38,13 @@ module Cafmal
|
|
38
38
|
@decoded_token['header'] = JSON.parse(Base64.decode64(@token.split('.')[0]))
|
39
39
|
@decoded_token['payload'] = JSON.parse(Base64.decode64(@token.split('.')[1]))
|
40
40
|
|
41
|
-
|
41
|
+
if (@decoded_token['payload']['role'] == 'user' || @decoded_token['payload']['role'] == 'admin')
|
42
|
+
team_id = JSON.parse(Cafmal::User.new(@cafmal_api_url, @token).show(@decoded_token['payload']['sub']))["team_id"]
|
43
|
+
event = Cafmal::Event.new(@cafmal_api_url, @token)
|
44
|
+
event.create({name: 'user.login', message: "#{email} has logged in.", kind: 'login', severity: 'info', team_id: team_id})
|
42
45
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
#@TODO silence all alerts for your team_id, set silenced_at now + 1h
|
46
|
+
#@TODO silence all alerts for your team_id, set silenced_at now + 1h
|
47
|
+
end
|
47
48
|
|
48
49
|
true
|
49
50
|
end
|
data/lib/cafmal/version.rb
CHANGED