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
slyphon-zookeeper-0.8.1 lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.1-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.0 lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.0-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.0.rc.1-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.8.0.rc.1 lib/zookeeper/acls.rb
slyphon-zookeeper-0.3.0 lib/zookeeper/acls.rb
slyphon-zookeeper-0.3.0-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.11 lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.11-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.10 lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.10-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.9-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.9 lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.8-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.8 lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.7 lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.7-java lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.5 lib/zookeeper/acls.rb
slyphon-zookeeper-0.2.5-java lib/zookeeper/acls.rb