robdiciuccio edited this page May 31, 2011 · 1 revision

Authorization is not enabled by default in the platform administration modules. Of course, there are several ways to provide authorization and authentication services, ranging from basic HTTP authentication to more integrated solutions. How to implement authorization is up to you; however, we have provided hooks and sample code to get you started.


The following explains how to enable admin authorization using Authlogic for authentication.

Install Authlogic

Edit your application's environment.rb file to include the Authlogic gem:

config.gem "authlogic", :version => '2.1.6'

Update your installed gems:

$ rake gems:install

Copy the Authlogic db migration file from vendor/plugins/linktv_platform/db/migrate/authlogic/ to your local db migrations directory.

Run the migration:

$ rake db:migrate

Include the bundled Authorization module in your ApplicationController (after PlatformController include):

class ApplicationController < ActionController::Base
  include Linktv::Platform::PlatformController
  include Linktv::Platform::Authorization

Override the User model in your application (user.rb), including the 'acts_as_authentic' initializer:

require_or_load "#{LINKTV_PLATFORM_ROOT}/app/models/user.rb"
class User

Setup the default admin user (admin:admin):

$ rake linktv_platform:db:seed:users

Start the application, and you will be prompted to login when accessing any admin resources.