2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
2019-06-04 03:40:48 +00:00
|
|
|
|
|
|
|
class KnowledgeBase::BaseController < ApplicationController
|
2019-12-02 13:17:57 +00:00
|
|
|
prepend_before_action :authentication_check
|
2020-03-19 09:39:51 +00:00
|
|
|
before_action :authorize!
|
2019-06-04 03:40:48 +00:00
|
|
|
|
|
|
|
def show
|
|
|
|
model_show_render(klass, params_for_permission)
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
model_create_render(klass, params_for_permission)
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
model_update_render(klass, params_for_permission)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
model_destroy_render(klass, params_for_permission)
|
|
|
|
end
|
|
|
|
|
|
|
|
def klass
|
|
|
|
@klass ||= controller_path.classify.constantize
|
|
|
|
end
|
|
|
|
|
2020-03-19 09:39:51 +00:00
|
|
|
private
|
|
|
|
|
2019-06-04 03:40:48 +00:00
|
|
|
def params_for_permission
|
|
|
|
params.permit klass.agent_allowed_params
|
|
|
|
end
|
|
|
|
end
|