Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Pull request Compare This branch is 3878 commits behind padrino:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
lib
test
.document
.gitignore
LICENSE
README.rdoc
Rakefile
padrino-admin.gemspec

README.rdoc

Admin Dashboard and Authentication (padrino-admin)

Overview

Padrino has a beautiful Admin management dashboard with these features:

Orm Agnostic

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

Template Agnostic

Erb and Haml Renderer

Authentication

Support for Account authentication, Account Permission managment

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 Padrino Admin guide.

Create a new project:

$ padrino-gen project demo
$ cd demo

Create the admin subapplication:

demo$ padrino-gen admin

Next, follow the admin setup steps:

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

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

  • run padrino rake seed

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

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

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

That's all!!

Admin Access Control

Padrino 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 < Padrino::Application
  register Padrino::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 Padrino Admin guide.

Copyright

Copyright © 2010 Padrino. See LICENSE for details.

Something went wrong with that request. Please try again.