darlingtonia 3.0.4 → 3.0.5

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: b417d442d5f092672b0843b6e4f724a6fed90c0913a8470976edb5b17c367b25
4
- data.tar.gz: b6240dd8d7c293f128f8905bd2dcd1e664ef90d0b81b892ee3a3e30a3d67b9bc
3
+ metadata.gz: 6be5042f9ac88ade67585052eae9cc2dfa30855be0356bbee2f2895150c5d9a5
4
+ data.tar.gz: 0466ed8a2f5fd289c591ca230f987d294b3710cac3becc4a0a3194c6c73ea31f
5
5
  SHA512:
6
- metadata.gz: 39cb14bd001b7359b69284a45fbe8642a0e4a797a67ecccd66bc3e1722576eb63994e8efa16cfad8257c6e1fdbcb94a5141d1224b6ac05b2a360ca897ed88a8f
7
- data.tar.gz: 4b99fc45b3434de8fbf398a8397c689ce49617bb081f2047dc4f483cbcc8fdd2922f26d356b81c54debc4943c084ffd52d75805e6cf6570cd04db465c7a3d2cf
6
+ metadata.gz: 18b96a5efae6c3f30c5965c88cd35e974db44e1abd155ab01fb19cdd1b53719d24c6ed4e0e29b45c4744f7534bd18fe18a7c674d4e9d1bc2cb92f07e7a200233
7
+ data.tar.gz: 7a3a556e44d1ca0552b84f3db46abe19ec35260c2c6ddfbd0fe370341748e927e1345162bac1e5aba939a9b78343d8a4b1b85d0b2929991729d36ba07e0d6553
@@ -1,3 +1,8 @@
1
+ 3.0.5 - Tue Feb 26, 2019
2
+
3
+ When setting the depositor, query for user with `find_by_user_key`, which is the Hyrax convention.
4
+ If user_key isn't found, fall back to querying by User.id for backward compatibility.
5
+
1
6
  3.0.4 - Fri Feb 22, 2019
2
7
 
3
8
  * Allow subclassed libraries not to have a files field
@@ -48,8 +48,9 @@ module Darlingtonia
48
48
  # "depositor" is a required field for Hyrax. If
49
49
  # it hasn't been set, set it to the Hyrax default
50
50
  # batch user.
51
- def set_depositor(user_id)
52
- user = User.find(user_id) if user_id
51
+ def set_depositor(user_key)
52
+ user = ::User.find_by_user_key(user_key) if user_key
53
+ user ||= ::User.find(user_key) if user_key
53
54
  user ||= ::User.find_or_create_system_user(DEFAULT_CREATOR_KEY)
54
55
  self.depositor = user
55
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Darlingtonia
4
- VERSION = '3.0.4'
4
+ VERSION = '3.0.5'
5
5
  end
@@ -128,7 +128,7 @@ describe Darlingtonia::HyraxRecordImporter, :clean do
128
128
  end
129
129
 
130
130
  context 'when depositor is passed to initializer' do
131
- subject(:importer) { described_class.new(error_stream: error_stream, info_stream: info_stream, attributes: { depositor_id: user.id }) }
131
+ subject(:importer) { described_class.new(error_stream: error_stream, info_stream: info_stream, attributes: { depositor_id: user.user_key }) }
132
132
 
133
133
  let(:user) { ::User.new(id: '123', user_key: 'special_user@example.com') }
134
134
  before { allow(::User).to receive(:find).and_return(user) }
@@ -19,6 +19,10 @@ shared_context 'with a work type' do
19
19
  self.user_key = inputs[:user_key] || batch_user_key
20
20
  end
21
21
 
22
+ def self.find_by_user_key(email)
23
+ User.new(user_key: email)
24
+ end
25
+
22
26
  def self.find_or_create_system_user(_email)
23
27
  User.new
24
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darlingtonia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Data Curation Experts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-22 00:00:00.000000000 Z
11
+ date: 2019-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora