# CanCan questions

**URL:** <https://www.ruby-forum.com/t/cancan-questions/187722>\
**Category:** Rails\
**Created:** [April 28, 2010, 10:29am UTC](https://www.ruby-forum.com/t/cancan-questions/187722 "2010-04-28T10:29:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariachi77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@mariachi77](https://www.ruby-forum.com/u/mariachi77)\
**Post date:** [April 28, 2010, 10:29am UTC](https://www.ruby-forum.com/t/cancan-questions/187722/1 "2010-04-28T10:29:42Z")

</div>

I’ve used Aegis in the past for role-based authorisation, but have  
seen a lot of talk about CanCan; so I thought I’d give it a go and  
have been fiddling with it over the last couple of days. It seems to  
have a slightly nicer DSL and simpler implementation for authorising  
CRUD operations, but I’m stumped at the moment for how to have  
arbitrary authorisations.

For instance; if I have some users that are allowed to give away free  
products, in Aegis I can have a permission method like this:

permission :give\_trials do |user|  
# role checks here  
end

but how do I do the same thing in CanCan? It wants me to pass in a  
Model, but for some checks there isn’t a 1:1 mapping.

Secondly, Aegis is an extension to the User model, while CanCan  
extends the controller - so how can I test stuff in the console with  
CanCan?

---

<div class="post-metadata">

**Author:** ![mariachi77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@mariachi77](https://www.ruby-forum.com/u/mariachi77)\
**Post date:** [April 29, 2010, 11:13am UTC](https://www.ruby-forum.com/t/cancan-questions/187722/2 "2010-04-29T11:13:45Z")

</div>

Noone using CanCan day-to-day then? Ho hum… back to Aegis.
