Burlesque
Crea estructura de roles y grupos para cualquier modelo, considera además las 3 tablas de join que pudiesen darse.
Installation
Before you can use the generator, add the gem to your project's Gemfile as follows:
gem 'burlesque'
Then install it by running:
bundle install
After, bootstrap your Rails app, for example:
rake burlesque:install:migrations
rake db:migrate
If you would like to run migrations only from Burlesque engine, you can do it by specifying SCOPE:
rake db:migrate SCOPE=burlesque
Finally, in model that you need burlesque:
include Burlesque::Admin
CanCan
Burlesque makes no assumption about how auhtorizations are handled in your application. However it integrates nicely with CanCan; all you have to do is define the Ability
model as follows:
class Ability
include CanCan::Ability
def initialize(user)
if user
user.roles.each do |role|
action = role.action_sym
model = role.resource_class
can action, model
end
end
end
end
Todo
Rake task for burlesque admin module inclusion.