In Files

  • drb/acl.rb

ACL

Public Class Methods

new(list=nil, order = DENY_ALLOW) click to toggle source
 
               # File drb/acl.rb, line 84
def initialize(list=nil, order = DENY_ALLOW)
  @order = order
  @deny = ACLList.new
  @allow = ACLList.new
  install_list(list) if list
end
            

Public Instance Methods

allow_addr?(addr) click to toggle source
 
               # File drb/acl.rb, line 97
def allow_addr?(addr)
  case @order
  when DENY_ALLOW
    return true if @allow.match(addr)
    return false if @deny.match(addr)
    return true
  when ALLOW_DENY
    return false if @deny.match(addr)
    return true if @allow.match(addr)
    return false
  else
    false
  end
end
            
allow_socket?(soc) click to toggle source
 
               # File drb/acl.rb, line 92
def allow_socket?(soc)
  allow_addr?(soc.peeraddr)
end
            
install_list(list) click to toggle source
 
               # File drb/acl.rb, line 113
def install_list(list)
  i = 0
  while i < list.size
    permission, domain = list.slice(i,2)
    case permission.downcase
    when 'allow'
      @allow.add(domain)
    when 'deny'
      @deny.add(domain)
    else
      raise "Invalid ACL entry #{list.to_s}"
    end
    i += 2
  end
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus