Sha256: f6c0c45f3332ea64111f636fd1e72e632f0c2e70ba4948c9165bff496c63d6c0
Contents?: true
Size: 845 Bytes
Versions: 41
Compression:
Stored size: 845 Bytes
Contents
class Ability include CanCan::Ability def initialize(u) if u.is_super_admin? can :manage, :all can :publish, :all can :assign_roles, Tenon::User elsif u.is_admin? can :manage, :all can :publish, :all can :assign_roles, Tenon::User can(:destroy, Tenon::Page) { |page| page.key.blank? } cannot :update, Tenon::User can([:update], Tenon::User) do |user| !user.is_super_admin? end can :create, Tenon::User elsif u.is_contributor? can([:update, :edit], Tenon::User) { |user| user == u } can :read, :all can :create, Tenon::Page can([:update, :destroy, :edit], Tenon::Page) do |item| u.id == item.creator_id end can(:destroy, Tenon::Page) { |page| page.key.blank? } else can :read, :all end end end
Version data entries
41 entries across 41 versions & 1 rubygems