hydra-head 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/.gitmodules +1 -0
  2. data/HISTORY.textile +6 -0
  3. data/app/assets/stylesheets/hydra/styles.css +1 -1
  4. data/app/controllers/user_sessions_controller.rb +1 -1
  5. data/app/helpers/hydra/application_helper_behavior.rb +0 -2
  6. data/app/helpers/hydra/blacklight_helper_behavior.rb +13 -16
  7. data/app/helpers/hydra/generic_content_objects_helper_behavior.rb +1 -6
  8. data/app/helpers/hydra/hydra_fedora_metadata_helper_behavior.rb +3 -1
  9. data/app/helpers/hydra/personalization_helper_behavior.rb +1 -1
  10. data/app/models/common_metadata_asset.rb +1 -1
  11. data/app/models/hydra/ability.rb +1 -1
  12. data/app/models/hydra/datastream/properties.rb +2 -2
  13. data/app/models/hydra/datastream/rights_metadata.rb +2 -2
  14. data/app/models/mods_asset.rb +3 -0
  15. data/app/models/superuser.rb +1 -1
  16. data/app/models/user_attribute.rb +2 -1
  17. data/app/models/uses_default_partials.rb +4 -3
  18. data/app/views/_user_util_links.html.erb +2 -2
  19. data/config/fedora.yml +1 -0
  20. data/config/solr.yml +1 -2
  21. data/hydra-head.gemspec +5 -4
  22. data/lib/generators/hydra/head_generator.rb +1 -1
  23. data/lib/generators/hydra/hyhead_fixtures_generator.rb +10 -10
  24. data/lib/hydra-head/engine.rb +0 -1
  25. data/lib/hydra-head/version.rb +1 -1
  26. data/lib/hydra/access_controls_enforcement.rb +1 -1
  27. data/lib/hydra/file_assets_helper.rb +3 -3
  28. data/lib/hydra/generic_content.rb +1 -1
  29. data/lib/hydra/generic_image.rb +2 -2
  30. data/lib/hydra/generic_user_attributes.rb +6 -4
  31. data/lib/hydra/model_mixins.rb +8 -3
  32. data/lib/hydra/model_mixins/rights_metadata.rb +357 -0
  33. data/lib/hydra/models/file_asset.rb +1 -1
  34. data/lib/hydra/mods_dataset.rb +5 -2
  35. data/lib/hydra/rights_metadata.rb +2 -2
  36. data/lib/hydra/superuser_attributes.rb +6 -5
  37. data/lib/mediashelf/active_fedora_helper.rb +1 -1
  38. data/lib/prev_next_links.rb +8 -3
  39. data/lib/user_attributes_loader.rb +22 -15
  40. data/lib/uva/mods_index_methods.rb +1 -1
  41. data/tasks/hydra-head.rake +4 -15
  42. data/tasks/hydra_jetty.rake +10 -1
  43. data/test_support/etc/Gemfile +13 -4
  44. data/test_support/features/support/paths.rb +5 -5
  45. data/test_support/spec/helpers/blacklight_helper_spec.rb +9 -5
  46. data/test_support/spec/helpers/generic_content_objects_helper_spec.rb +8 -0
  47. data/test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb +3 -0
  48. data/test_support/spec/helpers/hydra_helper_spec.rb +0 -1
  49. data/test_support/spec/models/generic_image_spec.rb +27 -30
  50. data/test_support/spec/models/user_spec.rb +9 -1
  51. data/test_support/spec/unit/rights_metadata_spec.rb +80 -0
  52. metadata +29 -111
  53. data/Gemfile.lock +0 -302
  54. data/test_support/etc/rvmrc +0 -32
  55. data/vendor/cache/RedCloth-4.2.9.gem +0 -0
  56. data/vendor/cache/actionmailer-3.2.3.gem +0 -0
  57. data/vendor/cache/actionpack-3.2.3.gem +0 -0
  58. data/vendor/cache/active-fedora-4.0.0.gem +0 -0
  59. data/vendor/cache/activemodel-3.2.3.gem +0 -0
  60. data/vendor/cache/activerecord-3.2.3.gem +0 -0
  61. data/vendor/cache/activeresource-3.2.3.gem +0 -0
  62. data/vendor/cache/activesupport-3.2.3.gem +0 -0
  63. data/vendor/cache/addressable-2.2.7.gem +0 -0
  64. data/vendor/cache/akami-1.0.0.gem +0 -0
  65. data/vendor/cache/arel-3.0.2.gem +0 -0
  66. data/vendor/cache/bcrypt-ruby-3.0.1.gem +0 -0
  67. data/vendor/cache/blacklight-3.3.2.gem +0 -0
  68. data/vendor/cache/block_helpers-0.3.3.gem +0 -0
  69. data/vendor/cache/builder-3.0.0.gem +0 -0
  70. data/vendor/cache/cancan-1.6.7.gem +0 -0
  71. data/vendor/cache/capybara-1.1.2.gem +0 -0
  72. data/vendor/cache/childprocess-0.3.1.gem +0 -0
  73. data/vendor/cache/chunky_png-1.2.5.gem +0 -0
  74. data/vendor/cache/compass-0.12.1.gem +0 -0
  75. data/vendor/cache/compass-rails-1.0.1.gem +0 -0
  76. data/vendor/cache/compass-susy-plugin-0.9.gem +0 -0
  77. data/vendor/cache/cucumber-1.1.9.gem +0 -0
  78. data/vendor/cache/cucumber-rails-1.3.0.gem +0 -0
  79. data/vendor/cache/daemons-1.1.8.gem +0 -0
  80. data/vendor/cache/devise-2.0.4.gem +0 -0
  81. data/vendor/cache/diff-lcs-1.1.3.gem +0 -0
  82. data/vendor/cache/equivalent-xml-0.2.9.gem +0 -0
  83. data/vendor/cache/erubis-2.7.0.gem +0 -0
  84. data/vendor/cache/factory_girl-2.6.4.gem +0 -0
  85. data/vendor/cache/fastercsv-1.5.4.gem +0 -0
  86. data/vendor/cache/ffi-1.0.11.gem +0 -0
  87. data/vendor/cache/fssm-0.2.9.gem +0 -0
  88. data/vendor/cache/gherkin-2.9.3.gem +0 -0
  89. data/vendor/cache/gyoku-0.4.4.gem +0 -0
  90. data/vendor/cache/hike-1.2.1.gem +0 -0
  91. data/vendor/cache/httpi-0.9.6.gem +0 -0
  92. data/vendor/cache/i18n-0.6.0.gem +0 -0
  93. data/vendor/cache/jettywrapper-1.2.1.gem +0 -0
  94. data/vendor/cache/journey-1.0.3.gem +0 -0
  95. data/vendor/cache/jquery-rails-2.0.2.gem +0 -0
  96. data/vendor/cache/json-1.6.6.gem +0 -0
  97. data/vendor/cache/kaminari-0.13.0.gem +0 -0
  98. data/vendor/cache/libwebsocket-0.1.3.gem +0 -0
  99. data/vendor/cache/logger-1.2.8.gem +0 -0
  100. data/vendor/cache/mail-2.4.4.gem +0 -0
  101. data/vendor/cache/marc-0.4.4.gem +0 -0
  102. data/vendor/cache/mediashelf-loggable-0.4.9.gem +0 -0
  103. data/vendor/cache/metaclass-0.0.1.gem +0 -0
  104. data/vendor/cache/mime-types-1.18.gem +0 -0
  105. data/vendor/cache/mocha-0.11.0.gem +0 -0
  106. data/vendor/cache/multi_json-1.3.2.gem +0 -0
  107. data/vendor/cache/multipart-post-1.1.2.gem +0 -0
  108. data/vendor/cache/nokogiri-1.5.2.gem +0 -0
  109. data/vendor/cache/nori-1.1.0.gem +0 -0
  110. data/vendor/cache/om-1.6.0.gem +0 -0
  111. data/vendor/cache/orm_adapter-0.0.7.gem +0 -0
  112. data/vendor/cache/polyglot-0.3.3.gem +0 -0
  113. data/vendor/cache/rack-1.4.1.gem +0 -0
  114. data/vendor/cache/rack-cache-1.2.gem +0 -0
  115. data/vendor/cache/rack-ssl-1.3.2.gem +0 -0
  116. data/vendor/cache/rack-test-0.6.1.gem +0 -0
  117. data/vendor/cache/rails-3.2.3.gem +0 -0
  118. data/vendor/cache/railties-3.2.3.gem +0 -0
  119. data/vendor/cache/rake-0.9.2.2.gem +0 -0
  120. data/vendor/cache/rdf-0.3.5.2.gem +0 -0
  121. data/vendor/cache/rdf-rdfxml-0.3.5.gem +0 -0
  122. data/vendor/cache/rdoc-3.12.gem +0 -0
  123. data/vendor/cache/rest-client-1.6.7.gem +0 -0
  124. data/vendor/cache/rsolr-1.0.8.gem +0 -0
  125. data/vendor/cache/rsolr-ext-1.0.3.gem +0 -0
  126. data/vendor/cache/rspec-2.9.0.gem +0 -0
  127. data/vendor/cache/rspec-core-2.9.0.gem +0 -0
  128. data/vendor/cache/rspec-expectations-2.9.1.gem +0 -0
  129. data/vendor/cache/rspec-mocks-2.9.0.gem +0 -0
  130. data/vendor/cache/rspec-rails-2.9.0.gem +0 -0
  131. data/vendor/cache/rubydora-0.5.8.gem +0 -0
  132. data/vendor/cache/rubyzip-0.9.7.gem +0 -0
  133. data/vendor/cache/sanitize-2.0.3.gem +0 -0
  134. data/vendor/cache/sass-3.1.16.gem +0 -0
  135. data/vendor/cache/sass-rails-3.2.5.gem +0 -0
  136. data/vendor/cache/savon-0.9.9.gem +0 -0
  137. data/vendor/cache/selenium-webdriver-2.21.2.gem +0 -0
  138. data/vendor/cache/solrizer-1.2.0.gem +0 -0
  139. data/vendor/cache/solrizer-fedora-2.0.0.gem +0 -0
  140. data/vendor/cache/sprockets-2.1.2.gem +0 -0
  141. data/vendor/cache/sqlite3-1.3.6.gem +0 -0
  142. data/vendor/cache/stomp-1.2.2.gem +0 -0
  143. data/vendor/cache/term-ansicolor-1.0.7.gem +0 -0
  144. data/vendor/cache/thor-0.14.6.gem +0 -0
  145. data/vendor/cache/tilt-1.3.3.gem +0 -0
  146. data/vendor/cache/treetop-1.4.10.gem +0 -0
  147. data/vendor/cache/tzinfo-0.3.33.gem +0 -0
  148. data/vendor/cache/unicode-0.4.2.gem +0 -0
  149. data/vendor/cache/warden-1.1.1.gem +0 -0
  150. data/vendor/cache/wasabi-2.1.0.gem +0 -0
  151. data/vendor/cache/xml-simple-1.1.1.gem +0 -0
  152. data/vendor/cache/xpath-0.1.4.gem +0 -0
  153. data/vendor/cache/yard-0.7.5.gem +0 -0
