Sha256: 2ced4ab01eece476f4c29cdb6091d484943f718d589d2ec7267956a875b9608e
Contents?: true
Size: 1.98 KB
Versions: 6
Compression:
Stored size: 1.98 KB
Contents
module J1App module Helpers def public_content? return true if request.path_info == '/authentication' return true if request.path_info == '/info' return true if request.path_info == '/redirect_after_callback' !!(J1App.public_content && J1App.public_content.match(request.path_info)) end def redirect_whitelisted?(redirect) return true if redirect == '/authentication' return true if redirect == '/info' return true if redirect == '/redirect_after_callback' !!(J1App.public_content && J1App.public_content.match(redirect)) end def authentication_enabled? return J1App.auth? end def warden env['warden'] end def authenticate!(*args) warden.authenticate!(*args) end def authenticated?(*args) warden.authenticated?(*args) end def category_whitelisted?(*args) whitelist, user = *args return true if whitelist.include? 'all' return true if whitelist.include? user return false end def payment_activated?(payment) return true if payment.any? return false end def payment_valid?(payment_info) return true if payment_info.nil? return false end def logout! warden.logout end def has_umlaut? (str) !!(str =~ /[öäüÖÄÜß]/) end def log_info! (*args) scope, func, text, details = *args if details.nil? message = sprintf( "[%-20s] [%-20s] %s", "#{scope} ", "#{func}", "#{text}" ) else message = sprintf( "[%-20s] [%-20s] %s: %s", "#{scope} ", "#{func}", "#{text}", "#{details}" ) end logger.info "#{message}" end # def authentication_strategy # if !ENV["GITHUB_TEAM_ID"].to_s.blank? # :team # elsif !ENV["GITHUB_TEAM_IDS"].to_s.blank? # :teams # elsif !ENV["GITHUB_ORG_NAME"].to_s.blank? # :org # elsif !ENV['GITHUB_MEMBERS'].to_s.blank? # :member # end # end end end
Version data entries
6 entries across 6 versions & 1 rubygems