Hi all,
I set up the app with the cantango 0.9.4.7, and using the simple_roles gem.
config\initializers\simple_roles.rb
SimpleRoles.configure do
valid_roles :teacher, :parent, :student
strategy :one # Default is :one
end
config\initializers\cantango.rb
CanTango.config do |config|
config.debug!
config.permits.disable :account, :special, :role_group
config.engine(:permission).set :off
config.engine(:permit).set :on
config.ability.mode = :no_cache
# more configuration here...
config.guest.user Proc.new { Guest.new }
config.roles.role_system = :simple_roles
end
# in order to make #current_admin accessible at the class level
module CanTango::Api
def self.current_admin
@current_admin ||= AdminUser.first
end
end
app\models\user.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :role
tango_user
simple_roles
end
And I defined three Role Permit in \app\permits
For example ParentRolePermit
But I found that all there Permit had been registered, however, none of them was builded, see the debug logs as following:
permits registry:[#<Hashie::Mash admin_user=AdminUserPermit guest=GuestPermit>, #<Hashie::Mash>, #<Hashie::Mash parent=ParentRolePermit parent_role=ParentRolePermit student=StudentRolePermit teacher=TeacherRolePermit>, #<Hashie::Mash>]
Ability: read on Wordlist
permits allowed:[]
permits denied:[]
++ Permit Builder: CanTango::Permits::UserPermit::Builder
Permit Finder: CanTango::Permits::UserPermit::Finder
no account permits found for user
no permits found for user
Not building any UserPermit
Permit Finder: CanTango::Permits::UserPermit::Finder
no account permits found for user
no permits found for user
== Permits built: 0
++ Permit Builder: CanTango::Permits::RolePermit::Builder
Not building any RolePermit
== Permits built: 0
Permit Engine executing...
Execute user permits
Done user permits
Execute role permits
Done role permits
Done Permit Engine
My question is how to make cantango build these Permit?