bpluser 0.1.19 → 0.2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +33 -0
  3. data/Rakefile +34 -3
  4. data/app/assets/config/bpluser_manifest.js +1 -0
  5. data/app/assets/javascripts/bpluser/folder_tools.js +26 -0
  6. data/app/controllers/bookmarks_controller.rb +50 -0
  7. data/app/controllers/concerns/bpluser/folders_verify_user.rb +20 -0
  8. data/app/controllers/concerns/bpluser/omniauth_callbacks.rb +27 -0
  9. data/app/controllers/concerns/bpluser/registrations.rb +35 -0
  10. data/app/controllers/concerns/bpluser/saved_searches.rb +62 -0
  11. data/app/controllers/folder_items_actions_controller.rb +77 -0
  12. data/app/controllers/folder_items_controller.rb +97 -0
  13. data/app/controllers/folders_controller.rb +100 -0
  14. data/app/controllers/saved_searches_controller.rb +5 -0
  15. data/app/controllers/users/omniauth_callbacks_controller.rb +7 -0
  16. data/app/controllers/users/registrations_controller.rb +7 -0
  17. data/app/controllers/users/sessions_controller.rb +6 -0
  18. data/app/controllers/users_controller.rb +25 -0
  19. data/app/helpers/bpluser/folders_helper_behavior.rb +11 -0
  20. data/app/helpers/folders_helper.rb +5 -0
  21. data/app/models/bpluser/folder.rb +21 -10
  22. data/app/models/bpluser/folder_item.rb +5 -7
  23. data/app/models/concerns/bpluser/users.rb +71 -0
  24. data/app/models/concerns/bpluser/validatable.rb +34 -0
  25. data/app/views/bookmarks/index.html.erb +58 -0
  26. data/app/views/bookmarks/update.js.erb +1 -0
  27. data/app/views/bpluser/folders/_folder.html.erb +36 -0
  28. data/app/views/catalog/_constraints.html.erb +14 -0
  29. data/app/views/catalog/_folder_item_control.html.erb +52 -0
  30. data/app/views/catalog/_save_search.html.erb +8 -0
  31. data/app/views/devise/confirmations/new.html.erb +14 -0
  32. data/app/views/devise/mailer/reset_password_instructions.html.erb +13 -0
  33. data/app/views/devise/passwords/edit.html.erb +32 -0
  34. data/app/views/devise/passwords/new.html.erb +30 -0
  35. data/app/views/devise/registrations/edit.html.erb +82 -0
  36. data/app/views/devise/registrations/new.html.erb +45 -0
  37. data/app/views/devise/sessions/new.html.erb +72 -0
  38. data/app/views/devise/shared/_links.erb +29 -0
  39. data/app/views/folder_items/create.js.erb +1 -0
  40. data/app/views/folder_items/destroy.js.erb +1 -0
  41. data/app/views/folder_items/item_actions.js.erb +2 -0
  42. data/app/views/folder_items/update.js.erb +1 -0
  43. data/app/views/folders/_in_folder.html.erb +3 -0
  44. data/app/views/folders/_new_edit_form_fields.html.erb +36 -0
  45. data/app/views/folders/edit.html.erb +25 -0
  46. data/app/views/folders/index.html.erb +67 -0
  47. data/app/views/folders/new.html.erb +26 -0
  48. data/app/views/folders/public_list.html.erb +41 -0
  49. data/app/views/folders/show.html.erb +82 -0
  50. data/app/views/saved_searches/index.html.erb +55 -0
  51. data/app/views/search_history/index.html.erb +57 -0
  52. data/app/views/shared/_folder_item_actions.html.erb +54 -0
  53. data/app/views/shared/_folder_tools.html.erb +4 -0
  54. data/app/views/shared/_tools.html.erb +16 -0
  55. data/app/views/shared/_user_util_links.html.erb +42 -0
  56. data/app/views/users/show.html.erb +33 -0
  57. data/config/locales/bpluser.en.yml +129 -0
  58. data/config/routes.rb +23 -2
  59. data/lib/bpluser/controller.rb +61 -0
  60. data/lib/bpluser/devise_guests_override.rb +21 -0
  61. data/lib/bpluser/engine.rb +27 -1
  62. data/lib/bpluser/version.rb +3 -1
  63. data/lib/bpluser.rb +21 -15
  64. data/lib/generators/bpluser/controller_generator.rb +29 -0
  65. data/lib/generators/bpluser/devise_generator.rb +40 -0
  66. data/lib/generators/bpluser/install_generator.rb +62 -0
  67. data/lib/generators/bpluser/templates/config/locales/devise.en.yml +53 -0
  68. data/lib/generators/bpluser/templates/config/omniauth-polaris.yml +10 -15
  69. data/lib/generators/bpluser/templates/models/user.rb +3 -4
  70. data/lib/generators/bpluser/user_generator.rb +23 -0
  71. data/lib/tasks/bpluser_tasks.rake +27 -0
  72. metadata +132 -158
  73. data/app/controllers/bpluser/api_controller.rb +0 -8
  74. data/app/controllers/bpluser/users/omniauth_callbacks_controller.rb +0 -48
  75. data/app/controllers/bpluser/users/registrations_controller.rb +0 -35
  76. data/app/controllers/bpluser/users/sessions_controller.rb +0 -23
  77. data/app/models/bpluser/ability.rb +0 -22
  78. data/app/models/bpluser/application_record.rb +0 -5
  79. data/app/models/bpluser/concerns/users.rb +0 -190
  80. data/app/models/bpluser/concerns/validatable.rb +0 -47
  81. data/app/models/bpluser/user.rb~ +0 -213
  82. data/app/models/bpluser/user_institution.rb +0 -6
  83. data/app/models/bpluser/validatable.rb~ +0 -65
  84. data/lib/bpluser/routes.rb +0 -37
  85. data/lib/generators/bpluser/bpluser_generator.rb +0 -183
  86. data/lib/generators/bpluser/templates/config/hydra-ldap.yml +0 -33
  87. data/lib/generators/bpluser/templates/config/omniauth-facebook.yml +0 -14
  88. data/lib/generators/bpluser/templates/controllers/users/omniauth_callbacks_controller.rb +0 -3
  89. data/lib/generators/bpluser/templates/controllers/users/registrations_controller.rb +0 -3
  90. data/lib/generators/bpluser/templates/controllers/users/sessions_controller.rb +0 -3
  91. data/lib/generators/bpluser/templates/migrations/add_fields_to_user.rb +0 -22
  92. data/lib/generators/bpluser/templates/migrations/add_folder_items_to_folder.rb +0 -18
  93. data/lib/generators/bpluser/templates/migrations/add_folders_to_user.rb +0 -14
  94. data/lib/generators/bpluser/templates/migrations/create_institutions_for_users.rb +0 -16
  95. data/lib/generators/bpluser/templates/models/ability.rb +0 -4
  96. data/lib/generators/bpluser/templates/views/devise/registrations/edit.html.erb +0 -0
  97. data/lib/generators/bpluser/templates/views/devise/registrations/new.html.erb +0 -24
  98. data/lib/generators/bpluser/templates/views/devise/sessions/new.html.erb +0 -17
  99. /data/lib/generators/bpluser/templates/config/initializers/{devise.rb → devise.rb.bak} +0 -0
