Sha256: b610268bd13c454dc0958c2f59e92657eb6e0a78077f7e25ae9376dc46f9c3e3
Contents?: true
Size: 1.31 KB
Versions: 19
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true module Decidim module Initiatives module Admin # A class used to find the admins for an initiative or an organization initiatives. class AdminUsers < Rectify::Query # Syntactic sugar to initialize the class and return the queried objects. # # initiative - Decidim::Initiative def self.for(initiative) new(initiative).query end # Syntactic sugar to initialize the class and return the queried objects. # # organization - an organization that needs to find its initiative admins def self.for_organization(organization) new(nil, organization).query end # Initializes the class. # # initiative - Decidim::Initiative # organization - an organization that needs to find its initiative admins def initialize(initiative, organization = nil) @initiative = initiative @organization = initiative&.organization || organization end # Finds organization admins and the users with role admin for the given initiative. # # Returns an ActiveRecord::Relation. def query organization.admins end private attr_reader :initiative, :organization end end end end
Version data entries
19 entries across 19 versions & 1 rubygems