Sha256: 31a0c6486411cfaf731668886d658b04284b07894c59de8ba12abbf290dc8078
Contents?: true
Size: 1 KB
Versions: 6
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Decidim module Admin # A class used to find the roles of the users that can manage a given # participatory process in a process admin role (that is, processs that are # not organization admins). class ProcessAdminRolesForProcess < Rectify::Query # Syntactic sugar to initialize the class and return the queried objects. # # process - a process that needs to find its process admins def self.for(process) new(process).query end # Initializes the class. # # process - a process that needs to find its process admins def initialize(process) @process = process end # Finds the UserRoles of the users that can manage the given process. # # Returns an ActiveRecord::Relation. def query ParticipatoryProcessUserRole .where(participatory_process: process, role: [:admin, :collaborator]) end private attr_reader :process end end end
Version data entries
6 entries across 6 versions & 2 rubygems