@@ -0,0 +1,129 @@
1
+ en:
2
+ blacklight:
3
+ bookmarks:
4
+ collection:
5
+ add:
6
+ button: 'Add to Bookmarks'
7
+ title: 'Bookmarks'
8
+ description: 'The default folder for creating a list of items.'
9
+ no_bookmarks: 'This folder does not currently have any items.'
10
+ add:
11
+ button: 'Bookmark'
12
+ success:
13
+ one: 'Item added to folder.'
14
+ other: 'Items added to folder.'
15
+ failure: 'Item could not be added.'
16
+ remove:
17
+ button: 'Remove bookmark'
18
+ success: 'Item removed from folder.'
19
+ failure: 'Item could not be removed.'
20
+ action_confirm: 'Remove this item?'
21
+ clear:
22
+ action_title: 'Remove all items'
23
+ action_confirm: 'Are you sure you want to remove all items?'
24
+ success: 'All items removed.'
25
+ failure: 'Items could not be removed. Please try again later.'
26
+ need_login: 'Please log in to create and manage folders.'
27
+ list_title: 'Your Bookmarks'
28
+ delete: 'Remove'
29
+
30
+ breadcrumb:
31
+ separator: ' > '
32
+
33
+ folders:
34
+ intro: 'Folders can be used to create, organize, and share your own personal collections of items.'
35
+ list_title: 'Folders'
36
+ no_folders: 'You do not currently have any folders.'
37
+ need_login: 'Please log in to create and view folders.'
38
+ create:
39
+ success: 'Folder created.'
40
+ error:
41
+ no_title: 'Title cannot be blank.'
42
+ no_save: 'The folder could not be created. Please try again later.'
43
+ update:
44
+ success: 'Folder updated.'
45
+ error:
46
+ no_title: 'Title cannot be blank.'
47
+ no_save: 'The folder could not be updated. Please try again later.'
48
+ delete:
49
+ delete: 'Delete folder'
50
+ success: 'Folder deleted.'
51
+ confirm: 'Are you sure you want to delete this folder?'
52
+ edit: 'Edit folder'
53
+ add_folder: 'Create a New Folder'
54
+ edit_folder: 'Edit Folder'
55
+ empty: 'This folder does not currently have any items.'
56
+ private: 'You do not have access to this folder.'
57
+ public_list:
58
+ intro: 'Lists of items created and shared by Digital Commonwealth users.'
59
+ title: 'Shared Folders'
60
+ update_items:
61
+ copy:
62
+ success: "Items copied to '%{folder_name}' folder."
63
+ failure: 'Items could not be copied. Make sure the destination folder does not already include the items. If you are still unable to copy the items, please use the Contact link to report the problem.'
64
+ remove:
65
+ success: 'Items removed.'
66
+ failure: 'Items could not be removed. Please try again later.'
67
+ no_items: 'No items selected!'
68
+ help:
69
+ add_items: 'To add items to your folder, click the "Add to Folder" button in the "Tools" section
70
+ of the item detail page.'
71
+
72
+ folder_items:
73
+ item_in_folder: 'In Folder'
74
+ add:
75
+ button: 'Add to Folder'
76
+ success: 'Item added to folder.'
77
+ failure: 'Item could not be added.'
78
+ submit: 'Add'
79
+ remove:
80
+ button: 'Remove from folder'
81
+ success: 'Item removed from folder.'
82
+ failure: 'Item could not be removed.'
83
+ clear:
84
+ action: 'Remove all items'
85
+ confirm: 'Are you sure you want to remove all items?'
86
+ success: 'All items removed.'
87
+ failure: 'Items could not be removed. Please try again later.'
88
+
89
+ header_links:
90
+ logout: 'Log Out'
91
+ login: 'Sign Up / Log In'
92
+ profile: 'Profile'
93
+ folders: 'Folders'
94
+ bookmarks: 'Folders'
95
+ saved_searches: 'Saved Searches'
96
+ search_history: 'Search History'
97
+ selected_items: 'Selected Items'
98
+
99
+ saved_searches:
100
+ add:
101
+ success: 'Successfully saved your search.'
102
+ failure: 'There was a problem saving your search.'
103
+ remove:
104
+ success: 'Search removed.'
105
+ failure: 'There was a problem removing your search.'
106
+ clear:
107
+ action_title: 'Clear All'
108
+ action_confirm: 'Clear your saved searches?'
109
+ success: 'Cleared your saved searches.'
110
+ failure: 'There was a problem clearing your searches.'
111
+ save: 'Save Search'
112
+ title: 'Saved Searches'
113
+ page_title: 'Saved Searches - %{application_name}'
114
+ intro: 'Saved searches allow you to quickly re-search for items of interest.'
115
+ need_login: 'Please log in to manage and view your saved searches.'
116
+ no_searches: "You don't have any saved searches at the moment."
117
+ list_title: 'Your saved searches'
118
+ delete: 'Delete this search.'
119
+
120
+ search_history:
121
+ intro: 'View and save your recent searches.'
122
+ no_history: 'You have no search history for this session yet.'
123
+
124
+ tools:
125
+ copy_to: 'Copy to'
126
+ remove: 'Remove'
127
+
128
+ users:
129
+ account_heading: 'My Account'
data/config/routes.rb CHANGED
@@ -1,3 +1,24 @@
1
- Bpluser::Engine.routes.draw do
2
- post 'sdf', :to => 'api#sdf', :as => 'sdf_request'
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks', registrations: 'users/registrations', sessions: 'users/sessions' }
5
+
6
+ # folders
7
+ resources :folders
8
+ get 'folders/public', to: 'folders#public_list', as: 'public_folders'
9
+ delete 'folder/:id/clear', to: 'folder_items#clear', as: 'clear_folder_items'
10
+ put 'folder/:id/item_actions', to: 'folder_items_actions#folder_item_actions', as: 'selected_folder_items_actions'
11
+
12
+ # folder items
13
+ resources :folder_items
14
+
15
+ # user account management (not login/auth)
16
+ resources :users, only: [:show]
17
+
18
+ # saved searches -- no longer provided by blacklight >= 7
19
+ get 'saved_searches', to: 'saved_searches#index', as: 'saved_searches'
20
+ put 'saved_searches/save/:id', to: 'saved_searches#save', as: 'save_search'
21
+ post 'saved_searches/forget/:id', to: 'saved_searches#forget'
22
+ delete 'saved_searches/forget/:id', to: 'saved_searches#forget', as: 'forget_search'
23
+ delete 'saved_searches/clear', to: 'saved_searches#clear', as: 'clear_saved_searches'
3
24
  end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Filters added to this controller apply to all controllers in local app
