Sha256: cb0149fb89e44cdae7545ec3c124f5846264f40153408dac689f79c41bf927e0
Contents?: true
Size: 855 Bytes
Versions: 42
Compression:
Stored size: 855 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, :publish], 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
42 entries across 42 versions & 1 rubygems