uc3-dmp-rds 0.0.15 → 0.0.17

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
  SHA256:
3
- metadata.gz: ab8baeefeaefa3440ab7fd1dd17f82597e3a0bdebf56ca00a204cab9fee9fdb0
4
- data.tar.gz: 6517005d0c6dee5e89274063811ecc73e8f97f25e6e363ed807c4fd2d05d267f
3
+ metadata.gz: 12d1d6576ea3620ee8bf943382a260531b6193a39141173698fd5e70f8fccca9
4
+ data.tar.gz: '08c112afc6771fa199222358eeb09f7d45821f92775875b639fd0c2d91fc2dbe'
5
5
  SHA512:
6
- metadata.gz: f82f8dcd0237f542278a0a296a2a4aac96cc99c50455eae77e66e192cc4b64b451d4bb5fa5b2bca8c38fd3d12bd906c17d0b0a2bb7d309d83b30d4ccbaf7d624
7
- data.tar.gz: edcda33c09cef2fae6de7a85cf345c4cd75a915b7575830096d22f7e7fe876ee829b402519003c72f1f3dfc07d340c14c6cb1b753d675b8ee68bd569b9975eac
6
+ metadata.gz: 7d73bf4e5172eee22e80101d452ed41ff9bb3873abff75f90be4f39bd8b858adb8b46f901f1fb4e552a1f3e7a5a1f8f1c3ea04803c021d180bb9a1f04d7ff72f
7
+ data.tar.gz: a68f4ed811d8af5920c369c23a4452467a092a56aeec302e732cee594065cb439bacc0bbcd6c755fcb78b6cde81d3fd9923c0e8de7af6b09b1bbb3bc6cd93bf1
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'active_record'
4
4
  require 'active_record_simple_execute'
5
+ require 'json'
5
6
  require 'mysql2'
6
7
 
7
8
  module Uc3DmpRds
@@ -17,6 +18,10 @@ module Uc3DmpRds
17
18
  # Look up the user based on the API token. Will fail if Uc3DmpRds::Adapter does not
18
19
  # have an established connection!
19
20
  def authenticate(token:)
21
+
22
+ puts "Authenticator called"
23
+
24
+
20
25
  raise AuthenticatorError, MSG_INVALID_TOKEN if token.nil? || token.to_s.strip.empty?
21
26
 
22
27
  puts "TOKEN: #{token}"
@@ -65,7 +70,7 @@ puts sql
65
70
  puts "DB RESULTS:"
66
71
  puts user
67
72
 
68
- return {} if user.nil? || user['mbox'].nil?
73
+ return {} if user.nil? || user['email'].nil?
69
74
 
70
75
  hash = {
71
76
  name: [user['surname'], user['firstname']].join(', '),
@@ -73,7 +78,7 @@ puts user
73
78
  admin: !user['perm_name'].nil?
74
79
  }
75
80
  hash[:user_id] = { type: 'orcid', identifier: user['orcid'] } unless user['orcid'].nil?
76
- return hash.to_json if user['org_name'].nil?
81
+ return hash if user['org_name'].nil?
77
82
 
78
83
  hash[:affiliation] = { name: user.fetch('ror_name', user['org_name']) }
79
84
  hash[:affiliation][:affiliation_id] = { type: 'ror', identifier: user['ror_id'] } unless user['ror_id'].nil?
@@ -81,7 +86,7 @@ puts user
81
86
  puts "HASH:"
82
87
  puts hash
83
88
 
84
- hash
89
+ JSON.parse(hash.to_json)
85
90
  end
86
91
  end
87
92
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpRds
4
- VERSION = '0.0.15'
4
+ VERSION = '0.0.17'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-rds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley