sufia-models 4.0.0.beta2 → 4.0.0.beta3

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/actors/sufia/generic_file/actor.rb +118 -0
  3. data/app/models/batch.rb +3 -3
  4. data/app/models/checksum_audit_log.rb +3 -3
  5. data/app/models/collection.rb +41 -0
  6. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file.rb +33 -43
  7. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/accessible_attributes.rb +3 -3
  8. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/audit.rb +12 -18
  9. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/characterization.rb +1 -8
  10. data/app/models/concerns/sufia/generic_file/derivatives.rb +26 -0
  11. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/export.rb +13 -13
  12. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/featured.rb +0 -0
  13. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/metadata.rb +0 -0
  14. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/mime_types.rb +15 -1
  15. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/permissions.rb +5 -1
  16. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/reload_on_save.rb +0 -0
  17. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/trophies.rb +0 -0
  18. data/app/models/concerns/sufia/generic_file/versions.rb +16 -0
  19. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/virus_check.rb +2 -3
  20. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/web_form.rb +9 -2
  21. data/app/models/concerns/sufia/properties_datastream_behavior.rb +3 -4
  22. data/app/models/concerns/sufia/user.rb +2 -2
  23. data/app/models/datastreams/fits_datastream.rb +137 -136
  24. data/app/models/datastreams/generic_file_rdf_datastream.rb +6 -0
  25. data/app/models/datastreams/paranoid_rights_datastream.rb +3 -3
  26. data/app/models/file_usage.rb +53 -0
  27. data/app/models/follow.rb +2 -4
  28. data/app/models/geo_names_resource.rb +5 -7
  29. data/app/models/local_authority.rb +14 -14
  30. data/app/models/single_use_link.rb +1 -1
  31. data/app/models/sufia/download.rb +9 -0
  32. data/app/models/trophy.rb +1 -1
  33. data/app/services/sufia/{usage_statistics.rb → analytics.rb} +1 -24
  34. data/app/services/sufia/id_service.rb +2 -2
  35. data/lib/generators/sufia/models/install_generator.rb +5 -2
  36. data/lib/generators/sufia/models/templates/config/setup_mail.rb +1 -1
  37. data/lib/generators/sufia/models/templates/config/sufia.rb +5 -3
  38. data/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb +6 -6
  39. data/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb +2 -3
  40. data/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb +20 -20
  41. data/lib/sufia/ability.rb +1 -1
  42. data/lib/sufia/models/engine.rb +3 -9
  43. data/lib/sufia/models/file_content/versions.rb +3 -3
  44. data/lib/sufia/models/jobs/active_fedora_pid_based_job.rb +6 -2
  45. data/lib/sufia/models/jobs/batch_update_job.rb +6 -10
  46. data/lib/sufia/models/jobs/characterize_job.rb +1 -13
  47. data/lib/sufia/models/jobs/create_derivatives_job.rb +14 -0
  48. data/lib/sufia/models/jobs/import_url_job.rb +27 -23
  49. data/lib/sufia/models/version.rb +1 -1
  50. data/lib/tasks/sufia-models_tasks.rake +1 -1
  51. data/sufia-models.gemspec +1 -1
  52. metadata +65 -64
  53. data/lib/sufia/models/generic_file/actions.rb +0 -50
  54. data/lib/sufia/models/generic_file/derivatives.rb +0 -31
  55. data/lib/sufia/models/generic_file/thumbnail.rb +0 -37
  56. data/lib/sufia/models/generic_file/versions.rb +0 -16
  57. data/lib/sufia/models/jobs/transcode_audio_job.rb +0 -15
  58. data/lib/sufia/models/jobs/transcode_video_job.rb +0 -15
  59. data/lib/sufia/models/solr_document_behavior.rb +0 -118
@@ -51,6 +51,12 @@ class GenericFileRdfDatastream < ActiveFedora::NtriplesRDFDatastream
51
51
  property :related_url, predicate: RDF::RDFS.seeAlso do |index|
52
52
  index.as :stored_searchable
53
53
  end
54
+ property :bibliographic_citation, predicate: RDF::DC.bibliographicCitation do |index|
55
+ index.as :stored_searchable
56
+ end
57
+ property :source, predicate: RDF::DC.source do |index|
58
+ index.as :stored_searchable
59
+ end
54
60
 
