Sha256: 72da13e4b03ad3d8b419f41b042219e0ad9314f9375ef29705719a4e45ed92f6
Contents?: true
Size: 800 Bytes
Versions: 16
Compression:
Stored size: 800 Bytes
Contents
# frozen_string_literal: true # Ability class for our dummy app. Used by CanCanCan to determine # the appropriate permissions for current_ability class Ability include CanCan::Ability def initialize(user) user ||= User.new can :list, WorksCited::Citation can :list, WorksCited::Contributor return if user.new_record? # Anonymous Users leave can :read, WorksCited::Citation can :read, WorksCited::Contributor # # We could have other rules in here, like: # can :manage, WorksCited::Citation, record: { user_id: user.id } # can :manage, WorksCited::Contributor, record: { user_id: user.id } return unless user.admin? # Non Admin Users leave can :select, :all can :manage, WorksCited::Citation can :manage, WorksCited::Contributor end end
Version data entries
16 entries across 16 versions & 1 rubygems