Class: Lockdown::Delivery
- Inherits:
-
Object
- Object
- Lockdown::Delivery
- Defined in:
- lib/lockdown/delivery.rb
Class Method Summary collapse
-
.allowed?(path, access_rights = nil) ⇒ true|false
If the given path is allowed.
Class Method Details
.allowed?(path, access_rights = nil) ⇒ true|false
Returns if the given path is allowed.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lockdown/delivery.rb', line 7 def allowed?(path, access_rights = nil) begin ::Authorization.configure rescue NameError end access_rights ||= Lockdown::Configuration.public_access path += "/" unless path =~ /\/$/ path = "/" + path unless path =~ /^\// access_rights.split(Lockdown::DELIMITER).each do |ar| if (Lockdown.regex(ar) =~ path) == 0 return true end end return false end |