= Admin Dashboard and Authentication (padrino-admin)
=== Overview
Padrino has a beautiful Ajax Admin, with these fatures:
Orm Agnostic:: Adapters for datamapper, activerecord, mongomapper, couchdb (now only: datamapper and activerecord)
Authentication:: Support for Account authentication, Account Permission managment
Scaffold:: You can simply create a new "admin interface" simply providing a Model
Ajax Uploads:: You can upload file, manage them and attach them to any model in a quick and simple way (coming soon)
=== Admin Usage
Create a project:
$ padrino-gen app fun-test
$ cd fun-test
For create the admin application:
fun-test$ padrino-gen admin
Now follow admin instructions so:
* edit your config/database.rb
* run padrino rake dm:auto:migrate
* run padrino rake seed
Your admin now is "complete", you can start your server with padrino start and point your browser to /admin!
For create a new "scaffold" you need to provide only a Model for them like:
fun-test$ padrino-gen model post --skip-migration // edit your post.rb model and add some fields
fun-test$ padrino-gen rake dm:auto:migrate
fun-test$ padrino-gen admin_page Post
fun-test$ padrino start // and go to yourserver.local/admin
That's all!!
=== Admin Authentication
Padrino Admin use a model Account for manage role, membership and permissions take the following example:
access_control.roles_for :any do |role|
role.allow "/sessions"
# role.deny "/deny/this/always"
end
access_control.roles_for :admin do |role, account|
role.allow "/"
role.project_module :accounts do |project|
project.menu :list, "/admin/accounts.js"
project.menu :new, "/admin/accounts/new"
end
end
access_control.roles_for :editor do |role, account|
role.project_module :posts do |project|
project.menu :list, "/admin/posts.js"
project.menu :new, "/admin/posts/new"
end
role.project_module :comments do |project|
project.menu :list, "/admin/comments.js"
project.menu :new, "/admin/comments/new"
end
end
In this example we grant "/session" (and each subpaths like /sessions/new) for all users logged and unlogged.
Account with role admin can manage only accounts because have access to "/admin/accounts/**" paths
Account with role editor can manage only post/comments because have access to "/admin/posts/**", "/admin/posts/**" paths
Another good fature of Padrino admin is that when you define a Project Module role you also build the Menu Tree of the Admin.
Trust us that in future you appreciate so much this feature.
== Copyright
Copyright (c) 2010 Padrino. See LICENSE for details.