mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
28 lines
755 B
Ruby
28 lines
755 B
Ruby
class ApplicationController < ActionController::Base
|
|
include Pundit::Authorization
|
|
|
|
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
|
|
|
before_action :configure_permitted_parameters, if: :devise_controller?
|
|
before_action :load_boards
|
|
|
|
protected
|
|
|
|
def configure_permitted_parameters
|
|
devise_parameter_sanitizer.permit(:sign_up, keys: [:full_name, :notifications_enabled])
|
|
devise_parameter_sanitizer.permit(:account_update, keys: [:full_name, :notifications_enabled])
|
|
end
|
|
|
|
def load_boards
|
|
@boards = Board.select(:id, :name).order(order: :asc)
|
|
end
|
|
|
|
private
|
|
|
|
def user_not_authorized
|
|
render json: {
|
|
error: t('backend.errors.unauthorized')
|
|
}, status: :unauthorized
|
|
end
|
|
end
|