1

Facebook、Twitter、openidでユーザーを認証するための認証メカニズムとしてDevise+OmniAuthを使用しました。次に、RefineryCMSを既存のアプリケーションに統合する必要があります。

要件: アプリケーションのホームページには、静的コンテンツを含むサインアップ/サインインボタンがあります。サインインすると、ユーザーは制限区域にアクセスできます。制限されたページでRefineryCMSにアクセスするためのリンクを追加します。クレデンシャルを再度要求することはできません。

次のリンクをたどって、RefineryCMSを統合しました。

  1. http://refinerycms.com/guides/with-an-existing-rails-app
  2. http://refinerycms.com/guides/with-an-existing-rails-31-devise-app

サーバーを起動した後、ヒット http://localhost:3000するとにリダイレクトされhttp://localhost:3000/refinery/users/registerます。ユーザーは、公開コンテンツを含むホームページを表示できる必要があります。ユーザーは、サポートされているサービスで自分自身を認証した後にのみ、(/ helpを介して)製油所CMSにアクセスできます。

これがconfig/routes.rbのスナップです

mount Refinery::Core::Engine, :at => '/'
...
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", registrations: "registrations" }
....
root :to => "home#index"

config / application.rb

config.autoload_paths += Dir["#{config.root}/lib/**/"] # to load files from lib directory, including subfolders

    config.before_initialize do
      require 'refinery_patch'
      require 'restrict_refinery_to_refinery_users'
    end

    include Refinery::Engine
    after_inclusion do
      [ApplicationController, ApplicationHelper].each do |c|
        c.send :include, ::RefineryPatch
      end

      ::Refinery::AdminController.send :include, ::RestrictRefineryToRefineryUsers
      ::Refinery::AdminController.send :before_filter, :restrict_refinery_to_refinery_users
    end

私たちは初心者です。どんな助けでもかなりあります。

4

1 に答える 1

2

動作したhttp://sdownie.com/blogs/integrating-refinery-rails-3-2-into-your-existing-rails-appをフォローしました。

ここで議論されたいくつかの問題がありました。

https://groups.google.com/d/topic/refinery-cms/G5twqi0uTHs/discussion https://groups.google.com/d/topic/refinery-cms/w-4VrfPewQY/discussion

于 2012-10-05T05:55:44.870 に答える