sufia 7.3.0.rc2 → 7.3.0.rc3
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/.rubocop_todo.yml +1 -0
- data/README.md +12 -2
- data/app/services/sufia/admin_set_create_service.rb +29 -2
- data/lib/sufia/version.rb +1 -1
- data/lib/tasks/default_admin_set.rake +8 -0
- data/lib/tasks/migrate.rake +2 -2
- data/spec/services/sufia/admin_set_create_service_spec.rb +18 -1
- data/sufia.gemspec +1 -0
- data/template.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac8c45d5973e94def8f5a7d7d2241e6d8e492a6
|
4
|
+
data.tar.gz: ff143be07e8ca19044b9cade1910e1843cd80b78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce1118d2b2269c1eee9ff03dc78bc32bc4790fb0847ec26c62729596956b56013cb2289efa7c9856238522bd3a4e14ea184e2895fd5e90da6a296646d5496031
|
7
|
+
data.tar.gz: 36f2c7e153ed19f9f1034bb9364849bcbd262d89d4b47b6a5bfaa98d142655901f2bd433318f2aea01093a7220154f8b4541efd1cad0f636849aa6a39441fd93
|
data/.rubocop_todo.yml
CHANGED
@@ -81,6 +81,7 @@ RSpec/ExampleLength:
|
|
81
81
|
- 'spec/models/generic_work_spec.rb'
|
82
82
|
- 'spec/models/featured_work_spec.rb'
|
83
83
|
- 'spec/services/sufia/actor_factory_spec.rb'
|
84
|
+
- 'spec/services/sufia/admin_set_create_service_spec.rb'
|
84
85
|
- 'spec/services/sufia/user_stat_importer_spec.rb'
|
85
86
|
- 'spec/views/catalog/_index_list_default.html.erb_spec.rb'
|
86
87
|
- 'spec/views/collections/_form.html.erb_spec.rb'
|
data/README.md
CHANGED
@@ -68,8 +68,8 @@ After installing the Prerequisites:
|
|
68
68
|
|
69
69
|
Sufia 7.x requires the following software to work:
|
70
70
|
|
71
|
-
1. [Solr](http://lucene.apache.org/solr/) version >= 5.x (tested up to 6.
|
72
|
-
1. [Fedora Commons](http://www.fedora-commons.org/) digital repository version >= 4.5.1 (tested up to 4.7.
|
71
|
+
1. [Solr](http://lucene.apache.org/solr/) version >= 5.x (tested up to 6.4.1)
|
72
|
+
1. [Fedora Commons](http://www.fedora-commons.org/) digital repository version >= 4.5.1 (tested up to 4.7.1)
|
73
73
|
1. A SQL RDBMS (MySQL, PostgreSQL), though **note** that SQLite will be used by default if you're looking to get up and running quickly
|
74
74
|
1. [Redis](http://redis.io/), a key-value store
|
75
75
|
1. [ImageMagick](http://www.imagemagick.org/) with JPEG-2000 support
|
@@ -161,6 +161,16 @@ rake hydra:server
|
|
161
161
|
|
162
162
|
And now you should be able to browse to [localhost:3000](http://localhost:3000/) and see the application. Note that this web server is purely for development purposes; you will want to use a more fully featured [web server](#web-server) for production-like environments.
|
163
163
|
|
164
|
+
## Add Default Admin Set
|
165
|
+
|
166
|
+
After Fedora and Solr are running, create the default administrative set by running the following rake task:
|
167
|
+
|
168
|
+
```
|
169
|
+
rake sufia:default_admin_set:create
|
170
|
+
```
|
171
|
+
|
172
|
+
You will want to run this command the first time this code is deployed to a new environment as well.
|
173
|
+
|
164
174
|
# Managing a Sufia-based app
|
165
175
|
|
166
176
|
The [Sufia Management Guide](https://github.com/projecthydra/sufia/wiki/Sufia-Management-Guide) provides tips for how to manage, customize, and enhance your Sufia application, including guidance specific to:
|
@@ -1,6 +1,21 @@
|
|
1
1
|
module Sufia
|
2
2
|
# Creates AdminSets
|
3
3
|
class AdminSetCreateService
|
4
|
+
DEFAULT_ID = 'admin_sets/default'.freeze
|
5
|
+
|
6
|
+
def self.create_default!
|
7
|
+
return if AdminSet.exists?(DEFAULT_ID)
|
8
|
+
admin_set = AdminSet.new(id: DEFAULT_ID, title: ['Default Admin Set'])
|
9
|
+
begin
|
10
|
+
new(admin_set, nil).create
|
11
|
+
rescue ActiveFedora::IllegalOperation
|
12
|
+
# It is possible that another thread created the AdminSet just before this method
|
13
|
+
# was called, so ActiveFedora will raise IllegalOperation. In this case we can safely
|
14
|
+
# ignore the error.
|
15
|
+
Rails.logger.error("AdminSet ID=#{DEFAULT_ID} may or may not have been created due to threading issues.")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
4
19
|
# @param admin_set [AdminSet] the admin set to operate on
|
5
20
|
# @param creating_user [User] the user who created the admin set.
|
6
21
|
def initialize(admin_set, creating_user)
|
@@ -15,8 +30,20 @@ module Sufia
|
|
15
30
|
def create
|
16
31
|
admin_set.read_groups = ['public']
|
17
32
|
admin_set.edit_groups = ['admin']
|
18
|
-
admin_set.creator = [creating_user.user_key]
|
19
|
-
admin_set.save
|
33
|
+
admin_set.creator = [creating_user.user_key] if creating_user
|
34
|
+
admin_set.save.tap do |result|
|
35
|
+
create_permission_template if result
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def access_grants_attributes
|
40
|
+
return [] unless creating_user
|
41
|
+
[{ agent_type: 'user', agent_id: creating_user.user_key, access: 'manage' }]
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_permission_template
|
45
|
+
PermissionTemplate.create!(admin_set_id: admin_set.id,
|
46
|
+
access_grants_attributes: access_grants_attributes)
|
20
47
|
end
|
21
48
|
end
|
22
49
|
end
|
data/lib/sufia/version.rb
CHANGED
data/lib/tasks/migrate.rake
CHANGED
@@ -5,8 +5,8 @@ namespace :sufia do
|
|
5
5
|
MoveAllWorksToAdminSet.run(AdminSet.find(Sufia::DefaultAdminSetActor::DEFAULT_ID))
|
6
6
|
end
|
7
7
|
|
8
|
-
desc "Migrate data from 7.
|
9
|
-
task
|
8
|
+
desc "Migrate workflow data from 7.3.0.rc1"
|
9
|
+
task from_7_3_0rc1_release: :environment do
|
10
10
|
logger = Logger.new(STDOUT)
|
11
11
|
logger.level = Logger::DEBUG
|
12
12
|
logger.info(%(Starting migration to Sufia 7.3.0 in preparation for Hyrax 1.0.0))
|
@@ -9,12 +9,16 @@ RSpec.describe Sufia::AdminSetCreateService do
|
|
9
9
|
subject { service.create }
|
10
10
|
|
11
11
|
context "when the admin_set is valid" do
|
12
|
-
|
12
|
+
let(:permission_template) { Sufia::PermissionTemplate.find_by(admin_set_id: admin_set.id) }
|
13
|
+
let(:grant) { permission_template.access_grants.first }
|
14
|
+
it "creates an AdminSet, PermissionTemplate, and sets access" do
|
13
15
|
expect do
|
14
16
|
expect(subject).to be true
|
15
17
|
end.to change { admin_set.persisted? }.from(false).to(true)
|
16
18
|
expect(admin_set.read_groups).to eq ['public']
|
17
19
|
expect(admin_set.edit_groups).to eq ['admin']
|
20
|
+
expect(grant.agent_id).to eq user.user_key
|
21
|
+
expect(grant.access).to eq 'manage'
|
18
22
|
expect(admin_set.creator).to eq [user.user_key]
|
19
23
|
end
|
20
24
|
end
|
@@ -24,4 +28,17 @@ RSpec.describe Sufia::AdminSetCreateService do
|
|
24
28
|
it { is_expected.to be false }
|
25
29
|
end
|
26
30
|
end
|
31
|
+
|
32
|
+
describe '.create_default!' do
|
33
|
+
let(:default_admin_set_id) { 'admin_sets/default' }
|
34
|
+
let(:permission_template) { Sufia::PermissionTemplate.find_by!(admin_set_id: default_admin_set_id) }
|
35
|
+
# It is important to test the side-effects as a default admin set is a fundamental assumption for Sufia >= 7.3
|
36
|
+
it 'creates AdminSet, PermissionTemplate' do
|
37
|
+
expect(AdminSet).not_to exist(default_admin_set_id)
|
38
|
+
described_class.create_default!
|
39
|
+
admin_set = AdminSet.find(default_admin_set_id)
|
40
|
+
expect(admin_set).to be_persisted
|
41
|
+
expect(permission_template).to be_persisted
|
42
|
+
end
|
43
|
+
end
|
27
44
|
end
|
data/sufia.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.version = Sufia::VERSION
|
19
19
|
spec.license = 'Apache2'
|
20
20
|
|
21
|
+
spec.add_dependency 'hydra-works', '~> 0.16'
|
21
22
|
spec.add_dependency 'curation_concerns', '~> 1.7.5'
|
22
23
|
spec.add_dependency 'hydra-head', '>= 10.4.0'
|
23
24
|
spec.add_dependency 'hydra-batch-edit', '~> 2.0'
|
data/template.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sufia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.3.0.
|
4
|
+
version: 7.3.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -14,6 +14,20 @@ bindir: bin
|
|
14
14
|
cert_chain: []
|
15
15
|
date: 2017-03-02 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: hydra-works
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "~>"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0.16'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0.16'
|
17
31
|
- !ruby/object:Gem::Dependency
|
18
32
|
name: curation_concerns
|
19
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1340,6 +1354,7 @@ files:
|
|
1340
1354
|
- lib/sufia/version.rb
|
1341
1355
|
- lib/sufia/zotero.rb
|
1342
1356
|
- lib/sufia/zotero/config.rb
|
1357
|
+
- lib/tasks/default_admin_set.rake
|
1343
1358
|
- lib/tasks/migrate.rake
|
1344
1359
|
- solr/config/_rest_managed.json
|
1345
1360
|
- solr/config/admin-extra.html
|