4
+ # this module is mixed-in to local app's ApplicationController on installation.
5
+ module Bpluser
6
+ module Controller
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ include InstanceMethods
11
+ after_action :store_location
12
+ end
13
+
14
+ module InstanceMethods
15
+ EXCLUDE_PATHS = %w[
16
+ /users/auth
17
+ /users/sign_in
18
+ /users/sign_up
19
+ /users/password
20
+ /users/password/new
21
+ /users/password/edit
22
+ /users/confirmation
23
+ /users/sign_out
24
+ ].freeze
25
+ # redirect after login to previous non-login page
26
+ # TODO figure out why it doesn't work for Polaris
27
+ def store_location
28
+ # Don't store if ajax call or fullpath doesn't include segments in EXCLUDE_PATHS const
29
+ return if !request.get? || request.xhr? || EXCLUDE_PATHS.any? { |exclude_path| request.fullpath.include?(exclude_path) }
30
+
31
+ store_location_for(:user, request.fullpath)
32
+ end
33
+
34
+ def after_sign_in_path_for(resource_or_scope)
35
+ stored_location_for(resource_or_scope) || root_path
36
+ end
37
+
38
+ private
39
+
40
+ ##
41
+ # adds behavior to Blacklight::Controller#transfer_guest_user_actions_to_current_user
42
+ # so folders are transferred in addition to searches and bookmarks
43
+ def transfer_guest_user_actions_to_current_user
44
+ return unless respond_to?(:current_user) && respond_to?(:guest_user) && current_user && guest_user
45
+
46
+ guest_user.folders.with_folder_items.find_each do |folder|
47
+ target_folder = current_user.folders.where(title: folder.title).first
48
+ target_folder ||= current_user.folders.create!(title: folder.title, description: folder.description, visibility: folder.visibility)
49
+
50
+ folder.folder_items.find_each do |item_to_add|
51
+ next if target_folder.folder_item?(item_to_add.document_id)
52
+
53
+ target_folder.folder_items.create!(document_id: item_to_add.document_id)
54
+ end
55
+ end
56
+
57
+ super
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bpluser
4
+ module DeviseGuestsOverride
5
+ # DEPRECATED changing devise to use email keys instead of uid authentication keys makes this no longer needed
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ include InstanceMethods
10
+ end
11
+
12
+ module InstanceMethods
13
+ private
14
+
15
+ def guest_uid_authentication_key(key)
16
+ key &&= nil unless key.to_s.match?(/^guest/)
17
+ key || "guest_#{guest_user_unique_suffix}@example.com"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,6 +1,32 @@
1
- require 'devise'
1
+ # frozen_string_literal: true
2
+
2
3
  module Bpluser
