开发者

getting comatose working with authlogic

I started using comatose to handle content on my site but am having problems using it with my existing authentication using a generic Authlogic config.

In the readme he sites an example for configuring it with Restful Authentication and I'm wondering how I would do the same within a general Authlogi开发者_JAVA百科c setup?

    #environment.rb 
    Comatose.configure do |config|
      # Includes AuthenticationSystem in the ComatoseController
      config.includes << :authenticated_system
    end

http://github.com/darthapo/comatose


I think a better way to do it is moving the auth methods out into a module, and include that from both ApplicationController and comatose. Example:

Put your auth methods into user_sessions_helper:

module UserSessionsHelper
  module AuthMethods
    private 
      ...
    def require_user
      ...

Then include the module in your ApplicationController:

  class ApplicationController < ActionController::Base
     include UserSessionsHelper::AuthMethods
     ...

And finally in the comatose config as well (environment.rb):

Comatose.configure do |config|
  config.admin_includes << "UserSessionsHelper::AuthMethods"   
  config.admin_authorization = :require_user
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