RAA - ldapmapper

ldapmapper / 1.0.0

Short description: CRUD Object to map LDAP object in Ruby object, R/W accessors
Category: Library/Directory
Status: stable
Created: 2006-09-11 11:59:03 GMT
Last update: 2006-09-11 12:12:41 GMT
Owner: Romain GEORGES (Projects of this owner)
Homepage: http://ldapmapper.rubyforge.org
Download: http://ldapmapper.rubyforge.org
License: BSD
Dependency:
Requires: ruby/1.8.0(+) The Ruby Interpreter
Requires: ruby-ldap/0.9.7(*) LDAP API for Ruby
(*): newer version exists
(+): no such version
Description:

About LDAPMapper

Ldapmapper is a CRUD LDAP object for Ruby. Ldapmapper map LDAP object in a Ruby object and offer Read/write access on any attributs. You could find/create/modify any objects in your LDAP Tree simply with a few code lines

Exemples :

   #!/usr/local/bin/ruby
   require 'rubygems'
   require_gem 'ldapmapper'
   include Ldapmapper
   _basedn = 'dc=__domaine__,dc=__tld__'
   _dn = "ou=toto,#{_basedn}"
   record = LdapMapper.new(_dn,'__secret__',"cn=root,#{_basedn}")
   puts "- Could create it ? : #{record.can_create?}"
   puts "- Already exist ? : #{record.exist?}"
   puts "- Is it a node ? : #{record.is_node?}"
   puts "- Is it the base ? : #{record.is_base?}"
   if record.exist? then
     puts "- ObjectClasses list :"
     record.list_objectclass.each{|objectclass|
       puts "  * #{objectclass}"
     }
     puts "- Attributes list : "
     record.list_attributs.each{|attribute,value|
       if value.size > 1 then
         puts "* #{attribute} ="
         value.each{|val| puts "  - #{val}"
         }
       else
         puts "* #{attribute} = #{value}"
       end
     }
     puts record.description
     record.description = `date`
     record.commit!
   elsif record.can_create?
     record.add_objectclass!('organizationalUnit')
     record.ou = 'toto'
     record.description = "Test"
     p record.must
     p record.may
     record.commit!
   else
     puts "kaboum!"
   end

first running :

    - Could create it ? : true
    - Already exist ? : false
    - Is it a node ? : false
    - Is it the base ? : false
    ["ou", "objectClass", "dn"]
    ["physicalDeliveryOfficeName", "l", "st", "telexNumber", "destinationIndicator", "businessCategory",
    "postalAddress", "telephoneNumber", "searchGuide", "internationaliSDNNumber", "preferredDeliveryMethod",
    "description", "postalCode", "teletexTerminalIdentifier", "userPassword", "street",
    "registeredAddress", "postOfficeBox", "facsimileTelephoneNumber", "seeAlso", "x121Address"]

second ruuning :

    - Could create it ? : false
    - Already exist ? : true
    - Is it a node ? : false
    - Is it the base ? : false
    - ObjectClasses list :
      * top
      * organizationalUnit
    - Attributes list :
      * description = Jeu  7 sep 2006 16:11:44 CEST
      * ou = toto
      * objectClass =
        - top
        - organizationalUnit
      * dn = ou=toto,dc=ultragreen,dc=net
    Jeu  7 sep 2006 16:11:44 CEST

Edit this project (for project owner)

back to RAA top