sufia 0.0.1.pre1 → 0.0.1.pre2

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.
Files changed (151) hide show
  1. data/.gitignore +1 -2
  2. data/Gemfile +2 -1
  3. data/README.md +19 -15
  4. data/Rakefile +2 -0
  5. data/app/controllers/batch_controller.rb +2 -3
  6. data/app/controllers/contact_form_controller.rb +1 -0
  7. data/app/controllers/dashboard_controller.rb +2 -2
  8. data/app/controllers/generic_files_controller.rb +24 -12
  9. data/app/controllers/mailbox_controller.rb +2 -2
  10. data/app/controllers/single_use_link_controller.rb +5 -5
  11. data/app/controllers/users_controller.rb +10 -10
  12. data/app/helpers/{application_helper.rb → sufia_helper.rb} +5 -13
  13. data/app/models/audit_job.rb +3 -4
  14. data/app/models/batch.rb +2 -0
  15. data/app/models/batch_update_job.rb +4 -6
  16. data/app/models/checksum_audit_log.rb +2 -0
  17. data/app/models/contact_form.rb +2 -0
  18. data/app/models/content_delete_event_job.rb +1 -1
  19. data/app/models/content_deposit_event_job.rb +2 -2
  20. data/app/models/content_new_version_event_job.rb +2 -2
  21. data/app/models/content_restored_version_event_job.rb +2 -2
  22. data/app/models/content_update_event_job.rb +2 -2
  23. data/app/models/datastreams/properties_datastream.rb +1 -1
  24. data/app/models/domain_term.rb +1 -0
  25. data/app/models/event_job.rb +1 -1
  26. data/app/models/generic_file.rb +5 -4
  27. data/app/models/local_authority.rb +1 -0
  28. data/app/models/local_authority_entry.rb +1 -0
  29. data/app/models/single_use_link.rb +2 -2
  30. data/app/models/user_edit_profile_event_job.rb +1 -1
  31. data/app/models/user_follow_event_job.rb +2 -2
  32. data/app/models/user_unfollow_event_job.rb +2 -2
  33. data/app/models/version_committer.rb +1 -0
  34. data/app/views/_footer.html.erb +21 -0
  35. data/app/views/_logo.html.erb +3 -0
  36. data/app/views/_masthead.html.erb +38 -0
  37. data/app/views/_user_util_links.html.erb +14 -43
  38. data/app/views/catalog/_document_list.html.erb +0 -7
  39. data/app/views/catalog/_home_text.html.erb +4 -4
  40. data/app/views/catalog/_recent_document.html.erb +5 -5
  41. data/app/views/contact_form/_directions.html.erb +4 -0
  42. data/app/views/contact_form/new.html.erb +2 -4
  43. data/app/views/dashboard/_document_list.html.erb +1 -8
  44. data/app/views/dashboard/_facets.html.erb +1 -1
  45. data/app/views/dashboard/_index_partials/_list_files.html.erb +1 -1
  46. data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +6 -6
  47. data/app/views/dashboard/_search_form.html.erb +1 -1
  48. data/app/views/dashboard/index.html.erb +26 -25
  49. data/app/views/generic_files/_media_display.html.erb +5 -5
  50. data/app/views/generic_files/_permission.html.erb +11 -11
  51. data/app/views/generic_files/edit.html.erb +10 -8
  52. data/app/views/generic_files/show.html.erb +16 -12
  53. data/app/views/layouts/error.html.erb +2 -53
  54. data/app/views/layouts/hydra-head.html.erb +2 -21
  55. data/app/views/mailbox/index.html.erb +1 -1
  56. data/app/views/static/about.html.erb +2 -65
  57. data/app/views/static/help.html.erb +1 -721
  58. data/app/views/users/_search_form.html.erb +1 -1
  59. data/app/views/users/edit.html.erb +6 -3
  60. data/config/locales/sufia.en.yml +6 -0
  61. data/config/routes.rb +1 -3
  62. data/features/browse_dashboard_files.feature +1 -1
  63. data/features/display_dashboard.feature +1 -1
  64. data/features/step_definitions/fixture_steps.rb +2 -2
  65. data/features/step_definitions/user_steps.rb +12 -8
  66. data/features/support/env.rb +9 -0
  67. data/features/support/paths.rb +21 -21
  68. data/lib/generators/sufia/sufia_generator.rb +46 -4
  69. data/lib/generators/sufia/templates/catalog_controller.rb +2 -2
  70. data/lib/generators/sufia/templates/config/redis_config.rb +20 -0
  71. data/lib/generators/sufia/templates/config/sufia.rb +29 -0
  72. data/lib/generators/sufia/templates/migrations/add_groups_to_users.rb +0 -4
  73. data/lib/sufia.rb +22 -15
  74. data/lib/sufia/active_fedora/redis.rb +49 -0
  75. data/lib/{generators/sufia/templates/config/active_record_base_redis.rb → sufia/active_record/redis.rb} +1 -16
  76. data/lib/sufia/controller.rb +1 -2
  77. data/lib/sufia/http_header_auth.rb +9 -0
  78. data/lib/sufia/role_mapper.rb +1 -0
  79. data/lib/sufia/user.rb +24 -6
  80. data/lib/sufia/version.rb +1 -1
  81. data/lib/tasks/fixtures.rake +245 -0
  82. data/spec/.gitignore +1 -0
  83. data/spec/active_fedora/unsaved_digital_object_spec.rb +2 -2
  84. data/spec/config/host_to_vhost_spec.rb +8 -8
  85. data/spec/controllers/batch_controller_spec.rb +6 -6
  86. data/spec/controllers/catalog_controller_spec.rb +2 -0
  87. data/spec/controllers/dashboard_controller_spec.rb +13 -10
  88. data/spec/controllers/downloads_controller_spec.rb +8 -8
  89. data/spec/controllers/generic_files_controller_spec.rb +46 -44
  90. data/spec/controllers/mailbox_controller_spec.rb +6 -12
  91. data/spec/controllers/sessions_controller_spec.rb +8 -6
  92. data/spec/controllers/single_use_link_controller_spec.rb +9 -14
  93. data/spec/controllers/users_controller_spec.rb +49 -49
  94. data/spec/{factories.rb → factories/users.rb} +6 -3
  95. data/spec/fixtures/scholarsphere/scholarsphere_test2.foxml.erb +2 -2
  96. data/spec/fixtures/scholarsphere/scholarsphere_test3.foxml.erb +2 -2
  97. data/spec/fixtures/scholarsphere/scholarsphere_test4.foxml.erb +2 -2
  98. data/spec/fixtures/scholarsphere/scholarsphere_test6.foxml.erb +2 -2
  99. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.descMeta.txt +12 -0
  100. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.foxml.erb +79 -0
  101. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.txt +1 -0
  102. data/spec/fixtures/scholarsphere/{scholarsphere_test1.foxml.erb → sufia_test1.foxml.erb} +6 -6
  103. data/spec/fixtures/scholarsphere/{scholarsphere_test5.foxml.erb → sufia_test5.foxml.erb} +5 -5
  104. data/spec/fixtures/scholarsphere_generic_stub.foxml.erb +5 -5
  105. data/spec/lib/{scholarsphere → sufia}/id_service_spec.rb +5 -5
  106. data/spec/lib/{scholarsphere → sufia}/role_mapper_spec.rb +5 -2
  107. data/spec/models/audit_job_spec.rb +1 -1
  108. data/spec/models/batch_spec.rb +2 -2
  109. data/spec/models/batch_update_job_spec.rb +5 -5
  110. data/spec/models/checksum_audit_log_spec.rb +1 -1
  111. data/spec/models/event_jobs_spec.rb +19 -19
  112. data/spec/models/file_content_datastream_spec.rb +6 -6
  113. data/spec/models/fits_datastream_spec.rb +1 -1
  114. data/spec/models/generic_file_spec.rb +8 -9
  115. data/spec/models/local_authority_spec.rb +3 -3
  116. data/spec/models/single_use_link_spec.rb +5 -5
  117. data/spec/models/unzip_job_spec.rb +1 -1
  118. data/spec/models/user_spec.rb +5 -26
  119. data/spec/rake/scholarsphere_fixtures_spec.rb +13 -12
  120. data/spec/routing/route_spec.rb +4 -41
  121. data/spec/spec_helper.rb +14 -4
  122. data/spec/support/Gemfile +21 -0
  123. data/spec/support/config/redis.yml +6 -0
  124. data/spec/support/lib/generators/test_app_generator.rb +40 -0
  125. data/sufia.gemspec +4 -2
  126. data/tasks/cucumber.rake +0 -6
  127. data/tasks/jetty.rake +40 -0
  128. data/tasks/scholarsphere-dev.rake +57 -17
  129. data/tasks/scholarsphere-fixtures.rake +16 -63
  130. metadata +74 -55
  131. data/.rvmrc +0 -59
  132. data/LICENSE +0 -22
  133. data/app/assets/images/site_images/logo_psuss_logotype.png +0 -0
  134. data/app/assets/images/site_images/logo_psuss_shield.png +0 -0
  135. data/lib/generators/sufia/templates/config/active_fedora_base_redis.rb +0 -54
  136. data/lib/sufia/ldap.rb +0 -123
  137. data/spec/fixtures/hydra_test_default_partials.foxml.xml +0 -80
  138. data/spec/fixtures/hydra_test_generic_content.foxml.xml +0 -138
  139. data/spec/fixtures/hydra_test_generic_image.foxml.xml +0 -395
  140. data/spec/fixtures/hydra_test_no_model.foxml.xml +0 -79
  141. data/spec/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +0 -1212
  142. data/spec/fixtures/hydrangea_fixture_file_asset1.foxml.xml +0 -4946
  143. data/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml +0 -234
  144. data/spec/fixtures/hydrangea_fixture_mods_article2.foxml.xml +0 -177
  145. data/spec/fixtures/hydrangea_fixture_mods_article3.foxml.xml +0 -170
  146. data/spec/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +0 -187
  147. data/spec/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +0 -676
  148. data/spec/fixtures/hydrus_admin_class1.foxml.xml +0 -176
  149. data/spec/fixtures/libra-oa_1.foxml.xml +0 -2324
  150. data/spec/fixtures/libra-oa_2.foxml.xml +0 -2422
  151. data/spec/fixtures/libra-oa_7.foxml.xml +0 -1735
data/.gitignore CHANGED
@@ -24,8 +24,7 @@ tmtags
24
24
  .\#*
25
25
 
26
26
  ## VIM
27
- *.swp
28
- *.swo
27
+ *.sw[pon]
29
28
 
30
29
  ## OSX
31
30
  .DS_Store
data/Gemfile CHANGED
@@ -15,7 +15,6 @@ group :development, :test do
15
15
  gem "rails_indexes", :git => "git://github.com/warpc/rails_indexes.git", :ref => '4a550270'
16
16
  gem 'selenium-webdriver'
17
17
  gem 'headless'
18
- gem 'rspec', '2.11.0'
19
18
  gem 'rspec-rails', '>= 2.11.0'
20
19
  gem 'ruby-prof'
21
20
  gem 'mocha', '0.12.4', :require => false
@@ -26,4 +25,6 @@ group :development, :test do
26
25
  gem "jettywrapper"
27
26
  gem "factory_girl_rails", "~> 4.1.0"
28
27
  gem 'launchy'
28
+
29
+ gem 'devise'
29
30
  end # (leave this comment here to catch a stray line inserted by blacklight!)
data/README.md CHANGED
@@ -1,11 +1,10 @@
1
- # Scholarsphere
1
+ # Sufia
2
2
 
3
- Run the blacklight, hydra mailboxer and scholarsphere generators
3
+ Run the blacklight, hydra and scholarsphere generators
4
4
  ```
5
5
  rails g blacklight --devise
6
- rails g hydra:head -df
7
- rails g mailboxer:install
8
- rails g scholarsphere -df
6
+ rails g hydra:head -f
7
+ rails g sufia -f
9
8
  ```
