Class ::xowf::IpRange (public)
::nx::Class ::xowf::IpRange
Defined in packages/xowf/tcl/iprange-procs.tcl
Class representing a range of IPs to be used to enforce access control.
- Testcases:
- No testcase defined.
Source code: :property {allowed ""} :property {disallowed ""} :property {title ""} :method match {spec ip} { if {[string first / $spec] > -1 && [ns_subnetmatch $spec $ip]} { return 1 } elseif {[string first * $spec] > -1 && [string match $spec $ip]} { return 1 } elseif {$spec eq $ip} { return 1 } return 0 } :public method allow_access {ip} { # # Check, if provided IP address is in the provided ranges of # disallowed or allowed addresses. First, the explicitly # disallowed addresses are checked, then the explicitly allowed # ones. Addresses can be specified in the following formats: # # <ul> # <li> IP address in CIDR format (e.g., 127.208.0.0/16) # <li> IP address containing wildcard "*" # <li> literal IP address # </ul> # @return boolean value expressing success foreach spec ${:disallowed} { if {[:match $spec $ip]} { return 0 } } foreach spec ${:allowed} { if {[:match $spec $ip]} { return 1 } } return 0 }XQL Not present: Generic, PostgreSQL, Oracle