ddr-models 1.2.1 → 1.3.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 +75 -1
- data/app/models/attachment.rb +6 -1
- data/app/models/collection.rb +19 -1
- data/app/models/component.rb +6 -1
- data/app/models/item.rb +6 -1
- data/app/models/solr_document.rb +3 -0
- data/app/models/target.rb +8 -1
- data/config/initializers/devise.rb~ +245 -0
- data/db/migrate/20141104181418_create_users.rb~ +6 -0
- data/lib/ddr/auth.rb +6 -1
- data/lib/ddr/auth.rb~ +47 -0
- data/lib/ddr/auth/ability.rb +5 -0
- data/lib/ddr/auth/ability.rb~ +204 -0
- data/lib/ddr/auth/group_service.rb~ +53 -0
- data/lib/ddr/auth/grouper_service.rb~ +77 -0
- data/lib/ddr/auth/remote_group_service.rb~ +35 -0
- data/lib/ddr/auth/superuser.rb~ +9 -0
- data/lib/ddr/auth/user.rb~ +65 -0
- data/lib/ddr/index_fields.rb +2 -2
- data/lib/ddr/models.rb +21 -4
- data/lib/ddr/models/engine.rb +26 -13
- data/lib/ddr/models/version.rb +1 -1
- data/lib/ddr/services/id_service.rb +4 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +2727 -1701
- data/spec/dummy/log/test.log +56845 -35270
- data/spec/factories/attachment_factories.rb +0 -4
- data/spec/factories/collection_factories.rb +0 -8
- data/spec/factories/component_factories.rb +1 -6
- data/spec/factories/item_factories.rb +0 -8
- data/spec/factories/user_factories.rb~ +7 -0
- data/spec/features/grouper_integration_spec.rb~ +21 -0
- data/spec/models/ability_spec.rb +11 -24
- data/spec/models/ability_spec.rb~ +245 -0
- data/spec/models/superuser_spec.rb~ +13 -0
- data/spec/models/user_spec.rb~ +56 -0
- data/spec/services/group_service_spec.rb~ +71 -0
- data/spec/spec_helper.rb +16 -25
- metadata +23 -18
- data/config/initializers/ddr.rb +0 -8
- data/lib/ddr/configurable.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4fe3945441c76c106744f6dde305b6e5fa58982
|
4
|
+
data.tar.gz: 8f356b6a8e1b21cb39baf12b4f567341d898ca86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b8d700036e95792c35bea91de5e963c56065665f50a32e507c7a323440f247febc6ef5d0973d671788de6f4a8db412669522c1c63592c503d98efff09d8eae3
|
7
|
+
data.tar.gz: e3cbe827d83386857783a5118c0d02112e0ae29b68dd7b31ad2246860514e7da4e27f9dfd5a716e53fa7b5522d50a10b54a50e4d28202115e98be35a7a8c6087
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ddr-models
|
2
2
|
|
3
|
-
[](https://travis-ci.org/duke-libraries/ddr-models)
|
4
4
|
[](http://badge.fury.io/rb/ddr-models)
|
5
5
|
|
6
6
|
A Rails engine providing Hydra and ActiveRecord models and common services for the Duke Digital Repository.
|
@@ -15,5 +15,79 @@ and
|
|
15
15
|
|
16
16
|
bundle install
|
17
17
|
|
18
|
+
## Configuration
|
18
19
|
|
20
|
+
ddr-models has several runtime dependencies that are independently configurable:
|
19
21
|
|
22
|
+
- [active_fedora](https://github.com/projecthydra/active_fedora)
|
23
|
+
- [hydra-head](https://github.com/projecthydra/hydra-head)
|
24
|
+
- [ddr-antivirus](https://github.com/duke-libraries/ddr-antivirus)
|
25
|
+
- [devise-remote-user](https://github.com/duke-libraries/devise-remote-user)
|
26
|
+
|
27
|
+
ddr-models configuration options:
|
28
|
+
|
29
|
+
- Authentication/Authorization options are set on [Ddr::Auth](http://www.rubydoc.info/gems/ddr-models/Ddr/Auth).
|
30
|
+
|
31
|
+
### Additional configuration steps
|
32
|
+
|
33
|
+
#### User model
|
34
|
+
|
35
|
+
Include `Ddr::Auth::User` in `app/models/user.rb` and remove content inserted by Hydra, Blacklight and Devise generators:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
class User
|
39
|
+
include Ddr::Auth::User
|
40
|
+
#
|
41
|
+
# Remove content inserted by Hydra, Blacklight, or Devise generators --
|
42
|
+
# it's provided by Ddr::Auth::User.
|
43
|
+
#
|
44
|
+
# include Blacklight::User
|
45
|
+
# include Hydra::User
|
46
|
+
# devise :database_authenticatable [...]
|
47
|
+
#
|
48
|
+
# ... as well as any methods.
|
49
|
+
#
|
50
|
+
# You can add custom methods for the app as needed.
|
51
|
+
#
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
#### Ability class
|
56
|
+
|
57
|
+
The hydra-head generator may have created a class module at `app/models/ability.rb` like so:
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
class Ability
|
61
|
+
include Hydra::Ability
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
Change the class like so:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
class Ability < Ddr::Auth::Ability
|
69
|
+
#
|
70
|
+
# Ddr::Auth::Ability includes Hydra::PolicyAwareAbility
|
71
|
+
# include Hydra::Ability
|
72
|
+
#
|
73
|
+
# Add custom methods here as needed to Ability.ability_logic:
|
74
|
+
#
|
75
|
+
# self.ability_logic += [:my_ability]
|
76
|
+
#
|
77
|
+
# def my_ability
|
78
|
+
# # whatever
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
#### Migrations
|
85
|
+
|
86
|
+
Install the ddr-models migrations:
|
87
|
+
|
88
|
+
rake ddr_models:install:migrations
|
89
|
+
|
90
|
+
then
|
91
|
+
|
92
|
+
rake db:migrate db:test:prepare
|
93
|
+
|
data/app/models/attachment.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
+
#
|
2
|
+
# An Attachment is a miscellaneous content-bearing resource associated with a Collection.
|
3
|
+
#
|
4
|
+
# Example: A collection digitization QC information spreadsheet.
|
5
|
+
#
|
1
6
|
class Attachment < Ddr::Models::Base
|
2
7
|
|
3
8
|
include Ddr::Models::HasContent
|
4
9
|
|
5
10
|
belongs_to :attached_to, property: :is_attached_to, class_name: 'ActiveFedora::Base'
|
6
11
|
|
7
|
-
end
|
12
|
+
end
|
data/app/models/collection.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
#
|
2
|
+
# A Collection is a conceptual and administrative entity containing a set of items.
|
3
|
+
#
|
4
|
+
# Provides default permissions (Hydra admin policy) for objects associated with the collection
|
5
|
+
# via an isGovernedBy relation.
|
6
|
+
#
|
1
7
|
class Collection < Ddr::Models::Base
|
2
8
|
|
3
9
|
include Hydra::AdminPolicyBehavior
|
@@ -17,6 +23,9 @@ class Collection < Ddr::Models::Base
|
|
17
23
|
|
18
24
|
validates_presence_of :title
|
19
25
|
|
26
|
+
# Returns the SolrDocuments for Components associated with the Collection through its member Items.
|
27
|
+
#
|
28
|
+
# @return A lazy enumerator of SolrDocuments.
|
20
29
|
def components_from_solr
|
21
30
|
outer = Ddr::IndexFields::IS_PART_OF
|
22
31
|
inner = Ddr::IndexFields::INTERNAL_URI
|
@@ -27,20 +36,29 @@ class Collection < Ddr::Models::Base
|
|
27
36
|
results.lazy.map {|doc| SolrDocument.new(doc)}
|
28
37
|
end
|
29
38
|
|
39
|
+
# Returns the license attributes provided as default values for objects governed by the Collection.
|
40
|
+
#
|
41
|
+
# @return [Hash] the attributes, `:title`, `:description`, and `:url`.
|
30
42
|
def default_license
|
31
43
|
if default_license_title.present? or default_license_description.present? or default_license_url.present?
|
32
44
|
{title: default_license_title, description: default_license_description, url: default_license_url}
|
33
45
|
end
|
34
46
|
end
|
35
47
|
|
48
|
+
# Sets the default license attributes for objects governed by the Collection.
|
36
49
|
def default_license=(new_license)
|
37
|
-
raise ArgumentError unless new_license.is_a?(Hash)
|
50
|
+
raise ArgumentError unless new_license.is_a?(Hash) # XXX don't do this - not duck-typeable
|
38
51
|
l = new_license.with_indifferent_access
|
39
52
|
self.default_license_title = l[:title]
|
40
53
|
self.default_license_description = l[:description]
|
41
54
|
self.default_license_url = l[:url]
|
42
55
|
end
|
43
56
|
|
57
|
+
# Returns a list of entities (either users or groups) having a default access level on objects governed by the Collection.
|
58
|
+
#
|
59
|
+
# @param type [String] the type of entity, "user" or "group".
|
60
|
+
# @param access [String] the default access level, "discover", "read", or "edit".
|
61
|
+
# @return [Array<String>] the entities (users or groups)
|
44
62
|
def default_entities_for_permission(type, access)
|
45
63
|
default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact
|
46
64
|
end
|
data/app/models/component.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# A Component is a part of an Item; the principal content-bearing repository resource.
|
3
|
+
#
|
4
|
+
# Examples: Page of a book, track of a recording, etc.
|
5
|
+
#
|
1
6
|
class Component < Ddr::Models::Base
|
2
7
|
|
3
8
|
include Ddr::Models::HasContent
|
@@ -12,4 +17,4 @@ class Component < Ddr::Models::Base
|
|
12
17
|
self.parent.parent rescue nil
|
13
18
|
end
|
14
19
|
|
15
|
-
end
|
20
|
+
end
|
data/app/models/item.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# An Item is a member of a Collection -- i.e., a "work" -- the principal describable resource.
|
3
|
+
#
|
4
|
+
# Examples: photograph, book, article, sound recording, video, etc.
|
5
|
+
#
|
1
6
|
class Item < Ddr::Models::Base
|
2
7
|
|
3
8
|
include Ddr::Models::HasContentMetadata
|
@@ -16,4 +21,4 @@ class Item < Ddr::Models::Base
|
|
16
21
|
alias_method :collection_id, :parent_id
|
17
22
|
alias_method :collection=, :parent=
|
18
23
|
|
19
|
-
end
|
24
|
+
end
|
data/app/models/solr_document.rb
CHANGED
data/app/models/target.rb
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
#
|
2
|
+
# A Target is digital scanner calibration artifact.
|
3
|
+
#
|
4
|
+
# A Target has a content file and is associated with a Collection OR one or more Components.
|
5
|
+
#
|
6
|
+
# See http://www.loc.gov/standards/mix/ and NISO Z39.87.
|
7
|
+
#
|
1
8
|
class Target < Ddr::Models::Base
|
2
9
|
|
3
10
|
include Ddr::Models::HasContent
|
@@ -5,4 +12,4 @@ class Target < Ddr::Models::Base
|
|
5
12
|
has_many :components, property: :has_external_target, class_name: 'Component'
|
6
13
|
belongs_to :collection, property: :is_external_target_for, class_name: 'Collection'
|
7
14
|
|
8
|
-
end
|
15
|
+
end
|
@@ -0,0 +1,245 @@
|
|
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
|