10
9
 
11
10
  Run the migrations
@@ -14,20 +13,25 @@ Run the migrations
14
13
  rake db:migrate
15
14
  ```
16
15
 
17
- Add include Scholarsphere::User into your user model
18
- Add include Scholarsphere::Controller into your application_controller.rb
19
-
20
- Add role_map_*.yml files into config?
21
-
22
-
16
+ In your Gemfile add this:
23
17
  ```
24
18
  gem 'jettywrapper'
25
19
  ```
26
- bundle install
20
+ Then run `bundle install`
27
21
 
28
22
 
29
- application.css
23
+ If you want to use the assets that ship with Sufia, add the following to application.css
24
+ ```
30
25
  *= require scholarsphere
31
-
32
- application.js
26
+ ```
27
+ and add the following to application.js
28
+ ```
33
29
  //= require scholarsphere
30
+ ```
31
+
32
+ Testing:
33
+ ```
34
+ rake scholarsphere:fixtures:create scholarsphere:fixtures:generate
35
+ rake fixtures
36
+ rake spec
37
+ ```
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env rake
2
2
 
3
3
  require "bundler/gem_tasks"
4
+ Dir.glob('tasks/*.rake').each { |r| import r }
5
+
@@ -14,7 +14,6 @@
14
14
 
15
15
  class BatchController < ApplicationController
16
16
  include Hydra::Controller::ControllerBehavior
17
- include Hydra::AssetsControllerHelper # for apply_depositor_metadata method
18
17
  include Hydra::Controller::UploadBehavior
19
18
  include Sufia::Noid # for normalize_identifier method
20
19
 
@@ -39,8 +38,8 @@ class BatchController < ApplicationController
39
38
  @batch = Batch.find_or_create(params[:id])
40
39
  @batch.status="processing"
41
40
  @batch.save
42
- Resque.enqueue(BatchUpdateJob, current_user.login, params, params[:generic_file])
41
+ Resque.enqueue(BatchUpdateJob, current_user.user_key, params, params[:generic_file])
43
42
  flash[:notice] = 'Your files are being processed by ScholarSphere in the background. The metadata and access controls you specified are being applied. Files will be marked <span class="label label-important" title="Private">Private</span> until this process is complete (shouldn\'t take too long, hang in there!). You may need to refresh your dashboard to see these updates.'
44
- redirect_to dashboard_path
43
+ redirect_to sufia.dashboard_path
45
44
  end
46
45
  end
@@ -22,6 +22,7 @@ class ContactFormController < ApplicationController
22
22
  @contact_form = ContactForm.new(params[:contact_form])
23
23
  @contact_form.request = request
24
24
  # not spam and a valid form
25
+ logger.warn "*** MARK ***"
25
26
  if @contact_form.deliver
26
27
  flash.now[:notice] = 'Thank you for your message!'
27
28
  render :new
@@ -33,8 +33,8 @@ class DashboardController < ApplicationController
33
33
  DashboardController.solr_search_params_logic << :exclude_unwanted_models
34
34
 
35
35
  def index
36
- extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => "RSS for results")
37
- extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => "Atom for results")
36
+ extra_head_content << view_context.auto_discovery_link_tag(:rss, sufia.url_for(params.merge(:format => 'rss')), :title => "RSS for results")
37
+ extra_head_content << view_context.auto_discovery_link_tag(:atom, sufia.url_for(params.merge(:format => 'atom')), :title => "Atom for results")
38
38
  (@response, @document_list) = get_search_results
39
39
  @user = current_user
40
40
  @events = @user.events(100)
@@ -22,7 +22,17 @@ class GenericFilesController < ApplicationController
22
22
  # This is needed as of BL 3.7
23
23
  self.copy_blacklight_config_from(CatalogController)
24
24
 
25
- rescue_from AbstractController::ActionNotFound, :with => :render_404
25
+ # Catch permission errors
26
+ rescue_from Hydra::AccessDenied do |exception|
27
+ if (exception.action == :edit)
28
+ redirect_to(sufia.url_for({:action=>'show'}), :alert => exception.message)
29
+ elsif current_user and current_user.persisted?
30
+ redirect_to root_url, :alert => exception.message
31
+ else
32
+ session["user_return_to"] = request.url
33
+ redirect_to new_user_session_url, :alert => exception.message
34
+ end
35
+ end
26
36
 
27
37
  # actions: audit, index, create, new, edit, show, update, destroy, permissions, citation
28
38
  before_filter :authenticate_user!, :except => [:show, :citation]
@@ -54,11 +64,11 @@ class GenericFilesController < ApplicationController
54
64
  pid = @generic_file.noid
55
65
  @generic_file.delete
56
66
  begin
57
- Resque.enqueue(ContentDeleteEventJob, pid, current_user.login)
67
+ Resque.enqueue(ContentDeleteEventJob, pid, current_user.user_key)
58
68
  rescue Redis::CannotConnectError
59
69
  logger.error "Redis is down!"
60
70
  end
61
- redirect_to dashboard_path, :notice => render_to_string(:partial=>'generic_files/asset_deleted_flash', :locals => { :generic_file => @generic_file })
71
+ redirect_to sufia.dashboard_path, :notice => render_to_string(:partial=>'generic_files/asset_deleted_flash', :locals => { :generic_file => @generic_file })
62
72
  end
63
73
 
64
74
  # routed to /files (POST)
@@ -84,7 +94,7 @@ class GenericFilesController < ApplicationController
84
94
  create_and_save_generic_file
85
95
  if @generic_file
86
96
  begin
87
- Resque.enqueue(ContentDepositEventJob, @generic_file.pid, current_user.login)
97
+ Resque.enqueue(ContentDepositEventJob, @generic_file.pid, current_user.user_key)
88
98
  rescue Redis::CannotConnectError
89
99
  logger.error "Redis is down!"
90
100
  end
@@ -144,7 +154,7 @@ class GenericFilesController < ApplicationController
144
154
  @generic_file.add_file_datastream(revision.content, :dsid => 'content')
145
155
  version_event = true
146
156
  begin
147
- Resque.enqueue(ContentRestoredVersionEventJob, @generic_file.pid, current_user.login, params[:revision])
157
+ Resque.enqueue(ContentRestoredVersionEventJob, @generic_file.pid, current_user.user_key, params[:revision])
148
158
  rescue Redis::CannotConnectError
149
159
  logger.error "Redis is down!"
150
160
  end
@@ -155,7 +165,7 @@ class GenericFilesController < ApplicationController
155
165
  add_posted_blob_to_asset(@generic_file, params[:filedata])
156
166
  version_event = true
157
167
  begin
158
- Resque.enqueue(ContentNewVersionEventJob, @generic_file.pid, current_user.login)
168
+ Resque.enqueue(ContentNewVersionEventJob, @generic_file.pid, current_user.user_key)
159
169
  rescue Redis::CannotConnectError
160
170
  logger.error "Redis is down!"
161
171
  end
@@ -166,12 +176,12 @@ class GenericFilesController < ApplicationController
166
176
  @generic_file.save
167
177
  # do not trigger an update event if a version event has already been triggered
168
178
  begin
169
- Resque.enqueue(ContentUpdateEventJob, @generic_file.pid, current_user.login) unless version_event
179
+ Resque.enqueue(ContentUpdateEventJob, @generic_file.pid, current_user.user_key) unless version_event
170
180
  rescue Redis::CannotConnectError
171
181
  logger.error "Redis is down!"
172
182
  end
173
183
  record_version_committer(@generic_file, current_user)
174
- redirect_to edit_generic_file_path(:tab => params[:redirect_tab]), :notice => render_to_string(:partial=>'generic_files/asset_updated_flash', :locals => { :generic_file => @generic_file })
184
+ redirect_to sufia.edit_generic_file_path(:tab => params[:redirect_tab]), :notice => render_to_string(:partial=>'generic_files/asset_updated_flash', :locals => { :generic_file => @generic_file })
175
185
 
176
186
  end
177
187
 
@@ -180,8 +190,8 @@ class GenericFilesController < ApplicationController
180
190
  Sufia::GenericFile::Permissions.parse_permissions(params)
181
191
  @generic_file.update_attributes(params[:generic_file].reject { |k,v| %w{ Filedata Filename revision}.include? k})
182
192
  @generic_file.save
183
- Resque.enqueue(ContentUpdateEventJob, @generic_file.pid, current_user.login)
184
- redirect_to edit_generic_file_path, :notice => render_to_string(:partial=>'generic_files/asset_updated_flash', :locals => { :generic_file => @generic_file })
193
+ Resque.enqueue(ContentUpdateEventJob, @generic_file.pid, current_user.user_key)
194
+ redirect_to sufia.edit_generic_file_path, :notice => render_to_string(:partial=>'generic_files/asset_updated_flash', :locals => { :generic_file => @generic_file })
185
195
  end
186
196
 
187
197
  protected
@@ -192,7 +202,7 @@ class GenericFilesController < ApplicationController
192
202
  VersionCommitter.create(:obj_id => version.pid,
193
203
  :datastream_id => version.dsid,
194
204
  :version_id => version.versionID,
195
- :committer_login => user.login)
205
+ :committer_login => user.user_key)
196
206
  end
197
207
 
198
208
  def find_by_id
@@ -230,6 +240,7 @@ class GenericFilesController < ApplicationController
230
240
  # file.tempfile = f
231
241
  #end
232
242
  add_posted_blob_to_asset(@generic_file,file)
243
+
233
244
  @generic_file.apply_depositor_metadata(user_key)
234
245
  @generic_file.date_uploaded = Time.now.ctime
235
246
  @generic_file.date_modified = Time.now.ctime
@@ -248,12 +259,13 @@ class GenericFilesController < ApplicationController
248
259
  @generic_file.save
249
260
  rescue RSolr::Error::Http => error
250
261
  logger.warn "GenericFilesController::create_and_save_generic_file Caught RSOLR error #{error.inspect}"
251
- save_tries++
262
+ save_tries+=1
252
263
  # fail for good if the tries is greater than 3
253
264
  rescue_action_without_handler(error) if save_tries >=3
254
265
  sleep 0.01
255
266
  retry
256
267
  end
268
+
257
269
  record_version_committer(@generic_file, current_user)
258
270
  begin
259
271
  Resque.enqueue(UnzipJob, @generic_file.pid) if file.content_type == 'application/zip'
@@ -30,7 +30,7 @@ class MailboxController < ApplicationController
30
30
  delete_message(msg)
31
31
  end
32
32
  empty_trash(current_user)
33
- redirect_to mailbox_path
33
+ redirect_to sufia.mailbox_path
34
34
  end
35
35
 
36
36
  def delete
@@ -43,7 +43,7 @@ class MailboxController < ApplicationController
43
43
  else
44
44
  flash[:alert] = "You do not have privileges to delete the notification..."
45
45
  end
46
- redirect_to mailbox_path
46
+ redirect_to sufia.mailbox_path
47
47
  end
48
48
 
49
49
  private
@@ -6,7 +6,7 @@ class SingleUseLinkController < DownloadsController
6
6
  def generate_download
7
7
  id = check_single_use_link
8
8
  @su = SingleUseLink.create_download(id)
9
- @link = Rails.application.routes.url_helpers.download_single_use_link_path(@su.downloadKey)
9
+ @link = sufia.download_single_use_link_path(@su.downloadKey)
10
10
  @generic_file = GenericFile.find(id)
11
11
  respond_to do |format|
12
12
  format.html
@@ -18,7 +18,7 @@ class SingleUseLinkController < DownloadsController
18
18
  def generate_show
19
19
  id = check_single_use_link
20
20
  @su = SingleUseLink.create_show(id)
21
- @link = Rails.application.routes.url_helpers.show_single_use_link_path(@su.downloadKey)
21
+ @link = sufia.show_single_use_link_path(@su.downloadKey)
22
22
  @generic_file = GenericFile.find(id)
23
23
  respond_to do |format|
24
24
  format.html
@@ -35,7 +35,7 @@ class SingleUseLinkController < DownloadsController
35
35
  id = link.itemId
36
36
 
37
37
  #check to make sure the path matches
38
- not_found if link.path != Rails.application.routes.url_helpers.download_path(id)
38
+ not_found if link.path != sufia.download_path(id)
39
39
 
40
40
  # send the data content
41
41
  send_content(id)
@@ -48,7 +48,7 @@ class SingleUseLinkController < DownloadsController
48
48
  id = link.itemId
49
49
 
50
50
  #check to make sure the path matches
51
- not_found if link.path != Rails.application.routes.url_helpers.generic_file_path(id)
51
+ not_found if link.path != sufia.generic_file_path(id)
52
52
 
53
53
  #show the file
54
54
  @generic_file = GenericFile.find(id)
@@ -57,7 +57,7 @@ class SingleUseLinkController < DownloadsController
57
57
 
58
58
  # create a dowload link that is single use for the user since we do not just want to show metadata we want to access it too
59
59
  @su = SingleUseLink.create_download(id)
60
- @download_link = Rails.application.routes.url_helpers.download_single_use_link_path(@su.downloadKey)
60
+ @download_link = sufia.download_single_use_link_path(@su.downloadKey)
61
61
  end
62
62
 
63
63
  protected
@@ -50,15 +50,15 @@ class UsersController < ApplicationController
50
50
  @user.populate_attributes if params[:update_directory]
51
51
  @user.avatar = nil if params[:delete_avatar]
52
52
  unless @user.save
53
- redirect_to edit_profile_path(@user.to_s), alert: @user.errors.full_messages
53
+ redirect_to sufia.edit_profile_path(@user.to_s), alert: @user.errors.full_messages
54
54
  return
55
55
  end
56
56
  begin
57
- Resque.enqueue(UserEditProfileEventJob, @user.login)
57
+ Resque.enqueue(UserEditProfileEventJob, @user.user_key)
58
58
  rescue Redis::CannotConnectError
59
59
  logger.error "Redis is down!"
60
60
  end
61
- redirect_to profile_path(@user.to_s), notice: "Your profile has been updated"
61
+ redirect_to sufia.profile_path(@user.to_s), notice: "Your profile has been updated"
62
62
  end
63
63
 
64
64
  # Follow a user
@@ -66,12 +66,12 @@ class UsersController < ApplicationController
66
66
  unless current_user.following?(@user)
67
67
  current_user.follow(@user)
68
68
  begin
69
- Resque.enqueue(UserFollowEventJob, current_user.login, @user.login)
69
+ Resque.enqueue(UserFollowEventJob, current_user.user_key, @user.user_key)
70
70
  rescue Redis::CannotConnectError
71
71
  logger.error "Redis is down!"
72
72
  end
73
73
  end
74
- redirect_to profile_path(@user.to_s), notice: "You are following #{@user.to_s}"
74
+ redirect_to sufia.profile_path(@user.to_s), notice: "You are following #{@user.to_s}"
75
75
  end
76
76
 
77
77
  # Unfollow a user
@@ -79,26 +79,26 @@ class UsersController < ApplicationController
79
79
  if current_user.following?(@user)
80
80
  current_user.stop_following(@user)
81
81
  begin
82
- Resque.enqueue(UserUnfollowEventJob, current_user.login, @user.login)
82
+ Resque.enqueue(UserUnfollowEventJob, current_user.user_key, @user.user_key)
83
83
  rescue Redis::CannotConnectError
84
84
  logger.error "Redis is down!"
85
85
  end
86
86
  end
87
- redirect_to profile_path(@user.to_s), notice: "You are no longer following #{@user.to_s}"
87
+ redirect_to sufia.profile_path(@user.to_s), notice: "You are no longer following #{@user.to_s}"
88
88
  end
89
89
 
90
90
  private
91
91
  def find_user
92
- @user = User.find_by_login(params[:uid])
92
+ @user = User.find_by_user_key(params[:uid])
93
93
  redirect_to root_path, alert: "User '#{params[:uid]}' does not exist" if @user.nil?
94
94
  end
95
95
 
96
96
  def user_is_current_user
97
- redirect_to profile_path(@user.to_s), alert: "You cannot edit #{@user.to_s}\'s profile" unless @user == current_user
97
+ redirect_to sufia.profile_path(@user.to_s), alert: "You cannot edit #{@user.to_s}\'s profile" unless @user == current_user
98
98
  end
99
99
 
100
100
  def user_not_current_user
101
- redirect_to profile_path(@user.to_s), alert: "You cannot follow or unfollow yourself" if @user == current_user
101
+ redirect_to sufia.profile_path(@user.to_s), alert: "You cannot follow or unfollow yourself" if @user == current_user
102
102
  end
103
103
 
104
104
  def get_sort
@@ -12,15 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- module ApplicationHelper
16
-
17
- def javascript(*files)
18
- content_for(:js_head) { javascript_include_tag(*files) }
19
- end
20
-
21
- def stylesheet(*files)
22
- content_for(:css_head) { stylesheet_link_tag(*files) }
23
- end
15
+ module SufiaHelper
24
16
 
25
17
  # link_back_to_dashboard(:label=>'Back to Search')
26
18
  # Create a link back to the dashboard screen, keeping the user's facet, query and paging choices intact by using session.
@@ -43,7 +35,7 @@ module ApplicationHelper
43
35
 
44
36
  def display_user_name(recent_document)
45
37
  return "no display name" unless recent_document[:depositor_t]
46
- return User.where(:login => recent_document[:depositor_t][0]).name rescue recent_document[:depositor_t][0]
38
+ return User.find_by_user_key(recent_document[:depositor_t][0]).name rescue recent_document[:depositor_t][0]
47
39
  end
48
40
 
49
41
  def get_depositor_from_document(doc)
@@ -76,10 +68,10 @@ module ApplicationHelper
76
68
  end
77
69
 
78
70
  def link_to_profile(login)
79
- user = User.find_by_login(login)
80
- link_to user.name, profile_path(login)
71
+ user = User.find_by_user_key(login)
72
+ link_to user.name, Sufia::Engine.routes.url_helpers.profile_path(login)
81
73
  rescue
82
- link_to login, profile_path(login)
74
+ link_to login, Sufia::Engine.routes.url_helpers.profile_path(login)
83
75
  end
84
76
 
85
77
  def linkify_chat_id(chat_id)
@@ -34,11 +34,10 @@ class AuditJob
34
34
  #logger.info "User login is #{login}"`
