invision_bridge 0.1.0 → 0.2.0
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/README.md +66 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/invision_bridge.gemspec +8 -8
- data/lib/invision_bridge/invision_bridge.rb +11 -5
- metadata +29 -13
- data/README.textile +0 -7
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# InvisionBridge
|
2
|
+
|
3
|
+
Allows your [Authlogic](http://github.com/binarylogic/authlogic)-based User model to authenticate using an [IP.Board](http://www.invisionpower.com/) 3.x database.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
### Database configuration
|
8
|
+
|
9
|
+
You'll need to **manually** alter the `ibf_members` table in your IP.Board database to
|
10
|
+
add the following fields for use by Authlogic:
|
11
|
+
|
12
|
+
persistence_token varchar(255) NOT NULL
|
13
|
+
last_request_at datetime NULL
|
14
|
+
current_login_at datetime NULL
|
15
|
+
last_login_at datetime NULL
|
16
|
+
current_login_ip varchar(255) NULL
|
17
|
+
last_login_ip varchar(255) NULL
|
18
|
+
single_access_token varchar(255) NULL
|
19
|
+
|
20
|
+
Modify your `config/database.yml` file to include your IP.Board database information:
|
21
|
+
|
22
|
+
invision_bridge_development:
|
23
|
+
adapter: mysql
|
24
|
+
database: my_forums_development
|
25
|
+
host: localhost
|
26
|
+
user: username
|
27
|
+
password: password
|
28
|
+
prefix: ibf_
|
29
|
+
|
30
|
+
invision_bridge_production:
|
31
|
+
adapter: mysql
|
32
|
+
database: my_forums
|
33
|
+
host: localhost
|
34
|
+
user: username
|
35
|
+
password: password
|
36
|
+
prefix: ibf_
|
37
|
+
|
38
|
+
### Model creation
|
39
|
+
|
40
|
+
Modify or create your User model to inherit from `InvisionBridge::User::Base`
|
41
|
+
|
42
|
+
class User < InvisionBridge::User::Base
|
43
|
+
end
|
44
|
+
|
45
|
+
That's it. You can further customize your model as needed. For example, you may
|
46
|
+
have a group of administrators on your forum that you want to be administrators
|
47
|
+
in your Rails application.
|
48
|
+
|
49
|
+
class User < InvisionBridge::User::Base
|
50
|
+
ADMIN_GROUP = 1
|
51
|
+
|
52
|
+
def is_admin?
|
53
|
+
self.member_group_id == ADMIN_GROUP
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
## Known Issues
|
58
|
+
|
59
|
+
While using this in my own production application, I'd occasionally get "MySQL
|
60
|
+
server has gone away" exceptions popping up. I still don't know the root cause,
|
61
|
+
but I was able to make the error stop appearing by adding `reconnect: true` to the
|
62
|
+
`invision_bridge_production` database definition.
|
63
|
+
|
64
|
+
## Credits
|
65
|
+
|
66
|
+
Copyright (c) 2010 Robert Speicher, released under the MIT license
|
data/Rakefile
CHANGED
@@ -26,10 +26,10 @@ begin
|
|
26
26
|
require 'jeweler'
|
27
27
|
Jeweler::Tasks.new do |s|
|
28
28
|
s.name = "invision_bridge"
|
29
|
-
s.summary = "
|
29
|
+
s.summary = "Allows your Authlogic-based User model to authenticate using an IP.Board 3.x database."
|
30
30
|
s.email = "rspeicher@gmail.com"
|
31
31
|
s.homepage = "http://github.com/tsigo/invision_bridge"
|
32
|
-
s.description = "
|
32
|
+
s.description = "Allows your Authlogic-based User model to authenticate using an IP.Board 3.x database."
|
33
33
|
s.authors = ["Robert Speicher"]
|
34
34
|
s.files = FileList["[A-Za-z]*", "{lib,rails,spec,config}/**/*"]
|
35
35
|
s.add_dependency 'authlogic'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/invision_bridge.gemspec
CHANGED
@@ -5,19 +5,19 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{invision_bridge}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Robert Speicher"]
|
12
|
-
s.date = %q{2010-
|
13
|
-
s.description = %q{
|
12
|
+
s.date = %q{2010-08-18}
|
13
|
+
s.description = %q{Allows your Authlogic-based User model to authenticate using an IP.Board 3.x database.}
|
14
14
|
s.email = %q{rspeicher@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"README.
|
16
|
+
"README.md"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
"MIT-LICENSE",
|
20
|
-
"README.
|
20
|
+
"README.md",
|
21
21
|
"Rakefile",
|
22
22
|
"VERSION",
|
23
23
|
"config/database.yml.example",
|
@@ -38,8 +38,8 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.homepage = %q{http://github.com/tsigo/invision_bridge}
|
39
39
|
s.rdoc_options = ["--charset=UTF-8"]
|
40
40
|
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.3.
|
42
|
-
s.summary = %q{
|
41
|
+
s.rubygems_version = %q{1.3.7}
|
42
|
+
s.summary = %q{Allows your Authlogic-based User model to authenticate using an IP.Board 3.x database.}
|
43
43
|
s.test_files = [
|
44
44
|
"spec/invision_bridge/crypto_provider_spec.rb",
|
45
45
|
"spec/spec_helper.rb"
|
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
|
|
49
49
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
50
|
s.specification_version = 3
|
51
51
|
|
52
|
-
if Gem::Version.new(Gem::
|
52
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
53
|
s.add_runtime_dependency(%q<authlogic>, [">= 0"])
|
54
54
|
else
|
55
55
|
s.add_dependency(%q<authlogic>, [">= 0"])
|
@@ -7,14 +7,20 @@ module InvisionBridge
|
|
7
7
|
module ClassMethods
|
8
8
|
def establish_bridge()
|
9
9
|
if Rails
|
10
|
-
|
11
|
-
|
10
|
+
config_file = Rails.configuration.database_configuration_file
|
11
|
+
config_group = "invision_bridge_#{Rails.env}"
|
12
12
|
else
|
13
|
-
|
14
|
-
|
13
|
+
config_file = File.join(File.dirname(__FILE__), '..', '..', 'config', 'database.yml')
|
14
|
+
config_group = "invision_bridge"
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
begin
|
18
|
+
config = YAML::load(config_file)
|
19
|
+
config = config[config_group]
|
20
|
+
config['prefix'] ||= 'ibf_'
|
21
|
+
rescue NoMethodError
|
22
|
+
raise "Unable to read database configuration from #{config_file} -- Make sure an #{config_group} definition exists."
|
23
|
+
end
|
18
24
|
|
19
25
|
establish_connection(config)
|
20
26
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invision_bridge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Robert Speicher
|
@@ -9,30 +15,34 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-08-18 00:00:00 -04:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: authlogic
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
23
32
|
version: "0"
|
24
|
-
|
25
|
-
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Allows your Authlogic-based User model to authenticate using an IP.Board 3.x database.
|
26
36
|
email: rspeicher@gmail.com
|
27
37
|
executables: []
|
28
38
|
|
29
39
|
extensions: []
|
30
40
|
|
31
41
|
extra_rdoc_files:
|
32
|
-
- README.
|
42
|
+
- README.md
|
33
43
|
files:
|
34
44
|
- MIT-LICENSE
|
35
|
-
- README.
|
45
|
+
- README.md
|
36
46
|
- Rakefile
|
37
47
|
- VERSION
|
38
48
|
- config/database.yml.example
|
@@ -59,24 +69,30 @@ rdoc_options:
|
|
59
69
|
require_paths:
|
60
70
|
- lib
|
61
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
62
73
|
requirements:
|
63
74
|
- - ">="
|
64
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
65
79
|
version: "0"
|
66
|
-
version:
|
67
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
68
82
|
requirements:
|
69
83
|
- - ">="
|
70
84
|
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
71
88
|
version: "0"
|
72
|
-
version:
|
73
89
|
requirements: []
|
74
90
|
|
75
91
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.3.
|
92
|
+
rubygems_version: 1.3.7
|
77
93
|
signing_key:
|
78
94
|
specification_version: 3
|
79
|
-
summary:
|
95
|
+
summary: Allows your Authlogic-based User model to authenticate using an IP.Board 3.x database.
|
80
96
|
test_files:
|
81
97
|
- spec/invision_bridge/crypto_provider_spec.rb
|
82
98
|
- spec/spec_helper.rb
|