Sha256: 806897a9a75fd78417e831a90c0c54c894cef5e4ec8567dc1f2f2ceacf6f0f38

Contents?: true

Size: 418 Bytes

Versions: 4

Compression:

Stored size: 418 Bytes

Contents

module EnjuExport
  class Ability
    include CanCan::Ability

    def initialize(user, ip_address = nil)
      case user.try(:role).try(:name)
      when 'Administrator'
        can [:read, :destroy], ExportFile
      when 'Librarian'
        can [:read, :destroy], ExportFile
      when 'User'
        can :read, ExportFile do |export_file|
          export_file.user == user
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enju_export-0.1.1.pre6 app/models/enju_export/ability.rb
enju_export-0.1.1.pre5 app/models/enju_export/ability.rb
enju_export-0.1.1.pre4 app/models/enju_export/ability.rb
enju_export-0.1.1.pre3 app/models/enju_export/ability.rb