Sha256: 9f69bdf396271a17ffa78b8303193dc8d46ec3bbb0342b460001171607034a7b
Contents?: true
Size: 322 Bytes
Versions: 39
Compression:
Stored size: 322 Bytes
Contents
module PandaCms class AdminConstraint def initialize(&block) @block = block end def matches?(request) user = current_user(request) user.present? && user.admin? && @block&.call(user) end def current_user(request) User.find_by(id: request.session[:user_id]) end end end
Version data entries
39 entries across 39 versions & 1 rubygems