Browse Source

Maintenance: Clean up unused Checklist code

Mantas Masalskis 4 months ago
parent
commit
f43894dd00

+ 2 - 0
app/controllers/tickets_controller.rb

@@ -98,6 +98,7 @@ class TicketsController < ApplicationController
 
       # Prevent direct access to checklist via API
       # Otherwise users may get unauthorized access to checklists of other tickets
+      params.delete(:checklist)
       params.delete(:checklist_id)
 
       clean_params = Ticket.association_name_to_id_convert(params)
@@ -249,6 +250,7 @@ class TicketsController < ApplicationController
 
     # Prevent direct access to checklist via API
     # Otherwise users may get unauthorized access to checklists of other tickets
+    params.delete(:checklist)
     params.delete(:checklist_id)
 
     clean_params = Ticket.association_name_to_id_convert(params)

+ 0 - 33
app/policies/controllers/ticket_checklist_controller_policy.rb

@@ -1,33 +0,0 @@
-# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
-
-class Controllers::TicketChecklistControllerPolicy < Controllers::ApplicationControllerPolicy
-  def show?
-    read_access_via_ticket?
-  end
-
-  def create?
-    update_access_via_ticket?
-  end
-
-  def destroy?
-    update_access_via_ticket?
-  end
-
-  def update?
-    update_access_via_ticket?
-  end
-
-  private
-
-  def ticket_policy
-    @ticket_policy ||= TicketPolicy.new(user, Ticket.lookup(id: record.params[:ticket_id]))
-  end
-
-  def read_access_via_ticket?
-    ticket_policy.agent_read_access?
-  end
-
-  def update_access_via_ticket?
-    ticket_policy.agent_update_access?
-  end
-end