Im in the process of setting up a Spree shopping cart on an existing site which uses a phpbb forum for storing all users and logging in etc. I wanted the existing users of the site to be able to purchase from the shopping cart area without having to go through another sign up process and have 2 sets of usernames and passwords so iv created a Spree extension called spree-phpbb-auth.
The extension looks for the phpbb session cookie and looks it up in the forum database, if the user is unknkown to the spree application, a user will be created within Spree in the background. The standard Spree authentication system is then used to set that users session up to declare them as being logged in. It overwrites the existing login /logout/register/edit my account actions so that they redirect to the phpbb equivalents.
Its not being used in Production yet but it all seems to work ok locally. There are a few issues that I can think of
- Won’t work accross different domains (should work on subdomains if you set the cookie domain to be ".site.com" instead of "forum.site.com")
- All users that get automatically added to the Spree users table get assigned to the group "users" so it doesn’t look at the phpbb permissions at all.
- If you allow your phpbb user to change email addressess then when they hit the cart after a change, they will be registed as a new user.
- script/extension install git://github.com/mattfawcett/spree-phpbb-auth.git
- Change the contents of config/phpbb_auth_settings.rb
- Add an entry to your database.yml file for "phpbb_database_production"
When your developing a web app, you usually end up with lots of duff data both in your database and file system from when you have been testing inserting data and uploading files when things have been half implemented. Usually its a good idea to take a fresh database dump from your production server and download the assets (or whatever you call the directory where user uploads go) so that you actually have some real data.
This is usually a bit of a pain to do as you need to ssh in to dump the database, SCP the assets. It also forces you to develop using a MySQL database if thats what your production server uses.
Adam Wiggins has released a plugin called yaml_db that allows you to dump and import your database into/from YAML format. Today I wrote a quick rake task that connects to your production or staging over SSH, runs the task to dump the YAML file (rake db:data:dump) and then downloads it locally with SFTP. It then runs the rake task to import the data (rake db:data:load). It also uses Rsync to sync any asset or other folders on your remote server that are installation specific to your local development environment.
At the moment the only downside to the script is that it calls rsync from the shell which asks you to type your password. It would be good to have it all inclusive within the script, but that doesn’t seem possible with rsync. The script is a gist on Github