Skip to content

Commit

Permalink
Use a system user for import
Browse files Browse the repository at this point in the history
This removes the need for a hard coded user with a password, using Hyrax's
system user functionality instead. This prefigures Shibboleth support in #274.
  • Loading branch information
Tom Johnson committed Jan 26, 2018
1 parent ca51357 commit 71621a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ DATACITE_HOST='"https://mds.datacite.org"'
DATACITE_LOGIN=DATACITE.DCE
DATACITE_PASSWORD=YOUR_PASSWORD_HERE
DATACITE_PREFIX=10.24354
IMPORTER_USER='import_user@example.com'
IMPORTER_USER_PASS=password
IMPORTER_USER_KEY='importuser@example.com'
IMPORTER_FILE_PATH='spec/fixtures/'
OKCOMPUTER_LOGIN=radiohead_dev
OKCOMPUTER_PASSWORD=th0m_y0rke
Expand Down
3 changes: 1 addition & 2 deletions app/importers/importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def config
private

def default_creator
User
.first_or_create!(email: config['username'], password: config['password'])
User.find_or_create_system_user(config['user_key'])
end

def default_record_importer
Expand Down
9 changes: 3 additions & 6 deletions config/importer.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
---
development:
username: <%= ENV['IMPORTER_USER'] %>
password: <%= ENV['IMPORTER_USER_PASS'] %>
user_key: <%= ENV['IMPORTER_USER_KEY'] %>
file_path: <%= ENV['IMPORTER_FILE_PATH'] %>

test:
username: <%= ENV['IMPORTER_USER'] %>
password: <%= ENV['IMPORTER_USER_PASS'] %>
user_key: <%= ENV['IMPORTER_USER_KEY'] %>
file_path: <%= ENV['IMPORTER_FILE_PATH'] %>

production:
username: <%= ENV['IMPORTER_USER'] %>
password: <%= ENV['IMPORTER_USER_PASS'] %>
user_key: <%= ENV['IMPORTER_USER_KEY'] %>
file_path: <%= ENV['IMPORTER_FILE_PATH'] %>

0 comments on commit 71621a3

Please sign in to comment.