@@ -1,3 +1,4 @@
1
1
  [submodule "jetty"]
2
2
  path = jetty
3
3
  url = git://github.com/projecthydra/hydra-jetty.git
4
+ ignore = dirty
@@ -1,3 +1,9 @@
1
+ h3. 4.1.0
2
+ * Upgrade to active fedora 4.1.0
3
+ * Upgrade to solrizer-fedora 2.1.0
4
+ * Upgrade to blacklight 3.4.1
5
+ * Improved access controls api
6
+
1
7
  h3. 4.0.0
2
8
  * Upgrade to active fedora 4.0.0
3
9
  * Upgrade to blacklight 3.3.0
@@ -100,7 +100,7 @@ button.ui-button-icon-only {
100
100
  }
101
101
 
102
102
  a:link, a:visited, a:active, #uvalicense_read_all {
103
- color: blue
103
+ color: blue;
104
104
  text-decoration: underline;
105
105
  border: none;
106
106
  }
@@ -4,7 +4,7 @@ class UserSessionsController < ApplicationController
4
4
  def superuser
5
5
  if session[:superuser_mode]
6
6
  session[:superuser_mode] = nil
7
- elsif current_user.can_be_superuser?
7
+ elsif Deprecation.silence(Hydra::SuperuserAttributes) { current_user.can_be_superuser? }
8
8
  session[:superuser_mode] = true
