Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 62e696b68c
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (19 sloc) 0.474 kB
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if user.role == 'admin'
can :read, :all
can :manage, User
can :manage, Category
can [:destroy, :approve, :reject], Ad
else
can :read, Ad
if user.role == 'user'
can :read, User, id: user.id
can :create, Ad
can [:update, :destroy, :verify], Ad, user_id: user.id
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.