From codesite-noreply at google.com Thu Apr 2 11:57:55 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Thu, 02 Apr 2009 15:57:55 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r938 - translation was done from '.search' to 'valid?' into Japanese. Message-ID: <001636164ad1c71d430466947e49@google.com> Author: tashen.hatena Date: Thu Apr 2 08:56:40 2009 New Revision: 938 Modified: wiki/TutorialJa.wiki Log: translation was done from '.search' to 'valid?' into Japanese. Modified: wiki/TutorialJa.wiki ============================================================================== --- wiki/TutorialJa.wiki (original) +++ wiki/TutorialJa.wiki Thu Apr 2 08:56:40 2009 @@ -688,33 +688,80 @@ === .search === -.search is a class method that is accessible from any subclass of Base, and Base. It lets the user perform an arbitrary search against the current LDAP connection irrespetive of LDAP mapping data. This is meant to be useful as a utility method to cover 80% of the cases where a user would want to use Base.connection directly. + + .search is a class method that is accessible from any subclass of Base, and + Base. It lets the user perform an arbitrary search against the current LDAP + connection irrespetive of LDAP mapping data. This is meant to be useful as a + utility method to cover 80% of the cases where a user would want to use + Base.connection directly. + +.search ? ActiveLdap::Base ??????????????????????? ??? +???????? LDAP??????????????????????????? ?? +Base.connection ????????????????????????8????? ?? +???????? +{{{ irb> Base.search(:base => 'dc=example,dc=com', :filter => '(uid=roo*)', :scope => :sub, :attributes => ['uid', 'cn']) => [["uid=root,ou=People,dc=dataspill,dc=org",{"cn"=>["root"], "uidNumber"=>["0"]}] +}}} -You can specify the :filter, :base, :scope, and :attributes, but they all have defaults ? - - * :filter defaults to objectClass=* - usually this isn't what you want - * :base defaults to the base of the class this is executed from (as set in ldap_mapping) - * :scope defaults to :sub. Usually you won't need to change it - * :attributes defaults to [] and is the list of attributes you want back. Empty means all of them. - -valid? - -valid? is a method that verifies that all attributes that are required by the objects current objectClasses are populated. -save - -save is a method that writes any changes to an object back to the LDAP server. It automatically handles the addition of new objects, and the modification of existing ones. -.exists? - -exists? is a simple method which returns true is the current object exists in LDAP, or false if it does not. + + You can specify the :filter, :base, :scope, and :attributes, but they all have + defaults ? + +:filter, :base, :scope, :attributes ??????????????????? ??? +?????????? + + + * :filter defaults to objectClass=* - usually this isn't what you want + * :base defaults to the base of the class this is executed from (as set in + ldap_mapping) + * :scope defaults to :sub. Usually you won't need to change it + * :attributes defaults to [] and is the list of attributes you want back. + Empty means all of them. + + * :filter ??????? "objectClass=*" ???????????????? ???????? + * :base ?????????????????????? :base ?????? ldap_mapping ??????????????? + * :scope ? :sub ?????????? + * :attributes ??????? [] ???????????????????? ??????????????????????????? + +=== valid? === + + + valid? is a method that verifies that all attributes that are required by the + objects current objectClasses are populated. + +valid? ?????????????????????????????????? ?? +??????????????????? + +=== save === + + + save is a method that writes any changes to an object back to the LDAP server. + It automatically handles the addition of new objects, and the modification of + existing ones. + +save ? LDAP ??????????????????????????????? ?? +????????????????????????? LDAP ????????? ??? +????????????????????????????????????? LDAP? +??????????????????????? + +=== .exists? === + + + exists? is a simple method which returns true is the current object exists in + LDAP, or false if it does not. + +exists? ?????????????????? :dn_attribute ???????? ?? +?????????????????? +{{{ irb> User.exists?("dshadsadsa") => false +}}} -ActiveLdap::Base +== ActiveLdap::Base == ActiveLdap::Base has come up a number of times in the examples above. Every time, it was being used as the super class for the wrapper objects. While this is it's main purpose, it also handles quite a bit more in the background. What is it? From codesite-noreply at google.com Tue Apr 7 07:59:36 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Tue, 07 Apr 2009 11:59:36 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r939 - * add ActiveLdap::Schema#dump for debugging. Message-ID: <0016e645abf4c193320466f5bf85@google.com> Author: koutou Date: Tue Apr 7 04:39:34 2009 New Revision: 939 Modified: trunk/lib/active_ldap/schema.rb Log: * add ActiveLdap::Schema#dump for debugging. Modified: trunk/lib/active_ldap/schema.rb ============================================================================== --- trunk/lib/active_ldap/schema.rb (original) +++ trunk/lib/active_ldap/schema.rb Tue Apr 7 04:39:34 2009 @@ -151,6 +151,17 @@ end end + def dump(output=nil) + require 'pp' + output ||= STDOUT + if output.respond_to?(:write) + PP.pp(@entries, output) + else + open(output, "w") {|out| PP.pp(@entries, out)} + end + nil + end + private def cache(key) (@cache[key] ||= [yield])[0] From codesite-noreply at google.com Wed Apr 8 08:53:12 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 08 Apr 2009 12:53:12 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r941 - * don't convert AuthenticationError to ConnectionError on reconnect. Message-ID: <001485f5473440475904670a9d27@google.com> Author: koutou Date: Wed Apr 8 05:50:51 2009 New Revision: 941 Modified: trunk/lib/active_ldap/adapter/base.rb Log: * don't convert AuthenticationError to ConnectionError on reconnect. Suggested by tashen. Thanks!!! Modified: trunk/lib/active_ldap/adapter/base.rb ============================================================================== --- trunk/lib/active_ldap/adapter/base.rb (original) +++ trunk/lib/active_ldap/adapter/base.rb Wed Apr 8 05:50:51 2009 @@ -564,6 +564,8 @@ begin connect(options) break + rescue AuthenticationError + raise rescue => detail @logger.error do _("Reconnect to server failed: %s\n" \ From codesite-noreply at google.com Wed Apr 8 08:57:27 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 08 Apr 2009 12:57:27 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r940 - * retries -> retry_limit. Message-ID: <001636164ad171a6d804670aacd7@google.com> Author: koutou Date: Wed Apr 8 05:39:23 2009 New Revision: 940 Modified: trunk/lib/active_ldap.rb Log: * retries -> retry_limit. Reported by tashen. Thanks!!! Modified: trunk/lib/active_ldap.rb ============================================================================== --- trunk/lib/active_ldap.rb (original) +++ trunk/lib/active_ldap.rb Wed Apr 8 05:39:23 2009 @@ -469,7 +469,7 @@ # * :try_sasl, when true, tells ActiveLdap to attempt a SASL-GSSAPI bind # * :sasl_quiet, when true, tells the SASL libraries to not spew messages to STDOUT # * :method indicates whether to use :ssl, :tls, or :plain -# * :retries - indicates the number of attempts to reconnect that will be undertaken when a stale connection occurs. -1 means infinite. +# * :retry_limit - indicates the number of attempts to reconnect that will be undertaken when a stale connection occurs. -1 means infinite. # * :retry_wait - seconds to wait before retrying a connection # * :scope - dictates how to find objects. (Default: :one) # * :timeout - time in seconds - defaults to disabled. This CAN interrupt search() requests. Be warned. From codesite-noreply at google.com Wed Apr 8 10:45:07 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 08 Apr 2009 14:45:07 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r942 - * normalize schema attribute name. Message-ID: <00151750d9b87dd09404670c2d30@google.com> Author: koutou Date: Wed Apr 8 07:42:19 2009 New Revision: 942 Modified: trunk/README trunk/lib/active_ldap/schema.rb Log: * normalize schema attribute name. Reported by Tim Hermans. Thanks!!! Modified: trunk/README ============================================================================== --- trunk/README (original) +++ trunk/README Wed Apr 8 07:42:19 2009 @@ -126,3 +126,4 @@ * id:dicdak: A bug report. * Raiko Mitsu: A bug report. * tashen: Documents in Japanese. +* Tim Hermans: A bug report. Modified: trunk/lib/active_ldap/schema.rb ============================================================================== --- trunk/lib/active_ldap/schema.rb (original) +++ trunk/lib/active_ldap/schema.rb Wed Apr 8 07:42:19 2009 @@ -3,7 +3,7 @@ include GetTextSupport def initialize(entries) - @entries = default_entries.merge(entries || {}) + @entries = normalize_entries(entries || {}) @schema_info = {} @class_attributes_info = {} @cache = {} @@ -262,7 +262,20 @@ "attributeTypes" => [], "ldapSyntaxes" => [], "dITContentRules" => [], + "matchingRules" => [], } + end + + def normalize_entries(entries) + normalized_entries = default_entries + normalized_keys = normalized_entries.keys + entries.each do |name, values| + normalized_name = normalized_keys.find do |key| + key.downcase == name + end + normalized_entries[normalized_name || name] = values + end + normalized_entries end class Entry From codesite-noreply at google.com Wed Apr 8 14:08:05 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 08 Apr 2009 18:08:05 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r943 - translate from "ActiveLdap::Base" to "Exceptions" into Japanese. Message-ID: <0016369206115a995304670f03f4@google.com> Author: tashen.hatena Date: Wed Apr 8 11:07:01 2009 New Revision: 943 Modified: wiki/TutorialJa.wiki Log: translate from "ActiveLdap::Base" to "Exceptions" into Japanese. Modified: wiki/TutorialJa.wiki ============================================================================== --- wiki/TutorialJa.wiki (original) +++ wiki/TutorialJa.wiki Wed Apr 8 11:07:01 2009 @@ -111,14 +111,18 @@ == ?????? == - Assuming all the requirements are installed, you can install by grabbing the latest tgz file from the download site. + Assuming all the requirements are installed, you can install by grabbing the + latest tgz file from the download site. The following steps will get the ActiveLdap installed in no time! $ tar -xzvf ruby-activeldap-current.tgz $ cd ruby-activeldap-VERSION - Edit lib/active_ldap/configuration.rb replacing values to match what will work with your LDAP servers. Please note that those variables are required, but can be overridden in any program as detailed later in this document. Also make sure that "ROOT" stays all upcase. + Edit lib/active_ldap/configuration.rb replacing values to match what will work + with your LDAP servers. Please note that those variables are required, but can + be overridden in any program as detailed later in this document. Also make + sure that "ROOT" stays all upcase. Now run: @@ -131,7 +135,9 @@ => true irb> exit - If the require returns false or an exception is raised, there has been a problem with the installation. You may need to customize what setup.rb does on install. + If the require returns false or an exception is raised, there has been a + problem with the installation. You may need to customize what setup.rb does on + install. ??????? gem ?????????? @@ -763,16 +769,55 @@ == ActiveLdap::Base == -ActiveLdap::Base has come up a number of times in the examples above. Every time, it was being used as the super class for the wrapper objects. While this is it's main purpose, it also handles quite a bit more in the background. -What is it? + + ActiveLdap::Base has come up a number of times in the examples above. Every + time, it was being used as the super class for the wrapper objects. While this + is it's main purpose, it also handles quite a bit more in the background. + +ActiveLdap::Base ????????????????????????????? LDAP +????????????????????????????????????? ??? +?????????????? -ActiveLdap::Base is the heart of ActiveLdap. It does all the schema parsing for validation and attribute-to-method mangling as well as manage the connection to LDAP. -setup_connection + + What is it? + +=== ????? ==== -Base.setup_connection takes many (optional) arguments and is used to connect to the LDAP server. Sometimes you will want to connect anonymously and other times over TLS with user credentials. Base.setup_connection is here to do all of that for you. + + ActiveLdap::Base is the heart of ActiveLdap. It does all the schema parsing + for validation and attribute-to-method mangling as well as manage the + connection to LDAP. + +ActiveLdap::Base ? ActiveLdap ?????????? setter/getter ???? ??? +????????????????????????????????LDAP??? ??? +?????????? -By default, if you call any subclass of Base, such as Group, it will call Base.setup_connection() if these is no active LDAP connection. If your server allows anonymous binding, and you only want to access data in a read-only fashion, you won't need to call Base.setup_connection. Here is a fully parameterized call: +=== setup_connection === + + Base.setup_connection takes many (optional) arguments and is used to connect + to the LDAP server. Sometimes you will want to connect anonymously and other + times over TLS with user credentials. Base.setup_connection is here to do all + of that for you. + +Base.setup_connection ? LDAP ?????????????????????? ??? +????????????????????????????????????? ??? +TLS????????????????Base.setup_connection ????????? ?? + + + By default, if you call any subclass of Base, such as Group, it will call + Base.setup_connection() if these is no active LDAP connection. If your server + allows anonymous binding, and you only want to access data in a read-only + fashion, you won't need to call Base.setup_connection. Here is a fully + parameterized call: + +Group ?????Base ??????????????????????????? ?? +???Base.setup_connection ??????????????????????? ??? +????????????????????????????????????? ? +?????????????????????????????? setup_connection ? +??????? + +{{{ Base.setup_connection( :host => 'ldap.dataspill.org', :port => 389, @@ -783,9 +828,15 @@ :allow_anonymous => false, :try_sasl => false ) +}}} -There are quite a few arguments, but luckily many of them have safe defaults: + + There are quite a few arguments, but luckily many of them have safe defaults: + +????????????????????????????????????? ??? +?? + * :host defaults to @@host from configuration.rb waaay back at the setup.rb stage.@ * :port defaults to @@port from configuration.rb as well * :base defaults to Base.base() from configuration.rb @@ -794,9 +845,22 @@ * :password_block defaults to nil * :allow_anonymous defaults to true * :try_sasl defaults to false - see Advanced Topics for more on this one. + -Most of these are obvious, but I'll step through them for completeness: + * :host ???????? '127.0.0.1' ?? + * :port ? nil ????????????? 389 ??????? + * :bind_dn ? nil ????????????????????????? + * :logger ???????????????????????? Log4r ???? ????? + * :password_block ??????? nil ??? + * :allow_anonymous ??????? true ?? + * :try_sasl ??????? false ???????????????????? ??? "?????" ??????? + + + Most of these are obvious, but I'll step through them for completeness: + +???????????????????? + * :host defines the LDAP server hostname to connect to. * :port defines the LDAP server port to connect to. * :method defines the type of connection - :tls, :ssl, :plain @@ -815,41 +879,130 @@ * :scope - dictates how to find objects. (Default: :one) * :timeout - time in seconds - defaults to disabled. This CAN interrupt search() requests. Be warned. * :retry_on_timeout - whether to reconnect when timeouts occur. Defaults to true + + + * :host ????LDAP?????????????? + * :port ????LDAP????????????? + * :method ???????????? :tls, :ssl, :plain ??????? + * :base ? LDAP????????????????? Base ?????? ? :prefix ?????????? + * :bind_dn ????????????????????????????? dn ??????? + * :logger ???????????????????????????????? ???????????????? + * :pasword_block ?? Proc ??????????????????????? ????????????????????? + * :password ????????????????? + * :store_password ?????????????????? :password_block ? ?????????????????????????????????????? password_block ?????????????????????????????? + * :allow_anonymous ??????????????????????????? ?????? + * :try_ssl ? true ????SASL-GSSAPI ????????? + * :sasl_quiet ? true ????SASL ?????? STDOUT ????????? ????????? + * :method ???????????:ssl, :tls ??? :plain ?????? + * :retry_limit ????????????????????????????-1 ????????????????? + * :retry_on_timeout ??????????????????????????? ?????????? true ?? + * :retry_wait ???????????????????? + * :scope ?LDAP???????????????????????? :one ?? + * :timeout ??????????????????????????????? ?????search() ??????????????????????????? + + + See lib/configuration.rb for defaults for each option + +?????????????? ActiveLdap::Configuration::DEFAULT_CONFIG ?? ???????? + + + Base.setup_connection both connects and binds in one step. It follows roughly + the following approach: + +Base.setup_connection ?????????????????????????? ??? +?????????? -See lib/configuration.rb for defaults for each option + + * Connect to host:port using :method + * If bind_dn and password_block/password, attempt to bind with credentials. + * If that fails or no password_block and anonymous allowed, attempt to bind anonymously. + * If that fails, error out. + + * host:port ??????:method ????????? + * ?? bind_dn ? password_block ? password ?????????????? ??????????????? + * ???????????????????????????????????? ?????????????????? + * ????????????????????? -Base.setup_connection both connects and binds in one step. It follows roughly the following approach: + + *obsolete + On connect, the configuration options passed in are stored in an internal + class variable @configuration which is used to cache the information without + ditching the defaults passed in from configuration.rb + +?????????????????????? @@defined_configuration ??? ?? +???????????????????????????????????? ?? - * Connect to host:port using :method - * If bind_dn and password_block/password, attempt to bind with credentials. - * If that fails or no password_block and anonymous allowed, attempt to bind anonymously. - * If that fails, error out. +=== connection === -On connect, the configuration options passed in are stored in an internal class variable @configuration which is used to cache the information without ditching the defaults passed in from configuration.rb -connection + + Base.connection returns the ActiveLdap::Connection object. + +Base.connection ? ActiveLdasp::Connection ??????????? -Base.connection returns the ActiveLdap::Connection object. -Exceptions + + Exceptions + +== ????? == -There are a few custom exceptions used in ActiveLdap. They are detailed below. -DeleteError + + There are a few custom exceptions used in ActiveLdap. They are detailed below. + +ActiveLdap ???????????????????????????????? ??? -This exception is raised when delete fails. It will include LDAP error information that was passed up during the error. -SaveError +=== DeleteError === -This exception is raised when there is a problem in save updating or creating an LDAP entry. Often the error messages are cryptic. Looking at the server logs or doing an Ethereal dump of the connection will often provide better insight. -AuthenticationError + + This exception is raised when delete fails. It will include LDAP error + information that was passed up during the error. + +LDAP???????????????????????????????? LDAP ? +?????????????? -This exception is raised during Base.setup_connection if no valid authentication methods succeeded. -ConnectionError +=== SaveError === -This exception is raised during Base.setup_connection if no valid connection to the LDAP server could be created. Check you configuration.rb, Base.setup_connection arguments, and network connectivity! Also check your LDAP server logs to see if it ever saw the request. -ObjectClassError + + This exception is raised when there is a problem in save updating or creating + an LDAP entry. Often the error messages are cryptic. Looking at the server + logs or doing an Ethereal dump of the connection will often provide better + insight. + +LDAP ???????????????????????????????LDAP?? ?? +??? Ethereal ????????????????????????????? ?? +?? + +=== AuthenticationError === + + + This exception is raised during Base.setup_connection if no valid + authentication methods succeeded. + +????? setup_connection ? :method ?????????????????? ????????? + +=== ConnectionError === + + + This exception is raised during Base.setup_connection if no valid connection + to the LDAP server could be created. Check you configuration.rb, + Base.setup_connection arguments, and network connectivity! Also check your + LDAP server logs to see if it ever saw the request. + +????? setup_connectio ???????????????????????? ?? +setup_connection ????????????????????????????? ?? +??????????????????LDAP???????????????? ?? -This exception is raised when an object class is used that is not defined in the schema. -Others +=== ObjectClassError === + + + This exception is raised when an object class is used that is not defined in + the schema. + +??????LDAP????????????????????????????? ??? +????????? + +== Others == Other exceptions may be raised by the Ruby/LDAP module, or by other subsystems. If you get one of these exceptions and think it should be wrapped, write me an email and let me know where it is and what you expected. For faster results, email a patch! + Putting it all together Now that all of the components of ActiveLdap have been covered, it's time to put it all together! The rest of this section will show the steps to setup example user and group management scripts for use with the LDAP tree described above. From codesite-noreply at google.com Thu Apr 9 08:14:47 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Thu, 09 Apr 2009 12:14:47 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r944 - * accept normalized attribute name by default. Message-ID: <0016e644cb28b531f904671e3150@google.com> Author: koutou Date: Thu Apr 9 05:14:19 2009 New Revision: 944 Modified: trunk/lib/active_ldap/base.rb Log: * accept normalized attribute name by default. Modified: trunk/lib/active_ldap/base.rb ============================================================================== --- trunk/lib/active_ldap/base.rb (original) +++ trunk/lib/active_ldap/base.rb Thu Apr 9 05:14:19 2009 @@ -1124,7 +1124,7 @@ obj end - def to_real_attribute_name(name, allow_normalized_name=false) + def to_real_attribute_name(name, allow_normalized_name=true) return name if name.nil? if allow_normalized_name entry_attribute.normalize(name, allow_normalized_name) || From codesite-noreply at google.com Thu Apr 9 11:06:38 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Thu, 09 Apr 2009 15:06:38 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r945 - * follow the recent attribute normalization change. Message-ID: <00163698966f4d54b10467209827@google.com> Author: koutou Date: Thu Apr 9 08:05:10 2009 New Revision: 945 Modified: trunk/lib/active_ldap/base.rb trunk/test/test_attributes.rb trunk/test/test_base.rb Log: * follow the recent attribute normalization change. Modified: trunk/lib/active_ldap/base.rb ============================================================================== --- trunk/lib/active_ldap/base.rb (original) +++ trunk/lib/active_ldap/base.rb Thu Apr 9 08:05:10 2009 @@ -921,7 +921,7 @@ def have_attribute?(name, except=[]) real_name = to_real_attribute_name(name) - real_name and !except.include?(real_name) + !real_name.nil? and !except.include?(real_name) end alias_method :has_attribute?, :have_attribute? Modified: trunk/test/test_attributes.rb ============================================================================== --- trunk/test/test_attributes.rb (original) +++ trunk/test/test_attributes.rb Thu Apr 9 08:05:10 2009 @@ -8,9 +8,11 @@ priority :normal def test_to_real_attribute_name user = @user_class.new("user") - assert_nil(user.__send__(:to_real_attribute_name, "objectclass")) + assert_equal("objectClass", + user.__send__(:to_real_attribute_name, "objectclass")) assert_equal("objectClass", user.__send__(:to_real_attribute_name, "objectclass", true)) + assert_nil(user.__send__(:to_real_attribute_name, "objectclass", false)) end def test_protect_object_class_from_mass_assignment Modified: trunk/test/test_base.rb ============================================================================== --- trunk/test/test_base.rb (original) +++ trunk/test/test_base.rb Thu Apr 9 08:05:10 2009 @@ -776,13 +776,13 @@ def test_have_attribute? make_temporary_user do |user, password| - assert(user.have_attribute?(:cn)) - assert(user.have_attribute?(:commonName)) - assert(user.have_attribute?(:common_name)) - assert(!user.have_attribute?(:commonname)) - assert(!user.have_attribute?(:COMMONNAME)) + assert_true(user.have_attribute?(:cn)) + assert_true(user.have_attribute?(:commonName)) + assert_true(user.have_attribute?(:common_name)) + assert_true(user.have_attribute?(:commonname)) + assert_true(user.have_attribute?(:COMMONNAME)) - assert(!user.have_attribute?(:unknown_attribute)) + assert_false(user.have_attribute?(:unknown_attribute)) end end From codesite-noreply at google.com Sat Apr 11 02:15:20 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sat, 11 Apr 2009 06:15:20 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r946 - * association proxy's to_param returns target's to_param. Message-ID: <0016361e7bdceb51780467416755@google.com> Author: koutou Date: Fri Apr 10 23:14:04 2009 New Revision: 946 Modified: trunk/README trunk/lib/active_ldap/association/proxy.rb Log: * association proxy's to_param returns target's to_param. Suggested by Joe Francis. Thanks!!! Modified: trunk/README ============================================================================== --- trunk/README (original) +++ trunk/README Fri Apr 10 23:14:04 2009 @@ -127,3 +127,4 @@ * Raiko Mitsu: A bug report. * tashen: Documents in Japanese. * Tim Hermans: A bug report. +* Joe Francis: A suggestion. Modified: trunk/lib/active_ldap/association/proxy.rb ============================================================================== --- trunk/lib/active_ldap/association/proxy.rb (original) +++ trunk/lib/active_ldap/association/proxy.rb Fri Apr 10 23:14:04 2009 @@ -3,12 +3,13 @@ class Proxy alias_method :proxy_respond_to?, :respond_to? alias_method :proxy_extend, :extend + delegate :to_param, :to => :target def initialize(owner, options) @owner = owner @options = options - extend(options[:extend]) if options[:extend] reset + extend(options[:extend]) if options[:extend] end def respond_to?(symbol, include_priv=false) From codesite-noreply at google.com Sat Apr 11 02:46:24 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sat, 11 Apr 2009 06:46:24 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r947 - * don't retry reconnect if it's already connected. Message-ID: <0016e644cc68faa734046741d6ba@google.com> Author: koutou Date: Fri Apr 10 23:45:16 2009 New Revision: 947 Modified: trunk/lib/active_ldap/adapter/base.rb Log: * don't retry reconnect if it's already connected. Modified: trunk/lib/active_ldap/adapter/base.rb ============================================================================== --- trunk/lib/active_ldap/adapter/base.rb (original) +++ trunk/lib/active_ldap/adapter/base.rb Fri Apr 10 23:45:16 2009 @@ -310,7 +310,13 @@ Timeout.alarm(@timeout, &block) rescue Timeout::Error => e @logger.error {_('Requested action timed out.')} - retry if @retry_on_timeout and try_reconnect and reconnect(options) + if @retry_on_timeout + if connecting? + retry + elsif try_reconnect and reconnect(options) + retry + end + end @logger.error {e.message} raise TimeoutError, e.message end From codesite-noreply at google.com Sat Apr 11 02:50:24 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sat, 11 Apr 2009 06:50:24 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r948 - * shorten default retry values. Message-ID: <0016e6509e8e4f054f046741e54f@google.com> Author: koutou Date: Fri Apr 10 23:49:34 2009 New Revision: 948 Modified: trunk/lib/active_ldap/configuration.rb Log: * shorten default retry values. Modified: trunk/lib/active_ldap/configuration.rb ============================================================================== --- trunk/lib/active_ldap/configuration.rb (original) +++ trunk/lib/active_ldap/configuration.rb Fri Apr 10 23:49:34 2009 @@ -37,8 +37,8 @@ DEFAULT_CONFIG[:sasl_mechanisms] = ["GSSAPI", "DIGEST-MD5", "CRAM-MD5", "EXTERNAL"] - DEFAULT_CONFIG[:retry_limit] = 3 - DEFAULT_CONFIG[:retry_wait] = 3 + DEFAULT_CONFIG[:retry_limit] = 1 + DEFAULT_CONFIG[:retry_wait] = 1 DEFAULT_CONFIG[:timeout] = 0 # in seconds; 0 <= Never timeout # Whether or not to retry on timeouts DEFAULT_CONFIG[:retry_on_timeout] = true From codesite-noreply at google.com Sun Apr 12 00:50:51 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 12 Apr 2009 04:50:51 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r949 - * use :class_name instead of :class. Message-ID: <00163691fefc92fb3c046754570b@google.com> Author: koutou Date: Sat Apr 11 21:49:59 2009 New Revision: 949 Modified: trunk/rails/README Log: * use :class_name instead of :class. Modified: trunk/rails/README ============================================================================== --- trunk/rails/README (original) +++ trunk/rails/README Sat Apr 11 21:49:59 2009 @@ -32,8 +32,8 @@ app/model/member.rb: class Member < ActiveLdap::Base ldap_mapping :dn_attribute => 'uid', - :classes => ['person', 'posixAccount'] - belongs_to :primary_group, :class => "Group", + :classes => ['person', 'posixAccount'] + belongs_to :primary_group, :class_name => "Group", :foreign_key => "gidNumber", :primary_key => "gidNumber" belongs_to :groups, :many => 'memberUid' end From codesite-noreply at google.com Sun Apr 12 00:55:51 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 12 Apr 2009 04:55:51 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r950 - * remove obsolete generator: scaffold_al. Message-ID: <0016368e1d5f7b8f420467546983@google.com> Author: koutou Date: Sat Apr 11 21:55:33 2009 New Revision: 950 Removed: trunk/rails_generators/scaffold_al/ Log: * remove obsolete generator: scaffold_al. From codesite-noreply at google.com Sun Apr 12 14:14:25 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 12 Apr 2009 18:14:25 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r951 - " Putting it all together" is being translated into Japanese. Message-ID: <0016e644ce1c5b50ca04675f91a2@google.com> Author: tashen.hatena Date: Sun Apr 12 10:59:57 2009 New Revision: 951 Modified: wiki/TutorialJa.wiki Log: " Putting it all together" is being translated into Japanese. Modified: wiki/TutorialJa.wiki ============================================================================== --- wiki/TutorialJa.wiki (original) +++ wiki/TutorialJa.wiki Sun Apr 12 10:59:57 2009 @@ -999,38 +999,116 @@ ??????LDAP????????????????????????????? ??? ????????? -== Others == - -Other exceptions may be raised by the Ruby/LDAP module, or by other subsystems. If you get one of these exceptions and think it should be wrapped, write me an email and let me know where it is and what you expected. For faster results, email a patch! - -Putting it all together - -Now that all of the components of ActiveLdap have been covered, it's time to put it all together! The rest of this section will show the steps to setup example user and group management scripts for use with the LDAP tree described above. - -All of the scripts here are in the package's examples/ directory. -Setting up lib/ - -In ldapadmin/lib/ create the file user.rb: - - cat < 'uid', :prefix => 'ou=People', :classes => ['top', 'account', 'posixAccount'] - belongs_to :groups, :class => 'Group', :wrap => 'memberUid' + + Others + +=== ?????? === + + + Other exceptions may be raised by the Ruby/LDAP module, or by other + subsystems. If you get one of these exceptions and think it should be + wrapped, write me an email and let me know where it is and what you + expected. For faster results, email a patch! + +??????? Ruby/LDAP ???????????????????????? ??? +?????????????????ActiveLdap ??????????????? ?? +????????????????????????????????????? ??? +??????????????????? + + + Putting it all together + +== ?????????????? == + + + Now that all of the components of ActiveLdap have been covered, it's time to + put it all together! The rest of this section will show the steps to setup + example user and group management scripts for use with the LDAP tree described + above. + +????? ActiveLdap ?????????????????????????? ??? +????????????????? ???????????????? LDAP ? ?? +????????????????????????????????????? ? +?? + + + All of the scripts here are in the package's examples/ directory. + +??????????????ActiveLdap ?????? examples/ ?????? ??? +???????? + + + Setting up lib/ + +=== ?? === + + + ????? ldapadmin ???????????????????? + +????????????????? +{{{ + mkdir -p ldapadmin/objects +}}} + + + In ldapadmin/lib/ create the file user.rb: + +???ldapadin/objects/user.rb ?????????????????????? ?? + +{{{ +require 'objects/group' + +class User < ActiveLdap::Base + ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People', + :classes => ['person', 'posixAccount'] + belongs_to :primary_group, :class => "Group", + :foreign_key => "gidNumber", :primary_key => "gidNumber" + belongs_to :groups, :many => 'memberUid' + + # An example of using the old "return_objects" API with the + # new ActiveRecord-style API. + alias groups_mapping groups + def groups(return_objects=true) + return groups_mapping if return_objects + attr = 'cn' + Group.search(:attribute => 'memberUid', + :value => id, + :attributes => [attr]).map {|dn, attrs| attrs[attr]}.flatten end - EOF - -In ldapadmin/lib/ create the file group.rb: +end +}}} - cat < ['top', 'posixGroup'], :prefix => 'ou=Group' - has_many :members, :class => "User", :many => "memberUid" - has_many :primary_members, :class => 'User', :foreign_key => 'gidNumber', :primary_key => 'gidNumber' - end # Group - EOF + + In ldapadmin/lib/ create the file group.rb: + +????ldapadmin/objects/group.rb ??????? + +{{{ +class Group < ActiveLdap::Base + ldap_mapping :dn_attribute => "cn", + :classes => ['posixGroup'] + # Inspired by ActiveRecord, this tells ActiveLDAP that the + # LDAP entry has a attribute which contains one or more of + # some class |:class_name| where the attributes name is + # |:local_key|. This means that it will call + # :class_name.new(value_of(:local_key)) to create the objects. + has_many :members, :class => "User", :wrap => "memberUid" + has_many :primary_members, :class => 'User', + :foreign_key => 'gidNumber', + :primary_key => 'gidNumber' +end +}}} + + + Now, we can write some small scripts to do simple management tasks. + +???????????????????????????????????? ?? + + + Creating LDAP entries + -Now, we can write some small scripts to do simple management tasks. -Creating LDAP entries +=== LDAP ??????? === Now let's create a really dumb script for adding users - ldapadmin/useradd: From codesite-noreply at google.com Wed Apr 15 09:26:11 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 15 Apr 2009 13:26:11 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r952 - * fixed regular expression in LDAP::Schema.attr(). Reported by bidon. Thanks!!! Message-ID: <00163698966f1f5d40046797e444@google.com> Author: Alexey.Chebotar Date: Wed Apr 15 05:18:21 2009 New Revision: 952 Modified: ldap/trunk/ChangeLog ldap/trunk/README ldap/trunk/lib/ldap/schema.rb Log: * fixed regular expression in LDAP::Schema.attr(). Reported by bidon. Thanks!!! Modified: ldap/trunk/ChangeLog ============================================================================== --- ldap/trunk/ChangeLog (original) +++ ldap/trunk/ChangeLog Wed Apr 15 05:18:21 2009 @@ -1,3 +1,6 @@ +Wed Apr 15 11:38:06 UTC 2009 Alexey Chebotar + * Fixed regular expression in LDAP::Schema.attr() + Thu Mar 25 08:45:02 UTC 2009 Alexey Chebotar * Version 0.9.8. Modified: ldap/trunk/README ============================================================================== --- ldap/trunk/README (original) +++ ldap/trunk/README Wed Apr 15 05:18:21 2009 @@ -243,3 +243,21 @@ * Object Identifiers Registry http://www.alvestrand.no/harald/objectid/ +THANKS + +This list maybe not correct. If you notice mistakes of this list, please point out. + +* atsu@@metallic.co.jp +* Akinori MUSHA +* Akira Yamada +* Pirmin Kalberer +* Radek Hnilica +* Hadmut Danisch +* Yuuzou Gotou +* Tilo Sloboda +* Usa Nakamura +* Mark Kittisopikul +* Jan Mikkelsen +* Adam Doligalski +* Chris Scharf +* bidon: Patch. Modified: ldap/trunk/lib/ldap/schema.rb ============================================================================== --- ldap/trunk/lib/ldap/schema.rb (original) +++ ldap/trunk/lib/ldap/schema.rb Wed Apr 15 05:18:21 2009 @@ -25,7 +25,7 @@ # +key+. See LDAP::Conn#schema for common values of +key+. # def names(key) - self[key].collect{|val| val =~ /NAME\s+'([\w\d_-]+)'/; $1} + self[key].collect{|val| val =~ /NAME\s+'([\w\d_\-]+)'/; $1} end # Return the list of attributes in object class +oc+ that are of category @@ -35,10 +35,8 @@ self['objectClasses'].each{|s| if( s =~ /NAME\s+'#{oc}'/ ) case s - when /#{at}\s+\(([\w\d_-\s\$]+)\)/i - return $1.split("$").collect{|attr| attr.strip} - when /#{at}\s+([\w\d_-]+)/i - return $1.split("$").collect{|attr| attr.strip} + when /#{at}\s+\(([\w\d_\-\s\$]+)\)/i then return $1.split("$").collect{| attr| attr.strip} + when /#{at}\s+([\w\d_\-]+)/i then return $1.split("$").collect{|attr| attr.strip} end end } From codesite-noreply at google.com Wed Apr 15 09:59:30 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 15 Apr 2009 13:59:30 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r955 - * fix infinite retry on timeout. Message-ID: <00163628395e42af100467985bd5@google.com> Author: koutou Date: Wed Apr 15 06:52:04 2009 New Revision: 955 Modified: trunk/lib/active_ldap/adapter/base.rb trunk/test/test_connection.rb Log: * fix infinite retry on timeout. Modified: trunk/lib/active_ldap/adapter/base.rb ============================================================================== --- trunk/lib/active_ldap/adapter/base.rb (original) +++ trunk/lib/active_ldap/adapter/base.rb Wed Apr 15 06:52:04 2009 @@ -306,15 +306,17 @@ end def with_timeout(try_reconnect=true, options={}, &block) + n_retries = 0 + retry_limit = options[:retry_limit] || @retry_limit begin Timeout.alarm(@timeout, &block) rescue Timeout::Error => e @logger.error {_('Requested action timed out.')} - if @retry_on_timeout + if @retry_on_timeout and retry_limit < 0 and n_retries <= retry_limit if connecting? retry - elsif try_reconnect and reconnect(options) - retry + elsif try_reconnect + retry if with_timeout(false, options) {reconnect(options)} end end @logger.error {e.message} @@ -596,7 +598,9 @@ def reconnect_if_need(options={}) return if connecting? - reconnect(options) + with_timeout(false, options) do + reconnect(options) + end end # Determine if we have exceed the retry limit or not. Modified: trunk/test/test_connection.rb ============================================================================== --- trunk/test/test_connection.rb (original) +++ trunk/test/test_connection.rb Wed Apr 15 06:52:04 2009 @@ -27,7 +27,18 @@ config = current_configuration.merge("host" => "192.168.29.29", "retry_limit" => 0) ActiveLdap::Base.setup_connection(config) + notify("maybe take a long time") assert_raise(ActiveLdap::ConnectionError) do + ActiveLdap::Base.find(:first) + end + end + + def test_retry_limit_0_with_nonexistent_host_with_timeout + config = current_configuration.merge("host" => "192.168.29.29", + "retry_limit" => 0, + "timeout" => 1) + ActiveLdap::Base.setup_connection(config) + assert_raise(ActiveLdap::TimeoutError) do ActiveLdap::Base.find(:first) end end From codesite-noreply at google.com Wed Apr 15 09:54:20 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 15 Apr 2009 13:54:20 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r953 - * don't provide class variable accessors to instance. Message-ID: <0016361e892ac57d7204679848a2@google.com> Author: koutou Date: Wed Apr 15 06:51:00 2009 New Revision: 953 Modified: trunk/README trunk/lib/active_ldap/base.rb Log: * don't provide class variable accessors to instance. removed methods #prefix=, #dn_attribute=, #sort_by=, #order=, #required_classes=, #recommended_classes= and #excluded_classes. Pointed out by David Morton. Modified: trunk/README ============================================================================== --- trunk/README (original) +++ trunk/README Wed Apr 15 06:51:00 2009 @@ -106,7 +106,7 @@ * Naoto Morishima: Bug reports. * David Morton: * An API improvement idea. - * A bug report. + * Bug reports. * Lennon Day-Reynolds: Bug reports. * Tilo: A bug report. * Matt Mencel: A bug report. Modified: trunk/lib/active_ldap/base.rb ============================================================================== --- trunk/lib/active_ldap/base.rb (original) +++ trunk/lib/active_ldap/base.rb Wed Apr 15 06:51:00 2009 @@ -309,7 +309,6 @@ end def #{sym}; self.class.#{sym}; end def self.#{sym}=(value); @#{sym} = value; end - def #{sym}=(value); self.class.#{sym} = value; end EOS end end @@ -1008,7 +1007,6 @@ end.join(",") end - undef_method :base= def base=(object_local_base) @dn = nil @base = object_local_base @@ -1019,7 +1017,6 @@ @scope || scope_of_class end - undef_method :scope= def scope=(scope) self.class.validate_scope(scope) @scope = scope From codesite-noreply at google.com Wed Apr 15 10:17:03 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 15 Apr 2009 14:17:03 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r954 - * don't provide class variable accessors to instance. Message-ID: <0016e644de5e0a3bb30467989a23@google.com> Author: koutou Date: Wed Apr 15 06:51:22 2009 New Revision: 954 Modified: trunk/test/test_base.rb Log: * don't provide class variable accessors to instance. removed methods #prefix=, #dn_attribute=, #sort_by=, #order=, #required_classes=, #recommended_classes= and #excluded_classes. Pointed out by David Morton. Modified: trunk/test/test_base.rb ============================================================================== --- trunk/test/test_base.rb (original) +++ trunk/test/test_base.rb Wed Apr 15 06:51:22 2009 @@ -50,16 +50,19 @@ end end - def test_destroy_with_empty_base_of_class + def test_destroy_with_empty_base_and_prefix_of_class make_temporary_user do |user,| + p user.dn base = user.class.base + prefix = user.class.prefix begin user.class.base = "" - user.prefix = "" + user.class.prefix = "" user.base = base user.destroy ensure user.class.base = base + user.class.prefix = prefix end end end From codesite-noreply at google.com Thu Apr 16 12:49:36 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Thu, 16 Apr 2009 16:49:36 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r956 - " Putting it all together" was translated into Japanese. Message-ID: <0016e646426271ed290467aed95f@google.com> Author: tashen.hatena Date: Thu Apr 16 09:49:15 2009 New Revision: 956 Modified: wiki/TutorialJa.wiki Log: " Putting it all together" was translated into Japanese. Modified: wiki/TutorialJa.wiki ============================================================================== --- wiki/TutorialJa.wiki (original) +++ wiki/TutorialJa.wiki Thu Apr 16 09:49:15 2009 @@ -1110,8 +1110,13 @@ === LDAP ??????? === -Now let's create a really dumb script for adding users - ldapadmin/useradd: + + Now let's create a really dumb script for adding users - + ldapadmin/useradd: + +???????????????? ldapadmin/useradd ???????????? ?? + #!/usr/bin/ruby -W0 require 'active_ldap' @@ -1154,11 +1159,67 @@ puts user.errors.full_messages exit 1 end + +{{{ + #!/usr/bin/ruby -W0 + + base = File.expand_path(File.join(File.dirname(__FILE__), "..")) + $LOAD_PATH << File.join(base, "lib") + $LOAD_PATH << File.join(base, "examples") -Managing LDAP entries + require 'active_ldap' + require 'objects/user' + require 'objects/group' -Now let's create another dumb script for modifying users - ldapadmin/usermod: + argv, opts, options = ActiveLdap::Command.parse_options do |opts, options| + opts.banner += " USER_NAME CN UID" + end + if argv.size == 3 + name, cn, uid = argv + else + $stderr.puts opts + exit 1 + end + + pwb = Proc.new do |user| + ActiveLdap::Command.read_password("[#{user}] Password: ") + end + + ActiveLdap::Base.setup_connection(:password_block => pwb, + :allow_anonymous => false) + + if User.exists?(name) + $stderr.puts("User #{name} already exists.") + exit 1 + end + + user = User.new(name) + user.add_class('shadowAccount') + user.cn = cn + user.uid_number = uid + user.gid_number = uid + user.home_directory = "/home/#{name}" + user.sn = "somesn" + unless user.save + puts "failed" + puts user.errors.full_messages + exit 1 + end +}}} + + + Managing LDAP entries + +=== LDAP ??????? === + + + Now let's create another dumb script for modifying users - + ldapadmin/usermod: + +???????????????? /ldapadmin/usermod ??????? + + #!/usr/bin/ruby -W0 require 'active_ldap' @@ -1197,11 +1258,63 @@ puts user.errors.full_messages exit 1 end + +{{{ +#!/usr/bin/ruby -W0 + +base = File.expand_path(File.join(File.dirname(__FILE__), "..")) +$LOAD_PATH << File.join(base, "lib") +$LOAD_PATH << File.join(base, "examples") + +require 'active_ldap' +require 'objects/user' +require 'objects/group' + +argv, opts, options = ActiveLdap::Command.parse_options do |opts, options| + opts.banner += " USER_NAME CN UID" +end + +if argv.size == 3 + name, cn, uid = argv +else + $stderr.puts opts + exit 1 +end + +pwb = Proc.new do |user| + ActiveLdap::Command.read_password("[#{user}] Password: ") +end + +ActiveLdap::Base.setup_connection(:password_block => pwb, + :allow_anonymous => false) + +unless User.exists?(name) + $stderr.puts("User #{name} doesn't exist.") + exit 1 +end + +user = User.find(name) +user.cn = cn +user.uid_number = uid +user.gid_number = uid +unless user.save + puts "failed" + puts user.errors.full_messages + exit 1 +end +}}} + + + Removing LDAP entries + +LDAP ??????? + + + And finally, a dumb script for removing user - ldapadmin/userdel: + +?????????????????? ldapadmin/userdel ??????? -Removing LDAP entries - -And finally, a dumb script for removing user - ldapadmin/userdel: - + #!/usr/bin/ruby -W0 require 'active_ldap' @@ -1232,8 +1345,48 @@ end User.destroy(name) - -Advanced Topics + +{{{ +#!/usr/bin/ruby -W0 + +base = File.expand_path(File.join(File.dirname(__FILE__), "..")) +$LOAD_PATH << File.join(base, "lib") +$LOAD_PATH << File.join(base, "examples") + +require 'active_ldap' +require 'objects/user' +require 'objects/group' + +argv, opts, options = ActiveLdap::Command.parse_options do |opts, options| + opts.banner += " USER_NAME" +end + +if argv.size == 1 + name = argv.shift +else + $stderr.puts opts + exit 1 +end + +pwb = Proc.new do |user| + ActiveLdap::Command.read_password("[#{user}] Password: ") +end + +ActiveLdap::Base.setup_connection(:password_block => pwb, + :allow_anonymous => false) + +unless User.exists?(name) + $stderr.puts("User #{name} doesn't exist.") + exit 1 +end + +User.destroy(name) +}}} + + + Advanced Topics + +== ????? == Below are some situation tips and tricks to get the most out of ActiveLdap. Binary data and other subtypes From codesite-noreply at google.com Sat Apr 18 23:45:03 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 19 Apr 2009 03:45:03 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r957 - * test/test_base.rb: remove a garbage. Message-ID: <0016e645ab9a2ffef90467e03d1c@google.com> Author: koutou Date: Sat Apr 18 20:43:59 2009 New Revision: 957 Modified: trunk/test/test_base.rb Log: * test/test_base.rb: remove a garbage. Modified: trunk/test/test_base.rb ============================================================================== --- trunk/test/test_base.rb (original) +++ trunk/test/test_base.rb Sat Apr 18 20:43:59 2009 @@ -52,7 +52,6 @@ def test_destroy_with_empty_base_and_prefix_of_class make_temporary_user do |user,| - p user.dn base = user.class.base prefix = user.class.prefix begin From codesite-noreply at google.com Sat Apr 18 23:49:04 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 19 Apr 2009 03:49:04 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r958 - * fix a bug that ActiveLdap::Base#base= doesn't change DN. Message-ID: <00163630e87f8b80870467e04b1e@google.com> Author: koutou Date: Sat Apr 18 20:46:50 2009 New Revision: 958 Modified: trunk/lib/active_ldap/base.rb trunk/test/test_base_per_instance.rb Log: * fix a bug that ActiveLdap::Base#base= doesn't change DN. Reported by David Morton. Thanks!!! Modified: trunk/lib/active_ldap/base.rb ============================================================================== --- trunk/lib/active_ldap/base.rb (original) +++ trunk/lib/active_ldap/base.rb Sat Apr 18 20:46:50 2009 @@ -1008,6 +1008,7 @@ end def base=(object_local_base) + ensure_update_dn @dn = nil @base = object_local_base end Modified: trunk/test/test_base_per_instance.rb ============================================================================== --- trunk/test/test_base_per_instance.rb (original) +++ trunk/test/test_base_per_instance.rb Sat Apr 18 20:46:50 2009 @@ -9,6 +9,13 @@ end priority :must + def test_set_base + guest = @user_class.new("guest") + guest.base = "ou=Sub" + assert_equal("uid=guest,ou=Sub,#{@user_class.base}", guest.dn) + end + + priority :normal def test_dn_is_base entry_class = Class.new(ActiveLdap::Base) entry_class.ldap_mapping :prefix => "", @@ -21,7 +28,6 @@ assert_equal(entry_class.base, entry.base) end - priority :normal def test_loose_dn user = @user_class.new("test-user , ou = Sub") assert_equal("uid=test-user,ou=Sub,#{@user_class.base}", user.dn) From codesite-noreply at google.com Tue Apr 21 11:01:04 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Tue, 21 Apr 2009 15:01:04 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r959 - * added support of OpenLDAP 2.4.15 and higher. Reported by Milos Jakubicek. Thanks!!! Message-ID: <0016362835ea73628f046811eae6@google.com> Author: Alexey.Chebotar Date: Tue Apr 21 08:00:30 2009 New Revision: 959 Modified: ldap/trunk/ChangeLog ldap/trunk/README ldap/trunk/conn.c ldap/trunk/ldap.c Log: * added support of OpenLDAP 2.4.15 and higher. Reported by Milos Jakubicek. Thanks!!! Modified: ldap/trunk/ChangeLog ============================================================================== --- ldap/trunk/ChangeLog (original) +++ ldap/trunk/ChangeLog Tue Apr 21 08:00:30 2009 @@ -1,3 +1,7 @@ +Tue Apr 21 14:46:38 UTC 2009 Alexey Chebotar + * LDAP_OPT_X_TLS_PROTOCOL changed to LDAP_OPT_X_TLS_PROTOCOL_MIN + (more information in ITS#5655). Thanks to Milos Jakubicek. + Wed Apr 15 11:38:06 UTC 2009 Alexey Chebotar * Fixed regular expression in LDAP::Schema.attr() Modified: ldap/trunk/README ============================================================================== --- ldap/trunk/README (original) +++ ldap/trunk/README Tue Apr 21 08:00:30 2009 @@ -261,3 +261,4 @@ * Adam Doligalski * Chris Scharf * bidon: Patch. +* Milos Jakubicek: Patch. \ No newline at end of file Modified: ldap/trunk/conn.c ============================================================================== --- ldap/trunk/conn.c (original) +++ ldap/trunk/conn.c Tue Apr 21 08:00:30 2009 @@ -497,8 +497,8 @@ #ifdef LDAP_OPT_X_TLS_KEYFILE case LDAP_OPT_X_TLS_KEYFILE: #endif -#ifdef LDAP_OPT_X_TLS_PROTOCOL - case LDAP_OPT_X_TLS_PROTOCOL: +#ifdef LDAP_OPT_X_TLS_PROTOCOL_MIN + case LDAP_OPT_X_TLS_PROTOCOL_MIN: #endif #ifdef LDAP_OPT_X_TLS_CIPHER_SUITE case LDAP_OPT_X_TLS_CIPHER_SUITE: @@ -627,8 +627,8 @@ #ifdef LDAP_OPT_X_TLS_KEYFILE case LDAP_OPT_X_TLS_KEYFILE: #endif -#ifdef LDAP_OPT_X_TLS_PROTOCOL - case LDAP_OPT_X_TLS_PROTOCOL: +#ifdef LDAP_OPT_X_TLS_PROTOCOL_MIN + case LDAP_OPT_X_TLS_PROTOCOL_MIN: #endif #ifdef LDAP_OPT_X_TLS_CIPHER_SUITE case LDAP_OPT_X_TLS_CIPHER_SUITE: Modified: ldap/trunk/ldap.c ============================================================================== --- ldap/trunk/ldap.c (original) +++ ldap/trunk/ldap.c Tue Apr 21 08:00:30 2009 @@ -420,8 +420,8 @@ #ifdef LDAP_OPT_X_TLS rb_ldap_define_opt (LDAP_OPT_X_TLS); #endif -#ifdef LDAP_OPT_X_TLS_PROTOCOL - rb_ldap_define_opt (LDAP_OPT_X_TLS_PROTOCOL); +#ifdef LDAP_OPT_X_TLS_PROTOCOL_MIN + rb_ldap_define_opt (LDAP_OPT_X_TLS_PROTOCOL_MIN); #endif #ifdef LDAP_OPT_X_TLS_CIPHER_SUITE rb_ldap_define_opt (LDAP_OPT_X_TLS_CIPHER_SUITE); From codesite-noreply at google.com Wed Apr 22 03:19:10 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 22 Apr 2009 07:19:10 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r960 - Edited wiki page through web user interface. Message-ID: <0016e643486a7184b904681f947f@google.com> Author: Alexey.Chebotar Date: Wed Apr 22 00:14:53 2009 New Revision: 960 Modified: wiki/RubyLDAP.wiki Log: Edited wiki page through web user interface. Modified: wiki/RubyLDAP.wiki ============================================================================== --- wiki/RubyLDAP.wiki (original) +++ wiki/RubyLDAP.wiki Wed Apr 22 00:14:53 2009 @@ -1,12 +1,12 @@ #labels Phase-Requirements,Phase-Deploy = About Ruby/LDAP = -Ruby/LDAP is an extension module for Ruby. It provides the interface to some common LDAP libraries (for example, [http://www.openldap.org/ OpenLDAP], [http://www.umich.edu/~dirsvcs/ldap/ UMich LDAP], [http://www.mozilla.org/directory/ Netscape SDK] and [http://www.microsoft.com/windowsserver2008/en/us/active-directory.aspx Active Directory]). The common API for application development is described in RFC1823 and most libraries comply with it. Ruby/LDAP supports those libraries. +Ruby/LDAP is an extension module for Ruby. It provides the interface to some common LDAP libraries (for example, [http://www.openldap.org/ OpenLDAP], [http://www.mozilla.org/directory/ Netscape SDK] and [http://www.microsoft.com/windowsserver2008/en/us/active-directory.aspx Active Directory]). The common API for application development is described in RFC1823 and most libraries comply with it. Ruby/LDAP supports those libraries. == Requirement == * Ruby 1.8.x / 1.9.x (at least 1.8.2 if you want to use ldap/control) - * OpenLDAP, Netscape SDK, Windows 2003 or Windows XP + * OpenLDAP, Netscape SDK or Active Directory == Download == From codesite-noreply at google.com Wed Apr 22 05:57:09 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 22 Apr 2009 09:57:09 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r961 - Edited wiki page through web user interface. Message-ID: <0016e6464262703487046821c903@google.com> Author: Alexey.Chebotar Date: Wed Apr 22 01:10:16 2009 New Revision: 961 Modified: wiki/RubyLDAP.wiki Log: Edited wiki page through web user interface. Modified: wiki/RubyLDAP.wiki ============================================================================== --- wiki/RubyLDAP.wiki (original) +++ wiki/RubyLDAP.wiki Wed Apr 22 01:10:16 2009 @@ -10,7 +10,7 @@ == Download == - * Download archives from the ActiveLdap [http://code.google.com/p/ruby-activeldap/downloads/list project page]. + * Download archives from the Ruby/LDAP [https://sourceforge.net/projects/ruby-ldap/ project page] or ActiveLdap [http://code.google.com/p/ruby-activeldap/downloads/list project page]. * Using version from trunk: {{{ From codesite-noreply at google.com Wed Apr 22 09:17:26 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 22 Apr 2009 13:17:26 +0000 Subject: [activeldap-commit] [ruby-activeldap commit] r962 - * fix unexpected nil value. Message-ID: <0016361e892ab6014604682495fc@google.com> Author: koutou Date: Wed Apr 22 05:25:30 2009 New Revision: 962 Modified: trunk/README trunk/lib/active_ldap.rb Log: * fix unexpected nil value. Pointed out by Tiago Fernandes. Modified: trunk/README ============================================================================== --- trunk/README (original) +++ trunk/README Wed Apr 22 05:25:30 2009 @@ -128,3 +128,4 @@ * tashen: Documents in Japanese. * Tim Hermans: A bug report. * Joe Francis: A suggestion. +* Tiago Fernandes: Bug reports. Modified: trunk/lib/active_ldap.rb ============================================================================== --- trunk/lib/active_ldap.rb (original) +++ trunk/lib/active_ldap.rb Wed Apr 22 05:25:30 2009 @@ -904,6 +904,7 @@ # require_gem_if_need = Proc.new do |library_name, gem_name, *gem_args| + gem_name ||= library_name begin if !gem_args.empty? and Object.const_defined?(:Gem) gem gem_name, *gem_args