9
9
  end
10
10
  redirect_to :back
@@ -1,7 +1,5 @@
1
- #require "hydra_helper"
2
1
  module Hydra
3
2
  module ApplicationHelperBehavior
4
- include HydraHelper
5
3
 
6
4
  def application_name
7
5
  'A Hydra Head'
@@ -1,14 +1,12 @@
1
- require "hydra_helper"
2
- require 'blacklight/blacklight_helper_behavior'
3
-
1
+ require 'deprecation'
4
2
  module Hydra
5
3
  module BlacklightHelperBehavior
4
+ extend Deprecation
6
5
  include Blacklight::BlacklightHelperBehavior
7
- include HydraHelper
6
+
7
+ self.deprecation_horizon = 'hydra-head 5.x'
8
8
 
9
9
  def get_data_with_linked_label(doc, label, field_string, opts={})
10
- ActiveSupport::Deprecation.warn("get_data_with_linked_label is deprecated and will be removed in the next release")
11
-
12
10
  (opts[:default] and !doc[field_string]) ? field = opts[:default] : field = doc[field_string]
13
11
  delim = opts[:delimiter] ? opts[:delimiter] : "<br/>"
14
12
  if doc[field_string]
@@ -24,11 +22,12 @@ module Hydra
24
22
  text
25
23
  end
