Sha256: 1c2406fc74781a9e2ac01a0aa48c7c0ad3a72176b762f51544f6b3fdd036e734

Contents?: true

Size: 683 Bytes

Versions: 13

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # Class used the retrieve the authorizations for a user.
    class UserAuthorizations < Decidim::Query
      attr_reader :user

      # Syntactic sugar to initialize the class and return the queried objects.
      #
      # user - Decidim::User
      def self.for(user)
        new(user).query
      end

      # Retrieves authorizations for the given user
      #
      # user - Decidim::User
      def initialize(user)
        @user = user
      end

      # Retrieves authorizations for the given user.
      def query
        Authorization.where(user:).where.not(granted_at: nil)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-initiatives-0.29.1 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.28.4 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.29.0 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.28.3 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.29.0.rc4 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.29.0.rc3 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.29.0.rc2 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.29.0.rc1 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.28.2 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.28.1 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.28.0 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.28.0.rc5 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.28.0.rc4 app/queries/decidim/initiatives/user_authorizations.rb