disabled
  6   ˆÀ�þZ–q°9 €&]}–ŸÈƒ{ÇÆa–äY>” ”¾R( 	ÅõÆAp©‹FÿÅ "    # Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

class ChecklistsController < ApplicationController
  prepend_before_action :authenticate_and_authorize!

  def show
    model_show_render(Checklist, existing_checklist_params)
  end

  def create
    ticket = Ticket.find params[:ticket_id]

    checklist = if params[:template_id].present?
                  template = ChecklistTemplate.find(params[:template_id])
                  Checklist.create_from_template!(ticket, template)
                elsif params[:create_first_item]
                  Checklist.create_fresh!(ticket)
                else
                  Checklist.create!(ticket:)
                end

    render json: { id: checklist.id, assets: checklist.assets({}) }, status: :created
  end

  def update
    model_update_render(Checklist, existing_checklist_params)
  end

  def destroy
    model_destroy_render(Checklist, existing_checklist_params)
  end

  private

  def existing_checklist_params
    params.permit(:id, :name, sorted_item_ids: [])
  end
end
  !   ˆÊ�þ\–1,ã�f1’IZfYŸÉ„Í¾×ÈÇ¾Å ?÷     # Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

class UsersController < ApplicationController
  include ChecksUserAttributesByCurrentUserPermission
  include CanPaginate

  prepend_before_action -> { authorize! }, only: %i[import_example import_start search history unlock]
  prepend_before_action :authentication_check, except: %i[create password_reset_send password_reset_verify image email_verify email_verify_send admin_password_auth_send admin_password_auth_verify]
  prepend_before_action :authentication_check_only, only: %i[create]

  # @path       [GET] /users
  #
  # @summary          Returns a list of User records.
  # @notes            The requester has to be in the role 'Admin' or 'Agent' to
  #                   get a list of all Users. If the requester is in the
  #                   role 'Customer' only just the own User record will be returned.
  #
  # @response_message 200 [Array<User>] List of matching User records.
  # @response_message 403               Forbidden / Invalid session.
  def index
    users = policy_scope(User).reorder(id: :asc).offset(pagination.offset).limit(pagination.limit)

    if response_expand?
      list = users.map(&:attributes_with_association_names)
      render json: list, status: :ok
      return
    end

    if response_full?
      assets = {}
      item_ids = []
      users.each do |item|
        item_ids.push item.id
        assets = item.assets(assets)
      end
      render json: {
        record_ids: item_ids,
        assets:     assets,
      }, status: :ok
      return
    end

    users_all = users.map do |user|
      User.lookup(id: user.id).attributes_with_association_ids
    end
    render json: users_all, status: :ok
  end

  # @path       [GET] /users/{id}
  #
  # @summary          Returns the User record with the requested identifier.
  # @notes            The requester has to be in the role 'Admin' or 'Agent' to
  #                   access all User records. If the requester is in the
  #                   role 'Customer' just the own User record is accessable.
  #
  # @parameter        id(required) [Integer] The identifier matching the requested User.
  # @parameter        full         [Bool]    If set a Asset structure with all connected Assets gets returned.
  #
  # @response_message 200 [User] User record matching the requested identifier.
  # @response_message 403        Forbidden / Invalid session.
  def show
    user = User.find(params[:id])
    authorize!(user)

    if response_expand?
      result = user.attributes_with_association_names
      result.delete('password')
      render json: result
      return
    end

    if response_full?
      result = {
        id:     user.id,
        assets: user.assets({}),
      }
      render json: result
      return
    end

    result = user.attributes_with_association_ids
    result.delete('password')
    render json