Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow to specify all actions as required or allowed.

  • Loading branch information...
commit 80fc09d9587ad35d297d28631b82bf38a37f328d 1 parent de3a578
Jiri Zajpt authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/ssl_requirement.rb
View
11 lib/ssl_requirement.rb
@@ -38,14 +38,19 @@ def ssl_allowed(*actions)
protected
# Returns true if the current action is supposed to run as SSL
def ssl_required?
- (self.class.read_inheritable_attribute(:ssl_required_actions) || []).include?(action_name.to_sym)
+ check(:ssl_required_actions)
end
-
+
def ssl_allowed?
- (self.class.read_inheritable_attribute(:ssl_allowed_actions) || []).include?(action_name.to_sym)
+ ssl_check(:ssl_allowed_actions)
end
private
+ def ssl_check(actions)
+ arr = self.class.read_inheritable_attribute(actions) || []
+ arr.include?(:all) || arr.include?(action_name.to_sym)
+ end
+
def ensure_proper_protocol
return true if ssl_allowed?
Please sign in to comment.
Something went wrong with that request. Please try again.