Admin Dashboard and Authentication (tennpipes-su)

Overview

Tennpipes has a beautiful Admin management dashboard with these features:

Orm Agnostic

Data Adapters for Datamapper, Activerecord, Sequel, Mongomapper, Mongoid, Couchrest, Dynamoid

Template Agnostic

Erb, Erubis and Haml Renderer

Authentication

Support for Account authentication, Account Permission management

Scaffold

You can simply create a new “admin interface” by providing a Model

Access Control

Supports authentication and role permissions for your application

Admin Dashboard Usage

For a complete look at usage of the Admin dashboard functionality, be sure to check out the Tennpipes Admin guide.

Create a new project:

$ tennpipes-init project demo
$ cd demo

Create the admin subapplication:

demo$ tennpipes-init admin

Next, follow the admin setup steps:

  • configure your config/database.rb to connect to the correct data.

  • run tennpipes rake dm:migrate # or ar:migrate if you use activerecord

  • run tennpipes rake seed

Your admin panel now is ready and you can start your server with tennpipes start and point your browser to /admin!

To create a new “scaffold” you need to provide only a Model name to the command:

demo$ tennpipes-init model post --skip-migration # edit your post.rb model and add some fields
demo$ tennpipes-init rake dm:auto:migrate
demo$ tennpipes-init admin_page post
demo$ tennpipes start # and go to http://localhost:3000/admin

That’s all!!

Admin Access Control

Tennpipes Admin use a model Account for manage role, membership and permissions.

For an ecommerce website, usually certain actions require permissions and authentication. This is supported by the admin access control features:

class EcommerceSite < Tennpipes::Application
  register Tennpipes::Admin::AccessControl
  enable :store_location
  set    :login_page, "/login"

  access_control.roles_for :any do |role|
    role.protect "/customer/orders"
    role.protect "/cart/checkout"
  end
end

In this example if we visit URLs that start with /customer/orders or /cart/checkout we will be redirected to our :login_page “/login”. Once we are correctly logged in we can visit these pages.

For a more complete look at using the Admin panel functionality and access features, be sure to check out the Tennpipes Admin guide.

Copyright © 2011-2013 Tennpipes. See LICENSE for details.