vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Vbulletin Rails integration (https://vborg.vbsupport.ru/showthread.php?t=199000)

deepu256 12-16-2008 10:41 AM

Vbulletin Rails integration
 
Hi all,
we have been using vbulletin for our discussion board for long time now. once we had a very active community we began writing more web apps. Till now since all were written in php we didn't face any problems with authentication. we simple used vbulletin to see if a user is logged in or not and redirected accordingly. all this is possible because i can just simple "include vbulletin file".

now we are planning to use ruby on rails for coding an app. how can i still use vbulletin to check whether a user is logged in or not ? i also need his userid and username variables and then use them in my rails app.

Any ideas on how to do it ?

Cheers,
Deepu.

Thibaut 02-27-2009 08:54 AM

Looking for this too, any ideas ?

Dismounted 02-27-2009 10:41 AM

What you need to do is check the userid/password combination given in the user's cookies.

Thibaut 03-06-2009 04:27 PM

Thanks, that's what I'm doing but is it safe to authenticate a user by its cookies ? Cookies can be stolen...

TigerC10 03-06-2009 06:20 PM

It's the easiest way... But you're right, totally insecure if someone is on a public wireless network. Otherwise you're going to have to make a prompt for their passwords. Either way, you're going to have to write a custom DB connect in ruby rails that connects to your vBulletin database and checks the user table for authentication.

That shouldn't really be a problem if you are coding your new app yourself.

aussiev8 05-17-2009 01:02 AM

I'm keen to write a connector, something that'll pass the view variables from rails to something in php that'll bring up the view, while at the same time being able to pass the core bits and pieces that are needed to preform logic to the rails app.

I've tried to share cookies etc, but it was very hard, and very annoying trying to match the template, especially the header, with the drop downs etc. So I was thinking of creating a connector that'll let me write my apps in rails, and basically pass the information to a vbulletin addon that will let me pass the view (instance) variables to vbulletin for the vb plugin to then work out what template to show, etc.

I've written some stuff for VB that'll make things Restful. For instance, after my rails app authenticates itself to vb (using a 256character hash generated based on an algorithm (so it keeps changing)) i can do basic stuff right now, like grab a user, or a list of users, or a list of posts, etc. So rails is using activeresource for now to do that..

If anyone is interested in helping shoot me a pm on here and we can co-ordinate how we can do this.

Briskoda 05-25-2009 03:10 PM

Everyones needs are different. I'm building a members area that hooks into vb on the user and usergroup (vb subscription changes users primary group)

So for now I'm happy to prompt for a login and keep a separate cookie for the rails app. Not ideal but it works for my scenario.

Achieving this is quite straight forward, I've established a second connection in database.yml then created a user model.rb file. Within this we do:
Code:

class User < ActiveRecord::Base
  #Class to access the forums user table. 
  establish_connection :forums
  set_table_name 'user'
  set_primary_key 'userid'

/snip

Now model behaves like a normal AR model.
So using the mot basic parts from acts as authenticated I rolled my own sessions / login pages and then I used this
Code:

Digest::MD5.hexdigest(Digest::MD5.hexdigest(password)+salt)
to authenticate against the vb user table. All profile management is done via vb.

I would at some point like to logout of the member app when you logout of vb... But as it's a separate app on a separate sub-domain, I'm happy to leave them separate for the moment and focus on getting a working functional site out.

Of course the established connection makes it quite easy to lift out information from vb, which I think is easier than writing and calling api wrappers on vb code. More so as I've got so dam rusty on php... We used active resource for a few projects before dropping it in favor of establishing connections and masking remote tables this way. Everyone's needs are different...

HTH


All times are GMT. The time now is 03:39 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01132 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete