Sha256: 45d917ec79819258f694ea69d22d1b75282ab298d069ed5f26cca6247f04e004

Contents?: true

Size: 688 Bytes

Versions: 64

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # Class used the retrieve the authorizations for a user.
    class UserAuthorizations < Rectify::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: user).where.not(granted_at: nil)
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
decidim-initiatives-0.26.10 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.9 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.8 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.7 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.5 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.4 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.3 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.2 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.1 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.0 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.0.rc2 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.26.0.rc1 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.25.2 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.25.1 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.25.0 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.25.0.rc4 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.25.0.rc3 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.25.0.rc2 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.25.0.rc1 app/queries/decidim/initiatives/user_authorizations.rb
decidim-initiatives-0.24.3 app/queries/decidim/initiatives/user_authorizations.rb