55
61
  # TODO: Move this somewhere more appropriate
56
62
  begin
@@ -3,9 +3,9 @@ class ParanoidRightsDatastream < Hydra::Datastream::RightsMetadata
3
3
  use_terminology Hydra::Datastream::RightsMetadata
4
4
 
5
5
  VALIDATIONS = [
6
- {:key => :edit_users, :message => 'Depositor must have edit access', :condition => lambda { |obj| !obj.edit_users.include?(obj.depositor) }},
7
- {:key => :edit_groups, :message => 'Public cannot have edit access', :condition => lambda { |obj| obj.edit_groups.include?('public') }},
8
- {:key => :edit_groups, :message => 'Registered cannot have edit access', :condition => lambda { |obj| obj.edit_groups.include?('registered') }}
6
+ {key: :edit_users, message: 'Depositor must have edit access', condition: lambda { |obj| !obj.edit_users.include?(obj.depositor) }},
7
+ {key: :edit_groups, message: 'Public cannot have edit access', condition: lambda { |obj| obj.edit_groups.include?('public') }},
8
+ {key: :edit_groups, message: 'Registered cannot have edit access', condition: lambda { |obj| obj.edit_groups.include?('registered') }}
9
9
  ]
10
10
 
11
11
  def validate(object)
@@ -0,0 +1,53 @@
1
+ class FileUsage
2
+
3
+ attr_accessor :id, :created, :path, :downloads, :pageviews
4
+
5
+ def initialize id
6
+ self.id = id
7
+ self.path = Sufia::Engine.routes.url_helpers.generic_file_path(Sufia::Noid.noidify(id))
8
+ self.created = DateTime.parse(::GenericFile.find(id).create_date)
9
+ self.downloads = download_statistics
10
+ self.pageviews = pageview_statistics
11
+ end
12
+
13
+ def total_downloads
14
+ self.downloads.map(&:marshal_dump).reduce(0) { |total, result| total + result[:totalEvents].to_i }
15
+ end
16
+
17
+ def total_pageviews
18
+ self.pageviews.map(&:marshal_dump).reduce(0) { |total, result| total + result[:pageviews].to_i }
19
+ end
20
+
21
+ # Package data for visualization using JQuery Flot
22
+ def to_flot
23
+ [
24
+ { label: "Pageviews", data: pageviews_to_flot },
25
+ { label: "Downloads", data: downloads_to_flot }
26
+ ]
27
+ end
28
+
29
+ private
30
+
31
+ def download_statistics
32
+ Sufia::Analytics.profile.download(sort: 'date').for_file(self.id)
33
+ end
34
+
35
+ def pageview_statistics
36
+ Sufia::Analytics.profile.pageview(sort: 'date').for_path(self.path)
37
+ end
38
+
39
+ def pageviews_to_flot values = Array.new
40
+ self.pageviews.map(&:marshal_dump).map do |result_hash|
41
+ values << [ (Date.parse(result_hash[:date]).to_time.to_i * 1000), result_hash[:pageviews].to_i ]
42
+ end
43
+ return values
44
+ end
45
+
46
+ def downloads_to_flot values = Array.new
47
+ self.downloads.map(&:marshal_dump).map do |result_hash|
48
+ values << [ (Date.parse(result_hash[:date]).to_time.to_i * 1000), result_hash[:totalEvents].to_i ]
49
+ end
50
+ return values
51
+ end
52
+
53
+ end
@@ -1,14 +1,12 @@
1
1
  class Follow < ActiveRecord::Base
2
-
3
2
  extend ActsAsFollower::FollowerLib
4
3
  extend ActsAsFollower::FollowScopes
5
4
 
6
5
  # NOTE: Follows belong to the "followable" interface, and also to followers
7
- belongs_to :followable, :polymorphic => true
8
- belongs_to :follower, :polymorphic => true
6
+ belongs_to :followable, polymorphic: true
7
+ belongs_to :follower, polymorphic: true
9
8
 
10
9
  def block!
11
10
  self.update_attribute(:blocked, true)
12
11
  end
13
-
14
12
  end
@@ -2,19 +2,17 @@ class GeoNamesResource < ActiveResource::Base
2
2
  self.site = "http://api.geonames.org/"
3
3
  self.element_name = "searchJSON"
