davydovanton / kan

Simple, functional authorization library and role management for ruby
http://www.kanrb.org
MIT License
232 stars 12 forks source link

Role detector ability #25

Closed davydovanton closed 6 years ago

davydovanton commented 6 years ago

What we want

Detect role value for specific scope:

abilities['post.role'].call(user)    # => :payed

Why

Sometimes you need to understand what type of user you have. For this you can put all logic to user entity, but it's place for can. Because we need to understand role and permission for action here

UPD

How to handle cases, when user map to 1+ role? For example, admin user which map to regular and admin role?

TODO