activerecord-session_store 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord-session_store might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/MIT-LICENSE +22 -0
- data/README.md +21 -1
- data/lib/action_dispatch/session/active_record_store.rb +3 -3
- data/lib/active_record/session_store.rb +5 -0
- data/lib/active_record/session_store/extension/logger_silencer.rb +7 -4
- data/lib/active_record/session_store/railtie.rb +1 -1
- data/lib/active_record/session_store/session.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 199a971acd3d868bd22acce4c420c18e9379d15e
|
4
|
+
data.tar.gz: 72716a9c795e148bbe8f4b52521cd545ab136efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0c2e5bc2f6426beae8f3e7954b3c89f91c050ee9f27f15b4144350966b786ea9b8d8580038662155681101e0e37714c169e24b8b57ff582c25147eaf78dd2db
|
7
|
+
data.tar.gz: 8ccded75455d38d05815730b050fdcd249fb9ef15110c9e7773048e4e064fce653433fa40edbe13d01434947264727decbf3309d37c1ce891815c5cc19307b5a
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012-2015 David Heinemeier Hansson
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Run the migration generator:
|
|
21
21
|
Then, set your session store in `config/initializers/session_store.rb`:
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
|
24
|
+
Rails.application.config.session_store :active_record_store, :key => '_my_app_session'
|
25
25
|
```
|
26
26
|
|
27
27
|
Configuration
|
@@ -75,3 +75,23 @@ You must implement these methods:
|
|
75
75
|
|
76
76
|
The example SqlBypass class is a generic SQL session store. You may
|
77
77
|
use it as a basis for high-performance database-specific stores.
|
78
|
+
|
79
|
+
Please note that you will need to manually include the silencer module to your
|
80
|
+
custom logger if you are using a logger other than `Logger` and `Syslog::Logger`
|
81
|
+
and their subclasses:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
MyLogger.send :include, ActiveRecord::SessionStore::Extension::LoggerSilencer
|
85
|
+
```
|
86
|
+
|
87
|
+
This silencer is being used to silence the logger and not leaking private
|
88
|
+
information into the log, and it is required for security reason.
|
89
|
+
|
90
|
+
## Contributing to Active Record Session Store
|
91
|
+
|
92
|
+
Active Record Session Store is work of many contributors. You're encouraged to submit pull requests, propose features and discuss issues.
|
93
|
+
|
94
|
+
See [CONTRIBUTING](CONTRIBUTING.md).
|
95
|
+
|
96
|
+
## License
|
97
|
+
Active Record Session Store is released under the [MIT License](MIT-LICENSE).
|
@@ -62,7 +62,7 @@ module ActionDispatch
|
|
62
62
|
|
63
63
|
private
|
64
64
|
def get_session(env, sid)
|
65
|
-
logger.
|
65
|
+
logger.silence_logger do
|
66
66
|
unless sid and session = @@session_class.find_by_session_id(sid)
|
67
67
|
# If the sid was nil or if there is no pre-existing session under the sid,
|
68
68
|
# force the generation of a new sid and associate a new session associated with the new sid
|
@@ -75,7 +75,7 @@ module ActionDispatch
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def set_session(env, sid, session_data, options)
|
78
|
-
logger.
|
78
|
+
logger.silence_logger do
|
79
79
|
record = get_session_model(env, sid)
|
80
80
|
record.data = session_data
|
81
81
|
return false unless record.save
|
@@ -92,7 +92,7 @@ module ActionDispatch
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def destroy_session(env, session_id, options)
|
95
|
-
logger.
|
95
|
+
logger.silence_logger do
|
96
96
|
if sid = current_session_id(env)
|
97
97
|
get_session_model(env, sid).destroy
|
98
98
|
env[SESSION_RECORD_KEY] = nil
|
@@ -35,3 +35,8 @@ require 'active_record/session_store/railtie' if defined?(Rails)
|
|
35
35
|
|
36
36
|
ActionDispatch::Session::ActiveRecordStore.session_class = ActiveRecord::SessionStore::Session
|
37
37
|
Logger.send :include, ActiveRecord::SessionStore::Extension::LoggerSilencer
|
38
|
+
|
39
|
+
begin
|
40
|
+
require "syslog/logger"
|
41
|
+
Syslog::Logger.send :include, ActiveRecord::SessionStore::Extension::LoggerSilencer
|
42
|
+
rescue LoadError; end
|
@@ -30,12 +30,15 @@ module ActiveRecord
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def add_with_threadsafety(severity, message = nil, progname = nil, &block)
|
33
|
-
|
34
|
-
|
33
|
+
if !defined?(@logdev) || @logdev.nil? || (severity || UNKNOWN) < level
|
34
|
+
true
|
35
|
+
else
|
36
|
+
add_without_threadsafety(severity, message, progname, &block)
|
37
|
+
end
|
35
38
|
end
|
36
39
|
|
37
40
|
# Silences the logger for the duration of the block.
|
38
|
-
def
|
41
|
+
def silence_logger(temporary_level = Logger::ERROR)
|
39
42
|
if silencer
|
40
43
|
begin
|
41
44
|
self.thread_level = temporary_level
|
@@ -65,7 +68,7 @@ module ActiveRecord
|
|
65
68
|
end
|
66
69
|
|
67
70
|
class NilLogger
|
68
|
-
def self.
|
71
|
+
def self.silence_logger
|
69
72
|
yield
|
70
73
|
end
|
71
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-session_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -105,6 +105,7 @@ extensions: []
|
|
105
105
|
extra_rdoc_files:
|
106
106
|
- README.md
|
107
107
|
files:
|
108
|
+
- MIT-LICENSE
|
108
109
|
- README.md
|
109
110
|
- lib/action_dispatch/session/active_record_store.rb
|
110
111
|
- lib/active_record/session_store.rb
|
@@ -116,7 +117,7 @@ files:
|
|
116
117
|
- lib/generators/active_record/session_migration_generator.rb
|
117
118
|
- lib/generators/active_record/templates/migration.rb
|
118
119
|
- lib/tasks/database.rake
|
119
|
-
homepage:
|
120
|
+
homepage: https://github.com/rails/activerecord-session_store
|
120
121
|
licenses:
|
121
122
|
- MIT
|
122
123
|
metadata: {}
|
@@ -138,9 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
141
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.4.5
|
142
|
+
rubygems_version: 2.4.5.1
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: An Action Dispatch session store backed by an Active Record class.
|
145
146
|
test_files: []
|
146
|
-
has_rdoc:
|