3
4
  class Engine < ::Rails::Engine
4
5
  isolate_namespace Bpluser
6
+
7
+ config.generators do |g|
8
+ g.orm :active_record
9
+ g.test_framework :rspec, fixture: true
10
+ g.fixture_replacement :factory_bot
11
+ g.factory_bot dir: 'spec/factories'
12
+ end
13
+
14
+ if Rails.env.development? || Rails.env.test?
15
+ begin
16
+ require 'factory_bot_rails'
17
+ config.factory_bot.definition_file_paths << File.expand_path('../../spec/factories/bpluser', __dir__)
18
+ rescue LoadError
19
+ warn 'Factory Bot Rails Not installed!'
20
+ end
21
+ end
22
+
23
+ # initializer 'bpluser.add_devise_guests_overrides', before: 'devise_guests.add_helpers' do
24
+ # DeviseGuests::Controllers::Helpers.include(Bpluser::DeviseGuestsOverride)
25
+ # end
26
+
27
+ # as of sprockets >= 4 have to explicitly declare each file
28
+ initializer 'bpluser.assets.precompile' do |app|
29
+ app.config.assets.precompile << 'bpluser_manifest.js'
30
+ end
5
31
  end
6
32
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bpluser
2
- VERSION = "0.1.19".freeze
4
+ VERSION = '0.2.0.1'
3
5
  end
