sufia 3.1.0 → 3.2.1
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.
- checksums.yaml +4 -4
- data/History.md +44 -0
- data/SUFIA_VERSION +1 -1
- data/app/controllers/authorities_controller.rb +0 -14
- data/app/controllers/batch_controller.rb +0 -14
- data/app/controllers/contact_form_controller.rb +0 -14
- data/app/controllers/dashboard_controller.rb +0 -14
- data/app/controllers/directory_controller.rb +0 -14
- data/app/controllers/downloads_controller.rb +0 -14
- data/app/controllers/errors_controller.rb +0 -14
- data/app/controllers/generic_files_controller.rb +0 -14
- data/app/controllers/mailbox_controller.rb +0 -14
- data/app/controllers/static_controller.rb +0 -14
- data/app/controllers/users_controller.rb +0 -14
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +0 -14
- data/app/helpers/contact_form_helper.rb +0 -14
- data/app/helpers/generic_file_helper.rb +0 -14
- data/app/helpers/sufia_helper.rb +0 -14
- data/app/helpers/trophy_helper.rb +0 -14
- data/app/jobs/content_delete_event_job.rb +0 -14
- data/app/jobs/content_deposit_event_job.rb +0 -14
- data/app/jobs/content_new_version_event_job.rb +0 -14
- data/app/jobs/content_restored_version_event_job.rb +0 -14
- data/app/jobs/content_update_event_job.rb +0 -14
- data/app/jobs/event_job.rb +0 -14
- data/app/jobs/user_edit_profile_event_job.rb +0 -14
- data/app/jobs/user_follow_event_job.rb +0 -14
- data/app/jobs/user_unfollow_event_job.rb +0 -14
- data/app/views/dashboard/_heading.html.erb +1 -0
- data/app/views/dashboard/index.html.erb +1 -1
- data/app/views/generic_files/_permission_form.html.erb +3 -3
- data/db/seeds.rb +0 -14
- data/lib/generators/sufia/sufia_generator.rb +18 -85
- data/lib/generators/sufia/templates/catalog_controller.rb +0 -14
- data/lib/generators/sufia/templates/config/action_dispatch_http_upload_monkey_patch.rb +0 -14
- data/lib/generators/sufia/templates/migrations/acts_as_follower_migration.rb +0 -14
- data/lib/generators/sufia/templates/migrations/add_avatars_to_users.rb +0 -14
- data/lib/generators/sufia/templates/migrations/add_groups_to_users.rb +0 -14
- data/lib/generators/sufia/templates/migrations/add_ldap_attrs_to_user.rb +0 -14
- data/lib/generators/sufia/templates/migrations/add_social_to_users.rb +0 -14
- data/lib/generators/sufia/templates/migrations/create_checksum_audit_logs.rb +0 -14
- data/lib/generators/sufia/templates/migrations/create_local_authorities.rb +0 -14
- data/lib/generators/sufia/templates/migrations/create_version_committers.rb +0 -14
- data/lib/sufia/batch_edits_controller_behavior.rb +1 -1
- data/lib/sufia/contact_form_controller_behavior.rb +0 -14
- data/lib/sufia/controller.rb +1 -15
- data/lib/sufia/downloads_controller_behavior.rb +0 -14
- data/lib/sufia/files_controller/upload_complete_behavior.rb +5 -0
- data/lib/sufia/files_controller_behavior.rb +3 -17
- data/lib/sufia/role_mapper.rb +0 -14
- data/lib/sufia/version.rb +1 -1
- data/lib/tasks/fixtures.rake +0 -14
- data/spec/factories/checksum_audit_logs.rb +0 -14
- data/spec/lib/sufia/upload_complete_behavior_spec.rb +10 -0
- data/spec/models/access_right_spec.rb +57 -0
- data/spec/models/generic_file/visibility_spec.rb +19 -0
- data/spec/models/generic_file_spec.rb +44 -28
- data/spec/support/uploaded_file_monkeypatch.rb +0 -14
- data/sufia-models/app/models/batch.rb +0 -14
- data/sufia-models/app/models/checksum_audit_log.rb +1 -1
- data/sufia-models/app/models/concerns/sufia/models/access_right.rb +79 -0
- data/sufia-models/app/models/concerns/sufia/models/with_access_right.rb +33 -0
- data/sufia-models/app/models/datastreams/batch_rdf_datastream.rb +0 -14
- data/sufia-models/app/models/datastreams/fits_datastream.rb +0 -14
- data/sufia-models/app/models/datastreams/generic_file_rdf_datastream.rb +0 -14
- data/sufia-models/app/models/datastreams/properties_datastream.rb +0 -14
- data/sufia-models/app/models/domain_term.rb +1 -1
- data/sufia-models/app/models/follow.rb +0 -14
- data/sufia-models/app/models/generic_file.rb +0 -13
- data/sufia-models/app/models/local_authority.rb +1 -1
- data/sufia-models/app/models/local_authority_entry.rb +1 -1
- data/sufia-models/app/models/single_use_link.rb +1 -1
- data/sufia-models/app/models/subject_local_authority_entry.rb +0 -14
- data/sufia-models/app/models/trophy.rb +1 -1
- data/sufia-models/app/models/version_committer.rb +1 -1
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +102 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/clamav.rb +1 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/mailboxer.rb +17 -0
- data/{lib/generators/sufia → sufia-models/lib/generators/sufia/models}/templates/config/redis_config.rb +1 -1
- data/{lib/generators/sufia → sufia-models/lib/generators/sufia/models}/templates/config/resque_config.rb +1 -1
- data/sufia-models/lib/generators/sufia/models/templates/config/setup_mail.rb +3 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +81 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb +17 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_avatars_to_users.rb +9 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_groups_to_users.rb +11 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_ldap_attrs_to_user.rb +27 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_social_to_users.rb +13 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb +20 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb +50 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_single_use_links.rb +12 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_trophies.rb +10 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_version_committers.rb +15 -0
- data/sufia-models/lib/sufia/models/active_record/deprecated_attr_accessible.rb +16 -0
- data/sufia-models/lib/sufia/models/engine.rb +1 -2
- data/sufia-models/lib/sufia/models/generic_file/permissions.rb +2 -17
- data/sufia-models/lib/sufia/models/generic_file/visibility.rb +65 -0
- data/sufia-models/lib/sufia/models/generic_file.rb +3 -2
- data/sufia-models/lib/sufia/models/id_service.rb +0 -14
- data/sufia-models/lib/sufia/models/jobs/audit_job.rb +0 -14
- data/sufia-models/lib/sufia/models/jobs/batch_update_job.rb +3 -17
- data/sufia-models/lib/sufia/models/jobs/characterize_job.rb +0 -14
- data/sufia-models/lib/sufia/models/jobs/resolrize_job.rb +0 -14
- data/sufia-models/lib/sufia/models/jobs/unzip_job.rb +0 -14
- data/sufia-models/lib/sufia/models/noid.rb +0 -14
- data/sufia-models/lib/sufia/models/solr_document_behavior.rb +0 -14
- data/sufia-models/lib/sufia/models/user.rb +1 -15
- data/sufia-models/lib/sufia/models/utils.rb +0 -14
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/lib/tasks/resque.rake +0 -14
- data/sufia-models/sufia-models.gemspec +3 -3
- data/tasks/release.rake +2 -1
- data/tasks/sufia-db.rake +0 -14
- data/tasks/sufia-dev.rake +0 -1
- data/tasks/sufia-fixtures.rake +0 -14
- data/tasks/sufia.rake +0 -14
- metadata +33 -14
- data/lib/generators/sufia/templates/config/clamav.rb +0 -14
- data/lib/generators/sufia/templates/config/mailboxer.rb +0 -31
- data/lib/generators/sufia/templates/config/setup_mail.rb +0 -17
- data/lib/generators/sufia/templates/config/sufia.rb +0 -82
- /data/{lib/generators/sufia → sufia-models/lib/generators/sufia/models}/templates/config/redis.yml +0 -0
- /data/{lib/generators/sufia → sufia-models/lib/generators/sufia/models}/templates/config/resque_admin.rb +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Returns an array containing the vhost 'CoSign service' value and URL
|
|
2
|
+
Sufia.config do |config|
|
|
3
|
+
|
|
4
|
+
config.fits_to_desc_mapping= {
|
|
5
|
+
:file_title => :title,
|
|
6
|
+
:file_author => :creator
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
# Specify a different template for your repositories unique identifiers
|
|
10
|
+
# config.noid_template = ".reeddeeddk"
|
|
11
|
+
|
|
12
|
+
config.max_days_between_audits = 7
|
|
13
|
+
|
|
14
|
+
config.cc_licenses = {
|
|
15
|
+
'Attribution 3.0 United States' => 'http://creativecommons.org/licenses/by/3.0/us/',
|
|
16
|
+
'Attribution-ShareAlike 3.0 United States' => 'http://creativecommons.org/licenses/by-sa/3.0/us/',
|
|
17
|
+
'Attribution-NonCommercial 3.0 United States' => 'http://creativecommons.org/licenses/by-nc/3.0/us/',
|
|
18
|
+
'Attribution-NoDerivs 3.0 United States' => 'http://creativecommons.org/licenses/by-nd/3.0/us/',
|
|
19
|
+
'Attribution-NonCommercial-NoDerivs 3.0 United States' => 'http://creativecommons.org/licenses/by-nc-nd/3.0/us/',
|
|
20
|
+
'Attribution-NonCommercial-ShareAlike 3.0 United States' => 'http://creativecommons.org/licenses/by-nc-sa/3.0/us/',
|
|
21
|
+
'Public Domain Mark 1.0' => 'http://creativecommons.org/publicdomain/mark/1.0/',
|
|
22
|
+
'CC0 1.0 Universal' => 'http://creativecommons.org/publicdomain/zero/1.0/',
|
|
23
|
+
'All rights reserved' => 'All rights reserved'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
config.cc_licenses_reverse = Hash[*config.cc_licenses.to_a.flatten.reverse]
|
|
27
|
+
|
|
28
|
+
config.resource_types = {
|
|
29
|
+
"Article" => "Article",
|
|
30
|
+
"Audio" => "Audio",
|
|
31
|
+
"Book" => "Book",
|
|
32
|
+
"Capstone Project" => "Capstone Project",
|
|
33
|
+
"Conference Proceeding" => "Conference Proceeding",
|
|
34
|
+
"Dataset" => "Dataset",
|
|
35
|
+
"Dissertation" => "Dissertation",
|
|
36
|
+
"Image" => "Image",
|
|
37
|
+
"Journal" => "Journal",
|
|
38
|
+
"Map or Cartographic Material" => "Map or Cartographic Material",
|
|
39
|
+
"Masters Thesis" => "Masters Thesis",
|
|
40
|
+
"Part of Book" => "Part of Book",
|
|
41
|
+
"Poster" => "Poster",
|
|
42
|
+
"Presentation" => "Presentation",
|
|
43
|
+
"Project" => "Project",
|
|
44
|
+
"Report" => "Report",
|
|
45
|
+
"Research Paper" => "Research Paper",
|
|
46
|
+
"Software or Program Code" => "Software or Program Code",
|
|
47
|
+
"Video" => "Video",
|
|
48
|
+
"Other" => "Other",
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
config.permission_levels = {
|
|
52
|
+
"Choose Access"=>"none",
|
|
53
|
+
"View/Download" => "read",
|
|
54
|
+
"Edit" => "edit"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
config.owner_permission_levels = {
|
|
58
|
+
"Edit" => "edit"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
config.queue = Sufia::Resque::Queue
|
|
62
|
+
|
|
63
|
+
# Map hostnames onto Google Analytics tracking IDs
|
|
64
|
+
# config.google_analytics_id = 'UA-99999999-1'
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# Where to store tempfiles, leave blank for the system temp directory (e.g. /tmp)
|
|
68
|
+
# config.temp_file_base = '/home/developer1'
|
|
69
|
+
|
|
70
|
+
# If you have ffmpeg installed and want to transcode audio and video uncomment this line
|
|
71
|
+
# config.enable_ffmpeg = true
|
|
72
|
+
|
|
73
|
+
# Specify the Fedora pid prefix:
|
|
74
|
+
# config.id_namespace = "sufia"
|
|
75
|
+
|
|
76
|
+
# Specify the path to the file characterization tool:
|
|
77
|
+
# config.fits_path = "fits.sh"
|
|
78
|
+
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
Date::DATE_FORMATS[:standard] = "%m/%d/%Y"
|
data/sufia-models/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class ActsAsFollowerMigration < ActiveRecord::Migration
|
|
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
|
|
7
|
+
t.timestamps
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
add_index :follows, ["follower_id", "follower_type"], :name => "fk_follows"
|
|
11
|
+
add_index :follows, ["followable_id", "followable_type"], :name => "fk_followables"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.down
|
|
15
|
+
drop_table :follows
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class AddGroupsToUsers < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :group_list, :text
|
|
4
|
+
add_column :users, :groups_last_update, :datetime
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.down
|
|
8
|
+
remove_column :users, :group_list
|
|
9
|
+
remove_column :users, :groups_last_update
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class AddLdapAttrsToUser < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :display_name, :string
|
|
4
|
+
add_column :users, :address, :string
|
|
5
|
+
add_column :users, :admin_area, :string
|
|
6
|
+
add_column :users, :department, :string
|
|
7
|
+
add_column :users, :title, :string
|
|
8
|
+
add_column :users, :office, :string
|
|
9
|
+
add_column :users, :chat_id, :string
|
|
10
|
+
add_column :users, :website, :string
|
|
11
|
+
add_column :users, :affiliation, :string
|
|
12
|
+
add_column :users, :telephone, :string
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.down
|
|
16
|
+
remove_column :users, :display_name
|
|
17
|
+
remove_column :users, :address
|
|
18
|
+
remove_column :users, :admin_area
|
|
19
|
+
remove_column :users, :department
|
|
20
|
+
remove_column :users, :title
|
|
21
|
+
remove_column :users, :office
|
|
22
|
+
remove_column :users, :chat_id
|
|
23
|
+
remove_column :users, :website
|
|
24
|
+
remove_column :users, :affiliation
|
|
25
|
+
remove_column :users, :telephone
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddSocialToUsers < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :facebook_handle, :string
|
|
4
|
+
add_column :users, :twitter_handle, :string
|
|
5
|
+
add_column :users, :googleplus_handle, :string
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.down
|
|
9
|
+
remove_column :users, :facebook_handle, :string
|
|
10
|
+
remove_column :users, :twitter_handle, :string
|
|
11
|
+
remove_column :users, :googleplus_handle, :string
|
|
12
|
+
end
|
|
13
|
+
end
|
data/sufia-models/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class CreateChecksumAuditLogs < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :checksum_audit_logs do |t|
|
|
4
|
+
t.string :pid
|
|
5
|
+
t.string :dsid
|
|
6
|
+
t.string :version
|
|
7
|
+
t.integer :pass
|
|
8
|
+
t.string :expected_result
|
|
9
|
+
t.string :actual_result
|
|
10
|
+
t.timestamps
|
|
11
|
+
end
|
|
12
|
+
add_index :checksum_audit_logs, [:pid, :dsid], :name=>'by_pid_and_dsid', :order => {:created_at => "DESC" }
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.down
|
|
17
|
+
remove_index(:checksum_audit_logs, :name => 'by_pid_and_dsid')
|
|
18
|
+
drop_table :checksum_audit_logs
|
|
19
|
+
end
|
|
20
|
+
end
|
data/sufia-models/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
class CreateLocalAuthorities < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :local_authority_entries, :force => true do |t|
|
|
4
|
+
t.integer :local_authority_id
|
|
5
|
+
t.string :label
|
|
6
|
+
t.string :uri
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
create_table :local_authorities, :force => true do |t|
|
|
10
|
+
t.string :name, :unique => true
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
create_table :domain_terms, :force => true do |t|
|
|
14
|
+
t.string :model
|
|
15
|
+
t.string :term
|
|
16
|
+
end
|
|
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
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
create_table :subject_local_authority_entries, :force => true do |t|
|
|
24
|
+
t.string :label
|
|
25
|
+
t.string :lowerLabel
|
|
26
|
+
t.string :url
|
|
27
|
+
end
|
|
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'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.down
|
|
38
|
+
drop_table :local_authority_entries
|
|
39
|
+
drop_table :local_authorities
|
|
40
|
+
drop_table :domain_terms
|
|
41
|
+
drop_table :domain_terms_local_authorities
|
|
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'
|
|
49
|
+
end
|
|
50
|
+
end
|
data/sufia-models/lib/generators/sufia/models/templates/migrations/create_version_committers.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateVersionCommitters < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :version_committers do |t|
|
|
4
|
+
t.string :obj_id
|
|
5
|
+
t.string :datastream_id
|
|
6
|
+
t.string :version_id
|
|
7
|
+
t.string :committer_login
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.down
|
|
13
|
+
drop_table :version_committers
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module ActiveRecord
|
|
2
|
+
module DeprecatedAttrAccessible
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
module ClassMethods
|
|
5
|
+
def deprecated_attr_accessible(*args)
|
|
6
|
+
if Rails::VERSION::MAJOR < 4 || defined?(ProtectedAttributes)
|
|
7
|
+
ActiveSupport::Deprecation.warn("deprecated_attr_accessible is, wait for it, deprecated. It will be removed when Sufia stops support Rails 3.")
|
|
8
|
+
attr_accessible(*args)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
ActiveRecord::Base.class_eval do
|
|
15
|
+
include ActiveRecord::DeprecatedAttrAccessible
|
|
16
|
+
end
|
|
@@ -37,6 +37,7 @@ module Sufia
|
|
|
37
37
|
initializer "patches" do
|
|
38
38
|
require 'sufia/models/active_fedora/redis'
|
|
39
39
|
require 'sufia/models/active_record/redis'
|
|
40
|
+
require 'sufia/models/active_record/deprecated_attr_accessible'
|
|
40
41
|
require 'sufia/models/active_support/core_ext/marshal' unless Rails::VERSION::MAJOR == 4
|
|
41
42
|
end
|
|
42
43
|
|
|
@@ -46,13 +47,11 @@ module Sufia
|
|
|
46
47
|
require 'sufia/models/noid'
|
|
47
48
|
require 'sufia/models/file_content'
|
|
48
49
|
require 'sufia/models/file_content/versions'
|
|
49
|
-
require 'sufia/models/generic_file/actions'
|
|
50
50
|
require 'sufia/models/generic_file/audit'
|
|
51
51
|
require 'sufia/models/generic_file/characterization'
|
|
52
52
|
require 'sufia/models/generic_file/derivatives'
|
|
53
53
|
require 'sufia/models/generic_file/export'
|
|
54
54
|
require 'sufia/models/generic_file/mime_types'
|
|
55
|
-
require 'sufia/models/generic_file/permissions'
|
|
56
55
|
require 'sufia/models/generic_file/thumbnail'
|
|
57
56
|
require 'sufia/models/generic_file'
|
|
58
57
|
require 'sufia/models/user'
|
|
@@ -4,26 +4,13 @@ module Sufia
|
|
|
4
4
|
extend ActiveSupport::Concern
|
|
5
5
|
#we're overriding the permissions= method which is in RightsMetadata
|
|
6
6
|
include Hydra::ModelMixins::RightsMetadata
|
|
7
|
+
include Sufia::GenericFile::Visibility
|
|
8
|
+
|
|
7
9
|
included do
|
|
8
10
|
has_metadata :name => "rightsMetadata", :type => ParanoidRightsDatastream
|
|
9
11
|
validate :paranoid_permissions
|
|
10
12
|
end
|
|
11
13
|
|
|
12
|
-
def set_visibility(visibility)
|
|
13
|
-
# only set explicit permissions
|
|
14
|
-
case visibility
|
|
15
|
-
when "open"
|
|
16
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"public"}, "read")
|
|
17
|
-
when "psu"
|
|
18
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"registered"}, "read")
|
|
19
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"public"}, "none")
|
|
20
|
-
when "restricted"
|
|
21
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"registered"}, "none")
|
|
22
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"public"}, "none")
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
|
|
27
14
|
def paranoid_permissions
|
|
28
15
|
# let the rightsMetadata ds make this determination
|
|
29
16
|
# - the object instance is passed in for easier access to the props ds
|
|
@@ -57,8 +44,6 @@ module Sufia
|
|
|
57
44
|
end
|
|
58
45
|
{'person'=>user_perms, 'group'=>group_perms}
|
|
59
46
|
end
|
|
60
|
-
|
|
61
|
-
|
|
62
47
|
end
|
|
63
48
|
end
|
|
64
49
|
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module Sufia
|
|
2
|
+
module GenericFile
|
|
3
|
+
module Visibility
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
extend Deprecation
|
|
6
|
+
|
|
7
|
+
def visibility=(value)
|
|
8
|
+
return if value.nil?
|
|
9
|
+
# only set explicit permissions
|
|
10
|
+
case value
|
|
11
|
+
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
|
12
|
+
public_visibility!
|
|
13
|
+
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
|
14
|
+
registered_visibility!
|
|
15
|
+
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
|
16
|
+
private_visibility!
|
|
17
|
+
else
|
|
18
|
+
raise ArgumentError, "Invalid visibility: #{value.inspect}"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def visibility
|
|
23
|
+
if read_groups.include? Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC
|
|
24
|
+
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
|
25
|
+
elsif read_groups.include? Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED
|
|
26
|
+
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
|
27
|
+
else
|
|
28
|
+
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def set_visibility(visibility)
|
|
33
|
+
Deprecation.warn Visibility, "set_visibility is deprecated, use visibility= instead. set_visibility will be removed in sufia 3.0", caller
|
|
34
|
+
self.visibility= visibility
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def visibility_changed?
|
|
38
|
+
@visibility_will_change
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
def visibility_will_change!
|
|
43
|
+
@visibility_will_change = true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def public_visibility!
|
|
47
|
+
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
|
48
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "read")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def registered_visibility!
|
|
52
|
+
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
|
53
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "read")
|
|
54
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def private_visibility!
|
|
58
|
+
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
|
59
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "none")
|
|
60
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -2,8 +2,9 @@ module Sufia
|
|
|
2
2
|
module GenericFile
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
extend ActiveSupport::Autoload
|
|
5
|
-
autoload :Actions
|
|
6
|
-
autoload :Permissions
|
|
5
|
+
autoload :Actions, 'sufia/models/generic_file/actions'
|
|
6
|
+
autoload :Permissions, 'sufia/models/generic_file/permissions'
|
|
7
|
+
autoload :Visibility, 'sufia/models/generic_file/visibility'
|
|
7
8
|
autoload :WebForm, 'sufia/models/generic_file/web_form'
|
|
8
9
|
autoload :AccessibleAttributes, 'sufia/models/generic_file/accessible_attributes'
|
|
9
10
|
include Sufia::ModelMethods
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
require 'noid'
|
|
16
2
|
|
|
17
3
|
module Sufia
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
class AuditJob < ActiveFedoraPidBasedJob
|
|
16
2
|
def queue_name
|
|
17
3
|
:audit
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
class BatchUpdateJob
|
|
16
2
|
include Hydra::PermissionsQuery
|
|
17
3
|
include Rails.application.routes.url_helpers
|
|
@@ -44,10 +30,10 @@ class BatchUpdateJob
|
|
|
44
30
|
|
|
45
31
|
job_user = User.batchuser()
|
|
46
32
|
|
|
47
|
-
message = '<
|
|
33
|
+
message = '<span class="batchid ui-helper-hidden">ss-'+batch.noid+'</span>The file(s) '+ file_list(@saved)+ " have been saved." unless @saved.empty?
|
|
48
34
|
job_user.send_message(user, message, 'Batch upload complete') unless @saved.empty?
|
|
49
35
|
|
|
50
|
-
message = '<
|
|
36
|
+
message = '<span class="batchid ui-helper-hidden">'+batch.noid+'</span>The file(s) '+ file_list(@denied)+" could not be updated. You do not have sufficient privileges to edit it." unless @denied.empty?
|
|
51
37
|
job_user.send_message(user, message, 'Batch upload permission denied') unless @denied.empty?
|
|
52
38
|
|
|
53
39
|
end
|
|
@@ -60,7 +46,7 @@ class BatchUpdateJob
|
|
|
60
46
|
end
|
|
61
47
|
gf.title = title[gf.pid] if title[gf.pid] rescue gf.label
|
|
62
48
|
gf.attributes=file_attributes
|
|
63
|
-
gf.
|
|
49
|
+
gf.visibility= visibility
|
|
64
50
|
|
|
65
51
|
save_tries = 0
|
|
66
52
|
begin
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
class CharacterizeJob < ActiveFedoraPidBasedJob
|
|
16
2
|
|
|
17
3
|
def queue_name
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
class ResolrizeJob
|
|
16
2
|
def queue_name
|
|
17
3
|
:resolrize
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
class UnzipJob < ActiveFedoraPidBasedJob
|
|
16
2
|
def queue_name
|
|
17
3
|
:unzip
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
module Sufia
|
|
16
2
|
module Noid
|
|
17
3
|
def Noid.noidify(identifier)
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
# -*- encoding : utf-8 -*-
|
|
16
2
|
module Sufia
|
|
17
3
|
module SolrDocumentBehavior
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
module Sufia::User
|
|
16
2
|
extend ActiveSupport::Concern
|
|
17
3
|
|
|
@@ -33,7 +19,7 @@ module Sufia::User
|
|
|
33
19
|
acts_as_followable
|
|
34
20
|
|
|
35
21
|
# Setup accessible (or protected) attributes for your model
|
|
36
|
-
|
|
22
|
+
deprecated_attr_accessible *permitted_attributes
|
|
37
23
|
|
|
38
24
|
# Add user avatar (via paperclip library)
|
|
39
25
|
has_attached_file :avatar, :styles => { medium: "300x300>", thumb: "100x100>" }, :default_url => '/assets/missing_:style.png'
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
1
|
module Sufia
|
|
16
2
|
module Utils
|
|
17
3
|
extend ActiveSupport::Concern
|