HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

Looking for collaborators for a Rails integration add-on.

edited November 2008 in Vanilla 1.0 Help
Hi, I'm a Rails programmer, and I'm working on project to make it really easy to integrate apps like Vanilla into existing Rails applications. I'm not too familiar with the internals of Vanilla, so it'd be great if there's someone out there that would also like this kind of project to happen. Here's the project page: http://greenfabric.com/page/integration_api_home_page Here's a quote from the readme file: The basic idea -------------- The key idea is to add a web services API into the existing Rails application, which allows one or more 3rd party apps to get the information they need, when they need it. The API should be configurable enough and general enough so that it can be added to any Rails app without modification. The Rails app stays in control of all sign-in and sign-out functions. A 3rd party app, such as Vanilla, is installed in a subdirectory of the Rails app on the same host. If that is difficult to do, it can be installed running on a different port. These configurations will allow it to access the Rails cookie. The Rails app will need no custom work. The third-party apps will need a small amount of programming. The following steps are performed in PHP, Rails, or whatever development environment in which the 3rd-party app runs: * Customize the sign-in and sign-out links to point to those in your Rails app. * Customize the function that checks if a user is signed in to do the following: 1. Get the Rails cookie name via the API. 2. Check for the existence of the cookie in the browser. Not there => not logged in. If there, continue... 3. Get the cookie data and send it to the API, which returns the user info. Empty data => not logged in. If there's user data, continue... 4. Create a new [Vanilla/Wordpress/etc.] user record if none exists yet. 5. Allow the [Vanilla/Wordpress/etc.] sign-in function to succeed, marking the user as signed in.

Comments

  • that looks interesting and writing a customized authenticator for vanilla should be easy for vanilla 1.1.5+
  • That'd be great if it's easy. Anybody have a pointer where I should start looking in the source code or developer docs? I finished a Wordpress plugin --- that code should be helpful to anyone wanting to make a Vanilla plugin.
  • edited November 2008
    You should check the documentation that explain how to write an addon and the one that describe the object factory. You probably should also read the bridge tutorials. However there are out of date. The LIBRARY_INCLUDE_PATH and OBJECT_FACTORY_REFERENCE_* settings have been added in Vanilla 1.1.5 and I don't think the documentation mention then. They allow vanilla to load extension classes before the extensions are loaded (some objects are created before the extension are loaded). Also since Vanilla 1.1.5 you can extends the Authenticator class (before your own Authenticator needed to be called Authenticathor).

    Check the Context class (library/Framework/Framework.Class.Context.php). It is this class that start the authentication and the session. The Authenticator class is the class that authenticate the user.

    You will have to write your own Authenticator class:
    # extensions/RorBridge/library/People/People.Class.RorBridgeAuthenticator.php include_once $Context->Configuration['LIBRARY_PATH'] . '/People/People.Class.Authenticator.php'; class RorBridgeAuthenticator extends Authenticator { ... }

    To make Vanilla use your authenticator:
    # extensions/RorBridge/default.php if (empty($Configuration['RORBRIDGE_VERSION'])) { AddConfigurationSetting($Context, 'AUTHENTICATION_CLASS', 'RorBridgeAuthenticator'); AddConfigurationSetting($Context, 'LIBRARY_INCLUDE_PATH', $Configuration['LIBRARY_INCLUDE_PATH'] + ';%EXTENSIONS%/RorBridge/library/'); AddConfigurationSetting($Context, 'RORBRIDGE_VERSION', '0.1.0'); }

    If you need to extends the UserManager and Session class:# extensions/RorBridge/library/People/People.Class.RorBridgeUserManager.php include_once $Context->Configuration['LIBRARY_PATH'] . '/People/People.Class.UserManager.php'; class RorBridgeUserManager extends UserManager{ ... } # extensions/RorBridge/library/People/People.Class.RorBridgeSession.php include_once $Context->Configuration['LIBRARY_PATH'] . '/People/People.Class.Session.php'; class RorBridgeSession extends PeopleSession{ ... } # extensions/RorBridge/default.php if (empty($Configuration['RORBRIDGE_VERSION'])) { AddConfigurationSetting($Context, 'AUTHENTICATION_CLASS', 'RorBridgeAuthenticator'); AddConfigurationSetting($Context, 'OBJECT_FACTORY_REFERENCE_USER_MANAGER', 'RorBridgeUserManager'); AddConfigurationSetting($Context, 'OBJECT_FACTORY_REFERENCE_PEOPLE_SESSION', 'RorBridgeSession'); AddConfigurationSetting($Context, 'LIBRARY_INCLUDE_PATH', $Configuration['LIBRARY_INCLUDE_PATH'] + ';%EXTENSIONS%/RorBridge/library/'); AddConfigurationSetting($Context, 'RORBRIDGE_VERSION', '0.1.0'); }
This discussion has been closed.