26
24
  end
25
+ deprecation_deprecate :get_data_with_linked_label
27
26
 
28
27
  def linked_label(field, field_string)
29
- ActiveSupport::Deprecation.warn("linked_label is deprecated and will be removed in the next release")
30
28
  link_to(field, add_facet_params(field_string, field).merge!({"controller" => "catalog", :action=> "index"}))
31
29
  end
30
+ deprecation_deprecate :linked_label
32
31
 
33
32
  # currently only used by the render_document_partial helper method (below)
34
33
  def document_partial_name(document)
@@ -44,19 +43,17 @@ module Hydra
44
43
  end
45
44
 
46
45
  def render_complex_facet_value(facet_solr_field, item, options ={})
47
- ActiveSupport::Deprecation.warn("render_complex_facet_value is deprecated and will be removed in the next release")
48
46
  link_to_unless(options[:suppress_link], format_item_value(item.value), add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select") + " (" + format_num(item.hits) + ")"
49
47
  end
48
+ deprecation_deprecate :render_complex_facet_value
50
49
 
51
50
  def render_journal_facet_value(facet_solr_field, item, options ={})
52
- ActiveSupport::Deprecation.warn("render_journal_facet_value is deprecated and will be removed in the next release")
53
-
54
51
  val = item.value.strip.length > 12 ? item.value.strip[0..12].concat("...") : item.value.strip
55
52
  link_to_unless(options[:suppress_link], val, add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select") + " (" + format_num(item.hits) + ")"
56
53
  end
54
+ deprecation_deprecate :render_journal_facet_value
57
55
 
58
56
  def render_complex_facet_image(facet_solr_field, item, options = {})
59
- ActiveSupport::Deprecation.warn("render_complex_facet_image is deprecated and will be removed in the next release")
60
57
  computing_id = extract_computing_id(item.value)
61
58
  if File.exists?("#{Rails.root}/public/images/faculty_images/#{computing_id}.jpg")
62
59
  img = image_tag "/images/faculty_images/#{computing_id}.jpg", :width=> "100", :alt=>"#{item.value}"
@@ -65,9 +62,9 @@ module Hydra
65
62
  end
66
63
  link_to_unless(options[:suppress_link], img, add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select facet_image")
67
64
  end
65
+ deprecation_deprecate :render_complex_facet_image
68
66
 
69
67
  def render_journal_image(facet_solr_field, item, options = {})
70
- ActiveSupport::Deprecation.warn("render_journal_image is deprecated and will be removed in the next release")
71
68
  if File.exists?("#{Rails.root}/public/images/journal_images/#{item.value.strip.downcase.gsub(/\s+/,'_')}.jpg")
72
69
  img = image_tag "/images/journal_images/#{item.value.strip.downcase.gsub(/\s+/,'_')}.jpg", :width => "100"
73
70
  else
@@ -76,9 +73,9 @@ module Hydra
76
73
 
77
74
  link_to_unless(options[:suppress_link], img, add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select")
78
75
  end
76
+ deprecation_deprecate :render_journal_image
79
77
 
80
78
  def get_randomized_display_items items
81
- ActiveSupport::Deprecation.warn("get_randomized_display_items is deprecated and will be removed in the next release")
82
79
  clean_items = items.each.inject([]) do |array, item|
83
80
  array << item unless item.value.strip.blank?
84
81
  array
@@ -90,17 +87,16 @@ module Hydra
90
87
  rdi = clean_items.sort_by {rand}.slice(0..5)
91
88
  return rdi.sort_by {|item| item.value.downcase}
92
89
  end
93
-
94
90
  end
91
+ deprecation_deprecate :get_randomized_display_items
95
92
 
96
93
  def extract_computing_id val
97
- ActiveSupport::Deprecation.warn("extract_computing_id is deprecated and will be removed in the next release")
98
94
  cid = val.split(" ")[-1]
99
95
  cid[1..cid.length-2]
100
96
  end
97
+ deprecation_deprecate :extract_computing_id
101
98
 
102
99
  def format_item_value val
103
- ActiveSupport::Deprecation.warn("format_item_value is deprecated and will be removed in the next release")
104
100
  begin
105
101
  last, f_c = val.split(", ")
106
102
  first = f_c.split(" (")[0]
@@ -109,6 +105,7 @@ module Hydra
109
105
  end
110
106
  [last, "#{first[0..0]}."].join(", ")
111
107
  end
108
+ deprecation_deprecate :format_item_value
112
109
 
113
110
  # COPIED from vendor/plugins/blacklight/app/helpers/application_helper.rb
114
111
  # Used in catalog/facet action, facets.rb view, for a click
@@ -1,12 +1,7 @@
1
1
  module Hydra::GenericContentObjectsHelperBehavior
2
2
 
3
3
  def datastream_disseminator_url pid, datastream_name
4
- begin
5
- base_url = Fedora::Repository.instance.send(:connection).site.to_s
6
- rescue
7
- base_url = "http://localhost:8983/fedora"
8
- end
9
- "#{base_url}/get/#{pid}/#{datastream_name}"
4
+ ActiveFedora::Base.connection_for_pid(pid).client.url + "/get/#{pid}/#{datastream_name}"
10
5
  end
11
6
 
12
7
  def disseminator_link pid, datastream_name
@@ -44,13 +44,15 @@ module Hydra::HydraFedoraMetadataHelperBehavior
44
44
  field_values = [field_values.first]
45
45
  container_tag_type = :span
46
46
  end
47
+ required = opts.fetch(:required, true) ? "required" : ""
48
+
47
49
  body = ""
48
50
 
49
51
  field_values.each_with_index do |current_value, z|
50
52
  base_id = generate_base_id(field_name, current_value, field_values, opts)
51
53
  name = "asset[#{datastream_name}][#{field_name}][#{z}]"
52
54
  processed_field_value = Sanitize.clean( RedCloth.new(current_value, [:sanitize_html]).to_html, Sanitize::Config::BASIC)
53
- body << "<textarea class=\"editable-edit edit\" id=\"#{base_id}\" data-datastream-name=\"#{datastream_name}\" name=\"#{name}\" rows=\"10\" cols=\"25\">#{h(current_value.strip)}</textarea>"
55
+ body << "<textarea class=\"editable-edit edit\" id=\"#{base_id}\" data-datastream-name=\"#{datastream_name}\" name=\"#{name}\" #{required} rows=\"10\" cols=\"25\">#{h(current_value.strip)}</textarea>"
54
56
  body << "<a href=\"\" title=\"Delete '#{h(current_value)}'\" class=\"destructive field\">Delete</a>" unless z == 0
55
57
  end
56
58
 
@@ -35,7 +35,7 @@ module Hydra::PersonalizationHelperBehavior
35
35
 
36
36
  # Retrieves an attribute from the user
37
37
  # @param [string] login the login of the user
38
- # @param [string] the name of the attribute: out of the box values are first_name, last_name, full_name, affiliation, and photo
38
+ # @param [string] attribute the name of the attribute: out of the box values are first_name, last_name, full_name, affiliation, and photo
39
39
  def get_user_attribute login, attribute
40
40
  user = User.find_by_login(login)
41
41
  user.nil? ? "" : user.send(attribute.to_sym)
@@ -3,7 +3,7 @@
3
3
  class CommonMetadataAsset < ActiveFedora::Base
4
4
 
5
5
  def initialize
6
- ActiveSupport::Deprecation.warn("CommonMetadataAsset is deprecated and will be removed in release 5 or 6; this exemplar code has been moved into wiki documentation here: https://github.com/projecthydra/hydra-head/wiki/Models---Some-Examples")
6
+ ActiveSupport::Deprecation.warn("CommonMetadataAsset is deprecated and will be removed from HydraHead in release 5 or 6; this exemplar code has been moved into wiki documentation here: https://github.com/projecthydra/hydra-head/wiki/Models---Some-Examples")
7
7
  super
8
8
  end
9
9
 
@@ -24,7 +24,7 @@ module Hydra::Ability
24
24
 
25
25
  def hydra_default_permissions(user, session)
26
26
  logger.debug("Usergroups are " + user_groups(user, session).inspect)
27
- if user.is_being_superuser?(session)
27
+ if Deprecation.silence(Hydra::SuperuserAttributes) { user.is_being_superuser?(session) }
28
28
  can :manage, :all
29
29
  else
30
30
  edit_permissions(user, session)
@@ -7,9 +7,9 @@ module Hydra::Datastream
7
7
  # This is where we put the user id of the object depositor -- impacts permissions/access controls
8
8
  t.depositor :xmlns => '', :namespace_prefix => nil
9
9
 
10
- # @deprecated: Collection should be tracked in RELS-EXT RDF. collection term will be removed no later than release 6.x
10
+ # @deprecated Collection should be tracked in RELS-EXT RDF. collection term will be removed no later than release 6.x
11
11
  t.collection :xmlns => '', :namespace_prefix => nil
12
- # @deprecated: Title should be tracked in descMetadata. title term will be removed no later than release 6.x
12
+ # @deprecated Title should be tracked in descMetadata. title term will be removed no later than release 6.x
13
13
  t.title :xmlns => '', :namespace_prefix => nil
14
14
  end
15
15
 
@@ -122,14 +122,14 @@ module Hydra
122
122
  end
123
123
 
124
124
  # Updates permissions for all of the persons and groups in a hash
125
- # @param ex. {"group"=>{"group1"=>"discover","group2"=>"edit"}, "person"=>{"person1"=>"read","person2"=>"discover"}}
125
+ # @param params ex. {"group"=>{"group1"=>"discover","group2"=>"edit"}, "person"=>{"person1"=>"read","person2"=>"discover"}}
126
126
  # Currently restricts actor type to group or person. Any others will be ignored
127
127
  def update_permissions(params)
128
128
  params.fetch("group", {}).each_pair {|group_id, access_level| self.permissions({"group"=>group_id}, access_level)}
129
129
  params.fetch("person", {}).each_pair {|group_id, access_level| self.permissions({"person"=>group_id}, access_level)}
130
130
  end
131
131
 
132
- # @param [Symbol] symbol (either :group or :person)
132
+ # @param [Symbol] type (either :group or :person)
133
133
  # @return
134
134
  # This method limits the response to known access levels. Probably runs a bit faster than .permissions().
135
135
  def quick_search_by_type(type)
@@ -5,6 +5,9 @@ class ModsAsset < ActiveFedora::Base
5
5
  # basically, it is another expression of
6
6
  # has_metadata :name => "rightsMetadata", :type => Hydra::Datastream::RightsMetadata
7
7
  include Hydra::ModelMixins::CommonMetadata
8
+
9
+ ## Convenience methods for manipulating the rights metadata datastream
10
+ include Hydra::ModelMixins::RightsMetadata
8
11
 
9
12
  # declares a descMetadata datastream with type Hydra::Datastream::ModsArticle
10
13
  # basically, it is another expression of
@@ -5,7 +5,7 @@ class Superuser < ActiveRecord::Base
5
5
  belongs_to :user
6
6
 
7
7
  def initialize
8
- ActiveSupport::Deprecation.warn("Superuser is deprecated and will be removed in release 5 or 6; we are moving away from this approach.")
8
+ ActiveSupport::Deprecation.warn("Superuser is deprecated and will be removed from HydraHead in release 5 or 6; we are moving away from this approach.")
9
9
  super
10
10
  end
11
11
 
@@ -3,7 +3,7 @@ class UserAttribute < ActiveRecord::Base
3
3
  belongs_to :user
4
4
 
5
5
  def initialize
6
- ActiveSupport::Deprecation.warn("UserAttribute is deprecated and will be removed in release 5 or 6; this behavior should be implemented at the app level.")
6
+ ActiveSupport::Deprecation.warn("UserAttribute is deprecated and will be removed from HydraHead in release 5 or 6; this behavior should be implemented at the app level.")
7
7
  super
8
8
  end
9
9
 
@@ -12,6 +12,7 @@ class UserAttribute < ActiveRecord::Base
12
12
  # @param [sting] login the login of the user
13
13
  # @return the user attribute object or nil
14
14
  def self.find_by_login(login)
15
+ ActiveSupport::Deprecation.warn("UserAttribute.find_by_login is deprecated and will be removed from HydraHead in release 5 or 6; this behavior should be implemented at the app level.")
15
16
  user = User.find_by_login(login)
16
17
  if user
17
18
  UserAttribute.find_by_user_id(user.id)
@@ -12,9 +12,10 @@ class UsesDefaultPartials < ActiveFedora::Base
12
12
 
13
13
  has_metadata :name => "descMetadata", :type => Hydra::Datastream::ModsGenericContent
14
14
 
15
- # Uses the Hydra Rights Metadata Schema for tracking access permissions & copyright
16
- # FIXME: should this have "include Hydra::ModelMixins::CommonMetadata" instead?
17
- has_metadata :name => "rightsMetadata", :type => Hydra::Datastream::RightsMetadata
15
+ # declares a rightsMetadata datastream with type Hydra::Datastream::RightsMetadata
16
+ # basically, it is another expression of
17
+ # has_metadata :name => "rightsMetadata", :type => Hydra::Datastream::RightsMetadata
18
+ include Hydra::ModelMixins::CommonMetadata
18
19
 
19
20
  # adds helpful methods for basic hydra objects.
20
21
  include Hydra::ModelMethods
@@ -2,8 +2,8 @@
2
2
 
3
3
  <%= render :partial=>"/add_assets_links" %>
4
4
 
5
- <% if current_user.can_be_superuser? %>
6
- <% if current_user.is_being_superuser?(session) %>
5
+ <% if Deprecation.silence(Hydra::SuperuserAttributes) { current_user.can_be_superuser? } %>
6
+ <% if Deprecation.silence(Hydra::SuperuserAttributes) { current_user.is_being_superuser?(session) } %>
7
7
  <%= link_to "Stop being superuser", superuser_path %>
8
8
  <% else %>
9
9
  <%= link_to "Become superuser", superuser_path %>
@@ -1,3 +1,4 @@
1
+ # For given rails environment, what is the fedora url, admin user and password?
1
2
  development:
2
3
  user: fedoraAdmin
3
4
  password: fedoraAdmin
@@ -1,5 +1,4 @@
1
- # This is a sample config file that does not have multiple solr instances. You will also need to be sure to
2
- # edit the fedora.yml file to match the solr URL for active-fedora.
1
+ # For given rails environment, what is the Solr url?
3
2
  development:
4
3
  url: http://localhost:8983/solr/development
5
4
  test: &TEST
@@ -12,14 +12,15 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{Hydra-Head Rails Engine (requires Rails3) }
13
13
  s.description = %q{Hydra-Head is a Rails Engine containing the core code for a Hydra application. The full hydra stack includes: Blacklight, Fedora, Solr, active-fedora, solrizer, and om}
14
14
 
15
- s.add_dependency "rails", '3.2.3'
16
- s.add_dependency "blacklight", '~>3.3.2'
15
+ s.add_dependency "rails", '~>3.2.3'
16
+ s.add_dependency "blacklight", '~>3.4.2'
17
17
  s.add_dependency "devise"
18
- s.add_dependency "active-fedora", '~>4.0.0'
18
+ s.add_dependency "active-fedora", '~>4.1'
19
19
  s.add_dependency 'RedCloth', '=4.2.9'
20
20
  s.add_dependency 'block_helpers'
21
21
  s.add_dependency 'sanitize'
22
22
  s.add_dependency 'cancan'
23
+ s.add_dependency 'deprecation'
23
24
  s.add_dependency 'jquery-rails'
24
25
 
25
26
  s.add_development_dependency 'sqlite3'
@@ -29,7 +30,7 @@ Gem::Specification.new do |s|
29
30
  s.add_development_dependency 'mocha'
30
31
  s.add_development_dependency 'cucumber-rails', '>=1.2.0'
31
32
  s.add_development_dependency 'factory_girl', "~> 2.6.0"
32
- s.add_development_dependency 'solrizer-fedora', '>=2.0.0'
33
+ s.add_development_dependency 'solrizer-fedora', '>=2.1.0'
33
34
 
34
35
 
35
36
  s.files = `git ls-files`.split("\n")
@@ -100,7 +100,7 @@ EOF
100
100
  "\n include Hydra::User\n"
101
101
  end
102
102
  else
103
- puts " \e[31mFailure\e[0m Hydra requires a user object in order to apply access controls. This generators assumes that the model is defined in the file /app/models/user.rb, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails -g hydra:head client"
103
+ puts " \e[31mFailure\e[0m Hydra requires a user object in order to apply access controls. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails -g hydra:head client"
104
104
  end
105
105
  end
106
106
 
@@ -1,27 +1,27 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'rails/generators'
3
- require 'rails/generators/migration'
3
+ require 'rails/generators/migration'
4
4
 
5
5
  module Hydra
6
6
  class HyheadFixturesGenerator < Rails::Generators::Base
7
-
7
+
8
8
  source_root File.expand_path('../../../../', __FILE__)
9
-
9
+
10
10
  desc """
11
11
  This Generator copies the hydra-head sample/test objects into your application's test_support/fixtures directory
12
- These objects are useful for getting a sense of how hydra works, but you will want to delete them and create your own
12
+ These objects are useful for getting a sense of how hydra works, but you will want to delete them and create your own
13
13
  fixtures to run your application's tests against.
14
-
14
+
15
15
  After running this generator, you can import your fixtures into fedora & solr by running
16
-
16
+
17
17
  rake hydra:fixtures:refresh
18
18
  rake hydra:fixtures:refresh RAILS_ENV=test
19
-
19
+
20
20
  """
21
-
21
+
22
22
  def copy_hyhead_fixtures
23
- directory("test_support/fixtures", "test_support/fixtures")
23
+ directory("test_support/fixtures", "spec/fixtures")
24
24
  end
25
-
25
+
26
26
  end
27
27
  end
@@ -1,7 +1,6 @@
1
1
  require "hydra-head"
2
2
  require "rails"
3
3
  require 'action_controller'
4
- require 'application_helper'
5
4
  module HydraHead
6
5
 
7
6
  class Engine < Rails::Engine
@@ -1,4 +1,4 @@
1
1
  module HydraHead
2
- VERSION = "4.0.1"
2
+ VERSION = "4.0.2"
3
3
  end
4
4
 
@@ -198,7 +198,7 @@ module Hydra::AccessControlsEnforcement
198
198
  permission_types.each do |type|
199
199
  user_access_filters << "#{type}_access_person_t:#{user_key}"
200
200
  end
201
- if current_user.is_being_superuser?(session)
201
+ if Deprecation.silence(Hydra::SuperuserAttributes) { current_user.is_being_superuser?(session) }
202
202
  permission_types.each do |type|
203
203
  user_access_filters << "#{type}_access_person_t:[* TO *]"
204
204
  end
@@ -22,9 +22,9 @@ module Hydra::FileAssetsHelper
22
22
  # Puts the contents of params[:Filedata] (posted blob) into a datastream within the given @asset
23
23
  # Sets asset label and title to filename if they're empty
24
24
  #
25
- # @param [FileAsset] the File Asset to add the blob to
26
- # @return [FileAsset] the File Asset
27
- def add_posted_blob_to_asset(asset,file)
25
+ # @param [FileAsset] asset the File Asset to add the blob to
26
+ # @return [FileAsset] file the File Asset
27
+ def add_posted_blob_to_asset(asset, file)
28
28
  #file_name = filename_from_params
29
29
  file_name = file.original_filename
30
30
  options = {:label=>file_name, :mimeType=>mime_type(file_name)}
@@ -79,7 +79,7 @@ module Hydra::GenericContent
79
79
 
80
80
  # Returns a human readable filesize appropriate for the given number of bytes (ie. automatically chooses 'bytes','KB','MB','GB','TB')
81
81
  # Based on a bit of python code posted here: http://blogmag.net/blog/read/38/Print_human_readable_file_size
82
- # @param [Numeric] file size in bits
82
+ # @param [Numeric] num file size in bits
83
83
  def bits_to_human_readable(num)
84
84
  ['bytes','KB','MB','GB','TB'].each do |x|
85
85
  if num < 1024.0
@@ -92,11 +92,11 @@ module Hydra::GenericImage
92
92
  end
93
93
 
94
94
  def admin_site
95
- @admin_site ||= Fedora::Repository.instance.send(:connection).site.to_s.gsub(/fedora$/,"")
95
+ @admin_site ||= ActiveFedora::Base.connection_for_pid(pid).client.url.gsub(/[^\/]+$/,"")
96
96
  end
97
97
 
98
98
  def datastream_url ds_name="content"
99
- "#{admin_site}fedora/objects/#{pid}/datastreams/#{ds_name}/content"
99
+ ActiveFedora::Base.connection_for_pid(pid).client.url + "/objects/#{pid}/datastreams/#{ds_name}/content"
100
100
  end
101
101
 
102
102
  end