Class: RolePermit::User
- Defined in:
- lib/permits.rb,
lib/generators/auth_assist/test.rb,
lib/generators/auth_assist/templates/permits.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(ability) ⇒ User
constructor
A new instance of User.
- #permit?(user, request) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(ability) ⇒ User
Returns a new instance of User.
42 43 44 |
# File 'lib/permits.rb', line 42 def initialize(ability) super end |
Instance Method Details
#permit?(user, request) ⇒ Boolean
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/permits.rb', line 46 def permit?(user) super return if user.role? :admin can :read, :all # user.owns(Comment) # a user can manage comments he/she created # can :manage, Comment do |comment| # comment.try(:user) == user # end # can :create, Comment end |