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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85bf93918888b671597451ccd0e07c06f0f2aee6
4
- data.tar.gz: abbb22706f9e46df530be4d75d99a17cc5f8b4d3
3
+ metadata.gz: 7538cbd3446a01fa4cba36d7b6b6b0d074f7d2e7
4
+ data.tar.gz: 58f9df9e4247c5192e55f3779d8c763454e0d26f
5
5
  SHA512:
6
- metadata.gz: 63b8f647b9a58f7f31c75d6ae59918f739aaabc280fd37de3f736e73daee069bc7d1fce9fd7f97cb19321e42db65b27a29b0cdcba4a041d189f730c194bc7cf2
7
- data.tar.gz: 9427d711729984c6dcd04af845012bb4b9bf6c77b50e42270e9679ec26b802b3de3d3e7c46965a19acf7132e92346545b6c5c45f0a14c0b65188b576104a800a
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
- team_id = JSON.parse(Cafmal::User.new(@cafmal_api_url, @token).show(@decoded_token['payload']['sub']))["team_id"]
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
- 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})
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
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Cafmal
4
- VERSION = "0.21.0"
4
+ VERSION = "0.22.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafmal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nils Bartels