sufia 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +11 -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/generic_files/_permission_form.html.erb +3 -3
- data/db/seeds.rb +0 -14
- 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/contact_form_controller_behavior.rb +0 -14
- data/lib/sufia/controller.rb +0 -14
- 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 +2 -1
- 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_spec.rb +1 -1
- data/spec/support/uploaded_file_monkeypatch.rb +0 -14
- data/sufia-models/app/models/batch.rb +0 -14
- 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/follow.rb +0 -14
- data/sufia-models/app/models/subject_local_authority_entry.rb +0 -14
- data/sufia-models/lib/sufia/models/generic_file/visibility.rb +30 -26
- 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/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 +0 -14
- 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/tasks/sufia-db.rake +0 -14
- data/tasks/sufia-fixtures.rake +0 -14
- data/tasks/sufia.rake +0 -14
- metadata +8 -4
@@ -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
|
@@ -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
|
#Monkey patch UploadedFile so that it responds to read (same as ActionDispatch::Http::UploadedFile). Required by RestClient when posting to fedora.
|
16
2
|
class Rack::Test::UploadedFile
|
17
3
|
def read(*args)
|
@@ -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 Batch < ActiveFedora::Base
|
16
2
|
include Hydra::ModelMixins::CommonMetadata
|
17
3
|
include Hydra::ModelMixins::RightsMetadata
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Sufia
|
2
|
+
module Models
|
3
|
+
class AccessRight
|
4
|
+
PERMISSION_TEXT_VALUE_PUBLIC = 'public'.freeze
|
5
|
+
PERMISSION_TEXT_VALUE_AUTHENTICATED = 'registered'.freeze
|
6
|
+
VISIBILITY_TEXT_VALUE_PUBLIC = 'open'.freeze
|
7
|
+
VISIBILITY_TEXT_VALUE_EMBARGO = 'open_with_embargo_release_date'.freeze
|
8
|
+
VISIBILITY_TEXT_VALUE_AUTHENTICATED = 'psu'.freeze
|
9
|
+
VISIBILITY_TEXT_VALUE_PRIVATE = 'restricted'.freeze
|
10
|
+
|
11
|
+
# @param permissionable [#visibility, #permissions]
|
12
|
+
# @example
|
13
|
+
# file = GenericFile.find('sufia:1234')
|
14
|
+
# access = Sufia::AccessRight.new(file)
|
15
|
+
def initialize(permissionable)
|
16
|
+
@permissionable = permissionable
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_reader :permissionable
|
20
|
+
delegate :persisted?, :permissions, :visibility, to: :permissionable
|
21
|
+
protected :persisted?, :permissions, :visibility
|
22
|
+
|
23
|
+
|
24
|
+
def open_access?
|
25
|
+
return true if has_visibility_text_for?(VISIBILITY_TEXT_VALUE_PUBLIC)
|
26
|
+
# We don't want to know if its under embargo, simply does it have a date.
|
27
|
+
# In this way, we can properly inform the label input
|
28
|
+
persisted_open_access_permission? && !permissionable.embargo_release_date.present?
|
29
|
+
end
|
30
|
+
|
31
|
+
def open_access_with_embargo_release_date?
|
32
|
+
return false unless permissionable_is_embargoable?
|
33
|
+
return true if has_visibility_text_for?(VISIBILITY_TEXT_VALUE_EMBARGO)
|
34
|
+
# We don't want to know if its under embargo, simply does it have a date.
|
35
|
+
# In this way, we can properly inform the label input
|
36
|
+
persisted_open_access_permission? && permissionable.embargo_release_date.present?
|
37
|
+
end
|
38
|
+
|
39
|
+
def authenticated_only?
|
40
|
+
return false if open_access?
|
41
|
+
has_permission_text_for?(PERMISSION_TEXT_VALUE_AUTHENTICATED) ||
|
42
|
+
has_visibility_text_for?(VISIBILITY_TEXT_VALUE_AUTHENTICATED)
|
43
|
+
end
|
44
|
+
|
45
|
+
def private?
|
46
|
+
return false if open_access?
|
47
|
+
return false if authenticated_only?
|
48
|
+
return false if open_access_with_embargo_release_date?
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def persisted_open_access_permission?
|
55
|
+
if persisted?
|
56
|
+
has_permission_text_for?(PERMISSION_TEXT_VALUE_PUBLIC)
|
57
|
+
else
|
58
|
+
visibility.to_s == ''
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def on_or_after_any_embargo_release_date?
|
63
|
+
return true unless permissionable.embargo_release_date
|
64
|
+
permissionable.embargo_release_date.to_date < Date.today
|
65
|
+
end
|
66
|
+
|
67
|
+
def permissionable_is_embargoable?
|
68
|
+
permissionable.respond_to?(:embargo_release_date)
|
69
|
+
end
|
70
|
+
|
71
|
+
def has_visibility_text_for?(text)
|
72
|
+
visibility == text
|
73
|
+
end
|
74
|
+
def has_permission_text_for?(text)
|
75
|
+
!!permissions.detect { |perm| perm[:name] == text }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Sufia
|
2
|
+
module Models
|
3
|
+
module WithAccessRight
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def under_embargo?
|
7
|
+
@under_embargo ||= rightsMetadata.under_embargo?
|
8
|
+
end
|
9
|
+
|
10
|
+
def open_access?
|
11
|
+
access_rights.open_access?
|
12
|
+
end
|
13
|
+
|
14
|
+
def open_access_with_embargo_release_date?
|
15
|
+
access_rights.open_access_with_embargo_release_date?
|
16
|
+
end
|
17
|
+
|
18
|
+
def authenticated_only_access?
|
19
|
+
access_rights.authenticated_only?
|
20
|
+
end
|
21
|
+
|
22
|
+
def private_access?
|
23
|
+
access_rights.private?
|
24
|
+
end
|
25
|
+
|
26
|
+
def access_rights
|
27
|
+
@access_rights ||= AccessRight.new(self)
|
28
|
+
end
|
29
|
+
protected :access_rights
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -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 BatchRdfDatastream < ActiveFedora::NtriplesRDFDatastream
|
16
2
|
map_predicates do |map|
|
17
3
|
map.part(:to => "hasPart", :in => RDF::DC)
|
@@ -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 FitsDatastream < ActiveFedora::OmDatastream
|
16
2
|
include OM::XML::Document
|
17
3
|
|
@@ -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 GenericFileRdfDatastream < ActiveFedora::NtriplesRDFDatastream
|
16
2
|
map_predicates do |map|
|
17
3
|
map.part_of(:to => "isPartOf", :in => RDF::DC)
|
@@ -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
|
# properties datastream: catch-all for info that didn't have another home. Particularly depositor.
|
16
2
|
class PropertiesDatastream < ActiveFedora::OmDatastream
|
17
3
|
set_terminology 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 Follow < ActiveRecord::Base
|
16
2
|
|
17
3
|
extend ActsAsFollower::FollowerLib
|
@@ -1,16 +1,2 @@
|
|
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 SubjectLocalAuthorityEntry < ActiveRecord::Base
|
16
2
|
end
|
@@ -10,48 +10,52 @@ module Sufia
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def visibility= (value)
|
13
|
+
return if value.nil?
|
13
14
|
# only set explicit permissions
|
14
15
|
case value
|
15
|
-
when
|
16
|
+
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
16
17
|
public_visibility!
|
17
|
-
when
|
18
|
+
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
18
19
|
registered_visibility!
|
19
|
-
when
|
20
|
+
when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
20
21
|
private_visibility!
|
22
|
+
else
|
23
|
+
raise ArgumentError, "Invalid visibility: #{value.inspect}"
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
24
|
-
def public_visibility!
|
25
|
-
visibility_will_change! unless visibility == 'public'
|
26
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"public"}, "read")
|
27
|
-
end
|
28
|
-
|
29
|
-
def registered_visibility!
|
30
|
-
visibility_will_change! unless visibility == 'registered'
|
31
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"registered"}, "read")
|
32
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"public"}, "none")
|
33
|
-
end
|
34
|
-
|
35
|
-
def private_visibility!
|
36
|
-
visibility_will_change! unless visibility == 'private'
|
37
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"registered"}, "none")
|
38
|
-
self.datastreams["rightsMetadata"].permissions({:group=>"public"}, "none")
|
39
|
-
end
|
40
|
-
|
41
27
|
def visibility
|
42
|
-
if read_groups.include?
|
43
|
-
|
44
|
-
elsif read_groups.include?
|
45
|
-
|
28
|
+
if read_groups.include? Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC
|
29
|
+
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
30
|
+
elsif read_groups.include? Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED
|
31
|
+
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
46
32
|
else
|
47
|
-
|
33
|
+
Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
48
34
|
end
|
49
35
|
end
|
50
36
|
|
51
37
|
def set_visibility(visibility)
|
52
|
-
Deprecation.warn
|
38
|
+
Deprecation.warn Visibility, "set_visibility is deprecated, use visibility= instead. set_visibility will be removed in sufia 3.0", caller
|
53
39
|
self.visibility= visibility
|
54
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def public_visibility!
|
44
|
+
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
45
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "read")
|
46
|
+
end
|
47
|
+
|
48
|
+
def registered_visibility!
|
49
|
+
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
50
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "read")
|
51
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
|
52
|
+
end
|
53
|
+
|
54
|
+
def private_visibility!
|
55
|
+
visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
56
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "none")
|
57
|
+
self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
|
58
|
+
end
|
55
59
|
end
|
56
60
|
end
|
57
61
|
end
|
@@ -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
|