Sha256: 81b909e210fe2dff61355cc980164d3fc31ddde32de03b82518e3212d80f2186

Contents?: true

Size: 794 Bytes

Versions: 8

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  # A concern with the components needed when you want a model to be publicly shareable skipping authentication,
  # using a token with an expiration time.
  #
  module ShareableWithToken
    extend ActiveSupport::Concern

    included do
      has_many :share_tokens,
               class_name: "Decidim::ShareToken",
               foreign_key: "token_for_id",
               foreign_type: "token_for_type",
               inverse_of: :token_for,
               as: :token_for,
               dependent: :destroy

      # Override this method in the included class with the public url for the shareable resource
      def shareable_url(_share_token)
        raise NotImplementedError
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-core-0.23.6 lib/decidim/shareable_with_token.rb
decidim-core-0.23.5 lib/decidim/shareable_with_token.rb
decidim-core-0.23.4 lib/decidim/shareable_with_token.rb
decidim-core-0.23.3 lib/decidim/shareable_with_token.rb
decidim-core-0.23.2 lib/decidim/shareable_with_token.rb
decidim-core-0.23.1 lib/decidim/shareable_with_token.rb
decidim-core-0.23.1.rc1 lib/decidim/shareable_with_token.rb
decidim-core-0.23.0 lib/decidim/shareable_with_token.rb