sso_client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/sso_client/user.rb +33 -4
- data/lib/sso_client/version.rb +1 -1
- metadata +30 -30
@@ -1,6 +1,6 @@
|
|
1
1
|
module SsoClient
|
2
|
-
class
|
3
|
-
ATTRIBUTES = [:
|
2
|
+
class User
|
3
|
+
ATTRIBUTES = [:id, :name, :nickname, :email, :first_name, :last_name]
|
4
4
|
attr_accessor *ATTRIBUTES
|
5
5
|
|
6
6
|
def initialize(attributes = {})
|
@@ -10,12 +10,12 @@ module SsoClient
|
|
10
10
|
def self.from_omniauth(omniauth)
|
11
11
|
User.new(omniauth['info']).tap do | user |
|
12
12
|
user.attributes = omniauth['extra']
|
13
|
-
|
13
|
+
user.id = omniauth['uid']
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
def attributes
|
18
|
-
ATTRIBUTES.inject(
|
18
|
+
ATTRIBUTES.inject(HashWithIndifferentAccess.new) do |result, key|
|
19
19
|
result[key] = read_attribute_for_validation(key)
|
20
20
|
result
|
21
21
|
end
|
@@ -28,5 +28,34 @@ module SsoClient
|
|
28
28
|
def read_attribute_for_validation(key)
|
29
29
|
send(key)
|
30
30
|
end
|
31
|
+
|
32
|
+
def self.current
|
33
|
+
Thread.current[:user]
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.current_id
|
37
|
+
current.id if current
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.current=(user)
|
41
|
+
Thread.current[:user] = user
|
42
|
+
end
|
43
|
+
|
44
|
+
def new_record?
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
48
|
+
def destroyed?
|
49
|
+
false
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.primary_key
|
53
|
+
'id'
|
54
|
+
end
|
55
|
+
|
56
|
+
def [](key)
|
57
|
+
self.send(key)
|
58
|
+
end
|
59
|
+
|
31
60
|
end
|
32
61
|
end
|
data/lib/sso_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sso_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &19286200 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *19286200
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: configliere
|
27
|
-
requirement: &
|
27
|
+
requirement: &19285400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *19285400
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: omniauth
|
38
|
-
requirement: &
|
38
|
+
requirement: &19282540 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *19282540
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: omniauth-oauth2
|
49
|
-
requirement: &
|
49
|
+
requirement: &19281420 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *19281420
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: fabrication
|
60
|
-
requirement: &
|
60
|
+
requirement: &19280340 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *19280340
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &19295600 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *19295600
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard-spork
|
82
|
-
requirement: &
|
82
|
+
requirement: &19294360 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *19294360
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: libnotify
|
93
|
-
requirement: &
|
93
|
+
requirement: &19293160 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *19293160
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rb-inotify
|
104
|
-
requirement: &
|
104
|
+
requirement: &19292140 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *19292140
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rspec-rails
|
115
|
-
requirement: &
|
115
|
+
requirement: &19291180 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 2.6.0
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *19291180
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: shoulda-matchers
|
126
|
-
requirement: &
|
126
|
+
requirement: &19290400 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *19290400
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: spork
|
137
|
-
requirement: &
|
137
|
+
requirement: &19289660 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: 0.9.0.rc9
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *19289660
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: sqlite3
|
148
|
-
requirement: &
|
148
|
+
requirement: &19288860 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,7 +153,7 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *19288860
|
157
157
|
description: Client gem for connecting to SSO server (http://github.com/openteam/sso_server)
|
158
158
|
email:
|
159
159
|
- lda@openteam.ru
|
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
segments:
|
194
194
|
- 0
|
195
|
-
hash:
|
195
|
+
hash: -2764842920906126228
|
196
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
197
|
none: false
|
198
198
|
requirements:
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
segments:
|
203
203
|
- 0
|
204
|
-
hash:
|
204
|
+
hash: -2764842920906126228
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
207
|
rubygems_version: 1.8.11
|