Sha256: 712a2bc23d34d1259d2e32c3eeb8ae6e96a68f456c1f936d57bbeca079f7fb84
Contents?: true
Size: 701 Bytes
Versions: 50
Compression:
Stored size: 701 Bytes
Contents
module Avo module Fields module Concerns module FileAuthorization extend ActiveSupport::Concern delegate :authorization, to: :@resource delegate :authorize_action, to: :authorization delegate :id, :model, to: :@field def can_upload_file? authorize_file_action(:upload) end def can_delete_file? authorize_file_action(:delete) end def can_download_file? authorize_file_action(:download) end private def authorize_file_action(action) authorize_action("#{action}_#{id}?", record: model, raise_exception: false) end end end end end
Version data entries
50 entries across 50 versions & 1 rubygems