hydra-head 4.0.1 → 4.0.2
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.
- data/.gitmodules +1 -0
- data/HISTORY.textile +6 -0
- data/app/assets/stylesheets/hydra/styles.css +1 -1
- data/app/controllers/user_sessions_controller.rb +1 -1
- data/app/helpers/hydra/application_helper_behavior.rb +0 -2
- data/app/helpers/hydra/blacklight_helper_behavior.rb +13 -16
- data/app/helpers/hydra/generic_content_objects_helper_behavior.rb +1 -6
- data/app/helpers/hydra/hydra_fedora_metadata_helper_behavior.rb +3 -1
- data/app/helpers/hydra/personalization_helper_behavior.rb +1 -1
- data/app/models/common_metadata_asset.rb +1 -1
- data/app/models/hydra/ability.rb +1 -1
- data/app/models/hydra/datastream/properties.rb +2 -2
- data/app/models/hydra/datastream/rights_metadata.rb +2 -2
- data/app/models/mods_asset.rb +3 -0
- data/app/models/superuser.rb +1 -1
- data/app/models/user_attribute.rb +2 -1
- data/app/models/uses_default_partials.rb +4 -3
- data/app/views/_user_util_links.html.erb +2 -2
- data/config/fedora.yml +1 -0
- data/config/solr.yml +1 -2
- data/hydra-head.gemspec +5 -4
- data/lib/generators/hydra/head_generator.rb +1 -1
- data/lib/generators/hydra/hyhead_fixtures_generator.rb +10 -10
- data/lib/hydra-head/engine.rb +0 -1
- data/lib/hydra-head/version.rb +1 -1
- data/lib/hydra/access_controls_enforcement.rb +1 -1
- data/lib/hydra/file_assets_helper.rb +3 -3
- data/lib/hydra/generic_content.rb +1 -1
- data/lib/hydra/generic_image.rb +2 -2
- data/lib/hydra/generic_user_attributes.rb +6 -4
- data/lib/hydra/model_mixins.rb +8 -3
- data/lib/hydra/model_mixins/rights_metadata.rb +357 -0
- data/lib/hydra/models/file_asset.rb +1 -1
- data/lib/hydra/mods_dataset.rb +5 -2
- data/lib/hydra/rights_metadata.rb +2 -2
- data/lib/hydra/superuser_attributes.rb +6 -5
- data/lib/mediashelf/active_fedora_helper.rb +1 -1
- data/lib/prev_next_links.rb +8 -3
- data/lib/user_attributes_loader.rb +22 -15
- data/lib/uva/mods_index_methods.rb +1 -1
- data/tasks/hydra-head.rake +4 -15
- data/tasks/hydra_jetty.rake +10 -1
- data/test_support/etc/Gemfile +13 -4
- data/test_support/features/support/paths.rb +5 -5
- data/test_support/spec/helpers/blacklight_helper_spec.rb +9 -5
- data/test_support/spec/helpers/generic_content_objects_helper_spec.rb +8 -0
- data/test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb +3 -0
- data/test_support/spec/helpers/hydra_helper_spec.rb +0 -1
- data/test_support/spec/models/generic_image_spec.rb +27 -30
- data/test_support/spec/models/user_spec.rb +9 -1
- data/test_support/spec/unit/rights_metadata_spec.rb +80 -0
- metadata +29 -111
- data/Gemfile.lock +0 -302
- data/test_support/etc/rvmrc +0 -32
- data/vendor/cache/RedCloth-4.2.9.gem +0 -0
- data/vendor/cache/actionmailer-3.2.3.gem +0 -0
- data/vendor/cache/actionpack-3.2.3.gem +0 -0
- data/vendor/cache/active-fedora-4.0.0.gem +0 -0
- data/vendor/cache/activemodel-3.2.3.gem +0 -0
- data/vendor/cache/activerecord-3.2.3.gem +0 -0
- data/vendor/cache/activeresource-3.2.3.gem +0 -0
- data/vendor/cache/activesupport-3.2.3.gem +0 -0
- data/vendor/cache/addressable-2.2.7.gem +0 -0
- data/vendor/cache/akami-1.0.0.gem +0 -0
- data/vendor/cache/arel-3.0.2.gem +0 -0
- data/vendor/cache/bcrypt-ruby-3.0.1.gem +0 -0
- data/vendor/cache/blacklight-3.3.2.gem +0 -0
- data/vendor/cache/block_helpers-0.3.3.gem +0 -0
- data/vendor/cache/builder-3.0.0.gem +0 -0
- data/vendor/cache/cancan-1.6.7.gem +0 -0
- data/vendor/cache/capybara-1.1.2.gem +0 -0
- data/vendor/cache/childprocess-0.3.1.gem +0 -0
- data/vendor/cache/chunky_png-1.2.5.gem +0 -0
- data/vendor/cache/compass-0.12.1.gem +0 -0
- data/vendor/cache/compass-rails-1.0.1.gem +0 -0
- data/vendor/cache/compass-susy-plugin-0.9.gem +0 -0
- data/vendor/cache/cucumber-1.1.9.gem +0 -0
- data/vendor/cache/cucumber-rails-1.3.0.gem +0 -0
- data/vendor/cache/daemons-1.1.8.gem +0 -0
- data/vendor/cache/devise-2.0.4.gem +0 -0
- data/vendor/cache/diff-lcs-1.1.3.gem +0 -0
- data/vendor/cache/equivalent-xml-0.2.9.gem +0 -0
- data/vendor/cache/erubis-2.7.0.gem +0 -0
- data/vendor/cache/factory_girl-2.6.4.gem +0 -0
- data/vendor/cache/fastercsv-1.5.4.gem +0 -0
- data/vendor/cache/ffi-1.0.11.gem +0 -0
- data/vendor/cache/fssm-0.2.9.gem +0 -0
- data/vendor/cache/gherkin-2.9.3.gem +0 -0
- data/vendor/cache/gyoku-0.4.4.gem +0 -0
- data/vendor/cache/hike-1.2.1.gem +0 -0
- data/vendor/cache/httpi-0.9.6.gem +0 -0
- data/vendor/cache/i18n-0.6.0.gem +0 -0
- data/vendor/cache/jettywrapper-1.2.1.gem +0 -0
- data/vendor/cache/journey-1.0.3.gem +0 -0
- data/vendor/cache/jquery-rails-2.0.2.gem +0 -0
- data/vendor/cache/json-1.6.6.gem +0 -0
- data/vendor/cache/kaminari-0.13.0.gem +0 -0
- data/vendor/cache/libwebsocket-0.1.3.gem +0 -0
- data/vendor/cache/logger-1.2.8.gem +0 -0
- data/vendor/cache/mail-2.4.4.gem +0 -0
- data/vendor/cache/marc-0.4.4.gem +0 -0
- data/vendor/cache/mediashelf-loggable-0.4.9.gem +0 -0
- data/vendor/cache/metaclass-0.0.1.gem +0 -0
- data/vendor/cache/mime-types-1.18.gem +0 -0
- data/vendor/cache/mocha-0.11.0.gem +0 -0
- data/vendor/cache/multi_json-1.3.2.gem +0 -0
- data/vendor/cache/multipart-post-1.1.2.gem +0 -0
- data/vendor/cache/nokogiri-1.5.2.gem +0 -0
- data/vendor/cache/nori-1.1.0.gem +0 -0
- data/vendor/cache/om-1.6.0.gem +0 -0
- data/vendor/cache/orm_adapter-0.0.7.gem +0 -0
- data/vendor/cache/polyglot-0.3.3.gem +0 -0
- data/vendor/cache/rack-1.4.1.gem +0 -0
- data/vendor/cache/rack-cache-1.2.gem +0 -0
- data/vendor/cache/rack-ssl-1.3.2.gem +0 -0
- data/vendor/cache/rack-test-0.6.1.gem +0 -0
- data/vendor/cache/rails-3.2.3.gem +0 -0
- data/vendor/cache/railties-3.2.3.gem +0 -0
- data/vendor/cache/rake-0.9.2.2.gem +0 -0
- data/vendor/cache/rdf-0.3.5.2.gem +0 -0
- data/vendor/cache/rdf-rdfxml-0.3.5.gem +0 -0
- data/vendor/cache/rdoc-3.12.gem +0 -0
- data/vendor/cache/rest-client-1.6.7.gem +0 -0
- data/vendor/cache/rsolr-1.0.8.gem +0 -0
- data/vendor/cache/rsolr-ext-1.0.3.gem +0 -0
- data/vendor/cache/rspec-2.9.0.gem +0 -0
- data/vendor/cache/rspec-core-2.9.0.gem +0 -0
- data/vendor/cache/rspec-expectations-2.9.1.gem +0 -0
- data/vendor/cache/rspec-mocks-2.9.0.gem +0 -0
- data/vendor/cache/rspec-rails-2.9.0.gem +0 -0
- data/vendor/cache/rubydora-0.5.8.gem +0 -0
- data/vendor/cache/rubyzip-0.9.7.gem +0 -0
- data/vendor/cache/sanitize-2.0.3.gem +0 -0
- data/vendor/cache/sass-3.1.16.gem +0 -0
- data/vendor/cache/sass-rails-3.2.5.gem +0 -0
- data/vendor/cache/savon-0.9.9.gem +0 -0
- data/vendor/cache/selenium-webdriver-2.21.2.gem +0 -0
- data/vendor/cache/solrizer-1.2.0.gem +0 -0
- data/vendor/cache/solrizer-fedora-2.0.0.gem +0 -0
- data/vendor/cache/sprockets-2.1.2.gem +0 -0
- data/vendor/cache/sqlite3-1.3.6.gem +0 -0
- data/vendor/cache/stomp-1.2.2.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.7.gem +0 -0
- data/vendor/cache/thor-0.14.6.gem +0 -0
- data/vendor/cache/tilt-1.3.3.gem +0 -0
- data/vendor/cache/treetop-1.4.10.gem +0 -0
- data/vendor/cache/tzinfo-0.3.33.gem +0 -0
- data/vendor/cache/unicode-0.4.2.gem +0 -0
- data/vendor/cache/warden-1.1.1.gem +0 -0
- data/vendor/cache/wasabi-2.1.0.gem +0 -0
- data/vendor/cache/xml-simple-1.1.1.gem +0 -0
- data/vendor/cache/xpath-0.1.4.gem +0 -0
- data/vendor/cache/yard-0.7.5.gem +0 -0
data/.gitmodules
CHANGED
data/HISTORY.textile
CHANGED
|
@@ -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,14 +1,12 @@
|
|
|
1
|
-
require
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
data/app/models/hydra/ability.rb
CHANGED
|
@@ -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
|
|
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
|
|
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]
|
|
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)
|
data/app/models/mods_asset.rb
CHANGED
|
@@ -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
|
data/app/models/superuser.rb
CHANGED
|
@@ -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
|
-
#
|
|
16
|
-
#
|
|
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 %>
|
data/config/fedora.yml
CHANGED
data/config/solr.yml
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
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
|
data/hydra-head.gemspec
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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
|
|
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", "
|
|
23
|
+
directory("test_support/fixtures", "spec/fixtures")
|
|
24
24
|
end
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
end
|
|
27
27
|
end
|
data/lib/hydra-head/engine.rb
CHANGED
data/lib/hydra-head/version.rb
CHANGED
|
@@ -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
|
data/lib/hydra/generic_image.rb
CHANGED
|
@@ -92,11 +92,11 @@ module Hydra::GenericImage
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def admin_site
|
|
95
|
-
@admin_site ||=
|
|
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
|
-
"
|
|
99
|
+
ActiveFedora::Base.connection_for_pid(pid).client.url + "/objects/#{pid}/datastreams/#{ds_name}/content"
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
end
|