Class: UITemplateSyncsController
Instance Method Summary
collapse
#base_export_params, #base_import_params, #location_params, #log_deprecated_param, #organization_params, #template_export_params, #template_import_params, #transform_lock_param, #ui_template_export_params, #ui_template_import_params
Instance Method Details
#action_permission ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'app/controllers/ui_template_syncs_controller.rb', line 32
def action_permission
case params[:action]
when 'sync_settings'
:view_template_syncs
else
super
end
end
|
#export ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/ui_template_syncs_controller.rb', line 20
def export
@result = OpenStruct.new ForemanTemplates::TemplateExporter.new(ui_template_export_params).export!
if @result.error
render_errors [@result.error]
end
if @result.warning
render_errors [@result.warning], 'warning'
end
end
|
#parameter_filter_context ⇒ Object
41
42
43
|
# File 'app/controllers/ui_template_syncs_controller.rb', line 41
def parameter_filter_context
Foreman::ParameterFilter::Context.new(:api, controller_name, params[:action])
end
|
#render_errors(messages, severity = 'danger') ⇒ Object
45
46
47
|
# File 'app/controllers/ui_template_syncs_controller.rb', line 45
def render_errors(messages, severity = 'danger')
render :json => { :error => { :errors => { :base => messages }, full_messages: messages, :severity => severity } }, :status => :unprocessable_entity
end
|