data/lib/bpluser.rb CHANGED
@@ -1,19 +1,25 @@
1
- begin
2
- require 'base64'
3
- require 'cgi'
4
- require 'openssl'
5
- require 'rest_client'
6
- require 'active_support/concern' unless defined? ActiveSupport::Concern
7
- require 'active_fedora' unless defined? ActiveFedora
8
- require 'hydra-ldap' unless defined? Hydra::LDAP
9
- rescue LoadError => e
10
- raise "One more more depndencies have not been installed please install the gem referred to in this error #{e.message}"
11
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+ require 'cgi'
5
+ require 'active_support'
6
+ require 'active_support/concern'
7
+ require 'blacklight'
8
+ require 'devise'
9
+ require 'devise-guests'
10
+ require 'omniauth'
11
+ require 'omniauth-polaris'
12
+ require 'omniauth/rails_csrf_protection'
13
+ require 'openssl'
14
+ require 'rsolr'
15
+
16
+ require 'bpluser/version'
17
+ require 'bpluser/controller'
18
+ require 'bpluser/devise_guests_override'
12
19
  require 'bpluser/engine'
13
- module Bpluser
14
- autoload :Routes, 'bpluser/routes'
15
20
 
16
- def self.add_routes(router, options = {})
17
- Bpluser::Routes.new(router, options).draw
21
+ module Bpluser
22
+ def self.root
23
+ Bpluser::Engine.root
18
24
  end
