ddr-models 1.3.0 → 1.4.0
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/README.md +20 -3
- data/lib/ddr/models/has_content.rb +1 -3
- data/lib/ddr/models/version.rb +1 -1
- data/{app → spec/dummy/app}/models/solr_document.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +2449 -1445
- data/spec/dummy/log/test.log +58622 -52811
- data/spec/models/attachment_spec.rb +0 -6
- data/spec/spec_helper.rb +9 -2
- data/spec/support/shared_examples_for_has_content.rb +0 -7
- metadata +4 -24
- data/config/initializers/devise.rb~ +0 -245
- data/db/migrate/20141104181418_create_users.rb~ +0 -6
- data/lib/ddr/auth.rb~ +0 -47
- data/lib/ddr/auth/ability.rb~ +0 -204
- data/lib/ddr/auth/group_service.rb~ +0 -53
- data/lib/ddr/auth/grouper_service.rb~ +0 -77
- data/lib/ddr/auth/remote_group_service.rb~ +0 -35
- data/lib/ddr/auth/superuser.rb~ +0 -9
- data/lib/ddr/auth/user.rb~ +0 -65
- data/spec/factories/user_factories.rb~ +0 -7
- data/spec/features/grouper_integration_spec.rb~ +0 -21
- data/spec/models/ability_spec.rb~ +0 -245
- data/spec/models/superuser_spec.rb~ +0 -13
- data/spec/models/user_spec.rb~ +0 -56
- data/spec/services/group_service_spec.rb~ +0 -71
@@ -4,10 +4,4 @@ RSpec.describe Attachment, type: :model, attachments: true do
|
|
4
4
|
it_behaves_like "a DDR model"
|
5
5
|
it_behaves_like "an object that can have content"
|
6
6
|
it_behaves_like "it has an association", :belongs_to, :attached_to, :is_attached_to, "ActiveFedora::Base"
|
7
|
-
context "validations" do
|
8
|
-
before { subject.valid? }
|
9
|
-
it "should have content" do
|
10
|
-
expect(subject.errors.messages).to have_key(:content)
|
11
|
-
end
|
12
|
-
end
|
13
7
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
ENV['RAILS_ENV'] ||= "test"
|
2
2
|
|
3
|
+
require "coveralls"
|
4
|
+
Coveralls.wear!("rails")
|
5
|
+
|
3
6
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
4
7
|
|
5
8
|
require "ddr-models"
|
@@ -105,8 +108,12 @@ RSpec.configure do |config|
|
|
105
108
|
end
|
106
109
|
|
107
110
|
config.after(:suite) do
|
108
|
-
|
109
|
-
|
111
|
+
if Ddr::Models.external_file_store && Dir.exist?(Ddr::Models.external_file_store)
|
112
|
+
FileUtils.remove_entry_secure(Ddr::Models.external_file_store)
|
113
|
+
end
|
114
|
+
if Ddr::Models.minter_statefile && File.exist?(Ddr::Models.minter_statefile)
|
115
|
+
FileUtils.remove_entry_secure(Ddr::Models.minter_statefile)
|
116
|
+
end
|
110
117
|
end
|
111
118
|
|
112
119
|
config.after(:each) do
|
@@ -49,13 +49,6 @@ RSpec.shared_examples "an object that can have content" do
|
|
49
49
|
|
50
50
|
describe "save" do
|
51
51
|
|
52
|
-
describe "when content is not present" do
|
53
|
-
it "should not save" do
|
54
|
-
expect(object.save).to be false
|
55
|
-
expect(object.errors[:content]).to include "can't be blank"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
52
|
describe "when new content is present" do
|
60
53
|
|
61
54
|
context "and it's a new object" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -249,37 +249,27 @@ files:
|
|
249
249
|
- app/models/collection.rb
|
250
250
|
- app/models/component.rb
|
251
251
|
- app/models/item.rb
|
252
|
-
- app/models/solr_document.rb
|
253
252
|
- app/models/target.rb
|
254
253
|
- config/initializers/active_fedora_base.rb
|
255
254
|
- config/initializers/active_fedora_datastream.rb
|
256
255
|
- config/initializers/devise.rb
|
257
|
-
- config/initializers/devise.rb~
|
258
256
|
- config/initializers/subscriptions.rb
|
259
257
|
- config/routes.rb
|
260
258
|
- db/migrate/20141021233359_create_events.rb
|
261
259
|
- db/migrate/20141021234156_create_minted_ids.rb
|
262
260
|
- db/migrate/20141103192146_create_workflow_state.rb
|
263
261
|
- db/migrate/20141104181418_create_users.rb
|
264
|
-
- db/migrate/20141104181418_create_users.rb~
|
265
262
|
- db/migrate/20141107124012_add_columns_to_user.rb
|
266
263
|
- lib/ddr-models.rb
|
267
264
|
- lib/ddr/actions.rb
|
268
265
|
- lib/ddr/actions/fixity_check.rb
|
269
266
|
- lib/ddr/auth.rb
|
270
|
-
- lib/ddr/auth.rb~
|
271
267
|
- lib/ddr/auth/ability.rb
|
272
|
-
- lib/ddr/auth/ability.rb~
|
273
268
|
- lib/ddr/auth/group_service.rb
|
274
|
-
- lib/ddr/auth/group_service.rb~
|
275
269
|
- lib/ddr/auth/grouper_service.rb
|
276
|
-
- lib/ddr/auth/grouper_service.rb~
|
277
270
|
- lib/ddr/auth/remote_group_service.rb
|
278
|
-
- lib/ddr/auth/remote_group_service.rb~
|
279
271
|
- lib/ddr/auth/superuser.rb
|
280
|
-
- lib/ddr/auth/superuser.rb~
|
281
272
|
- lib/ddr/auth/user.rb
|
282
|
-
- lib/ddr/auth/user.rb~
|
283
273
|
- lib/ddr/datastreams.rb
|
284
274
|
- lib/ddr/datastreams/content_metadata_datastream.rb
|
285
275
|
- lib/ddr/datastreams/datastream_behavior.rb
|
@@ -341,6 +331,7 @@ files:
|
|
341
331
|
- spec/dummy/app/assets/stylesheets/application.css
|
342
332
|
- spec/dummy/app/controllers/application_controller.rb
|
343
333
|
- spec/dummy/app/helpers/application_helper.rb
|
334
|
+
- spec/dummy/app/models/solr_document.rb
|
344
335
|
- spec/dummy/app/models/user.rb
|
345
336
|
- spec/dummy/app/views/layouts/application.html.erb
|
346
337
|
- spec/dummy/bin/bundle
|
@@ -382,8 +373,6 @@ files:
|
|
382
373
|
- spec/factories/target_factories.rb
|
383
374
|
- spec/factories/test_model_factories.rb
|
384
375
|
- spec/factories/user_factories.rb
|
385
|
-
- spec/factories/user_factories.rb~
|
386
|
-
- spec/features/grouper_integration_spec.rb~
|
387
376
|
- spec/fixtures/contentMetadata.xml
|
388
377
|
- spec/fixtures/image1.tiff
|
389
378
|
- spec/fixtures/image2.tiff
|
@@ -393,7 +382,6 @@ files:
|
|
393
382
|
- spec/fixtures/sample.pdf
|
394
383
|
- spec/fixtures/target.png
|
395
384
|
- spec/models/ability_spec.rb
|
396
|
-
- spec/models/ability_spec.rb~
|
397
385
|
- spec/models/active_fedora_base_spec.rb
|
398
386
|
- spec/models/active_fedora_datastream_spec.rb
|
399
387
|
- spec/models/attachment_spec.rb
|
@@ -408,12 +396,9 @@ files:
|
|
408
396
|
- spec/models/permanent_identification_spec.rb
|
409
397
|
- spec/models/role_assignments_datastream_spec.rb
|
410
398
|
- spec/models/superuser_spec.rb
|
411
|
-
- spec/models/superuser_spec.rb~
|
412
399
|
- spec/models/target_spec.rb
|
413
400
|
- spec/models/user_spec.rb
|
414
|
-
- spec/models/user_spec.rb~
|
415
401
|
- spec/services/group_service_spec.rb
|
416
|
-
- spec/services/group_service_spec.rb~
|
417
402
|
- spec/services/id_service_spec.rb
|
418
403
|
- spec/spec_helper.rb
|
419
404
|
- spec/support/shared_examples_for_access_controllables.rb
|
@@ -457,6 +442,7 @@ test_files:
|
|
457
442
|
- spec/dummy/app/assets/stylesheets/application.css
|
458
443
|
- spec/dummy/app/controllers/application_controller.rb
|
459
444
|
- spec/dummy/app/helpers/application_helper.rb
|
445
|
+
- spec/dummy/app/models/solr_document.rb
|
460
446
|
- spec/dummy/app/models/user.rb
|
461
447
|
- spec/dummy/app/views/layouts/application.html.erb
|
462
448
|
- spec/dummy/bin/bundle
|
@@ -500,8 +486,6 @@ test_files:
|
|
500
486
|
- spec/factories/target_factories.rb
|
501
487
|
- spec/factories/test_model_factories.rb
|
502
488
|
- spec/factories/user_factories.rb
|
503
|
-
- spec/factories/user_factories.rb~
|
504
|
-
- spec/features/grouper_integration_spec.rb~
|
505
489
|
- spec/fixtures/contentMetadata.xml
|
506
490
|
- spec/fixtures/image1.tiff
|
507
491
|
- spec/fixtures/image2.tiff
|
@@ -511,7 +495,6 @@ test_files:
|
|
511
495
|
- spec/fixtures/sample.pdf
|
512
496
|
- spec/fixtures/target.png
|
513
497
|
- spec/models/ability_spec.rb
|
514
|
-
- spec/models/ability_spec.rb~
|
515
498
|
- spec/models/active_fedora_base_spec.rb
|
516
499
|
- spec/models/active_fedora_datastream_spec.rb
|
517
500
|
- spec/models/attachment_spec.rb
|
@@ -526,12 +509,9 @@ test_files:
|
|
526
509
|
- spec/models/permanent_identification_spec.rb
|
527
510
|
- spec/models/role_assignments_datastream_spec.rb
|
528
511
|
- spec/models/superuser_spec.rb
|
529
|
-
- spec/models/superuser_spec.rb~
|
530
512
|
- spec/models/target_spec.rb
|
531
513
|
- spec/models/user_spec.rb
|
532
|
-
- spec/models/user_spec.rb~
|
533
514
|
- spec/services/group_service_spec.rb
|
534
|
-
- spec/services/group_service_spec.rb~
|
535
515
|
- spec/services/id_service_spec.rb
|
536
516
|
- spec/spec_helper.rb
|
537
517
|
- spec/support/shared_examples_for_access_controllables.rb
|
@@ -1,245 +0,0 @@
|
|
1
|
-
require 'devise'
|
2
|
-
|
3
|
-
# Use this hook to configure devise mailer, warden hooks and so forth.
|
4
|
-
# Many of these configuration options can be set straight in your model.
|
5
|
-
Devise.setup do |config|
|
6
|
-
|
7
|
-
# Given the modules that we implement, this shouldn't be used, but Devise >= 3.1 requires it,
|
8
|
-
# so a random value should suffice.
|
9
|
-
config.secret_key = SecureRandom.hex(64)
|
10
|
-
|
11
|
-
# ==> Mailer Configuration
|
12
|
-
# Configure the e-mail address which will be shown in Devise::Mailer,
|
13
|
-
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
14
|
-
config.mailer_sender = "lib-drs@duke.edu"
|
15
|
-
|
16
|
-
# Configure the class responsible to send e-mails.
|
17
|
-
# config.mailer = "Devise::Mailer"
|
18
|
-
|
19
|
-
# ==> ORM configuration
|
20
|
-
# Load and configure the ORM. Supports :active_record (default) and
|
21
|
-
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
22
|
-
# available as additional gems.
|
23
|
-
require 'devise/orm/active_record'
|
24
|
-
|
25
|
-
# ==> Configuration for any authentication mechanism
|
26
|
-
# Configure which keys are used when authenticating a user. The default is
|
27
|
-
# just :email. You can configure it to use [:username, :subdomain], so for
|
28
|
-
# authenticating a user, both parameters are required. Remember that those
|
29
|
-
# parameters are used only when authenticating and not when retrieving from
|
30
|
-
# session. If you need permissions, you should implement that in a before filter.
|
31
|
-
# You can also supply a hash where the value is a boolean determining whether
|
32
|
-
# or not authentication should be aborted when the value is not present.
|
33
|
-
config.authentication_keys = [ :username ]
|
34
|
-
|
35
|
-
# Configure parameters from the request object used for authentication. Each entry
|
36
|
-
# given should be a request method and it will automatically be passed to the
|
37
|
-
# find_for_authentication method and considered in your model lookup. For instance,
|
38
|
-
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
39
|
-
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
40
|
-
# config.request_keys = []
|
41
|
-
|
42
|
-
# Configure which authentication keys should be case-insensitive.
|
43
|
-
# These keys will be downcased upon creating or modifying a user and when used
|
44
|
-
# to authenticate or find a user. Default is :email.
|
45
|
-
config.case_insensitive_keys = [ :username ]
|
46
|
-
|
47
|
-
# Configure which authentication keys should have whitespace stripped.
|
48
|
-
# These keys will have whitespace before and after removed upon creating or
|
49
|
-
# modifying a user and when used to authenticate or find a user. Default is :email.
|
50
|
-
config.strip_whitespace_keys = [ :username ]
|
51
|
-
|
52
|
-
# Tell if authentication through request.params is enabled. True by default.
|
53
|
-
# It can be set to an array that will enable params authentication only for the
|
54
|
-
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
55
|
-
# enable it only for database (email + password) authentication.
|
56
|
-
config.params_authenticatable = [:database]
|
57
|
-
|
58
|
-
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
59
|
-
# It can be set to an array that will enable http authentication only for the
|
60
|
-
# given strategies, for example, `config.http_authenticatable = [:token]` will
|
61
|
-
# enable it only for token authentication.
|
62
|
-
# config.http_authenticatable = false
|
63
|
-
|
64
|
-
# If http headers should be returned for AJAX requests. True by default.
|
65
|
-
# config.http_authenticatable_on_xhr = true
|
66
|
-
|
67
|
-
# The realm used in Http Basic Authentication. "Application" by default.
|
68
|
-
# config.http_authentication_realm = "Application"
|
69
|
-
|
70
|
-
# It will change confirmation, password recovery and other workflows
|
71
|
-
# to behave the same regardless if the e-mail provided was right or wrong.
|
72
|
-
# Does not affect registerable.
|
73
|
-
# config.paranoid = true
|
74
|
-
|
75
|
-
# By default Devise will store the user in session. You can skip storage for
|
76
|
-
# :http_auth and :token_auth by adding those symbols to the array below.
|
77
|
-
# Notice that if you are skipping storage for all authentication paths, you
|
78
|
-
# may want to disable generating routes to Devise's sessions controller by
|
79
|
-
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
80
|
-
config.skip_session_storage = [:http_auth]
|
81
|
-
|
82
|
-
# ==> Configuration for :database_authenticatable
|
83
|
-
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
84
|
-
# using other encryptors, it sets how many times you want the password re-encrypted.
|
85
|
-
#
|
86
|
-
# Limiting the stretches to just one in testing will increase the performance of
|
87
|
-
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
88
|
-
# a value less than 10 in other environments.
|
89
|
-
config.stretches = Rails.env.test? ? 1 : 10
|
90
|
-
|
91
|
-
# Setup a pepper to generate the encrypted password.
|
92
|
-
# config.pepper = "37669e0c50042b93e63f790c4102864bace2ee0a30eecad6fca7d490f3124d855d8bc6d2978e5500fb266aab2b8c8003d9f202a1f23e4c2c8e8f105b7c46a68f"
|
93
|
-
|
94
|
-
# ==> Configuration for :confirmable
|
95
|
-
# A period that the user is allowed to access the website even without
|
96
|
-
# confirming his account. For instance, if set to 2.days, the user will be
|
97
|
-
# able to access the website for two days without confirming his account,
|
98
|
-
# access will be blocked just in the third day. Default is 0.days, meaning
|
99
|
-
# the user cannot access the website without confirming his account.
|
100
|
-
# config.allow_unconfirmed_access_for = 2.days
|
101
|
-
|
102
|
-
# If true, requires any email changes to be confirmed (exactly the same way as
|
103
|
-
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
104
|
-
# db field (see migrations). Until confirmed new email is stored in
|
105
|
-
# unconfirmed email column, and copied to email column on successful confirmation.
|
106
|
-
config.reconfirmable = true
|
107
|
-
|
108
|
-
# Defines which key will be used when confirming an account
|
109
|
-
config.confirmation_keys = [ :username ]
|
110
|
-
|
111
|
-
# ==> Configuration for :rememberable
|
112
|
-
# The time the user will be remembered without asking for credentials again.
|
113
|
-
# config.remember_for = 2.weeks
|
114
|
-
|
115
|
-
# If true, extends the user's remember period when remembered via cookie.
|
116
|
-
# config.extend_remember_period = false
|
117
|
-
|
118
|
-
# Options to be passed to the created cookie. For instance, you can set
|
119
|
-
# :secure => true in order to force SSL only cookies.
|
120
|
-
# config.rememberable_options = {}
|
121
|
-
|
122
|
-
# ==> Configuration for :validatable
|
123
|
-
# Range for password length. Default is 6..128.
|
124
|
-
# config.password_length = 6..128
|
125
|
-
|
126
|
-
# Email regex used to validate email formats. It simply asserts that
|
127
|
-
# an one (and only one) @ exists in the given string. This is mainly
|
128
|
-
# to give user feedback and not to assert the e-mail validity.
|
129
|
-
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
130
|
-
|
131
|
-
# ==> Configuration for :timeoutable
|
132
|
-
# The time you want to timeout the user session without activity. After this
|
133
|
-
# time the user will be asked for credentials again. Default is 30 minutes.
|
134
|
-
# config.timeout_in = 30.minutes
|
135
|
-
|
136
|
-
# If true, expires auth token on session timeout.
|
137
|
-
# config.expire_auth_token_on_timeout = false
|
138
|
-
|
139
|
-
# ==> Configuration for :lockable
|
140
|
-
# Defines which strategy will be used to lock an account.
|
141
|
-
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
142
|
-
# :none = No lock strategy. You should handle locking by yourself.
|
143
|
-
# config.lock_strategy = :failed_attempts
|
144
|
-
|
145
|
-
# Defines which key will be used when locking and unlocking an account
|
146
|
-
config.unlock_keys = [ :username ]
|
147
|
-
|
148
|
-
# Defines which strategy will be used to unlock an account.
|
149
|
-
# :email = Sends an unlock link to the user email
|
150
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
151
|
-
# :both = Enables both strategies
|
152
|
-
# :none = No unlock strategy. You should handle unlocking by yourself.
|
153
|
-
# config.unlock_strategy = :both
|
154
|
-
|
155
|
-
# Number of authentication tries before locking an account if lock_strategy
|
156
|
-
# is failed attempts.
|
157
|
-
# config.maximum_attempts = 20
|
158
|
-
|
159
|
-
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
160
|
-
# config.unlock_in = 1.hour
|
161
|
-
|
162
|
-
# ==> Configuration for :recoverable
|
163
|
-
#
|
164
|
-
# Defines which key will be used when recovering the password for an account
|
165
|
-
config.reset_password_keys = [ :username ]
|
166
|
-
|
167
|
-
# Time interval you can reset your password with a reset password key.
|
168
|
-
# Don't put a too small interval or your users won't have the time to
|
169
|
-
# change their passwords.
|
170
|
-
config.reset_password_within = 6.hours
|
171
|
-
|
172
|
-
# ==> Configuration for :encryptable
|
173
|
-
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
174
|
-
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
175
|
-
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
176
|
-
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
177
|
-
# REST_AUTH_SITE_KEY to pepper)
|
178
|
-
# config.encryptor = :sha512
|
179
|
-
|
180
|
-
# ==> Configuration for :token_authenticatable
|
181
|
-
# Defines name of the authentication token params key
|
182
|
-
# config.token_authentication_key = :auth_token
|
183
|
-
|
184
|
-
# ==> Scopes configuration
|
185
|
-
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
186
|
-
# "users/sessions/new". It's turned off by default because it's slower if you
|
187
|
-
# are using only default views.
|
188
|
-
# config.scoped_views = false
|
189
|
-
|
190
|
-
# Configure the default scope given to Warden. By default it's the first
|
191
|
-
# devise role declared in your routes (usually :user).
|
192
|
-
# config.default_scope = :user
|
193
|
-
|
194
|
-
# Set this configuration to false if you want /users/sign_out to sign out
|
195
|
-
# only the current scope. By default, Devise signs out all scopes.
|
196
|
-
# config.sign_out_all_scopes = true
|
197
|
-
|
198
|
-
# ==> Navigation configuration
|
199
|
-
# Lists the formats that should be treated as navigational. Formats like
|
200
|
-
# :html, should redirect to the sign in page when the user does not have
|
201
|
-
# access, but formats like :xml or :json, should return 401.
|
202
|
-
#
|
203
|
-
# If you have any extra navigational formats, like :iphone or :mobile, you
|
204
|
-
# should add them to the navigational formats lists.
|
205
|
-
#
|
206
|
-
# The "*/*" below is required to match Internet Explorer requests.
|
207
|
-
# config.navigational_formats = ["*/*", :html]
|
208
|
-
|
209
|
-
# The default HTTP method used to sign out a resource. Default is :delete.
|
210
|
-
config.sign_out_via = :get
|
211
|
-
|
212
|
-
# ==> OmniAuth
|
213
|
-
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
214
|
-
# up on your models and hooks.
|
215
|
-
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
216
|
-
|
217
|
-
# ==> Warden configuration
|
218
|
-
# If you want to use other strategies, that are not supported by Devise, or
|
219
|
-
# change the failure app, you can configure them inside the config.warden block.
|
220
|
-
#
|
221
|
-
# config.warden do |manager|
|
222
|
-
# manager.intercept_401 = false
|
223
|
-
# manager.default_strategies(:scope => :user).unshift :remote_user_authenticatable
|
224
|
-
# end
|
225
|
-
|
226
|
-
config.warden do |manager|
|
227
|
-
# :superuser scope
|
228
|
-
manager.serialize_into_session(:superuser) { |superuser| superuser.id }
|
229
|
-
manager.serialize_from_session(:superuser) { |id| User.find(id) }
|
230
|
-
end
|
231
|
-
|
232
|
-
# ==> Mountable engine configurations
|
233
|
-
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
234
|
-
# is mountable, there are some extra configurations to be taken into account.
|
235
|
-
# The following options are available, assuming the engine is mounted as:
|
236
|
-
#
|
237
|
-
# mount MyEngine, at: "/my_engine"
|
238
|
-
#
|
239
|
-
# The router that invoked `devise_for`, in the example above, would be:
|
240
|
-
# config.router_name = :my_engine
|
241
|
-
#
|
242
|
-
# When using omniauth, Devise cannot automatically set Omniauth path,
|
243
|
-
# so you need to do it manually. For the users scope, it would be:
|
244
|
-
# config.omniauth_path_prefix = "/my_engine/users/auth"
|
245
|
-
end
|
data/lib/ddr/auth.rb~
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
module Ddr
|
2
|
-
module Auth
|
3
|
-
extend ActiveSupport::Autoload
|
4
|
-
|
5
|
-
autoload :User
|
6
|
-
autoload :Superuser
|
7
|
-
autoload :Ability
|
8
|
-
autoload :GroupService
|
9
|
-
autoload :GrouperService
|
10
|
-
autoload :RemoteGroupService
|
11
|
-
|
12
|
-
# Superuser group
|
13
|
-
mattr_accessor :superuser_group do
|
14
|
-
ENV['SUPERUSER_GROUP']
|
15
|
-
end
|
16
|
-
|
17
|
-
## Remote groups (i.e., Grouper) config settings
|
18
|
-
# request.env key for group memberships
|
19
|
-
mattr_accessor :remote_groups_env_key do
|
20
|
-
"ismemberof"
|
21
|
-
end
|
22
|
-
|
23
|
-
# request.env value internal delimiter
|
24
|
-
mattr_accessor :remote_groups_env_value_delim do
|
25
|
-
";"
|
26
|
-
end
|
27
|
-
|
28
|
-
# pattern/repl for converting request.env membership values to proper (Grouper) group names
|
29
|
-
mattr_accessor :remote_groups_env_value_sub do
|
30
|
-
[/^urn:mace:duke\.edu:groups/, "duke"]
|
31
|
-
end
|
32
|
-
|
33
|
-
# Filter for getting list of remote groups for the repository - String, not Regexp
|
34
|
-
mattr_accessor :remote_groups_name_filter do
|
35
|
-
"duke:library:repository:ddr:"
|
36
|
-
end
|
37
|
-
|
38
|
-
mattr_accessor :everyone_group do
|
39
|
-
"public"
|
40
|
-
end
|
41
|
-
|
42
|
-
mattr_accessor :authenticated_users_group do
|
43
|
-
"registered"
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|