35
35
  #logger.info "All users = #{User.all}"
36
36
  if login
37
- user = User.find_by_login(login)
37
+ user = User.find_by_user_key(login)
38
+ logger.warn "User '#{login}' not found" unless user
38
39
  #logger.info "ZZZ user = #{user.inspect}"
39
- job_user = User.where(login:"audituser").first
40
- job_user = User.create(login:"audituser", email:"auditemail") unless job_user
41
-
40
+ job_user = User.audituser()
42
41
  #send the user a message about the failing audit
43
42
  unless (log.pass == 1)
44
43
  message = "The audit run at #{log.created_at} for #{log.pid}:#{log.dsid}:#{log.version} was #{log.pass == 1 ? 'passing' : 'failing'}."
@@ -12,6 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require 'datastreams/batch_rdf_datastream'
16
+
15
17
  class Batch < ActiveFedora::Base
16
18
  include Hydra::ModelMixins::CommonMetadata
17
19
  include Hydra::ModelMixins::RightsMetadata
@@ -29,14 +29,13 @@ class BatchUpdateJob
29
29
  params = HashWithIndifferentAccess.new(params)
30
30
  perms = HashWithIndifferentAccess.new(perms)
31
31
  batch = Batch.find_or_create(params[:id])
32
- user = User.find_by_login(login)
33
-
32
+ user = User.find_by_user_key(login)
34
33
  saved = []
