Sha256: 51ec2ae80d007fbf7dbe9b169dc83cf9c62298839cdd7a3b5f64fa32197bdfae

Contents?: true

Size: 1.05 KB

Versions: 56

Compression:

Stored size: 1.05 KB

Contents

module ZookeeperACLs
  class Id
    attr_reader :scheme, :id
    def initialize(hash)
      @scheme = hash[:scheme]
      @id = hash[:id]
    end

    def to_hash
      { :id => id, :scheme => scheme }
    end
  end
    
  class ACL
    attr_reader :perms, :id
    def initialize(hash)
      @perms = hash[:perms]
      v = hash[:id]
      @id = v.kind_of?(Hash) ? Id.new(v) : v
    end

    def to_hash
      { :perms => perms, :id => id.to_hash }
    end
  end
  
  ZOO_PERM_READ   = 0
  ZOO_PERM_WRITE  = 1
  ZOO_PERM_CREATE = 2
  ZOO_PERM_DELETE = 4
  ZOO_PERM_ADMIN  = 8
  ZOO_PERM_ALL    = ZOO_PERM_READ | ZOO_PERM_WRITE | ZOO_PERM_CREATE | ZOO_PERM_DELETE | ZOO_PERM_ADMIN
  
  ZOO_ANYONE_ID_UNSAFE = Id.new(:scheme => "world", :id => "anyone")
  ZOO_AUTH_IDS         = Id.new(:scheme => "auth", :id => "")

  ZOO_OPEN_ACL_UNSAFE  = [ACL.new(:perms => ZOO_PERM_ALL,  :id => ZOO_ANYONE_ID_UNSAFE)]
  ZOO_READ_ACL_UNSAFE  = [ACL.new(:perms => ZOO_PERM_READ, :id => ZOO_ANYONE_ID_UNSAFE)]
  ZOO_CREATOR_ALL_ACL  = [ACL.new(:perms => ZOO_PERM_ALL,  :id => ZOO_AUTH_IDS)]
end

Version data entries

56 entries across 56 versions & 2 rubygems

Version Path
zookeeper-0.9.4 lib/zookeeper/acls.rb
zookeeper-0.9.4-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.4 lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.4-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.3 lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.3-java lib/zookeeper/acls.rb
zookeeper-0.9.3 lib/zookeeper/acls.rb
zookeeper-0.9.3-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.2 lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.2-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.1 lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.1-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.4 lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.4-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.0 lib/zookeeper/acls.rb
slyphon-zookeeper-0.9.0-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.3 lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.3-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.2 lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.2-java lib/zookeeper/acls.rb