4
4
  self.collection_name = "searchJSON"
5
-
5
+
6
6
  def self.collection_path(prefix_options = {}, query_options = nil)
7
- super(prefix_options, query_options).gsub(/\.json|\.xml/, "")
7
+ super(prefix_options, query_options).gsub(/\.json|\.xml/, "")
8
8
  end
9
9
 
10
10
  def self.instantiate_collection(collection, original_params = {}, prefix_options = {})
11
11
  col = super(collection["geonames"], original_params, prefix_options)
12
- col.map! {|item| { label: item.name+ (item.adminName1 ? ", " + item.adminName1 : "")+", " + item.countryName, value: item.name+ (item.adminName1 ? ", " + item.adminName1 : "")+", " + item.countryName} }
13
- return col
12
+ col.map! { |item| { label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName, value: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName} }
14
13
  end
15
-
14
+
16
15
  def self.find_location(location)
17
- return GeoNamesResource.find(:all, :params => { :q =>location, :username=>"cam156", :maxRows=>10})
16
+ return GeoNamesResource.find(:all, params: { q: location, username: "cam156", maxRows: 10})
18
17
  end
19
-
20
18
  end
@@ -6,18 +6,18 @@ class LocalAuthority < ActiveRecord::Base
6
6
  has_many :local_authority_entries
7
7
 
8
8
  def self.harvest_rdf(name, sources, opts = {})
9
- return unless self.where(:name => name).empty?
10
- authority = self.create(:name => name)
9
+ return unless self.where(name: name).empty?
10
+ authority = self.create(name: name)
11
11
  format = opts.fetch(:format, :ntriples)
12
12
  predicate = opts.fetch(:predicate, RDF::SKOS.prefLabel)
13
13
  entries = []
14
14
  sources.each do |uri|
15
- RDF::Reader.open(uri, :format => format) do |reader|
15
+ RDF::Reader.open(uri, format: format) do |reader|
16
16
  reader.each_statement do |statement|
17
17
  if statement.predicate == predicate
18
- entries << LocalAuthorityEntry.new(:local_authority => authority,
19
- :label => statement.object.to_s,
20
- :uri => statement.subject.to_s)
18
+ entries << LocalAuthorityEntry.new(local_authority: authority,
19
+ label: statement.object.to_s,
20
+ uri: statement.subject.to_s)
21
21
  end
22
22
  end
23
23
  end
@@ -30,17 +30,17 @@ class LocalAuthority < ActiveRecord::Base
30
30
  end
31
31
 
32
32
  def self.harvest_tsv(name, sources, opts = {})
33
- return unless self.where(:name => name).empty?
34
- authority = self.create(:name => name)
33
+ return unless self.where(name: name).empty?
34
+ authority = self.create(name: name)
35
35
  prefix = opts.fetch(:prefix, "")
36
36
  entries = []
37
37
  sources.each do |uri|
38
38
  open(uri) do |f|
39
39
  f.each_line do |tsv|
40
40
  fields = tsv.split(/\t/)
41
- entries << LocalAuthorityEntry.new(:local_authority => authority,
42
- :uri => "#{prefix}#{fields[0]}/",
43
- :label => fields[2])
41
+ entries << LocalAuthorityEntry.new(local_authority: authority,
42
+ uri: "#{prefix}#{fields[0]}/",
43
+ label: fields[2])
44
44
  end
45
45
  end
46
46
  end
@@ -69,15 +69,15 @@ class LocalAuthority < ActiveRecord::Base
69
69
  if (term == 'subject' && model == 'generic_files') # and local_authoritiy = lc_subject
70
70
  sql = SubjectLocalAuthorityEntry.where("lowerLabel like ?", "#{lowQuery}%").select("label, uri").limit(25).to_sql
71
71
  SubjectLocalAuthorityEntry.find_by_sql(sql).each do |hit|
72
- hits << {:uri => hit.uri, :label => hit.label}
72
+ hits << {uri: hit.uri, label: hit.label}
73
73
  end
74
74
  else
75
- dterm = DomainTerm.where(:model => model, :term => term).first
75
+ dterm = DomainTerm.where(model: model, term: term).first
76
76
  if dterm
77
77
  authorities = dterm.local_authorities.collect(&:id).uniq
