Class: WebConsole::Request
- Inherits:
-
ActionDispatch::Request
- Object
- ActionDispatch::Request
- WebConsole::Request
- Defined in:
- lib/web_console/request.rb
Overview
Web Console tailored request object.
Defined Under Namespace
Classes: GetSecureIp
Constant Summary collapse
Instance Method Summary collapse
-
#acceptable? ⇒ Boolean
Returns whether the request is acceptable.
-
#from_whitelisted_ip? ⇒ Boolean
Returns whether a request came from a whitelisted IP.
-
#strict_remote_ip ⇒ Object
Determines the remote IP using our much stricter whitelist.
Instance Method Details
#acceptable? ⇒ Boolean
Returns whether the request is acceptable.
25 26 27 |
# File 'lib/web_console/request.rb', line 25 def acceptable? xhr? && accepts.any? { |mime| Mime[:web_console_v2] == mime } end |
#from_whitelisted_ip? ⇒ Boolean
Returns whether a request came from a whitelisted IP.
For a request to hit Web Console features, it needs to come from a white listed IP.
15 16 17 |
# File 'lib/web_console/request.rb', line 15 def from_whitelisted_ip? whitelisted_ips.include?(strict_remote_ip) end |
#strict_remote_ip ⇒ Object
Determines the remote IP using our much stricter whitelist.
20 21 22 |
# File 'lib/web_console/request.rb', line 20 def strict_remote_ip GetSecureIp.new(self, whitelisted_ips).to_s end |