-
Notifications
You must be signed in to change notification settings - Fork 45
Generators
CanTango comes with the Rails 3 generators to do the following:
- install (initializer and yaml files)
- create user permit
- create account permit
- create role permit(s)
- create role group permit(s)
- create license(s)
- create permit(s) scoped under a specific account
Installs CanTango in your app by generating the following files
-
cantango.rb
initializer -
categories.yml
(optional) -
permissions.yml
(optional)
rails g cantango:install
Generate a single permit for a given user model
rails g cantango:user_permit Guest --read all
Generate a single permit for a user account model
rails g cantango:account_permit Admin --manage all
Generate a single permit for a role or role group
rails g cantango:role_permit Editor --manage article post --edit comment
For a role group:
rails g cantango:role_permit Editor --manage article post --edit comment --group
To scope permit for a specific account:
rails g cantango:role_permit Publisher --edit article post --account admin
Generate permits for a list of roles or role groups
rails g cantango:role_permits editor publisher
For role groups:
rails g cantango:role_permits editor publisher --group
Generate a single license (see Licenses)
rails g cantango:license article_writing --edit article post --create article
Generate multiple licenses
rails g cantango:licenses article_writing blogging
You can always get a list of all available options simply by running the generator with the --help
option:
rails g cantango:licenses --help
Enjoy!