78
78
  sql = LocalAuthorityEntry.where("local_authority_id in (?)", authorities).where("lower(label) like ?", "#{lowQuery}%").select("label, uri").limit(25).to_sql
79
79
  LocalAuthorityEntry.find_by_sql(sql).each do |hit|
80
- hits << {:uri => hit.uri, :label => hit.label}
80
+ hits << {uri: hit.uri, label: hit.label}
81
81
  end
82
82
  end
83
83
  end
@@ -6,7 +6,7 @@ class SingleUseLink < ActiveRecord::Base
6
6
  after_initialize :set_defaults
7
7
 
8
8
  def create_for_path path
9
- self.class.create :itemId => itemId, :path => path
9
+ self.class.create itemId: itemId, path: path
10
10
  end
11
11
 
12
12
  def expired?
@@ -0,0 +1,9 @@
1
+ module Sufia
2
+ class Download
3
+ extend Legato::Model
4
+
5
+ metrics :totalEvents
6
+ dimensions :eventCategory, :eventAction, :eventLabel, :date
7
+ filter :for_file, &lambda {|id| matches(:eventLabel, id)}
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  class Trophy < ActiveRecord::Base
2
- validate :count_within_limit, :on => :create
2
+ validate :count_within_limit, on: :create
3
3
 
4
4
  def count_within_limit
5
5
  if Trophy.where(user_id:self.user_id).count >= 5
@@ -3,7 +3,7 @@ require 'oauth2'
3
3
  require 'legato'
4
4
 
5
5
  module Sufia
6
- module UsageStatistics
6
+ module Analytics
7
7
  # Loads configuration options from config/analytics.yml. Expected structure:
8
8
  # `analytics:`
9
9
  # ` app_name: GOOGLE_OAUTH_APP_NAME`
@@ -16,29 +16,6 @@ module Sufia
16
16
  @config ||= YAML.load(File.read(File.join(Rails.root, 'config', 'analytics.yml')))['analytics']
17
17
  end
18
18
 
19
- # Convert query results into json for plotting in JQuery Flot
20
- # @param [Legato::Query] A Legato query object containing the results
21
- # @return [Array] An array of arrays represented in JSON: `[[1388563200000,4],[1388649600000,8],...]`
22
- def self.as_flot_json(ga_results)
23
- # Convert Legato query to hash
24
- results_list = ga_results.map(&:marshal_dump)
25
- # Results should look like: [[DATE_INT, NUM_HITS], ...]
26
- values = results_list.map do |result_hash|
27
- result_hash[:date] = Date.parse(result_hash[:date]).to_time.to_i * 1000
28
- result_hash[:pageviews] = result_hash[:pageviews].to_i
29
- result_hash.values
30
- end
31
-
32
- values.to_json
33
- end
34
-
35
- # Calculate total pageviews based on query results
36
- # @param [Legato::Query] A Legato query object containing the results
37
- # @return [Fixnum] An integer representing how many pageviews were recorded
38
- def self.total_pageviews(ga_results)
39
- ga_results.map(&:marshal_dump).reduce(0) { |total, result| total + result[:pageviews].to_i }
40
- end
41
-
42
19
  # Generate an OAuth2 token for Google Analytics
43
20
  # @return [OAuth2::AccessToken] An OAuth2 access token for GA
44
21
  def self.token
@@ -7,7 +7,7 @@ module Sufia
7
7
  Sufia.config.noid_template
8
8
  end
9
9
 
10
- @minter = ::Noid::Minter.new(:template => noid_template)
10
+ @minter = ::Noid::Minter.new(template: noid_template)
11
11
  @pid = $$
12
12
  @namespace = Sufia.config.id_namespace
13
13
  @semaphore = Mutex.new
@@ -32,7 +32,7 @@ module Sufia
32
32
  File.open(Sufia.config.minter_statefile, File::RDWR|File::CREAT, 0644) do |f|
33
33
  f.flock(File::LOCK_EX)
34
34
  yaml = YAML::load(f.read)
35
- yaml = {:template => noid_template} unless yaml
35
+ yaml = {template: noid_template} unless yaml
36
36
  minter = ::Noid::Minter.new(yaml)
37
37
  pid = "#{@namespace}:#{minter.mint}"
38
38
  f.rewind
