uc3-dmp-rds 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-rds/authenticator.rb +8 -3
- data/lib/uc3-dmp-rds/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12d1d6576ea3620ee8bf943382a260531b6193a39141173698fd5e70f8fccca9
|
4
|
+
data.tar.gz: '08c112afc6771fa199222358eeb09f7d45821f92775875b639fd0c2d91fc2dbe'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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['
|
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
|
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
|
data/lib/uc3-dmp-rds/version.rb
CHANGED