openstax_utilities 5.1.1 → 5.1.2
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/lib/openstax/utilities/access.rb +22 -20
- data/lib/openstax/utilities/osu_helper.rb +3 -1
- data/lib/openstax/utilities/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b0d5614455f42b5cdee91e432f30eec08d839ba8e10198412840814e9c634bf
|
4
|
+
data.tar.gz: 7c98d368d41ed57e535b7264c7225aeede514a8dd661e9bf2545649fa96c9f2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ba10b245bbcd0bdb522b649f269fd387f4ccf725ebb622f0b7a632c0432964abb9b0599b42c29ad8cfcfc04cba6a5220ed9aa8f5b5eabf468f1d25882da102a
|
7
|
+
data.tar.gz: 0b24d819a3d2203465eccc20671b3531f851f402f81bb75efc4ed3a10809f0e0c0e1f02324ea630b42965292aa7342fed4e4ae2bd2a7b601bb371dd302f7b0a2
|
@@ -1,24 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
return if !(options[:enable_always] || Rails.env.production?)
|
1
|
+
ActiveSupport.on_load(:action_controller_base) do
|
2
|
+
ActionController::Base.define_singleton_method(:protect_beta) do |options={}|
|
3
|
+
options[:username] ||= SecureRandom.hex
|
4
|
+
options[:password] ||= SecureRandom.hex
|
5
|
+
options[:enable_always] ||= false
|
6
|
+
options[:message] ||= ''
|
8
7
|
|
9
|
-
|
10
|
-
prepend_before_filter :protect_beta
|
11
|
-
end
|
8
|
+
return if !(options[:enable_always] || Rails.env.production?)
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
end
|
10
|
+
@@protect_beta_options = options
|
11
|
+
prepend_before_filter :protect_beta
|
12
|
+
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
ActionController::Base.define_singleton_method(:skip_protect_beta) do |options={}|
|
15
|
+
skip_before_filter :protect_beta, options
|
16
|
+
end
|
17
|
+
|
18
|
+
class ActionController::Base
|
19
|
+
def protect_beta
|
20
|
+
options = @@protect_beta_options
|
21
|
+
authenticate_or_request_with_http_basic(options[:message]) do |username, password|
|
22
|
+
username == options[:username] && password == options[:password]
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -27,7 +29,7 @@ module OpenStax
|
|
27
29
|
module Utilities
|
28
30
|
module Access
|
29
31
|
|
30
|
-
# Called in a controller to provide an outer level of basic HTTP
|
32
|
+
# Called in a controller to provide an outer level of basic HTTP
|
31
33
|
# authentication, typically used when code is deployed during development
|
32
34
|
# and it is not yet ready for public consumption.
|
33
35
|
#
|
@@ -39,7 +41,7 @@ module OpenStax
|
|
39
41
|
# @param :username The authentication username; default value is a random hex string
|
40
42
|
# @param :password The authentication password; default value is a random hex string
|
41
43
|
# @param :enable_always The default is the authentication is only enabled
|
42
|
-
# in production, setting this to true will make it effective in all
|
44
|
+
# in production, setting this to true will make it effective in all
|
43
45
|
# environments
|
44
46
|
# @param :message If given, this message will be displayed in the browser's
|
45
47
|
# authentication dialog box.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstax_utilities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
259
|
- !ruby/object:Gem::Version
|
260
260
|
version: '0'
|
261
261
|
requirements: []
|
262
|
-
rubygems_version: 3.
|
262
|
+
rubygems_version: 3.5.21
|
263
263
|
signing_key:
|
264
264
|
specification_version: 4
|
265
265
|
summary: Utilities for OpenStax web sites
|