@@ -7,7 +7,7 @@ class Sufia::Models::InstallGenerator < Rails::Generators::Base
7
7
 
8
8
  source_root File.expand_path('../templates', __FILE__)
9
9
 
10
- argument :model_name, :type => :string , :default => "user"
10
+ argument :model_name, type: :string , default: "user"
11
11
  desc """
12
12
  This generator makes the following changes to your application:
13
13
  1. Creates several database migrations if they do not exist in /db/migrate
@@ -104,6 +104,10 @@ This generator makes the following changes to your application:
104
104
  generate 'sufia:models:usagestats'
105
105
  end
106
106
 
107
+ def install_blacklight_gallery
108
+ generate "blacklight_gallery:install"
109
+ end
110
+
107
111
  private
108
112
 
109
113
  def better_migration_template(file)
@@ -113,5 +117,4 @@ This generator makes the following changes to your application:
113
117
  say_status("warning", e.message, :yellow)
114
118
  end
115
119
  end
116
-
117
120
  end
@@ -1,3 +1,3 @@
1
1
  ActionMailer::Base.smtp_settings = {
2
- :address => "smtp.psu.edu"
2
+ address: "smtp.psu.edu"
3
3
  }
@@ -2,8 +2,8 @@
2
2
  Sufia.config do |config|
3
3
 
4
4
  config.fits_to_desc_mapping= {
5
- :file_title => :title,
6
- :file_author => :creator
5
+ file_title: :title,
6
+ file_author: :creator
7
7
  }
8
8
 
9
9
  # Specify a different template for your repositories unique identifiers
@@ -61,7 +61,9 @@ Sufia.config do |config|
61
61
  config.queue = Sufia::Resque::Queue
62
62
 
63
63
  # Enable displaying usage statistics in the UI
64
- config.usage_statistics = true
64
+ # Defaults to FALSE
65
+ # Requires a Google Analytics id and OAuth2 keyfile. See README for more info
66
+ config.analytics = false
65
67
 
66
68
  # Specify a Google Analytics tracking ID to gather usage statistics
67
69
  # config.google_analytics_id = 'UA-99999999-1'
@@ -1,14 +1,14 @@
1
1
  class ActsAsFollowerMigration < ActiveRecord::Migration
2
2
  def self.up
3
- create_table :follows, :force => true do |t|
4
- t.references :followable, :polymorphic => true, :null => false
5
- t.references :follower, :polymorphic => true, :null => false
6
- t.boolean :blocked, :default => false, :null => false
3
+ create_table :follows, force: true do |t|
4
+ t.references :followable, polymorphic: true, null: false
5
+ t.references :follower, polymorphic: true, null: false
6
+ t.boolean :blocked, default: false, null: false
7
7
  t.timestamps
8
8
  end
9
9
 
10
- add_index :follows, ["follower_id", "follower_type"], :name => "fk_follows"
11
- add_index :follows, ["followable_id", "followable_type"], :name => "fk_followables"
10
+ add_index :follows, ["follower_id", "follower_type"], name: "fk_follows"
11
+ add_index :follows, ["followable_id", "followable_type"], name: "fk_followables"
12
12
  end
13
13
 
14
14
  def self.down
@@ -9,12 +9,11 @@ class CreateChecksumAuditLogs < ActiveRecord::Migration
9
9
  t.string :actual_result
10
10
  t.timestamps
11
11
  end
12
- add_index :checksum_audit_logs, [:pid, :dsid], :name=>'by_pid_and_dsid', :order => {:created_at => "DESC" }
13
-
12
+ add_index :checksum_audit_logs, [:pid, :dsid], name: 'by_pid_and_dsid', order: {created_at: "DESC" }
14
13
  end
15
14
 
16
15
  def self.down
17
- remove_index(:checksum_audit_logs, :name => 'by_pid_and_dsid')
16
+ remove_index(:checksum_audit_logs, name: 'by_pid_and_dsid')
18
17
  drop_table :checksum_audit_logs
19
18
  end
20
19
  end
@@ -1,37 +1,37 @@
1
1
  class CreateLocalAuthorities < ActiveRecord::Migration
2
2
  def self.up
3
- create_table :local_authority_entries, :force => true do |t|
3
+ create_table :local_authority_entries, force: true do |t|
4
4
  t.integer :local_authority_id
5
5
  t.string :label
6
6
  t.string :uri
7
7
  end
8
8
 
9
- create_table :local_authorities, :force => true do |t|
10
- t.string :name, :unique => true
9
+ create_table :local_authorities, force: true do |t|
10
+ t.string :name, unique: true
11
11
  end
12
12
 
13
- create_table :domain_terms, :force => true do |t|
13
+ create_table :domain_terms, force: true do |t|
14
14
  t.string :model
15
15
  t.string :term
16
16
  end
17
17
 
18
- create_table :domain_terms_local_authorities, :id => false do |t|
19
- t.integer :domain_term_id, :foreign_key => true
20
- t.integer :local_authority_id, :foreign_key => true
18
+ create_table :domain_terms_local_authorities, id: false do |t|
19
+ t.integer :domain_term_id, foreign_key: true
20
+ t.integer :local_authority_id, foreign_key: true
21
21
  end
22
22
 
23
- create_table :subject_local_authority_entries, :force => true do |t|
23
+ create_table :subject_local_authority_entries, force: true do |t|
24
24
  t.string :label
25
25
  t.string :lowerLabel
26
26
  t.string :url
27
27
  end
28
28
 
29
- add_index :local_authority_entries, [:local_authority_id, :label], :name => 'entries_by_term_and_label'
30
- add_index :local_authority_entries, [:local_authority_id, :uri], :name => 'entries_by_term_and_uri'
31
- add_index :domain_terms, [:model, :term], :name => 'terms_by_model_and_term'
32
- add_index :domain_terms_local_authorities, [:local_authority_id, :domain_term_id], :name => 'dtla_by_ids1'
33
- add_index :domain_terms_local_authorities, [:domain_term_id, :local_authority_id], :name => 'dtla_by_ids2'
34
- add_index :subject_local_authority_entries, [:lowerLabel], :name => 'entries_by_lower_label'
29
+ add_index :local_authority_entries, [:local_authority_id, :label], name: 'entries_by_term_and_label'
30
+ add_index :local_authority_entries, [:local_authority_id, :uri], name: 'entries_by_term_and_uri'
31
+ add_index :domain_terms, [:model, :term], name: 'terms_by_model_and_term'
32
+ add_index :domain_terms_local_authorities, [:local_authority_id, :domain_term_id], name: 'dtla_by_ids1'
33
+ add_index :domain_terms_local_authorities, [:domain_term_id, :local_authority_id], name: 'dtla_by_ids2'
34
+ add_index :subject_local_authority_entries, [:lowerLabel], name: 'entries_by_lower_label'
35
35
  end
36
36
 
37
37
  def self.down
@@ -40,11 +40,11 @@ class CreateLocalAuthorities < ActiveRecord::Migration
40
40
  drop_table :domain_terms
41
41
  drop_table :domain_terms_local_authorities
42
42
  drop_table :subject_local_authority_entries
43
- remove_index :local_authority_entries, :name => "entries_by_term_and_label"
44
- remove_index :local_authority_entries, :name => "entries_by_term_and_uri"
45
- remove_index :domain_terms, :name => "terms_by_model_and_term"
46
- remove_index :subject_local_authority_entries, :name => 'entries_by_lower_label'
47
- remove_index :domain_terms_local_authorities, :name => 'dtla_by_ids1'
48
- remove_index :domain_terms_local_authorities, :name => 'dtla_by_ids2'
43
+ remove_index :local_authority_entries, name: "entries_by_term_and_label"
44
+ remove_index :local_authority_entries, name: "entries_by_term_and_uri"
45
+ remove_index :domain_terms, name: "terms_by_model_and_term"
46
+ remove_index :subject_local_authority_entries, name: 'entries_by_lower_label'
47
+ remove_index :domain_terms_local_authorities, name: 'dtla_by_ids1'
48
+ remove_index :domain_terms_local_authorities, name: 'dtla_by_ids2'
49
49
  end
50
50
  end
@@ -17,7 +17,7 @@ module Sufia
17
17
  end
18
18
 
19
19
  def generic_file_abilities
20
- can :create, GenericFile if user_groups.include? 'registered'
20
+ can :create, [GenericFile, Collection] if user_groups.include? 'registered'
21
21
  end
22
22
 
23
23
  def editor_abilities