uc3-dmp-rds 0.0.17 → 0.0.18

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: 12d1d6576ea3620ee8bf943382a260531b6193a39141173698fd5e70f8fccca9
4
- data.tar.gz: '08c112afc6771fa199222358eeb09f7d45821f92775875b639fd0c2d91fc2dbe'
3
+ metadata.gz: ef65457155892c90bf5172d0a6bdbcf81f65a9c207f460f37100995f6895f1a6
4
+ data.tar.gz: 31d3dd6a9c5a831f3aff7c9407dadc0cc1957b19058003fa85f3638dd55b59ab
5
5
  SHA512:
6
- metadata.gz: 7d73bf4e5172eee22e80101d452ed41ff9bb3873abff75f90be4f39bd8b858adb8b46f901f1fb4e552a1f3e7a5a1f8f1c3ea04803c021d180bb9a1f04d7ff72f
7
- data.tar.gz: a68f4ed811d8af5920c369c23a4452467a092a56aeec302e732cee594065cb439bacc0bbcd6c755fcb78b6cde81d3fd9923c0e8de7af6b09b1bbb3bc6cd93bf1
6
+ metadata.gz: '0196dd990fa57ea307f7a29888f2d96863b764ab20ec0df43d61a7d6180d855b5f3b07c511f3b255e5f70cd10e9a108edc46aa4f3bb034d520112ceecf3cb969'
7
+ data.tar.gz: 630ea47371bb9a4e353423e3eca70df20302e92716e2ff0020d98b7a80d8a8957392754234176bc92e587929216ecb0a9d988bf5c1e8ada16cd175a88317a03f
@@ -18,19 +18,11 @@ module Uc3DmpRds
18
18
  # Look up the user based on the API token. Will fail if Uc3DmpRds::Adapter does not
19
19
  # have an established connection!
20
20
  def authenticate(token:)
21
-
22
- puts "Authenticator called"
23
-
24
-
25
21
  raise AuthenticatorError, MSG_INVALID_TOKEN if token.nil? || token.to_s.strip.empty?
26
22
 
27
- puts "TOKEN: #{token}"
28
-
29
23
  users = _query_user(token: token)
30
24
  raise AuthenticatorError, MSG_INVALID_TOKEN unless users.is_a?(Array) && users.any?
31
25
 
32
- puts "FOUND USER!"
33
-
34
26
  user = users.first
35
27
  raise AuthenticatorError, MSG_INACTIVE_USER unless user['active']
36
28
 
@@ -58,34 +50,23 @@ puts "FOUND USER!"
58
50
  AND i.identifier_scheme_id IN (SELECT sch.id FROM identifier_schemes sch WHERE sch.name = 'orcid')
59
51
  WHERE users.api_token = :token
60
52
  SQL
61
-
62
- puts sql
63
-
64
53
  users = ActiveRecord::Base.simple_execute(sql, token: token.to_s.strip)
65
54
  end
66
55
 
67
56
  # Convert the ActiveRecord query results into a JSON object
68
57
  def _serialize_user(user:)
69
-
70
- puts "DB RESULTS:"
71
- puts user
72
-
73
58
  return {} if user.nil? || user['email'].nil?
74
59
 
75
60
  hash = {
76
61
  name: [user['surname'], user['firstname']].join(', '),
77
62
  mbox: user['email'],
78
- admin: !user['perm_name'].nil?
63
+ admin: !user['perm'].nil?
79
64
  }
80
65
  hash[:user_id] = { type: 'orcid', identifier: user['orcid'] } unless user['orcid'].nil?
81
66
  return hash if user['org_name'].nil?
82
67
 
83
68
  hash[:affiliation] = { name: user.fetch('ror_name', user['org_name']) }
84
69
  hash[:affiliation][:affiliation_id] = { type: 'ror', identifier: user['ror_id'] } unless user['ror_id'].nil?
85
-
86
- puts "HASH:"
87
- puts hash
88
-
89
70
  JSON.parse(hash.to_json)
90
71
  end
91
72
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpRds
4
- VERSION = '0.0.17'
4
+ VERSION = '0.0.18'
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.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley