current_session 0.1.3 → 0.1.4
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/Gemfile.lock +1 -1
- data/lib/current_session/auth.rb +4 -3
- data/lib/current_session/base.rb +12 -3
- data/lib/current_session/interface.rb +1 -1
- data/lib/current_session/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bc53442f7b800e43a4da8cc2690d72ba5466be6afce2b6d28fed7e3e62de9fea
|
|
4
|
+
data.tar.gz: 46364f6ee395e2e2734cb0784cf700793dafb022963960d7478a5397feac8bd0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95c0d5af5fd5a896d277ccbb5955675ddaa04ee2caf52b41918c1aa1eae6cf0ca15d3c0cf781eddba225b3eef613a377054309347ddb3f1ae3e45b1f2002562f
|
|
7
|
+
data.tar.gz: f8e4b72b8bab60b40af08cf0a7fedcb8cc9613e7aab7a73a8d5d97b4fb7732ccccbd59c8a76890daed5b6382efe9f6e6c9a894fc99db18a9c7a316b99d9ed7b3
|
data/Gemfile.lock
CHANGED
data/lib/current_session/auth.rb
CHANGED
|
@@ -5,11 +5,12 @@ module CurrentSession
|
|
|
5
5
|
# Base class for providing auth methods
|
|
6
6
|
#
|
|
7
7
|
class Auth
|
|
8
|
-
|
|
8
|
+
class_attribute :user_class
|
|
9
|
+
|
|
10
|
+
def initialize(request)
|
|
9
11
|
@request = request
|
|
10
|
-
@user_class = user_class
|
|
11
12
|
end
|
|
12
|
-
attr_reader :request
|
|
13
|
+
attr_reader :request
|
|
13
14
|
|
|
14
15
|
def auth
|
|
15
16
|
request.env["omniauth.auth"]
|
data/lib/current_session/base.rb
CHANGED
|
@@ -10,7 +10,13 @@ module CurrentSession
|
|
|
10
10
|
attribute :current_user
|
|
11
11
|
|
|
12
12
|
class << self
|
|
13
|
-
attr_accessor :
|
|
13
|
+
attr_accessor :session_token_class
|
|
14
|
+
attr_reader :user_class
|
|
15
|
+
|
|
16
|
+
def user_class=(user_class)
|
|
17
|
+
@user_class = user_class
|
|
18
|
+
@auth_class.user_class = user_class if @auth_class
|
|
19
|
+
end
|
|
14
20
|
|
|
15
21
|
def current_time(_)
|
|
16
22
|
Time.current
|
|
@@ -24,8 +30,9 @@ module CurrentSession
|
|
|
24
30
|
if block
|
|
25
31
|
session_methods = Module.new(&block)
|
|
26
32
|
@session_repository_class = Class.new(CurrentSession::Repository) { include session_methods }
|
|
33
|
+
@session_methods = session_methods
|
|
27
34
|
else
|
|
28
|
-
@
|
|
35
|
+
@session_methods
|
|
29
36
|
end
|
|
30
37
|
end
|
|
31
38
|
|
|
@@ -37,8 +44,10 @@ module CurrentSession
|
|
|
37
44
|
if block
|
|
38
45
|
auth_methods = Module.new(&block)
|
|
39
46
|
@auth_class = Class.new(CurrentSession::Auth) { include auth_methods }
|
|
47
|
+
@auth_class.user_class = user_class
|
|
48
|
+
@auth_methods = auth_methods
|
|
40
49
|
else
|
|
41
|
-
@
|
|
50
|
+
@auth_methods
|
|
42
51
|
end
|
|
43
52
|
end
|
|
44
53
|
end
|
|
@@ -19,7 +19,7 @@ module CurrentSession
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def create(request)
|
|
22
|
-
auth = @auth_class.new(request
|
|
22
|
+
auth = @auth_class.new(request)
|
|
23
23
|
auth.find_or_create_by_auth.try do |user|
|
|
24
24
|
auth.update(user)
|
|
25
25
|
session_repository(request).update_session_token(user)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: current_session
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masa (Aileron inc)
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-10-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|