sentient_user 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/sentient_user.rb +8 -0
- metadata +24 -14
- data/.gitignore +0 -21
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
gem.email = "dbock@codesherpas.com"
|
11
11
|
gem.homepage = "http://github.com/bokmann/sentient_user"
|
12
12
|
gem.authors = ["bokmann"]
|
13
|
-
gem.add_development_dependency "
|
13
|
+
gem.add_development_dependency "shoulda", ">= 2.11.3"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
end
|
16
16
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/sentient_user.rb
CHANGED
@@ -19,6 +19,14 @@ module SentientUser
|
|
19
19
|
def current?
|
20
20
|
!Thread.current[:user].nil? && self.id == Thread.current[:user].id
|
21
21
|
end
|
22
|
+
|
23
|
+
def self.do_as(user, &block)
|
24
|
+
old_user = self.current
|
25
|
+
self.current = user
|
26
|
+
response = block.call unless block.nil?
|
27
|
+
self.current = old_user
|
28
|
+
response
|
29
|
+
end
|
22
30
|
}
|
23
31
|
end
|
24
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentient_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 3
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- bokmann
|
@@ -9,19 +14,23 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-12-23 00:00:00 -05:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
name: shoulda
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 11
|
30
|
+
- 3
|
31
|
+
version: 2.11.3
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
description: lets the User model in most authentication frameworks know who is the current user"
|
26
35
|
email: dbock@codesherpas.com
|
27
36
|
executables: []
|
@@ -33,7 +42,6 @@ extra_rdoc_files:
|
|
33
42
|
- README.rdoc
|
34
43
|
files:
|
35
44
|
- .document
|
36
|
-
- .gitignore
|
37
45
|
- LICENSE
|
38
46
|
- README.rdoc
|
39
47
|
- Rakefile
|
@@ -46,26 +54,28 @@ homepage: http://github.com/bokmann/sentient_user
|
|
46
54
|
licenses: []
|
47
55
|
|
48
56
|
post_install_message:
|
49
|
-
rdoc_options:
|
50
|
-
|
57
|
+
rdoc_options: []
|
58
|
+
|
51
59
|
require_paths:
|
52
60
|
- lib
|
53
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
62
|
requirements:
|
55
63
|
- - ">="
|
56
64
|
- !ruby/object:Gem::Version
|
65
|
+
segments:
|
66
|
+
- 0
|
57
67
|
version: "0"
|
58
|
-
version:
|
59
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
69
|
requirements:
|
61
70
|
- - ">="
|
62
71
|
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
63
74
|
version: "0"
|
64
|
-
version:
|
65
75
|
requirements: []
|
66
76
|
|
67
77
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.3.
|
78
|
+
rubygems_version: 1.3.6
|
69
79
|
signing_key:
|
70
80
|
specification_version: 3
|
71
81
|
summary: A trivial bit of common code
|