19
25
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+
5
+ module Bpluser
6
+ class ControllerGenerator < Rails::Generators::Base
7
+ source_root File.expand_path('templates', __dir__)
8
+
9
+ def inject_application_controller_behavior
10
+ target_file = 'app/controllers/application_controller.rb'
11
+ return unless File.read(target_file).include?('Bpluser::Controller')
12
+
13
+ marker = 'include Blacklight::Controller'
14
+ insert_into_file target_file, after: marker do
15
+ "\ninclude Bpluser::Controller"
16
+ end
17
+ end
18
+
19
+ def add_folders_show_tool
20
+ target_file = 'app/controllers/catalog_controller.rb'
21
+ return unless File.read(target_file).include?('folder_item_control')
22
+
23
+ marker = 'configure_blacklight do |config|'
24
+ insert_into_file target_file, after: marker do
25
+ "\nconfig.add_show_tools_partial :folder_items, partial: 'folder_item_control'"
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+
5
+ module Bpluser
6
+ class DeviseGenerator < Rails::Generators::Base
7
+ source_root File.expand_path('templates', __dir__)
8
+
9
+ desc 'DeviseGenerator Bpluser'
10
+
11
+ argument :devise_initializer, type: :string, default: 'config/initializers/devise.rb'
12
+
13
+ def keys
14
+ gsub_file(devise_initializer, /^[\s#]*config.authentication_keys[^\n]*/,
15
+ ' config.authentication_keys = [:email]')
16
+ gsub_file(devise_initializer, /^[\s#]*config.case_insensitive_keys[^\n]*/,
17
+ ' config.case_insensitive_keys = [:email]')
18
+ gsub_file(devise_initializer, /^[\s#]*config.strip_whitespace_keys[^\n]*/,
19
+ ' config.strip_whitespace_keys = [:email]')
20
+ end
21
+
22
+ def sign_out
23
+ gsub_file(devise_initializer, /^[\s#]*config.sign_out_via[^\n]*/,
24
+ ' config.sign_out_via = :get')
25
+ end
26
+
27
+ def omniauth
28
+ return if File.read(devise_initializer).include?('config.omniauth')
29
+
30
+ marker = '# ==> Warden configuration'
31
+ insert_into_file devise_initializer, before: marker do
32
+ "config.omniauth :polaris, title: OMNIAUTH_POLARIS_GLOBAL['title']," \
33
+ "\n http_uri: OMNIAUTH_POLARIS_GLOBAL['http_uri']," \
34
+ "\n access_key: OMNIAUTH_POLARIS_GLOBAL['access_key']," \
35
+ "\n access_id: OMNIAUTH_POLARIS_GLOBAL['access_id']," \
36
+ "\n method: OMNIAUTH_POLARIS_GLOBAL['method']\n\n"
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+
5
+ module Bpluser
6
+ class InstallGenerator < Rails::Generators::Base
7
+ source_root File.expand_path('templates', __dir__)
8
+
9
+ desc 'InstallGenerator Bpluser'
10
+
11
+ def verify_blacklight_installed
12
+ return if File.read('app/controllers/application_controller.rb').include?('include Blacklight::Controller')
13
+
14
+ say_status('info', 'BLACKLIGHT NOT INSTALLED; GENERATING BLACKLIGHT', :blue)
15
+ generate 'blacklight:install --devise'
16
+ end
17
+
18
+ def verify_devise_installed
19
+ user_model = 'app/models/user.rb'
20
+ return if !File.file?(user_model) || File.read(user_model).include?('devise')
21
+
22
+ generate 'blacklight:user --devise'
23
+ end
24
+
25
+ def copy_yml_files
26
+ %w[omniauth-polaris].each do |yml|
27
+ source_dest = "config/#{yml}.yml"
28
+ copy_file source_dest, source_dest unless File.file?(source_dest)
29
+ end
30
+ end
31
+
32
+ def copy_locale
33
+ copy_file 'config/locales/devise.en.yml', 'config/locales/devise.en.yml'
34
+ end
35
+
36
+ def insert_to_user_model
37
+ generate 'bpluser:user'
38
+ end
39
+
40
+ def copy_migrations
41
+ rake 'bpluser:install:migrations'
42
+ end
43
+
44
+ def copy_update_migrations
45
+ rake 'bpluser:update:migrations'
46
+ end
47
+
48
+ def configure_devise
49
+ generate 'bpluser:devise'
50
+ end
51
+
52
+ def insert_to_controllers
53
+ generate 'bpluser:controller'
54
+ end
55
+
56
+ def bundle_install
57
+ Bundler.with_clean_env do
58
+ run 'bundle install'
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,53 @@
1
+ en:
2
+ devise:
3
+ failure:
4
+ already_authenticated: 'You are already signed in.'
5
+ unauthenticated: 'You need to sign in or sign up before continuing.'
6
+ unconfirmed: 'You have to confirm your account before continuing.'
7
+ locked: 'Your account is locked.'
8
+ invalid: 'Invalid email or password.'
9
+ invalid_token: 'Invalid authentication token.'
10
+ timeout: 'Your session expired, please sign in again to continue.'
11
+ inactive: 'Your account was not activated yet.'
12
+ sessions:
13
+ signed_in: ''
14
+ signed_out: ''
15
+ passwords:
16
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
17
+ updated: 'Your password was changed successfully. You are now signed in.'
18
+ updated_not_active: 'Your password was changed successfully.'
19
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
20
+ no_token: "You can't access this page without a password reset email. If you did use the link from a password reset email, please make sure you used the full URL provided."
21
+ confirmations:
22
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
23
+ send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
24
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
25
+ registrations:
26
+ edit: 'Edit My Account'
27
+ password:
28
+ new: 'New password'
29
+ new_confirm: 'New password confirmation'
30
+ old: 'Current password'
31
+ sign_up: "Sign up."
32
+ signed_up: 'Welcome! You can now access your bookmarks, folders, and searches using the menu at the top right.'
33
+ signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
34
+ signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
35
+ signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
36
+ updated: 'You updated your account successfully.'
37
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
38
+ destroyed: 'Your account was successfully cancelled.'
39
+ unlocks:
40
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
41
+ unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
42
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
43
+ omniauth_callbacks:
44
+ # success: 'Successfully authenticated from %{kind} account.'
45
+ success: 'You are now signed in.'
46
+ failure: 'Could not authenticate you from %{kind} because "%{reason}".'
47
+ mailer:
48
+ confirmation_instructions:
49
+ subject: 'Digital Commonwealth - Confirmation instructions'
50
+ reset_password_instructions:
51
+ subject: 'Digital Commonwealth - Reset password instructions'
52
+ unlock_instructions:
53
+ subject: 'Digital Commonwealth - Unlock Instructions'
@@ -1,20 +1,15 @@
1
- test:
1
+ default: &default
2
2
  title: BPL Polaris Login
3
- http_uri: http://blah.org/PAPIService/REST/public/v1/1000/100/1/patron/
4
- access_key: F9998888-A000-1111-C22C-CC3333BB4444
5
- access_id: API
6
- method: GET
3
+ http_uri: <%= ENV.fetch('POLARIS_URI', '') %>
4
+ access_key: <%= ENV.fetch('POLARIS_KEY', '') %>
5
+ access_id: <%= ENV.fetch('POLARIS_ID', '') %>
6
+ method: POST
7
7
 
8
8
  development:
9
- title: BPL Polaris Login
10
- http_uri: http://blah.org/PAPIService/REST/public/v1/1000/100/1/patron/
11
- access_key: F9998888-A000-1111-C22C-CC3333BB4444
12
- access_id: API
13
- method: GET
9
+ <<: *default
10
+
11
+ test:
12
+ <<: *default
14
13
 
15
14
  production:
16
- title: BPL Polaris Login
17
- http_uri: http://blah.org/PAPIService/REST/public/v1/1000/100/1/patron/
18
- access_key: F9998888-A000-1111-C22C-CC3333BB4444
19
- access_id: API
20
- method: GET
15
+ <<: *default
@@ -1,10 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class User < ApplicationRecord
2
- # Connects this user object to Hydra behaviors.
3
- include Hydra::User
4
4
  # Connects this user object to Blacklights Bookmarks.
5
5
  include Blacklight::User
6
6
  # Connects this user object to the BPL omniauth service
7
7
  include Bpluser::Concerns::User
8
- self.table_name = "users"
9
-
8
+ self.table_name = 'users'
10
9
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+
5
+ module Bpluser
6
+ class UserGenerator < Rails::Generators::Base
7
+ source_root File.expand_path('templates', __dir__)
8
+
9
+ desc 'UserGenerator Bpluser'
10
+
11
+ argument :user_model_path, type: :string, default: 'app/models/user.rb'
12
+
13
+ def insert_into_users
14
+ return if File.read(user_model_path).include?('Bpluser')
15
+
16
+ insert_into_file user_model_path, after: 'include Blacklight::User' do
17
+ "\n\n # Adds Bpluser core funtionality" \
18
+ "\n include Bpluser::Users" \
19
+ "\n self.table_name = 'users'\n"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # desc "Explaining what the task does"
2
4
  # task :bpluser do
3
5
  # # Task goes here
@@ -6,5 +8,30 @@
6
8
  # APP_ROOT = File.expand_path("../..", __FILE__)
7
9
 
8
10
  namespace :bpluser do
11
+ namespace :update do
12
+ desc 'Copy over the updated migrations needed for new version'
13
+ task migrations: :environment do
14
+ ENV['MIGRATIONS_PATH'] = 'db/update_migrate'
15
+
16
+ if Rake::Task.task_defined?('bpluser:install:migrations')
17
+ Rake::Task['bpluser:install:migrations'].invoke
18
+ else
19
+ Rake::Task['app:bpluser:install:migrations'].invoke
20
+ end
21
+ end
22
+ end
9
23
 
24
+ namespace :test_index do
25
+ desc 'Put sample data into test app solr'
26
+ task seed: :environment do
27
+ require 'yaml'
28
+ docs = YAML.safe_load(File.open(File.join(File.join(Bpluser.root,
29
+ 'spec',
30
+ 'fixtures',
31
+ 'sample_solr_documents.yml'))))
32
+ conn = Blacklight.default_index.connection
33
+ conn.add docs
34
+ conn.commit
35
+ end
36
+ end
10
37
  end