Sha256: c2f7641c82990d73f4aebde6a8428fa1a65cad5f1d6ffd1dad7fe966a67e5049

Contents?: true

Size: 1.11 KB

Versions: 62

Compression:

Stored size: 1.11 KB

Contents

module Zookeeper
module ACLs
  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
  
  module Constants
    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
end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
zookeeper-1.4.4 lib/zookeeper/acls.rb
zookeeper-1.4.4-java lib/zookeeper/acls.rb
zookeeper-1.4.3 lib/zookeeper/acls.rb
zookeeper-1.4.3-java lib/zookeeper/acls.rb
zookeeper-1.4.2 lib/zookeeper/acls.rb
zookeeper-1.4.2-java lib/zookeeper/acls.rb
zookeeper-1.4.1 lib/zookeeper/acls.rb
zookeeper-1.4.1-java lib/zookeeper/acls.rb
zookeeper-1.3.0 lib/zookeeper/acls.rb
zookeeper-1.3.0-java lib/zookeeper/acls.rb
zookeeper-1.2.14 lib/zookeeper/acls.rb
zookeeper-1.2.14-java lib/zookeeper/acls.rb
zookeeper-1.2.13 lib/zookeeper/acls.rb
zookeeper-1.2.13-java lib/zookeeper/acls.rb
zookeeper-1.2.12 lib/zookeeper/acls.rb
zookeeper-1.2.12-java lib/zookeeper/acls.rb
zookeeper-1.2.11 lib/zookeeper/acls.rb
zookeeper-1.2.11-java lib/zookeeper/acls.rb
zookeeper-1.2.10 lib/zookeeper/acls.rb
zookeeper-1.2.10-java lib/zookeeper/acls.rb