35
34
  denied = []
36
35
 
37
36
  batch.generic_files.each do |gf|
38
37
  unless user.can? :edit, get_permissions_solr_response_for_doc_id(gf.pid)[1]
39
- logger.error "User #{user.login} DEEEENIED access to #{gf.pid}!"
38
+ logger.error "User #{user.user_key} DEEEENIED access to #{gf.pid}!"
40
39
  denied << gf
41
40
  next
42
41
  end
@@ -65,8 +64,7 @@ class BatchUpdateJob
65
64
  end
66
65
  batch.update_attributes({status:["Complete"]})
67
66
 
68
- job_user = User.where(login:"batchuser").first
69
- job_user = User.create(login:"batchuser", email:"batchmail") unless job_user
67
+ job_user = User.batchuser()
70
68
 
71
69
  message = '<a class="batchid ui-helper-hidden">ss-'+batch.noid+'</a>The file(s) '+ file_list(saved)+ " have been saved." unless saved.empty?
72
70
  job_user.send_message(user, message, 'Batch upload complete') unless saved.empty?
@@ -77,7 +75,7 @@ class BatchUpdateJob
77
75
  end
78
76
 
79
77
  def file_list ( files)
80
- return files.map {|gf| '<a href="'+generic_files_path+'/'+gf.noid+'">'+display_title(gf)+'</a>'}.join(', ')
78
+ return files.map {|gf| '<a href="'+Sufia::Engine.routes.url_helpers.generic_files_path+'/'+gf.noid+'">'+display_title(gf)+'</a>'}.join(', ')
81
79
 
82
80
  end
83
81