sixarm_ruby_current_user 1.2.6

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.
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ ��[�2������>8֡>H���.cPnVFZ���յSke�>�@ڶ�𥑙*���8�9�k�������ӭ�c˞.@
2
+ _ Eb/C�+r�b��e;�&N���Z�q�gV�_( J�5��B�+n�7�
data/.gemtest ADDED
File without changes
data/INSTALL.txt ADDED
@@ -0,0 +1,31 @@
1
+ = SixArm.com Ruby Gem Install
2
+
3
+
4
+ First-time users: add our gem certificate and source.
5
+ When you do this once, it works for all our gems.
6
+
7
+ sudo wget http://sixarm.com/sixarm.pem
8
+ sudo gem cert --add sixarm.pem
9
+ sudo gem sources --add http://sixarm.com
10
+
11
+ Install the gem with advanced options.
12
+
13
+ sudo gem install sixarm_ruby_current_user --test --trust-policy HighSecurity
14
+
15
+
16
+ == Notes
17
+
18
+ Do you have any questions, comments, suggestions, or feedback?
19
+ Let us know, we're happy to help. Our email is sixarm@sixarm.com
20
+
21
+ Do you want to create your own high security gems?
22
+ Learn how at http://www.rubygems.org/read/chapter/21
23
+
24
+ To see your current gem certificate list:
25
+
26
+ sudo gem cert --list
27
+
28
+ Our cert looks like this:
29
+
30
+ /C=US/ST=California/L=San Francisco/O=SixArm/CN=sixarm.com
31
+
data/LICENSE.txt ADDED
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+
3
+ You may choose any of these licenses:
4
+
5
+ - CreativeCommons License, Non-commercial Share Alike
6
+ - LGPL, GNU Lesser General Public License
7
+ - MIT License
8
+ - Ruby License
9
+
10
+ THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
data/README.rdoc ADDED
@@ -0,0 +1,15 @@
1
+
2
+ = SixArm Ruby Gem: CurrentUser module with current_user methods
3
+
4
+ Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
5
+ Copyright:: Copyright (c) 2005-2010 Joel Parker Henderson
6
+ License:: CreativeCommons License, Non-commercial Share Alike
7
+ License:: LGPL, GNU Lesser General Public License
8
+
9
+ Simple gem to get and set the current user,
10
+ using the related gem for current_user_id.
11
+
12
+ For speed, we memoize the current_user.
13
+
14
+ The current_user_find method also includes the user's roles.
15
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib' << 'test'
7
+ t.pattern = 'test/*.rb'
8
+ end
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README.rdoc
4
+ =end
5
+
6
+ require 'sixarm_ruby_current_user_id'
7
+
8
+ module CurrentUser
9
+
10
+ include CurrentUserId
11
+
12
+
13
+ # Get the current user:
14
+ # - if it is already set, then return it without doing a lookup
15
+ # - otherwise, find the user via #current_user_find
16
+ #
17
+ # If the current user is not set, and the current user id is nil,
18
+ # then this returns nil because current_user_find returns nil.
19
+
20
+ def current_user
21
+ @current_user ||= current_user_find_by_id(current_user_id)
22
+ end
23
+
24
+
25
+ # Set the current user and also set the current user id.
26
+
27
+ def current_user=(user)
28
+ @current_user = user
29
+ return current_user_id = (user ? user.id : nil)
30
+ end
31
+
32
+
33
+ # Return the current user by calling User.find with a user id.
34
+ # If the user id is nil, then return nil for the current user.
35
+
36
+ def current_user_find_by_id(id)
37
+ return id ? User.find(id) : nil
38
+ end
39
+
40
+
41
+ end
@@ -0,0 +1,54 @@
1
+ require 'test/unit'
2
+ require 'sixarm_ruby_current_user'
3
+ require 'sixarm_ruby_current_user_id'
4
+ require 'sixarm_ruby_active_record_mock'
5
+ require 'simplecov'
6
+ SimpleCov.start
7
+
8
+
9
+ class User < ActiveRecordMock
10
+ end
11
+
12
+
13
+ class Testing < Test::Unit::TestCase
14
+
15
+ include CurrentUser
16
+
17
+ ANNE_ID=1
18
+ BETH_ID=2
19
+ CATE_ID=3
20
+
21
+ ANNE = User.new(:id => ANNE_ID, :name => 'Anne')
22
+ BETH = User.new(:id => BETH_ID, :name => 'Beth')
23
+ CATE = User.new(:id => CATE_ID, :name => 'Cate')
24
+
25
+ def session
26
+ @session||=Hash.new
27
+ end
28
+
29
+ def test_blank_slate
30
+ assert_nil(current_user, "current_user")
31
+ assert_nil(current_user_id, "current_user_id")
32
+ end
33
+
34
+ def test_current_user_equals
35
+ current_user=BETH
36
+ actual=current_user
37
+ assert_equal(BETH, actual, "beth, actual:#{actual}")
38
+ assert_not_equal(ANNE, actual, "anne, actual:#{actual}")
39
+ assert_not_equal(CATE, actual, "cate, actual:#{actual}")
40
+ end
41
+
42
+ def test_current_user_clear
43
+ current_user=ANNE
44
+ assert_equal(ANNE, current_user, "current_user")
45
+ current_user=nil
46
+ assert_nil(current_user, "current_user")
47
+ end
48
+
49
+ end
50
+
51
+
52
+
53
+
54
+
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_current_user
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.2.6
6
+ platform: ruby
7
+ authors:
8
+ - SixArm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIIDBDCCAm2gAwIBAgIJAKPwEETU5bHoMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
15
+ BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp
16
+ c2NvMQ8wDQYDVQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb20wHhcNMTAx
17
+ MjEzMjMyNzEzWhcNMTMwOTA4MjMyNzEzWjBgMQswCQYDVQQGEwJVUzETMBEGA1UE
18
+ CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEPMA0GA1UEChMG
19
+ U2l4QXJtMRMwEQYDVQQDEwpzaXhhcm0uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN
20
+ ADCBiQKBgQC94mD9JDwBsunsOI0VR3CXXbOWg9cWaWciwFyJNFiM7A9I8KPLfXUw
21
+ QC4czUe5ZuG4WHvinrWhkrCK+1dWBqoEClxdF/FoKO5a+tonGCjjmfy81JmFjjyx
22
+ eTsjsHyvw+Qik9kpf9aj6+pnkNrVswgNHVea2o9yabbEiS6VSeJWoQIDAQABo4HF
23
+ MIHCMB0GA1UdDgQWBBQzPJtqmSgc53eDN7aSzDQwr9TALDCBkgYDVR0jBIGKMIGH
24
+ gBQzPJtqmSgc53eDN7aSzDQwr9TALKFkpGIwYDELMAkGA1UEBhMCVVMxEzARBgNV
25
+ BAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xDzANBgNVBAoT
26
+ BlNpeEFybTETMBEGA1UEAxMKc2l4YXJtLmNvbYIJAKPwEETU5bHoMAwGA1UdEwQF
27
+ MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAooEexP/oPam1TP71SyuhxMb+uTrZbSQe
28
+ jVB+ExRwWadGwaNPUA56d39qwavwP+iu+3JpeonNMVvbWXF5naCX/dNFIeREHzER
29
+ ZDRQYMqru9TEMna6HD9zpcstF7vwThGovlOQ+3Y6plQ4nMzipXcZ9THqs65PIL0q
30
+ eabwpCbAopo=
31
+ -----END CERTIFICATE-----
32
+
33
+ date: 2011-04-19 00:00:00 -07:00
34
+ default_executable:
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: sixarm_ruby_current_user_id
38
+ prerelease: false
39
+ requirement: &id001 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - "="
43
+ - !ruby/object:Gem::Version
44
+ version: 1.2.6
45
+ type: :runtime
46
+ version_requirements: *id001
47
+ - !ruby/object:Gem::Dependency
48
+ name: sixarm_ruby_active_record_mock
49
+ prerelease: false
50
+ requirement: &id002 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.3.0
56
+ type: :runtime
57
+ version_requirements: *id002
58
+ description:
59
+ email: sixarm@sixarm.com
60
+ executables: []
61
+
62
+ extensions: []
63
+
64
+ extra_rdoc_files: []
65
+
66
+ files:
67
+ - .gemtest
68
+ - Rakefile
69
+ - README.rdoc
70
+ - INSTALL.txt
71
+ - LICENSE.txt
72
+ - lib/sixarm_ruby_current_user.rb
73
+ - test/sixarm_ruby_current_user_test.rb
74
+ has_rdoc: true
75
+ homepage: http://sixarm.com/
76
+ licenses: []
77
+
78
+ post_install_message:
79
+ rdoc_options: []
80
+
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project:
98
+ rubygems_version: 1.6.2
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: "SixArm.com \xC2\xBB Ruby \xC2\xBB CurrentUser module for Ruby On Rails to get and set a user in a session"
102
+ test_files:
103
+ - test/sixarm_ruby_current_user_test.rb
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ sRT�+�2(J[��=z����Y�
2
+ ���5Y��2 ��.��$�U��-���n��> la�"�j-�8(��Г�|��e��m��|2wks�P;��由���ɀ�)��Y�B�g��狆��c����