Sha256: d0f7cd22419488bef1b9be5d3309db480dfcd377dc9a69f36dd1da34e37c11e0
Contents?: true
Size: 624 Bytes
Versions: 8
Compression:
Stored size: 624 Bytes
Contents
module CensorBear class ApplicationController < ActionController::Base before_action :check_authenticate_user! before_action :authenticate_censor_bear_user! include ::Pagy::Backend def check_authenticate_user! if respond_to?(:authenticate_user!) return authenticate_user! end authenticate_censor_bear_user! end def authenticate_censor_bear_user! render(json: { msg: "no permission" }, status: 403) unless current_user.admin? end def current_user user = main_app.scope.request.env["warden"]&.user return user if user.present? end end end
Version data entries
8 entries across 8 versions & 1 rubygems