Double Auth Engine

Authlogic and Declarative Authorization together in one fantastic Rails engine. Bladow!

Setup

  1. Add double_auth_engine to Gemfile

    gem "double_auth_engine"
    
  2. Rebundle

    bundle install
    
  3. Run the DoubleAuthEngine install generator

    rails g double_auth_engine:install
    
  4. Migrate your DB and seed it with default seeds (:user and :admin)

    rake db:migrate:seed
    
  5. Update "[email protected]" within setup_mail.rb to the default address for your application. This address is used for the engine's password reset mailer.

    class ActionMailer::Base
      def from_with_default(input=nil)
        return from_without_default(input) || "[email protected]" if input.nil?
        from_without_default(input)
      end
      alias_method_chain :from, :default
    end
    
  6. Start app

    rails s
    

Usage

Anything within a Rails engine can be overridden by creating the same file within the parent application. For example if you'd like to create your own login form, simply create a new.html.erb within the app/views/user_sessions folder in your application. If you need to add additional functionality to one of the models or controllers provided by the engine, create the corresponding file in the appropriate place with your application and then include the associated module from the engine.

class User < ActiveRecord::Base
  include DoubleAuthEngine::UserMixin
end

Readme Driven Development

A strike means its done!

  • Add Authlogic
  • Add Password Reset
  • Change Password
  • Update generator with ActionMailer monkey patch
  • Update install generator to add include to ApplicationController
  • Update README for mailer settings
  • Authlogic specs
  • Add Declarative Authorization
  • Declarative Authorization specs
  • Friendly ID
  • Mailer specs
  • Style views

Versioning

This project uses Semantic Versioning

Contributors

All contributions are welcome. Fork repo, make changes, add specs, ensure all specs pass, send a pull request.

Copyright (c) 2011 Kyle Bolton, released under the MIT license