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
|
@@ -1,85 +1,46 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
2
|
require 'rails/generators'
|
|
3
|
-
require 'rails/generators/migration'
|
|
3
|
+
require 'rails/generators/migration'
|
|
4
4
|
|
|
5
5
|
class SufiaGenerator < Rails::Generators::Base
|
|
6
6
|
include Rails::Generators::Migration
|
|
7
7
|
|
|
8
8
|
source_root File.expand_path('../templates', __FILE__)
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
argument :model_name, :type => :string , :default => "user"
|
|
11
11
|
desc """
|
|
12
12
|
This generator makes the following changes to your application:
|
|
13
|
-
1.
|
|
14
|
-
2. Adds
|
|
15
|
-
3.
|
|
16
|
-
|
|
17
|
-
5. Copies the catalog controller into the local app
|
|
18
|
-
6. Adds Sufia::SolrDocumentBehavior to app/models/solr_document.rb
|
|
19
|
-
7. Generates mailboxer
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
# Implement the required interface for Rails::Generators::Migration.
|
|
23
|
-
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
|
24
|
-
def self.next_migration_number(path)
|
|
25
|
-
unless @prev_migration_nr
|
|
26
|
-
@prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
|
27
|
-
else
|
|
28
|
-
@prev_migration_nr += 1
|
|
29
|
-
end
|
|
30
|
-
@prev_migration_nr.to_s
|
|
31
|
-
end
|
|
13
|
+
1. Runs sufia-models:install
|
|
14
|
+
2. Adds controller behavior to the application controller
|
|
15
|
+
3. Copies the catalog controller into the local app
|
|
16
|
+
"""
|
|
32
17
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
add_avatars_to_users.rb create_checksum_audit_logs.rb create_version_committers.rb
|
|
38
|
-
add_groups_to_users.rb create_local_authorities.rb create_trophies.rb}.each do |f|
|
|
39
|
-
better_migration_template f
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# Add behaviors to the user model
|
|
44
|
-
def inject_sufia_user_behavior
|
|
45
|
-
file_path = "app/models/#{model_name.underscore}.rb"
|
|
46
|
-
if File.exists?(file_path)
|
|
47
|
-
inject_into_class file_path, model_name.classify do
|
|
48
|
-
"# Connects this user object to Sufia behaviors. " +
|
|
49
|
-
"\n include Sufia::User\n"
|
|
50
|
-
end
|
|
51
|
-
else
|
|
52
|
-
puts " \e[31mFailure\e[0m Sufia requires a user object. 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 sufia client"
|
|
53
|
-
end
|
|
18
|
+
def run_required_generators
|
|
19
|
+
generate "blacklight --devise"
|
|
20
|
+
generate "hydra:head -f"
|
|
21
|
+
generate "sufia:models:install"
|
|
54
22
|
end
|
|
55
23
|
|
|
56
24
|
# Add behaviors to the application controller
|
|
57
|
-
def inject_sufia_controller_behavior
|
|
25
|
+
def inject_sufia_controller_behavior
|
|
58
26
|
controller_name = "ApplicationController"
|
|
59
27
|
file_path = "app/controllers/application_controller.rb"
|
|
60
|
-
if File.exists?(file_path)
|
|
61
|
-
insert_into_file file_path, :after => 'include Blacklight::Controller' do
|
|
62
|
-
" \n# Adds Sufia behaviors into the application controller \n" +
|
|
28
|
+
if File.exists?(file_path)
|
|
29
|
+
insert_into_file file_path, :after => 'include Blacklight::Controller' do
|
|
30
|
+
" \n# Adds Sufia behaviors into the application controller \n" +
|
|
63
31
|
" include Sufia::Controller\n"
|
|
64
32
|
end
|
|
65
33
|
gsub_file file_path, "layout 'blacklight'", "layout :search_layout"
|
|
66
34
|
else
|
|
67
|
-
puts " \e[31mFailure\e[0m Could not find #{file_path}. To add Sufia behaviors to your Controllers, you must include the Sufia::Controller module in the Controller class definition."
|
|
35
|
+
puts " \e[31mFailure\e[0m Could not find #{file_path}. To add Sufia behaviors to your Controllers, you must include the Sufia::Controller module in the Controller class definition."
|
|
68
36
|
end
|
|
69
37
|
end
|
|
70
|
-
|
|
71
|
-
def create_configuration_files
|
|
72
|
-
copy_file "config/sufia.rb", "config/initializers/sufia.rb"
|
|
73
|
-
copy_file "config/redis.yml", "config/redis.yml"
|
|
74
|
-
copy_file "config/redis_config.rb", "config/initializers/redis_config.rb"
|
|
75
|
-
copy_file "config/resque_admin.rb", "config/initializers/resque_admin.rb"
|
|
76
|
-
copy_file "config/resque_config.rb", "config/initializers/resque_config.rb"
|
|
77
|
-
end
|
|
38
|
+
|
|
78
39
|
|
|
79
40
|
def catalog_controller
|
|
80
41
|
copy_file "catalog_controller.rb", "app/controllers/catalog_controller.rb"
|
|
81
42
|
end
|
|
82
|
-
|
|
43
|
+
|
|
83
44
|
|
|
84
45
|
# The engine routes have to come after the devise routes so that /users/sign_in will work
|
|
85
46
|
def inject_routes
|
|
@@ -92,37 +53,9 @@ add_groups_to_users.rb create_local_authorities.rb create_trophies.rb}.each do
|
|
|
92
53
|
mount Sufia::Engine => '/'\n"
|
|
93
54
|
sentinel = /devise_for :users/
|
|
94
55
|
inject_into_file 'config/routes.rb', routing_code, { :after => sentinel, :verbose => false }
|
|
95
|
-
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
# Add behaviors to the SolrDocument model
|
|
99
|
-
def inject_sufia_solr_document_behavior
|
|
100
|
-
file_path = "app/models/solr_document.rb"
|
|
101
|
-
if File.exists?(file_path)
|
|
102
|
-
inject_into_class file_path, "SolrDocument" do
|
|
103
|
-
" # Adds Sufia behaviors to the SolrDocument.\n" +
|
|
104
|
-
" include Sufia::SolrDocumentBehavior\n"
|
|
105
|
-
end
|
|
106
|
-
else
|
|
107
|
-
puts " \e[31mFailure\e[0m Sufia requires a SolrDocument object. This generators assumes that the model is defined in the file #{file_path}, which does not exist."
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
56
|
|
|
111
|
-
def install_mailboxer
|
|
112
|
-
generate "mailboxer:install"
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
private
|
|
116
|
-
|
|
117
|
-
def better_migration_template (file)
|
|
118
|
-
begin
|
|
119
|
-
migration_template "migrations/#{file}", "db/migrate/#{file}"
|
|
120
|
-
sleep 1 # ensure scripts have different time stamps
|
|
121
|
-
rescue
|
|
122
|
-
puts " \e[1m\e[34mMigrations\e[0m " + $!.message
|
|
123
|
-
end
|
|
124
57
|
end
|
|
125
58
|
|
|
126
|
-
end
|
|
59
|
+
end
|
|
127
60
|
|
|
128
61
|
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
|
|
16
2
|
# -*- encoding : utf-8 -*-
|
|
17
3
|
require 'blacklight/catalog'
|
|
18
4
|
require 'blacklight_advanced_search'
|
|
@@ -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 ActionDispatch
|
|
16
2
|
module Http
|
|
17
3
|
class UploadedFile
|
|
@@ -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 ActsAsFollowerMigration < ActiveRecord::Migration
|
|
16
2
|
def self.up
|
|
17
3
|
create_table :follows, :force => true do |t|
|
|
@@ -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 AddAvatarsToUsers < ActiveRecord::Migration
|
|
16
2
|
def self.up
|
|
17
3
|
add_attachment :users, :avatar
|
|
@@ -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 AddGroupsToUsers < ActiveRecord::Migration
|
|
16
2
|
def self.up
|
|
17
3
|
add_column :users, :group_list, :text
|
|
@@ -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 AddLdapAttrsToUser < ActiveRecord::Migration
|
|
16
2
|
def self.up
|
|
17
3
|
add_column :users, :display_name, :string
|
|
@@ -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 AddSocialToUsers < ActiveRecord::Migration
|
|
16
2
|
def self.up
|
|
17
3
|
add_column :users, :facebook_handle, :string
|
|
@@ -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 CreateChecksumAuditLogs < ActiveRecord::Migration
|
|
16
2
|
def self.up
|
|
17
3
|
create_table :checksum_audit_logs do |t|
|
|
@@ -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 CreateLocalAuthorities < ActiveRecord::Migration
|
|
16
2
|
def self.up
|
|
17
3
|
create_table :local_authority_entries, :force => true do |t|
|
|
@@ -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 CreateVersionCommitters < ActiveRecord::Migration
|
|
16
2
|
def self.up
|
|
17
3
|
create_table :version_committers do |t|
|
|
@@ -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 ContactFormControllerBehavior
|
|
17
3
|
|
data/lib/sufia/controller.rb
CHANGED
|
@@ -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::Controller
|
|
16
2
|
extend ActiveSupport::Concern
|
|
17
3
|
|
|
@@ -53,7 +39,7 @@ module Sufia::Controller
|
|
|
53
39
|
return if action_name == "index" && controller_name == "mailbox"
|
|
54
40
|
if user_signed_in?
|
|
55
41
|
@notify_number= current_user.mailbox.inbox(:unread => true).count
|
|
56
|
-
@batches=current_user.mailbox.inbox.map {|msg| msg.last_message.body[/<
|
|
42
|
+
@batches=current_user.mailbox.inbox.map {|msg| msg.last_message.body[/<span class="batchid ui-helper-hidden">(.*)<\/span>The file(.*)/,1]}.select{|val| !val.blank?}
|
|
57
43
|
end
|
|
58
44
|
end
|
|
59
45
|
|
|
@@ -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 DownloadsControllerBehavior
|
|
17
3
|
extend ActiveSupport::Concern
|
|
@@ -3,5 +3,10 @@ module Sufia
|
|
|
3
3
|
def upload_complete_path(batch_id)
|
|
4
4
|
Sufia::Engine.routes.url_helpers.batch_edit_path(batch_id)
|
|
5
5
|
end
|
|
6
|
+
|
|
7
|
+
def destroy_complete_path(params)
|
|
8
|
+
Sufia::Engine.routes.url_helpers.dashboard_index_path
|
|
9
|
+
end
|
|
10
|
+
|
|
6
11
|
end # /FilesController::UploadCompleteBehavior
|
|
7
12
|
end # /Sufia
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
|
|
16
1
|
module Sufia
|
|
17
2
|
module FilesController
|
|
18
3
|
autoload :LocalIngestBehavior, 'sufia/files_controller/local_ingest_behavior'
|
|
@@ -72,7 +57,7 @@ module Sufia
|
|
|
72
57
|
pid = @generic_file.noid
|
|
73
58
|
@generic_file.destroy
|
|
74
59
|
Sufia.queue.push(ContentDeleteEventJob.new(pid, current_user.user_key))
|
|
75
|
-
redirect_to
|
|
60
|
+
redirect_to self.class.destroy_complete_path(params), :notice => render_to_string(:partial=>'generic_files/asset_deleted_flash', :locals => { :generic_file => @generic_file })
|
|
76
61
|
end
|
|
77
62
|
|
|
78
63
|
# routed to /files (POST)
|
|
@@ -182,6 +167,7 @@ module Sufia
|
|
|
182
167
|
|
|
183
168
|
protected
|
|
184
169
|
|
|
170
|
+
|
|
185
171
|
def json_error(error, name=nil, additional_arguments={})
|
|
186
172
|
args = {:error => error}
|
|
187
173
|
args[:name] = name if name
|
|
@@ -241,7 +227,7 @@ module Sufia
|
|
|
241
227
|
# this is provided so that implementing application can override this behavior and map params to different attributes
|
|
242
228
|
def update_metadata
|
|
243
229
|
@generic_file.attributes = @generic_file.sanitize_attributes(params[:generic_file])
|
|
244
|
-
@generic_file.
|
|
230
|
+
@generic_file.visibility = params[:visibility]
|
|
245
231
|
@generic_file.date_modified = DateTime.now
|
|
246
232
|
end
|
|
247
233
|
|
data/lib/sufia/role_mapper.rb
CHANGED
|
@@ -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 RoleMapper
|
|
16
2
|
def self.roles(uid)
|
|
17
3
|
u = User.find_by_login(uid)
|
data/lib/sufia/version.rb
CHANGED
data/lib/tasks/fixtures.rake
CHANGED
|
@@ -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
|
# sufia-fixtures
|
|
16
2
|
#
|
|
17
3
|
# This was extracted from the original Hydra version in
|
|
@@ -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
|
# Read about factories at http://github.com/thoughtbot/factory_girl
|
|
16
2
|
|
|
17
3
|
FactoryGirl.define do
|
|
@@ -9,6 +9,10 @@ class UploadThingRedefine
|
|
|
9
9
|
return "example.com"
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
def self.destroy_complete_path(id)
|
|
13
|
+
return "destroy.com"
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
describe Sufia::FilesController::UploadCompleteBehavior do
|
|
@@ -17,10 +21,16 @@ describe Sufia::FilesController::UploadCompleteBehavior do
|
|
|
17
21
|
it "respond with the batch edit path" do
|
|
18
22
|
UploadThing.upload_complete_path(test_id).should == Sufia::Engine.routes.url_helpers.batch_edit_path(test_id)
|
|
19
23
|
end
|
|
24
|
+
it "respond with the dashboard path" do
|
|
25
|
+
UploadThing.destroy_complete_path({}).should == Sufia::Engine.routes.url_helpers.dashboard_index_path
|
|
26
|
+
end
|
|
20
27
|
end
|
|
21
28
|
context "overriden path" do
|
|
22
29
|
it "respond with the batch edit path" do
|
|
23
30
|
UploadThingRedefine.upload_complete_path(test_id).should == "example.com"
|
|
24
31
|
end
|
|
32
|
+
it "respond with the batch edit path" do
|
|
33
|
+
UploadThingRedefine.destroy_complete_path(test_id).should == "destroy.com"
|
|
34
|
+
end
|
|
25
35
|
end
|
|
26
36
|
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sufia::Models::AccessRight do
|
|
4
|
+
[
|
|
5
|
+
[false, Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC, nil, nil, true, false, false, false],
|
|
6
|
+
[false, Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED, nil, nil, true, false, false, false],
|
|
7
|
+
[false, nil, nil, nil, true, false, false, false],
|
|
8
|
+
[false, nil, nil, 2.days.from_now, false, false, false, true],
|
|
9
|
+
[false, nil, nil, 2.days.ago, false, false, false, true],
|
|
10
|
+
[false, nil, Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, nil, true, false, false, false],
|
|
11
|
+
[false, nil, Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED, nil, false, true, false, false],
|
|
12
|
+
[false, nil, Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, nil, false, false, true, false],
|
|
13
|
+
[false, nil, Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO, nil, false, false, false, true],
|
|
14
|
+
[true, Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC, nil, nil, true, false, false, false],
|
|
15
|
+
[true, Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC, nil, 2.days.from_now, false, false, false, true],
|
|
16
|
+
[true, Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC, nil, 2.days.ago, false, false, false, true],
|
|
17
|
+
[true, Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED, nil, nil, false, true, false, false],
|
|
18
|
+
[true, nil, nil, nil, false, false, true, false],
|
|
19
|
+
[true, nil, Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, nil, true, false, false, false],
|
|
20
|
+
[true, nil, Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED, nil, false, true, false, false],
|
|
21
|
+
[true, nil, Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, nil, false, false, true, false],
|
|
22
|
+
[true, nil, Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO, nil, false, false, false, true],
|
|
23
|
+
].each do |given_persisted, givin_permission, given_visibility, given_embargo_release_date, expected_open_access, expected_authentication_only, expected_private, expected_open_access_with_embargo_release_date|
|
|
24
|
+
spec_text = <<-TEXT
|
|
25
|
+
|
|
26
|
+
GIVEN: {
|
|
27
|
+
persisted: #{given_persisted.inspect},
|
|
28
|
+
permission: #{givin_permission.inspect},
|
|
29
|
+
visibility: #{given_visibility.inspect},
|
|
30
|
+
embargo_release_date: #{given_embargo_release_date}
|
|
31
|
+
},
|
|
32
|
+
EXPECTED: {
|
|
33
|
+
open_access: #{expected_open_access.inspect},
|
|
34
|
+
restricted: #{expected_authentication_only.inspect},
|
|
35
|
+
private: #{expected_private.inspect},
|
|
36
|
+
open_access_with_embargo_release_date: #{expected_open_access_with_embargo_release_date}
|
|
37
|
+
},
|
|
38
|
+
TEXT
|
|
39
|
+
|
|
40
|
+
it spec_text do
|
|
41
|
+
permissions = [{access: :edit, name: givin_permission}]
|
|
42
|
+
permissionable = double(
|
|
43
|
+
'permissionable',
|
|
44
|
+
permissions: permissions,
|
|
45
|
+
visibility: given_visibility,
|
|
46
|
+
persisted?: given_persisted,
|
|
47
|
+
embargo_release_date: given_embargo_release_date
|
|
48
|
+
)
|
|
49
|
+
access_right = Sufia::Models::AccessRight.new(permissionable)
|
|
50
|
+
|
|
51
|
+
expect(access_right.open_access?).to eq(expected_open_access)
|
|
52
|
+
expect(access_right.authenticated_only?).to eq(expected_authentication_only)
|
|
53
|
+
expect(access_right.private?).to eq(expected_private)
|
|
54
|
+
expect(access_right.open_access_with_embargo_release_date?).to eq(expected_open_access_with_embargo_release_date)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sufia::GenericFile::Visibility do
|
|
4
|
+
module VisibilityOverride
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
include Sufia::GenericFile::Permissions
|
|
7
|
+
def visibility; super; end
|
|
8
|
+
def visibility=(value); super(value); end
|
|
9
|
+
end
|
|
10
|
+
class MockParent < ActiveFedora::Base
|
|
11
|
+
include VisibilityOverride
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'allows for overrides of visibility' do
|
|
15
|
+
expect{
|
|
16
|
+
MockParent.new(visibility: Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE)
|
|
17
|
+
}.to_not raise_error
|
|
18
|
+
end
|
|
19
|
+
end
|