we're trying to use CanTango in our web app. Somehow, it seems like
the CanTango Ability class is not used by CanCan as it says that it
cannot find the symbol "Ability".
We've configured CanTango in the cantango.rb initializer as follows.
If you need more configuration code, please just ask :)
CanTango.config do |config|
config.debug!
config.engines.all :on
# more configuration here...
config.ability.mode = :no_cache
end
We've also added "extend CanTango::Api::UserAccount::Ability" to our
application controller.
Are we missing something, or do we have to require a special module in
some class?
Thanks for your help
Eric
Now, we're experiencing some problems with the permission store. We
define a "everyone can manage everything" permission in the YAML file:
user_types:
user:
can:
manage:
- all
But when testing the permissions, we get CanCan::AccessDenied
exceptions and the following appears in the console log:
valid_mode? false [:cache] false
No permissions for #<User:0x007f92452baca8> found for #all_permissions
call
We're slightly confused :P
Thanks
Eric
config.engine(:permission) do |engine|
puts engine.modes
engine.mode = :cache
engine.set :on
puts "ON" if engine.on?
puts "OFF" if engine.off?
# permission engine specific
puts engine.types # permission types available
# permission file location
#engine.config_path 'my/special/permissions/location'
#engine.config_path = 'my/special/permissions/location'
puts engine.config_path
end
Output:
cache
ON
roles
role_groups
licenses
users
user_types
account_types
/Users/Robin/SWT2/swt2_11_hasso/config
I also think it would be better if you could refactor the master branch to exclude all the files from "cantango-config" and then instead create a gem dependency to "cantango-config". I think the error might well be caused by some configuration bug. I made a few fixed in the cantango-config gem.
Tonight I am working on each engine separately, I've just created a "permissions" project where I have moved anything relevant only to this engine.
Should make it much easier to track down bugs and maintaing the project in general. I'm sorry you are having all this trouble, but then again,
real life usage is what really can propel this project forward! Thanks!
Kristian
we've managed to find the cause of the problem:
The troles plugin only generated a 'role_list' method in the user
class. But CanTango expects a 'roles_list' method (with an 's').
I guess this could be a problem in your demo app as well.
Best regards
Eric
Good luck!
CanTango.config.roles.list_method = :role_list
I think the optimal solution would be to change the troles api, to use :roles_list. What do you think?
Den 24/11/2011 kl. 10.27 skrev betasheet: