Sha256: 67ff53c3438a2d249df60e125c2c0a36fb4d911df8ec25dbf086a0dee549da70
Contents?: true
Size: 592 Bytes
Versions: 9
Compression:
Stored size: 592 Bytes
Contents
module YariiEditor module ControllerAuthorization extend ActiveSupport::Concern included do before_action :check_if_yarii_is_authorized rescue_from YariiEditor::NotAuthorizedError, with: :handle_yarii_authorization_failure end def check_if_yarii_is_authorized yarii_user = YariiEditor::CurrentUser.from_controller(self) unless yarii_user&.can_access_yarii? raise YariiEditor::NotAuthorizedError end end def handle_yarii_authorization_failure render plain: "503 Not Authorized", status: 503 end end end
Version data entries
9 entries across 9 versions & 1 rubygems