Class: UffizziCore::ApplicationController
Constant Summary
collapse
- DEFAULT_PAGE =
1
- DEFAULT_PER_PAGE =
20
- RESCUABLE_EXCEPTIONS =
[RuntimeError, TypeError, NameError, ArgumentError, SyntaxError].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#ci_module, #ci_session, #controller_settings_service, #deployment_memory_module, #domain_module, #find_build_parser_module, #find_ingress_parser_module, #find_volume_parser_module, #notification_module, #password_protection_module, #template_memory_module, #user_access_module
#init_authorize, #pundit_user
#auth_token, #authenticate_request!, #current_user, #current_user_id, #sign_in, #sign_out, #signed_in?
#meta
Class Method Details
.responder ⇒ Object
38
39
40
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 38
def self.responder
UffizziCore::JsonResponder
end
|
Instance Method Details
#page ⇒ Object
61
62
63
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 61
def page
params[:page] || DEFAULT_PAGE
end
|
#per_page ⇒ Object
65
66
67
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 65
def per_page
params[:per_page] || DEFAULT_PER_PAGE
end
|
#policy_context ⇒ Object
34
35
36
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 34
def policy_context
UffizziCore::BaseContext.new(current_user, user_access_module, params)
end
|
#q_param ⇒ Object
57
58
59
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 57
def q_param
params[:q] || ActionController::Parameters.new
end
|
#render_errors(errors) ⇒ Object
51
52
53
54
55
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 51
def render_errors(errors)
json = { errors: errors }
render json: json, status: :unprocessable_entity
end
|
#render_not_authorized ⇒ Object
30
31
32
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 30
def render_not_authorized
render json: { errors: { title: [I18n.t('session.unauthorized')] } }, status: :forbidden
end
|
#render_not_found(exception) ⇒ Object
42
43
44
45
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 42
def render_not_found(exception)
resource = exception.model || 'Resource'
render json: { errors: { title: ["#{resource} Not Found"] } }, status: :not_found
end
|
#render_server_error(error) ⇒ Object
47
48
49
|
# File 'app/controllers/uffizzi_core/application_controller.rb', line 47
def render_server_error(error)
render json: { errors: { title: [error] } }, status: :internal_server_error
end
|