From codesite-noreply at google.com Mon May 4 04:34:45 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Mon, 04 May 2009 08:34:45 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r963 - Edited wiki
page through web user interface.
Message-ID: <0016e644de5ed62b8a046912086e@google.com>
Author: tashen.hatena
Date: Mon May 4 01:25:59 2009
New Revision: 963
Modified:
wiki/TutorialJa.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Mon May 4 01:25:59 2009
@@ -526,7 +526,7 @@
:many ????????LDAP?????????????????
??:foreign_key ?
????????????????LDAP???????????????????
??
:foreign_key ? uid?:many ? memberUid ?????????????RDB???
?
-????????????????????????????????????
+?????????????????????????????????????
??
:primary_key ???????????LDAP??????????????????
gidNumber ????????????????????????????????
??
@@ -1102,7 +1102,7 @@
Now, we can write some small scripts to do simple management tasks.
-????????????????????????????????????
??
+???????????????????????????????????
Creating LDAP entries
@@ -1114,7 +1114,7 @@
Now let's create a really dumb script for adding users -
ldapadmin/useradd:
-???????????????? ldapadmin/useradd ????????????
??
+????????????? ldapadmin/useradd ??????????????
#!/usr/bin/ruby -W0
@@ -1307,7 +1307,7 @@
Removing LDAP entries
-LDAP ???????
+=== LDAP ??????? ===
And finally, a dumb script for removing user - ldapadmin/userdel:
@@ -1388,133 +1388,326 @@
== ????? ==
-Below are some situation tips and tricks to get the most out of ActiveLdap.
-Binary data and other subtypes
+
+ Below are some situation tips and tricks to get the most out of
+ ActiveLdap.
+
+?????ActiveLdap ???????????????????????????
+?????????????????
+
+
+ Binary data and other subtypes
+
+=== ????????????? ===
-Sometimes, you may want to store attributes with language specifiers, or
perhaps in binary form. This is (finally!) fully supported. To do so,
follow the examples below:
+
+ Sometimes, you may want to store attributes with language specifiers, or
+ perhaps in binary form. This is (finally!) fully supported. To do so,
+ follow the examples below:
+
+?????????????????????????????????????
?
+?????????????????????????????????????
?
+?????????????
+{{{
+ # ????????
irb> user = User.new('drewry')
=> ...
- # This adds a cn entry in lang-en and whatever the server default is.
+ # cn ??????????????????????????
irb> user.cn = [ 'wad', {'lang-en' => ['wad', 'foo']} ]
=> ...
irb> user.cn
=> ["wad", {"lang-en-us" => ["wad", "Will Drewry"]}]
- # Now let's add a binary X.509 certificate (assume objectClass is
correct)
+ # X.509 ??????????????objectClass ????????????
??????
irb> user.user_certificate = File.read('example.der')
=> ...
+ # ??
irb> user.save
+}}}
-So that's a lot to take in. Here's what is going on. I just set the LDAP
object's cn to "wad" and cn:lang-en-us to ["wad", "Will Drewry"]. Anytime a
LDAP subtype is required, you must encapsulate the data in a Hash.
-
-But wait a minute, I just read in a binary certificate without wrapping it
up. So any binary attribute _that requires ;binary subtyping_ will
automagically get wrapped in {'binary? => value} if you don't do it. This
keeps your writes from breaking, and my code from crying. For correctness,
I could have easily done the following:
+
+ So that's a lot to take in. Here's what is going on. I just set the LDAP
+ object's cn to "wad" and cn:lang-en-us to ["wad", "Will Drewry"].
Anytime a
+ LDAP subtype is required, you must encapsulate the data in a Hash.
+
+
+?????????????????????????????????cn
?"wad"
+? cn;lang-en-us ? ["wad", "Will Drewry"] ?????????LDAP?????
+????????????????????? Hash ???????????
+
+
+ But wait a minute, I just read in a binary certificate without wrapping
it up.
+ So any binary attribute _that requires ;binary subtyping_ will
automagically
+ get wrapped in {'binary? => value} if you don't do it. This keeps your
writes
+ from breaking, and my code from crying. For correctness, I could have
easily
+ done the following:
+
+?????????? Hash ????? X.509 ???????????????
???
+?????????????? ;binary ???????????????????
??
+??????????????????? {'binary' => value} ? Hash ????
???
+?????????????????????????????? Hash ????
???
+????
+{{{
irb> user.user_certificate = {'binary' => File.read('example.der')}
+}}}
-You should note that some binary data does not use the binary subtype all
the time. One example is jpegPhoto. You can use it as jpegPhoto;binary or
just as jpegPhoto. Since the schema dictates that it is a binary value,
ActiveLdap will write it as binary, but the subtype will not be
automatically appended as above. The use of the subtype on attributes like
jpegPhoto is ultimately decided by the LDAP site policy and not by any
programmatic means.
+
+ You should note that some binary data does not use the binary subtype
all the
+ time. One example is jpegPhoto. You can use it as jpegPhoto;binary or
just as
+ jpegPhoto. Since the schema dictates that it is a binary value,
ActiveLdap
+ will write it as binary, but the subtype will not be automatically
appended as
+ above. The use of the subtype on attributes like jpegPhoto is ultimately
+ decided by the LDAP site policy and not by any programmatic means.
+
+???????????????????????? ;binary ?????????
??
+????????????????????? jpegPhoto ??????????
+jpegPhoto;binary? jpegPhoto ???????????????????????
??
+?????? ActiveLdap ?????????????????????????
???
+??????????jpegPhoto ?????????????????????
??LDAP
+?????????????????????????????????????
???
+????????????userCertificate ????????RFC?? ;binary ?
???
+?????????????????????? ;binary ???????????
+jpegPhoto ???????????? RFC ??????????????????
??
+????????????????????
-The only subtypes defined in LDAPv3 are lang-* and binary. These can be
nested though:
+
+ The only subtypes defined in LDAPv3 are lang-* and binary. These can be
+ nested though:
+
+LDAPv3 ???????????????? lang-* ? binary ?????????
+?????????? Hash ?????????????????
+{{{
irb> user.cn = [{'lang-JP-jp' => {'binary' => 'somejp'}}]
+}}}
-As I understand it, OpenLDAP does not support nested subtypes, but some
documentation I've read suggests that Netscape's LDAP server does. I only
have access to OpenLDAP. If anyone tests this out, please let me know how
it goes!
+
+ As I understand it, OpenLDAP does not support nested subtypes, but some
+ documentation I've read suggests that Netscape's LDAP server does. I
only have
+ access to OpenLDAP. If anyone tests this out, please let me know how it
goes!
+
+???????????? OpenLDAP ????????????????????
???
+?????????????????? LDAP ????????????????
???
+?????? OpenLDAP ??????????????????????????
???
+????????????????????
-And that pretty much wraps up this section.
-Further integration with your environment aka namespacing
+
+ And that pretty much wraps up this section.
+
+?????????????????????????????????????
???
+?????
-If you want this to cleanly integrate into your system-wide Ruby include
path, you should put your extension classes inside a custom module.
+
+ Further integration with your environment aka namespacing
+
-Example:
+=== ?????????? - ?? ??????? ===
- ./myldap.rb:
- require 'active_ldap'
- require 'myldap/user'
- require 'myldap/group'
- module MyLDAP
- end
+
+ If you want this to cleanly integrate into your system-wide Ruby include
path,
+ you should put your extension classes inside a custom module.
+
+ActiveLdap ? Ruby ????????????????????????????
??
+??????????????????
+
+
+ Example:
+
+??
+
+==== ./myldap.rb: ====
+{{{
+require 'active_ldap'
+require 'myldap/user'
+require 'myldap/group'
+module MyLDAP
+end
+}}}
- ./myldap/user.rb:
- module MyLDAP
+==== ./myldap/user.rb: ====
+{{{
+module MyLDAP
class User < ActiveLdap::Base
ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People', :classes
=> ['top', 'account', 'posixAccount']
belongs_to :groups, :class => 'MyLDAP::Group', :many => 'memberUid'
end
- end
+end
+}}}
- ./myldap/group.rb:
- module MyLDAP
+==== ./myldap/group.rb: ====
+{{{
+module MyLDAP
class Group < ActiveLdap::Base
ldap_mapping :classes => ['top', 'posixGroup'], :prefix => 'ou=Group'
has_many :members, :class => 'MyLDAP::User', :wrap => 'memberUid'
- has_many :primary_members, :class => 'MyLDAP::User', :foreign_key
=> 'gidNumber', :primary_key => 'gidNumber'
- end
+ has_many :primary_members, :class => 'MyLDAP::User', :wrap
=> 'gidNumber', :primary_key => 'gidNumber'
end
+end
+}}}
+
+
+ Now in your local applications, you can call
+
+????????????????????????????????????
??
-Now in your local applications, you can call
+{{{
+require 'myldap'
+
+MyLDAP::Group.new('foo')
+...
+}}}
- require 'myldap'
+
+ and everything should work well.
+
+????????????????????
- MyLDAP::Group.new('foo')
- ...
+
+ force array results for single values
+
-and everything should work well.
-force array results for single values
+=== ???????????? getter ???????????????????
? ===
-Even though ActiveLdap attempts to maintain programmatic ease by returning
Array values only. By specifying 'true? as an argument to any attribute
method you will get back a Array if it is single value. Here's an example:
+
+ Even though ActiveLdap attempts to maintain programmatic ease by
returning
+ Array values only. By specifying 'true? as an argument to any attribute
+ method you will get back a Array if it is single value. Here's an
example:
+
+?????????? true ????????????????????????
???
+?????????????????????
+{{{
irb> user = User.new('drewry')
=> ...
irb> user.cn(true)
=> ["Will Drewry"]
+}}}
-Dynamic attribute crawling
+
+ Dynamic attribute crawling
+
+=== ???????????? ===
-If you use tab completion in irb, you'll notice that you /can/ tab
complete the dynamic attribute methods. You can still see which methods are
for attributes using Base#attribute_names:
+
+ If you use tab completion in irb, you'll notice that you /can/ tab
complete
+ the dynamic attribute methods. You can still see which methods are for
+ attributes using Base#attribute_names:
+
+IRB????????????????????????????????????
??
+???????????Base#attribute_names ????????????????
??
+????????????????
+{{{
irb> d = Group.new('develop')
=> ...
irb> d.attribute_names
=>
["gidNumber", "cn", "memberUid", "commonName", "description", "userPassword", "objectClass"]
+}}}
-Juggling multiple LDAP connections
+
+ Juggling multiple LDAP connections
+
+=== ??? LDAP ??????? ===
-In the same vein as the last tip, you can use multiple LDAP connections by
per class as follows:
+
+ In the same vein as the last tip, you can use multiple LDAP connections
by per
+ class as follows:
+
+????????????? LDAP ?????????????????????
???
+???
+{{{
irb> anon_class = Class.new(Base)
=> ...
irb> anon_class.setup_connection
=> ...
irb> auth_class = Class.new(Base)
=> ...
- irb> auth_class.setup_connection(:password_block => {'mypass'})
+ irb> auth_class.setup_connection(:password_block => lambda{'mypass'})
=> ...
+}}}
-This can be useful for doing authentication tests and other such tricks.
-:try_sasl
+
+ This can be useful for doing authentication tests and other such tricks.
+
+?????????????????
-If you have the Ruby/LDAP package with the SASL/GSSAPI patch from Ian
MacDonald's web site, you can use Kerberos to bind to your LDAP server. By
default, :try_sasl is false.
+
+ :try_sasl
+
+=== :try_sasl ===
-Also note that you must be using OpenLDAP 2.1.29 or higher to use
SASL/GSSAPI due to some bugs in older versions of OpenLDAP.
-Don't be afraid! [Internals]
+
+ If you have the Ruby/LDAP package with the SASL/GSSAPI patch from Ian
+ MacDonald's web site, you can use Kerberos to bind to your LDAP server.
By
+ default, :try_sasl is false.
+
+:try_sasl ??????????? LDAP ?????????? Kerberos ???
???
+???????
-Don't be afraid to add more methods to the extensions classes and to
experiment. That's exactly how I ended up with this package. If you come up
with something cool, please share it!
+
+ Also note that you must be using OpenLDAP 2.1.29 or higher to use
SASL/GSSAPI
+ due to some bugs in older versions of OpenLDAP.
+
+???????OpenLDAP 2.1.29 ??????????????????????
???
+???????????
-The internal structure of ActiveLdap::Base, and thus all its subclasses,
is still in flux. I've tried to minimize the changes to the overall API,
but the internals are still rough around the edges.
-Where's ldap_mapping data stored? How can I get to it?
+
+ Don't be afraid! [Internals]
+
+=== ?????????? ===
-When you call ldap_mapping, it overwrites several class methods inherited
from Base:
+
+ Don't be afraid to add more methods to the extensions classes and to
+ experiment. That's exactly how I ended up with this package. If you come
up
+ with something cool, please share it!
+
+?????????????????????????????????????
???
+?????????????????????????????????????
???
+??????????????????????????
+
+
+ The internal structure of ActiveLdap::Base, and thus all its subclasses,
is
+ still in flux. I've tried to minimize the changes to the overall API,
but the
+ internals are still rough around the edges.
+
+ActiveLdap::Base ???????????????????????? API ??
???
+???????????????????????????????
+
+
+ Where's ldap_mapping data stored? How can I get to it?
+
+=== ldap_mapping ????????????????? ???????????
????? ===
+
+
+ When you call ldap_mapping, it overwrites several class methods
inherited from
+ Base:
+
+ldap_mapping ?????????ActiveLdap::Base ?????????????
???
+????????????????????
* Base.base()
* Base.required_classes()
* Base.dn_attribute()
-You can access these from custom class methods by calling MyClass.base(),
or whatever. There are predefined instance methods for getting to these
from any new instance methods you define:
+
+ You can access these from custom class methods by calling
MyClass.base(), or
+ whatever. There are predefined instance methods for getting to these
from any
+ new instance methods you define:
+
+???????????? MyClass.base() ????????????????
????
+?????????????????????????????????????
???
+?????????????????????
* Base#base()
* Base#required_classes()
* Base#dn_attribute()
-What else?
+
+ What else?
+
+=== ?????? ===
Well if you want to use the LDAP connection for anything, I'd suggest
still calling Base.connection to get it. There really aren't many other
internals that need to be worried about. You could get the LDAP schema with
Base.schema.
From codesite-noreply at google.com Mon May 4 21:56:10 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 01:56:10 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r964 - * tashen ->
Kazuaki Takase.
Message-ID: <0016e64616e63f15b504692095a5@google.com>
Author: koutou
Date: Mon May 4 18:52:36 2009
New Revision: 964
Modified:
trunk/CHANGES
trunk/README
Log:
* tashen -> Kazuaki Takase.
* update CHANGES.
Modified: trunk/CHANGES
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon May 4 18:52:36 2009
@@ -1,5 +1,5 @@
1.1.0:
- * Added documents in Japanese. [tashen]
+ * Added documents in Japanese. [Kazuaki Takase]
* Supported Ruby 1.9.1.
* [#20] [Ruby 1.9 Support] :: Running Tests [Alexey.Chebotar]
* Supported Rails 2.3.2.
@@ -7,6 +7,23 @@
* Bug fixes:
* Fixed blank values detection. [David Morton]
* [#22] Ruby 1.8.6 p287 :: Undefined methods [Alexey.Chebotar]
+ * Fixed gem loading. [Tiago Fernandes]
+ * Fixed DN change via #base=. [David Morton]
+ * Fixed infinite retry on timeout.
+ * Fixed needless reconnection.
+ * API improvements:
+ * Removed needless instance methods: #prefix=,
+ #dn_attribute=, #sort_by=, #order=, #required_classes=,
+ #recommended_classes= and #excluded_classes. [David Morton]
+ * Removed obsolete scafoold_al generator.
+ * Reduced default :retry_limit.
+ * Supported association as parameter. [Joe Francis]
+ * Normalized schema attribute name. [Tim Hermans]
+ * Suppressed AuthenticationError -> ConnectionError
+ conversion on reconnection. [Kazuaki Takase]
+ * Added ActiveLdap::Schema#dump.
+ * ActiveLdap::Base.establish_connection ->
+ ActiveLdap::Base.setup_connection.
1.0.2:
* Removed Base64 module use.
Modified: trunk/README
==============================================================================
--- trunk/README (original)
+++ trunk/README Mon May 4 18:52:36 2009
@@ -125,7 +125,7 @@
* ery.lee: A bug report.
* id:dicdak: A bug report.
* Raiko Mitsu: A bug report.
-* tashen: Documents in Japanese.
+* Kazuaki Takase: Documents in Japanese.
* Tim Hermans: A bug report.
* Joe Francis: A suggestion.
* Tiago Fernandes: Bug reports.
From codesite-noreply at google.com Mon May 4 22:14:26 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 02:14:26 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r965 - * don't use
Class#name to guess default dn_attribute.
Message-ID: <0016e642d6d48ee28c046920d668@google.com>
Author: koutou
Date: Mon May 4 19:11:49 2009
New Revision: 965
Modified:
trunk/lib/active_ldap/base.rb
Log:
* don't use Class#name to guess default dn_attribute.
default dn_attribute is 'cn' again.
Modified: trunk/lib/active_ldap/base.rb
==============================================================================
--- trunk/lib/active_ldap/base.rb (original)
+++ trunk/lib/active_ldap/base.rb Mon May 4 19:11:49 2009
@@ -600,16 +600,12 @@
end
def default_dn_attribute
- if name.blank?
- dn_attribute = nil
- parent_class = ancestors[1]
- if parent_class.respond_to?(:dn_attribute)
- dn_attribute = parent_class.dn_attribute
- end
- dn_attribute || "cn"
- else
- name.demodulize.underscore
+ dn_attribute = nil
+ parent_class = ancestors[1]
+ if parent_class.respond_to?(:dn_attribute)
+ dn_attribute = parent_class.dn_attribute
end
+ dn_attribute || "cn"
end
def default_prefix
From codesite-noreply at google.com Mon May 4 22:18:28 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 02:18:28 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r966 - * make a test
that takes a long time low priority.
Message-ID: <0016e644cf5a02ba27046920e509@google.com>
Author: koutou
Date: Mon May 4 19:16:15 2009
New Revision: 966
Modified:
trunk/test/test_connection.rb
Log:
* make a test that takes a long time low priority.
Modified: trunk/test/test_connection.rb
==============================================================================
--- trunk/test/test_connection.rb (original)
+++ trunk/test/test_connection.rb Mon May 4 19:16:15 2009
@@ -22,17 +22,6 @@
end
end
- priority :normal
- def test_retry_limit_0_with_nonexistent_host
- 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,
@@ -78,5 +67,16 @@
ActiveLdap::Base.setup_connection(config)
connection = ActiveLdap::Base.connection
assert(connection.send(:can_reconnect?, :reconnect_attempts => -10))
+ end
+
+ priority :low
+ def test_retry_limit_0_with_nonexistent_host
+ 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
end
From codesite-noreply at google.com Mon May 4 22:22:31 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 02:22:31 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r967 - * use
:class_name instead of :class.
Message-ID: <0016e645abf4745d07046920f31c@google.com>
Author: koutou
Date: Mon May 4 19:19:29 2009
New Revision: 967
Modified:
trunk/examples/objects/group.rb
trunk/examples/objects/user.rb
Log:
* use :class_name instead of :class.
Modified: trunk/examples/objects/group.rb
==============================================================================
--- trunk/examples/objects/group.rb (original)
+++ trunk/examples/objects/group.rb Mon May 4 19:19:29 2009
@@ -6,8 +6,8 @@
# 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',
+ has_many :members, :class_name => "User", :wrap => "memberUid"
+ has_many :primary_members, :class_name => 'User',
:foreign_key => 'gidNumber',
:primary_key => 'gidNumber'
end # Group
Modified: trunk/examples/objects/user.rb
==============================================================================
--- trunk/examples/objects/user.rb (original)
+++ trunk/examples/objects/user.rb Mon May 4 19:19:29 2009
@@ -3,7 +3,7 @@
class User < ActiveLdap::Base
ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People',
:classes => ['person', 'posixAccount']
- belongs_to :primary_group, :class => "Group",
+ belongs_to :primary_group, :class_name => "Group",
:foreign_key => "gidNumber", :primary_key => "gidNumber"
belongs_to :groups, :many => 'memberUid'
From codesite-noreply at google.com Mon May 4 23:33:51 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 03:33:51 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r968 - * follow the
recent default value change.
Message-ID: <001636163cc79b2a3b046921f243@google.com>
Author: koutou
Date: Mon May 4 20:01:26 2009
New Revision: 968
Modified:
trunk/lib/active_ldap.rb
Log:
* follow the recent default value change.
Modified: trunk/lib/active_ldap.rb
==============================================================================
--- trunk/lib/active_ldap.rb (original)
+++ trunk/lib/active_ldap.rb Mon May 4 20:01:26 2009
@@ -124,7 +124,7 @@
# Here's an extension class that maps to the LDAP Group objects:
#
# irb> class Group < ActiveLdap::Base
-# irb* ldap_mapping
+# irb* ldap_mapping
# irb* end
#
# Here is the Group class in use:
@@ -133,10 +133,7 @@
# => ["root", "daemon", "bin", "sys", "adm", "tty", ..., "develop"]
#
# irb> group = Group.find("develop")
-# => #
-#
-# irb> group.members.collect {|member| member.uid}
-# => ["drewry"]
+# => # ...>
#
# irb> group.cn
# => "develop"
@@ -220,8 +217,8 @@
# may help avoid programmer error later.
#
# :classes isn't the only optional argument. If :dn_attribute is left off,
-# it defaults to underscored class name or 'cn'. If :prefix is left off,
-# it will default to 'ou=PLURALIZED_CLASSNAME'. In this
+# it defaults to super class's value or 'cn'. If :prefix is left off,
+# it will default to 'ou=PluralizedClassName'. In this
# case, it would be 'ou=Groups'.
#
# :classes should be an Array. :dn_attribute should be a String and so
should
From codesite-noreply at google.com Tue May 5 01:56:37 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 05:56:37 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r969 - * use
:class_name instead of :class.
Message-ID: <0016e64ec8fc2e510a046923f148@google.com>
Author: koutou
Date: Mon May 4 22:56:19 2009
New Revision: 969
Modified:
trunk/lib/active_ldap.rb
Log:
* use :class_name instead of :class.
Modified: trunk/lib/active_ldap.rb
==============================================================================
--- trunk/lib/active_ldap.rb (original)
+++ trunk/lib/active_ldap.rb Mon May 4 22:56:19 2009
@@ -2,6 +2,7 @@
# = ActiveLdap
#
# "ActiveLdap" Copyright (C) 2004,2005 Will Drewry mailto:will at alum.bu.edu
+# Copyright (C) 2006-2009 Kouhei Sutou
#
# == Introduction
#
@@ -251,7 +252,7 @@
#
# irb> class User < ActiveLdap::Base
# irb* ldap_mapping :dn_attribute => 'uid', :prefix
=> 'People', :classes => ['top','account']
-# irb* belongs_to :groups, :class => 'Group', :many
=> 'memberUid', :foreign_key => 'uid'
+# irb* belongs_to :groups, :class_name => 'Group', :many
=> 'memberUid', :foreign_key => 'uid'
# irb* end
#
# Now, class User will have a method called 'groups' which will retrieve
all
@@ -259,7 +260,7 @@
#
# irb> me = User.find('drewry')
# irb> me.groups
-# => [#, #, ...]
+# => [#, #, ...]
# irb> me.groups.each { |group| p group.cn };nil
# "cdrom"
# "audio"
@@ -279,9 +280,9 @@
# Now let's talk about the arguments. The first argument is the name of
the
# method you wish to create. In this case, we created a method called
groups
# using the symbol :groups. The next collection of arguments are actually
a Hash
-# (as with ldap_mapping). :class should be a string that has the name of a
+# (as with ldap_mapping). :class_name should be a string that has the name
of a
# class you've already included. If you class is inside of a module, be
sure to
-# put the whole name, e.g. :class => "MyLdapModule::Group". :primary_key
+# put the whole name, e.g. :class_name
=> "MyLdapModule::Group". :primary_key
# tells belongs_to what attribute Group objects have that match the
# :many. :many is the name of the local attribute whose value
# should be looked up in Group under the primary key. If :foreign_key is
left
@@ -290,7 +291,7 @@
#
# irb> class User < ActiveLdap::Base
# irb* ldap_mapping :dn_attribute => 'uid', :prefix
=> 'People', :classes => ['top','account']
-# irb* belongs_to :groups, :class => 'Group', :many => 'memberUid'
+# irb* belongs_to :groups, :class_name => 'Group', :many => 'memberUid'
# irb* end
#
# In addition, you can do simple membership tests by doing the following:
@@ -309,7 +310,7 @@
#
# class Group < ActiveLdap::Base
# ldap_mapping :dn_attribute => 'cn', :prefix => 'ou=Groups', :classes
=> ['top', 'posixGroup']
-# has_many :members, :class => "User", :wrap
=> "memberUid", :primary_key => 'uid'
+# has_many :members, :class_name => "User", :wrap
=> "memberUid", :primary_key => 'uid'
# end
#
# Now we can see that group develop has user 'drewry' as a member, and it
can
@@ -324,7 +325,7 @@
# The arguments for has_many follow the exact same idea that belongs_to's
# arguments followed. :wrap's contents are used to search for matching
# :primary_key content. If :primary_key is not specified, it defaults to
the
-# dn_attribute of the specified :class.
+# dn_attribute of the specified :class_name.
#
# === Using these new classes
#
@@ -546,7 +547,7 @@
# cat < 'uid', :prefix
=> 'ou=People', :classes => ['top', 'account', 'posixAccount']
-# belongs_to :groups, :class => 'Group', :wrap => 'memberUid'
+# belongs_to :groups, :class_name => 'Group', :wrap => 'memberUid'
# end
# EOF
#
@@ -554,8 +555,8 @@
# 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'
+# has_many :members, :class_name => "User", :many => "memberUid"
+# has_many :primary_members, :class_name => 'User', :foreign_key
=> 'gidNumber', :primary_key => 'gidNumber'
# end # Group
# EOF
#
@@ -761,7 +762,7 @@
# module MyLDAP
# class User < ActiveLdap::Base
# ldap_mapping :dn_attribute => 'uid', :prefix
=> 'ou=People', :classes => ['top', 'account', 'posixAccount']
-# belongs_to :groups, :class => 'MyLDAP::Group', :many => 'memberUid'
+# belongs_to :groups, :class_name => 'MyLDAP::Group', :many
=> 'memberUid'
# end
# end
#
@@ -769,8 +770,8 @@
# module MyLDAP
# class Group < ActiveLdap::Base
# ldap_mapping :classes => ['top', 'posixGroup'], :prefix => 'ou=Group'
-# has_many :members, :class => 'MyLDAP::User', :wrap => 'memberUid'
-# has_many :primary_members, :class => 'MyLDAP::User', :foreign_key
=> 'gidNumber', :primary_key => 'gidNumber'
+# has_many :members, :class_name => 'MyLDAP::User', :wrap
=> 'memberUid'
+# has_many :primary_members, :class_name
=> 'MyLDAP::User', :foreign_key => 'gidNumber', :primary_key => 'gidNumber'
# end
# end
#
From codesite-noreply at google.com Tue May 5 02:14:40 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 06:14:40 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r970 - * primary ->
foreign.
Message-ID: <0016363108abbb92cb0469243156@google.com>
Author: koutou
Date: Mon May 4 23:13:52 2009
New Revision: 970
Modified:
trunk/lib/active_ldap.rb
Log:
* primary -> foreign.
Modified: trunk/lib/active_ldap.rb
==============================================================================
--- trunk/lib/active_ldap.rb (original)
+++ trunk/lib/active_ldap.rb Mon May 4 23:13:52 2009
@@ -282,10 +282,10 @@
# using the symbol :groups. The next collection of arguments are actually
a Hash
# (as with ldap_mapping). :class_name should be a string that has the name
of a
# class you've already included. If you class is inside of a module, be
sure to
-# put the whole name, e.g. :class_name
=> "MyLdapModule::Group". :primary_key
+# put the whole name, e.g. :class_name
=> "MyLdapModule::Group". :foreign_key
# tells belongs_to what attribute Group objects have that match the
# :many. :many is the name of the local attribute whose value
-# should be looked up in Group under the primary key. If :foreign_key is
left
+# should be looked up in Group under the foreign key. If :foreign_key is
left
# off of the argument list, it is assumed to be the dn_attribute. With
this in
# mind, the above definition could become:
#
From codesite-noreply at google.com Tue May 5 02:23:46 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 06:23:46 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r971 - * add
convenient find methods.
Message-ID: <0016361e86bc424e34046924522c@google.com>
Author: koutou
Date: Mon May 4 23:23:20 2009
New Revision: 971
Modified:
trunk/CHANGES
trunk/lib/active_ldap/operations.rb
trunk/test/test_base.rb
Log:
* add convenient find methods.
Modified: trunk/CHANGES
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon May 4 23:23:20 2009
@@ -24,6 +24,11 @@
* Added ActiveLdap::Schema#dump.
* ActiveLdap::Base.establish_connection ->
ActiveLdap::Base.setup_connection.
+ * Supported ActiveLdap::Base.find(:last).
+ * Added convenient methods:
+ * ActiveLdap::Base.first
+ * ActiveLdap::Base.last
+ * ActiveLdap::Base.all
1.0.2:
* Removed Base64 module use.
Modified: trunk/lib/active_ldap/operations.rb
==============================================================================
--- trunk/lib/active_ldap/operations.rb (original)
+++ trunk/lib/active_ldap/operations.rb Mon May 4 23:23:20 2009
@@ -204,6 +204,8 @@
case args.first
when :first
find_initial(options)
+ when :last
+ find_last(options)
when :all
options[:value] ||= args[1]
find_every(options)
@@ -212,9 +214,36 @@
end
end
+ # A convenience wrapper for find(:first,
+ # *args). You can pass in all the same arguments
+ # to this method as you can to find(:first).
+ def first(*args)
+ find(:first, *args)
+ end
+
+ # A convenience wrapper for find(:last,
+ # *args). You can pass in all the same arguments
+ # to this method as you can to find(:last).
+ def last(*args)
+ find(:last, *args)
+ end
+
+ # This is an alias for find(:all). You can pass in
+ # all the same arguments to this method as you can
+ # to find(:all)
+ def all(*args)
+ find(:all, *args)
+ end
+
private
def find_initial(options)
find_every(options.merge(:limit => 1)).first
+ end
+
+ def find_last(options)
+ order = options[:order] || self.order || 'ascend'
+ order = normalize_sort_order(order) == :ascend ? :descend : :ascend
+ find_initial(options.merge(:order => order))
end
def normalize_sort_order(value)
Modified: trunk/test/test_base.rb
==============================================================================
--- trunk/test/test_base.rb (original)
+++ trunk/test/test_base.rb Mon May 4 23:23:20 2009
@@ -6,6 +6,25 @@
include AlTestUtils
priority :must
+ def test_last
+ make_temporary_user(:simple => true) do |user1,|
+ make_temporary_user(:simple => true) do |user2,|
+ assert_equal(user2, @user_class.find(:last))
+ end
+ end
+ end
+
+ def test_convenient_operation_methods
+ make_temporary_user(:simple => true) do |user1,|
+ make_temporary_user(:simple => true) do |user2,|
+ assert_equal(user1, @user_class.first)
+ assert_equal(user2, @user_class.last)
+ assert_equal([user1, user2], @user_class.all)
+ end
+ end
+ end
+
+ priority :normal
def test_set_attributes_with_a_blank_value_in_values
make_temporary_user(:simple => true) do |user,|
user.attributes = {"description" => ["a", "b", ""]}
@@ -13,7 +32,6 @@
end
end
- priority :normal
def test_set_attributes_with_a_blank_value
make_temporary_user(:simple => true) do |user,|
user.attributes = {"description" => [""]}
From codesite-noreply at google.com Tue May 5 02:40:50 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 06:40:50 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r972 - * support
convenience search value notation on :first and :last.
Message-ID: <0016364ed802454d670469248fe2@google.com>
Author: koutou
Date: Mon May 4 23:39:30 2009
New Revision: 972
Modified:
trunk/lib/active_ldap/operations.rb
trunk/test/test_base.rb
Log:
* support convenience search value notation on :first and :last.
Modified: trunk/lib/active_ldap/operations.rb
==============================================================================
--- trunk/lib/active_ldap/operations.rb (original)
+++ trunk/lib/active_ldap/operations.rb Mon May 4 23:39:30 2009
@@ -196,15 +196,17 @@
#
# Finds the first match for value where |value| is the value of some
# |field|, or the wildcard match. This is only useful for derived
classes.
- # usage: Subclass.find(:attribute => "cn", :value => "some*val")
- # Subclass.find('some*val')
+ # usage: Subclass.find(:all, :attribute => "cn", :value
=> "some*val")
+ # Subclass.find(:all, 'some*val')
def find(*args)
options = extract_options_from_args!(args)
args = [:first] if args.empty? and !options.empty?
case args.first
when :first
+ options[:value] ||= args[1]
find_initial(options)
when :last
+ options[:value] ||= args[1]
find_last(options)
when :all
options[:value] ||= args[1]
Modified: trunk/test/test_base.rb
==============================================================================
--- trunk/test/test_base.rb (original)
+++ trunk/test/test_base.rb Mon May 4 23:39:30 2009
@@ -6,10 +6,20 @@
include AlTestUtils
priority :must
+ def test_first
+ make_temporary_user(:simple => true) do |user1,|
+ make_temporary_user(:simple => true) do |user2,|
+ assert_equal(user1, @user_class.find(:first))
+ assert_equal(user2, @user_class.find(:first, user2.cn))
+ end
+ end
+ end
+
def test_last
make_temporary_user(:simple => true) do |user1,|
make_temporary_user(:simple => true) do |user2,|
assert_equal(user2, @user_class.find(:last))
+ assert_equal(user1, @user_class.find(:last, user1.cn))
end
end
end
From codesite-noreply at google.com Tue May 5 03:16:57 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 07:16:57 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r973 - * adapt to the
current behavior.
Message-ID: <0016e64642626ff91f0469251046@google.com>
Author: koutou
Date: Tue May 5 00:10:33 2009
New Revision: 973
Modified:
trunk/lib/active_ldap.rb
Log:
* adapt to the current behavior.
Modified: trunk/lib/active_ldap.rb
==============================================================================
--- trunk/lib/active_ldap.rb (original)
+++ trunk/lib/active_ldap.rb Tue May 5 00:10:33 2009
@@ -319,7 +319,7 @@
# irb> develop = Group.find('develop')
# => ...
# irb> develop.members
-# => [#, #]
+# => [#, #]
#
#
# The arguments for has_many follow the exact same idea that belongs_to's
@@ -337,21 +337,21 @@
#
# ==== .find
#
-# .find is a class method that is accessible from any subclass of Base
that has
-# 'ldap_mapping' called. When called it returns the first match of the
given
-# class.
+# .find is a class method that is accessible from
+# any subclass of Base that has 'ldap_mapping' called. When
+# called .first(:first) returns the first match of the given class.
#
-# irb> Group.find('*').cn
-# => "root"
+# irb> Group.find(:first, 'deve*").cn
+# => "develop"
#
# In this simple example, Group.find took the search string of 'deve*' and
# searched for the first match in Group where the dn_attribute matched the
# query. This is the simplest example of .find.
#
-# irb> Group.find(:all, '*').collect {|group| group.cn}
+# irb> Group.find(:all).collect {|group| group.cn}
# => ["root", "daemon", "bin", "sys", "adm", "tty", ..., "develop"]
#
-# Here .find(:all) returns all matches to the same query. Both .find and
+# Here .find(:all) returns all matches to the same query.
Both .find(:first) and
# .find(:all) also can take more expressive arguments:
#
# irb> Group.find(:all, :attribute => 'gidNumber', :value
=> '1003').collect {|group| group.cn}
@@ -442,7 +442,7 @@
# * :port defaults to @@port from configuration.rb as well
# * :base defaults to Base.base() from configuration.rb
# * :bind_dn defaults @@bind_format from configuration.rb
-# * :logger defaults to a Log4r object that prints fatal messages to stderr
+# * :logger defaults to a Logger object that prints fatal messages to
stderr
# * :password_block defaults to nil
# * :allow_anonymous defaults to true
# * :try_sasl defaults to false - see Advanced Topics for more on this one.
@@ -474,8 +474,9 @@
# * :retry_on_timeout - whether to reconnect when timeouts occur. Defaults
to true
# See lib/configuration.rb for defaults for each option
#
-# Base.setup_connection both connects and binds in one step. It follows
-# roughly the following approach:
+# Base.setup_connection just setups connection
+# configuration. A connection is connected and bound when it
+# is needed. It follows roughly the following approach:
#
# * Connect to host:port using :method
#
@@ -484,9 +485,10 @@
# anonymously.
# * If that fails, error out.
#
-# 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
+# On connect, the configuration options passed in are stored
+# in an internal class variable which is used to cache the
+# information without ditching the defaults passed in from
+# configuration.rb
#
# ===== connection
#
@@ -566,36 +568,37 @@
#
# Now let's create a really dumb script for adding users -
ldapadmin/useradd:
#
-# #!/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 'lib/user'
-# require 'lib/group'
-# require 'password'
-#
+# 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)
-#
+# :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
@@ -614,34 +617,38 @@
# Now let's create another dumb script for modifying users -
ldapadmin/usermod:
#
# #!/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 'lib/user'
-# require 'lib/group'
-#
+# 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)
-#
+# :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
@@ -652,42 +659,6 @@
# exit 1
# end
#
-# ==== Removing LDAP entries
-#
-# And finally, a dumb script for removing user - ldapadmin/userdel:
-#
-#
-# #!/usr/bin/ruby -W0
-#
-# require 'active_ldap'
-# require 'lib/user'
-# require 'lib/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.
@@ -702,7 +673,7 @@
# irb> user = User.new('drewry')
# => ...
# # This adds a cn entry in lang-en and whatever the server default is.
-# irb> user.cn = [ 'wad', {'lang-en' => ['wad', 'foo']} ]
+# irb> user.cn = [ 'wad', {'lang-en' => ['wad', 'Will Drewry']} ]
# => ...
# irb> user.cn
# => ["wad", {"lang-en-us" => ["wad", "Will Drewry"]}]
@@ -733,7 +704,7 @@
# The only subtypes defined in LDAPv3 are lang-* and binary. These can be
nested
# though:
#
-# irb> user.cn = [{'lang-JP-jp' => {'binary' => 'somejp'}}]
+# irb> user.cn = [{'lang-ja' => {'binary' => 'some Japanese'}}]
#
# As I understand it, OpenLDAP does not support nested subtypes, but some
# documentation I've read suggests that Netscape's LDAP server does. I only
From codesite-noreply at google.com Tue May 5 04:03:10 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 08:03:10 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r975 - * fix a typo.
Message-ID: <0016e644c7c2ba52d5046925b515@google.com>
Author: koutou
Date: Tue May 5 00:17:39 2009
New Revision: 975
Modified:
wiki/TutorialJa.wiki
Log:
* fix a typo.
Thanks to fumitake!!!
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Tue May 5 00:17:39 2009
@@ -142,7 +142,7 @@
??????? gem ??????????
{{{
- gem install active_ldap
+ gem install activeldap
}}}
?????????????????irb ?????????????? require
???true ??????????????????
From codesite-noreply at google.com Tue May 5 07:30:18 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Tue, 05 May 2009 11:30:18 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r974 - * fix typos.
Message-ID: <0016361e7d947bbfc90469289a67@google.com>
Author: koutou
Date: Tue May 5 00:13:19 2009
New Revision: 974
Modified:
wiki/TutorialJa.wiki
Log:
* fix typos.
* adapt to the current behavior.
* has_many, belongs_to: :class -> :class_name
* find: remove needless '*' argument.
* find() -> find(:first).
* Log4r -> Logger.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Tue May 5 00:13:19 2009
@@ -147,7 +147,7 @@
?????????????????irb ?????????????? require
???true ??????????????????
{{{
-$ irb
+$ irb -rubygems
irb(main):001:0> require 'active_ldap'
=> true
irb(main):002:0>
@@ -229,20 +229,17 @@
??????????????????????????
{{{
- irb> all_groups = Group.find(:all, '*').collect {|group| group.cn}
+ irb> all_groups = Group.find(:all).collect {|group| group.cn}
=> ["root", "daemon", "bin", "sys", "adm", "tty", ..., "develop"]
irb> group = Group.find("develop")
- => #
-
- irb> group.members.collect {|member| member.uid}
- => ["drewry"]
+ => # ...>
irb> group.cn
=> "develop"
irb> group.gid_number
- => "1003"
+ => 1003
}}}
@@ -323,7 +320,7 @@
* dc=dataspill,dc=org
|- ou=People,dc=dataspill,dc=org
|+ ou=Groups,dc=dataspill,dc=org
- # |- cn=develop,ou=Groups,dc=dataspill,dc=org
+ |- cn=develop,ou=Groups,dc=dataspill,dc=org
|- cn=root,ou=Groups,dc=dataspill,dc=org
|- ...
}}}
@@ -396,12 +393,13 @@
:classes isn't the only optional argument. If :dn_attribute is left off,
it
- defaults to underscored class name or 'cn?. If :prefix is left off, it
will
+ defaults to super class's value or 'cn?. If :prefix is left off, it will
default to 'ou=PLURALIZED_CLASSNAME?. In this case, it would
be 'ou=Groups?.
:classes ????????????????????? :dn_attribute ????
???
-???????????? underscore ???????????????
TheClass???
-?"the_class"???cn ????????
+????????????????????cn ????????
+:prefix??????????????'ou=??????????????????
???
+?'ou=Groups'??????
:classes should be an Array. :dn_attribute should be a String and so
should
@@ -424,7 +422,8 @@
{{{
* dc=dataspill,dc=org
|+ ou=People,dc=dataspill,dc=org
- # |- uid=drewry,ou=People,dc=dataspill,dc=org
+ \
+ |- uid=drewry,ou=People,dc=dataspill,dc=org
|- ou=Groups,dc=dataspill,dc=org
}}}
@@ -433,7 +432,7 @@
the group 'develop?. You can see this by looking at the 'memberUid?
field of
'develop?.
-??????LDAP??????'drewry'?????'develo' ??????????
??
+??????LDAP??????'drewry'?????'develop' ?????????
???
????????'develop' ????? 'memberUid' ?????????????
??
???????
@@ -455,7 +454,7 @@
{{{
irb> class User < ActiveLdap::Base
irb* ldap_mapping :dn_attribute => 'uid', :prefix
=> 'People', :classes => ['top','account']
- irb* belongs_to :groups, :class => 'Group', :many
=> 'memberUid', :foreign_key => 'uid'
+ irb* belongs_to :groups, :class_name => 'Group', :many
=> 'memberUid', :foreign_key => 'uid'
irb* end
}}}
@@ -469,7 +468,7 @@
{{{
irb> me = User.find('drewry')
irb> me.groups
- => [#, #, ...]
+ => [#, #, ...]
irb> me.groups.each { |group| p group.cn };nil
"cdrom"
"audio"
@@ -498,12 +497,12 @@
Now let's talk about the arguments. The first argument is the name of the
method you wish to create. In this case, we created a method called
groups
using the symbol :groups. The next collection of arguments are actually
a Hash
- (as with ldap_mapping). :class should be a string that has the name of a
class
+ (as with ldap_mapping). :class_name should be a string that has the name
of a class
you've already included. If you class is inside of a module, be sure to
put
- the whole name, e.g. :class => "MyLdapModule::Group". :primary_key tells
+ the whole name, e.g. :class_name => "MyLdapModule::Group". :foreign_key
tells
belongs_to what attribute Group objects have that match the :many. :many
is
the name of the local attribute whose value should be looked up in Group
under
- the primary key. If :foreign_key is left off of the argument list, it is
+ the foreign key. If :foreign_key is left off of the argument list, it is
assumed to be the dn_attribute. With this in mind, the above definition
could
become:
@@ -513,20 +512,21 @@
????????? groups ????????????????????????
Hash
???ldap_mapping ??????
-:class ???????LDAP?????????? String ???????????
???
+:class_name ???????LDAP?????????? String ????????
??????
User ?????????????? Group ??????????????
??'Group'
???????????????? Ruby ??????????????????
????
-????:class => "MyLdapModule::Group" ?????????????????
???
+????:class_name => "MyLdapModule::Group" ???????????????
?????
???????
:foreign_key ???????LDAP??????????????????????
??
-????????????????:foreign_key ??????????????:
-dn_attribute??????????????
+????????????????:foreign_key ??????????????
+:dn_attribute??????????????
:many ????????LDAP?????????????????
??:foreign_key ?
????????????????LDAP???????????????????
??
:foreign_key ? uid?:many ? memberUid ?????????????RDB???
?
-?????????????????????????????????????
??
+?????????????????????????????????????
??
+:foreign_key????????????????????????????
:primary_key ???????????LDAP??????????????????
gidNumber ????????????????????????????????
??
@@ -535,7 +535,7 @@
{{{
irb> class User < ActiveLdap::Base
irb* ldap_mapping :dn_attribute => 'uid', :prefix
=> 'People', :classes => ['top','account']
- irb* belongs_to :groups, :class => 'Group', :many => 'memberUid'
+ irb* belongs_to :groups, :class_name => 'Group', :many => 'memberUid'
irb* end
}}}
@@ -566,7 +566,7 @@
{{{
class Group < ActiveLdap::Base
ldap_mapping :dn_attribute => 'cn', :prefix => 'ou=Groups', :classes
=> ['top', 'posixGroup']
- has_many :members, :class => "User", :wrap
=> "memberUid", :primary_key => 'uid'
+ has_many :members, :class_name => "User", :wrap
=> "memberUid", :primary_key => 'uid'
end
}}}
@@ -582,25 +582,25 @@
irb> develop = Group.find('develop')
=> ...
irb> develop.members
- => [#, #]
+ => [#, #]
}}}
The arguments for has_many follow the exact same idea that belongs_to's
arguments followed. :wrap's contents are used to search for matching
:primary_key content. If :primary_key is not specified, it defaults to
the
- dn_attribute of the specified :class.
+ dn_attribute of the specified :class_name.
has_many ???? belongs_to ???????????????????????
??
???????? Symbol ????????? Hash ???
-:class ??????????????????????????????????
??
+:class_name ???????????????????????????????
?????
? String???????
:wrap ???? :primary_key ?????????????????:primary_key
??
-??????????????????????????:class ?:primary_key
?
+??????????????????????????:class_name
?:primary_key ?
:wrap ?????????????????????????
-:primary_key ??????????:class ?????????? :dn_attribute
??
+:primary_key ??????????:class_name ?????????
? :dn_attribute ??
??????
@@ -612,7 +612,7 @@
These new classes have many method calls. Many of them are automatically
generated to provide access to the LDAP object's attributes. Other were
defined during class creation by special methods like belongs_to. There
are a
- few other methods that do not fall in to these categories.
+ few other methods that do not fall in to these categories.
????????????????????????????????????
LDAP
?????????????????????????????????????
???
@@ -622,15 +622,14 @@
=== .find ===
- * obsolete *
.find is a class method that is accessible from any subclass of Base
that has
- 'ldap_mapping? called. When called it returns the first match of the
given
+ 'ldap_mapping? called. When called .find(:first) returns the first match
of the given
class.
- irb> Group.find('*').cn
- => "root"
+ irb> Group.find(:first, 'deve*').cn
+ => "develop"
- In this simple example, Group.find took the search string of 'deve*? and
+ In this simple example, Group.find(:first) took the search string
of 'deve*? and
searched for the first match in Group where the dn_attribute matched the
query. This is the simplest example of .find.
@@ -640,17 +639,17 @@
?????????dn_attribute ??????????????????????
??
??
{{{
- irb> Group.find('develop')
+ irb> Group.find(:first, 'develop')
=> #
- irb> Group.find('develop').cn
+ irb> Group.find(:first, 'develop').cn
=> "develop"
- irb> Group.find('develo').members
+ irb> Group.find(:first, 'develop').members
=> ['drewry']
}}}
* obsolete *
- irb> Group.find(:all, '*').collect {|group| group.cn} =>
["root", "daemon",
+ irb> Group.find(:all).collect {|group| group.cn} => ["root", "daemon",
"bin", "sys", "adm", "tty", ..., "develop"]
Here .find(:all) returns all matches to the same query. Both .find and
@@ -663,9 +662,9 @@
?????? :all ????????????????????
{{{
irb> Group.find :all
- => [#, #, #]
+ => [#, #, #]
irb> Group.find :all, :filter => '(gidNumber=2*)'
- => [#, #]
+ => [#, #]
}}}
@@ -677,14 +676,14 @@
:attribute ? :value ?????????????????????????
:attribute ??????????:dn_attribute ????????
{{{
- irb> Group.find(:all, :attribute => 'gidNumber', :value '1003').collect{|
g| g.cn}
+ irb> Group.find(:all, :attribute => 'gidNumber', :value
=> '1003').collect{|g| g.cn}
=> ["develop"]
}}}
It is also possible to override :attribute and :value by
specifying :filter.
This argument allows the direct specification of a LDAP filter to
retrieve
- objects by.
+ objects by.
:filter ????LDAP???????????????????
{{{
@@ -786,7 +785,7 @@
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.
+ connection to LDAP.
ActiveLdap::Base ? ActiveLdap ?????????? setter/getter ????
???
????????????????????????????????LDAP???
???
@@ -811,7 +810,7 @@
fashion, you won't need to call Base.setup_connection. Here is a fully
parameterized call:
-Group ?????Base ???????????????????????????
??
+Group ?????Base ???????????????????????????
???
???Base.setup_connection ???????????????????????
???
?????????????????????????????????????
?
??????????????????????????????
setup_connection ?
@@ -837,11 +836,11 @@
??
- * :host defaults to @@host from configuration.rb waaay back at the
setup.rb stage.@
+ * :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
* :bind_dn defaults @@bind_format from configuration.rb
- * :logger defaults to a Log4r object that prints fatal messages to
stderr
+ * :logger defaults to a Logger object that prints fatal messages to
stderr
* :password_block defaults to nil
* :allow_anonymous defaults to true
* :try_sasl defaults to false - see Advanced Topics for more on this
one.
@@ -850,7 +849,7 @@
* :host ???????? '127.0.0.1' ??
* :port ? nil ????????????? 389 ???????
* :bind_dn ? nil ?????????????????????????
- * :logger ???????????????????????? Log4r ????
?????
+ * :logger ???????????????????????? Logger ????
?????
* :password_block ??????? nil ???
* :allow_anonymous ??????? true ??
* :try_sasl ??????? false ????????????????????
??? "?????" ???????
@@ -887,12 +886,12 @@
* :base ? LDAP????????????????? Base ??????
? :prefix ??????????
* :bind_dn ????????????????????????????? dn
???????
* :logger ????????????????????????????????
????????????????
- * :pasword_block ?? Proc ???????????????????????
?????????????????????
+ * :password_block ?? Proc ???????????????????????
?????????????????????
* :password ?????????????????
* :store_password ?????????????????? :password_block ?
??????????????????????????????????????
password_block ??????????????????????????????
* :allow_anonymous ???????????????????????????
??????
* :try_ssl ? true ????SASL-GSSAPI ?????????
- * :sasl_quiet ? true ????SASL ?????? STDOUT ?????????
?????????
+ * :sasl_quiet ? true ????SASL ?????? STDOUT ?????????
?????????
* :method ???????????:ssl, :tls ??? :plain ??????
* :retry_limit ????????????????????????????-1
?????????????????
* :retry_on_timeout ???????????????????????????
?????????? true ??
@@ -906,10 +905,11 @@
?????????????? ActiveLdap::Configuration::DEFAULT_CONFIG ??
????????
- Base.setup_connection both connects and binds in one step. It follows
roughly
- the following approach:
+ Base.setup_connection just setups connection
+ configuration. A connection is connected and bound when it
+ is needed. It follows roughly the following approach:
-Base.setup_connection ??????????????????????????
???
+Base.setup_connection ?????????????????LDAP???????
??????????????????????????????????????
???
??????????
@@ -920,16 +920,15 @@
* host:port ??????:method ?????????
* ?? bind_dn ? password_block ? password ??????????????
???????????????
- * ????????????????????????????????????
??????????????????
+ * ????????????????????????????????????
???????????????????
* ?????????????????????
- *obsolete
On connect, the configuration options passed in are stored in an internal
- class variable @configuration which is used to cache the information
without
+ class variable which is used to cache the information without
ditching the defaults passed in from configuration.rb
-?????????????????????? @@defined_configuration ???
??
+???????????????????????????
????????????????????????????????????
??
=== connection ===
@@ -986,7 +985,7 @@
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 ???????????????????????
???
setup_connection ?????????????????????????????
??
??????????????????LDAP????????????????
??
@@ -1061,7 +1060,7 @@
class User < ActiveLdap::Base
ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People',
:classes => ['person', 'posixAccount']
- belongs_to :primary_group, :class => "Group",
+ belongs_to :primary_group, :class_name => "Group",
:foreign_key => "gidNumber", :primary_key => "gidNumber"
belongs_to :groups, :many => 'memberUid'
@@ -1093,10 +1092,10 @@
# |: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',
+ has_many :primary_members, :class_name => 'User',
:foreign_key => 'gidNumber',
:primary_key => 'gidNumber'
-end
+end
}}}
@@ -1217,7 +1216,7 @@
Now let's create another dumb script for modifying users -
ldapadmin/usermod:
-???????????????? /ldapadmin/usermod ???????
+???????????????? ldapadmin/usermod ???????
#!/usr/bin/ruby -W0
@@ -1414,7 +1413,7 @@
irb> user = User.new('drewry')
=> ...
# cn ??????????????????????????
- irb> user.cn = [ 'wad', {'lang-en' => ['wad', 'foo']} ]
+ irb> user.cn = [ 'wad', {'lang-en' => ['wad', 'Will Drewry']} ]
=> ...
irb> user.cn
=> ["wad", {"lang-en-us" => ["wad", "Will Drewry"]}]
@@ -1479,7 +1478,7 @@
?????????? Hash ?????????????????
{{{
- irb> user.cn = [{'lang-JP-jp' => {'binary' => 'somejp'}}]
+ irb> user.cn = [{'lang-ja' => {'binary' => 'some Japanese'}}]
}}}
@@ -1530,7 +1529,7 @@
module MyLDAP
class User < ActiveLdap::Base
ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People', :classes
=> ['top', 'account', 'posixAccount']
- belongs_to :groups, :class => 'MyLDAP::Group', :many => 'memberUid'
+ belongs_to :groups, :class_name => 'MyLDAP::Group', :many
=> 'memberUid'
end
end
}}}
@@ -1540,8 +1539,8 @@
module MyLDAP
class Group < ActiveLdap::Base
ldap_mapping :classes => ['top', 'posixGroup'], :prefix => 'ou=Group'
- has_many :members, :class => 'MyLDAP::User', :wrap => 'memberUid'
- has_many :primary_members, :class => 'MyLDAP::User', :wrap
=> 'gidNumber', :primary_key => 'gidNumber'
+ has_many :members, :class_name => 'MyLDAP::User', :wrap => 'memberUid'
+ has_many :primary_members, :class_name => 'MyLDAP::User', :wrap
=> 'gidNumber', :primary_key => 'gidNumber'
end
end
}}}
@@ -1567,7 +1566,7 @@
force array results for single values
-=== ???????????? getter ???????????????????
? ===
+=== ??????????? getter ????????????????????
===
Even though ActiveLdap attempts to maintain programmatic ease by
returning
@@ -1730,4 +1729,4 @@
Currently, ActiveLdap could be faster. I have some recursive type checking
going on which slows object creation down, and I'm sure there are many,
many other places optimizations can be done. Feel free to send patches, or
just hang in there until I can optimize away the slowness.
Feedback
-Any and all feedback and patches are welcome. I am very excited about this
package, and I'd like to see it prove helpful to more people than just
myself.
\ No newline at end of file
+Any and all feedback and patches are welcome. I am very excited about this
package, and I'd like to see it prove helpful to more people than just
myself.
From codesite-noreply at google.com Sun May 10 04:59:48 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Sun, 10 May 2009 08:59:48 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r976 - Edited wiki
page through web user interface.
Message-ID: <0016363108ab74ced104698b156a@google.com>
Author: tashen.hatena
Date: Sun May 10 01:56:13 2009
New Revision: 976
Modified:
wiki/TutorialJa.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Sun May 10 01:56:13 2009
@@ -1,4 +1,4 @@
-# ???
+# ???
Introduction
@@ -1708,25 +1708,105 @@
=== ?????? ===
-Well if you want to use the LDAP connection for anything, I'd suggest
still calling Base.connection to get it. There really aren't many other
internals that need to be worried about. You could get the LDAP schema with
Base.schema.
+
+ Well if you want to use the LDAP connection for anything, I'd suggest
still
+ calling Base.connection to get it. There really aren't many other
internals
+ that need to be worried about. You could get the LDAP schema with
Base.schema.
+
+????????????? LDAP ?????????????????????
???
+ActiveLdap::Base.connection ??????????????????????
????
+???????????????????????????????
+ActiveLdap::Base.schema ??????????????
+
+
+ The only other useful tricks are dereferencing and accessing the stored
data.
+ Since LDAP attributes can have multiple names, e.g. cn or commonName, any
+ methods you write might need to figure it out. I'd suggest just calling
+ self[attribname] to get the value, but if that's not good enough, you
can call
+ look up the stored name by to_real_attribute_name as follows:
+
+?????????????????????????????????????
???
+????????Perl ? derefence ??????????????????
+
+???LDAP???cn / commonName ?????????????????????
???
+???????????????????????????????????
??cn ?
+???????????commonName ?????????????????????
??
+?????????????????????????
-The only other useful tricks are dereferencing and accessing the stored
data. Since LDAP attributes can have multiple names, e.g. cn or commonName,
any methods you write might need to figure it out. I'd suggest just calling
self[attribname] to get the value, but if that's not good enough, you can
call look up the stored name by to_real_attribute_name as follows:
+??????????????? self['???'] ??????????????
???
+?????????????????????????????????????
??
+to_real_attribute_name ???????????????????????
- irb> to_real_attribute_name('commonName')
- => 'cn'
+{{{
+ >> u = User.find :first
+ >> u.instance_eval do
+ ?> to_real_attribute_name 'commonName'
+ >> end
+ => "cn"
+}}}
-This tells you the name the attribute is stored in behind the scenes
(@data). Again, self[attribname] should be enough for most extensions, but
if not, it's probably safe to dabble here.
+
+ This tells you the name the attribute is stored in behind the scenes
(@data).
+ Again, self[attribname] should be enough for most extensions, but if
not, it's
+ probably safe to dabble here.
+
+??????????@data?????????????????????????
??
+???self[???] ????????????????????????????
??
+???????????????????????
-Also, if you like to look up all aliases for an attribute, you can call
the following:
+
+ Also, if you like to look up all aliases for an attribute, you can call
the
+ following:
+
+?????????????????????????????????????
???
+???????
+
+ *obsolete
irb> schema.attribute_aliases('cn')
=> ['cn','commonName']
+
+{{{
+ irb> User.schema.attribute_type 'cn', 'NAME'
+ => ['cn','commonName']
+}}}
-This is discovered automagically from the LDAP server's schema.
-Limitations
-Speed
+
+ This is discovered automagically from the LDAP server's schema.
+
+???LDAP ????????????????????
+
+
+ Limitations
+
+== ?? ==
-Currently, ActiveLdap could be faster. I have some recursive type checking
going on which slows object creation down, and I'm sure there are many,
many other places optimizations can be done. Feel free to send patches, or
just hang in there until I can optimize away the slowness.
-Feedback
+
+ Speed
+
+=== ???? ===
-Any and all feedback and patches are welcome. I am very excited about this
package, and I'd like to see it prove helpful to more people than just
myself.
+
+ Currently, ActiveLdap could be faster. I have some recursive type
checking
+ going on which slows object creation down, and I'm sure there are many,
many
+ other places optimizations can be done. Feel free to send patches, or
just
+ hang in there until I can optimize away the slowness.
+
+??????ActiveLdap ??????????????????????????
??
+????????????????????????????????????
???
+?????????????????????????????????????
???
+?????????????????????????????????????
???
+??????????
+
+
+ Feedback
+
+== ??????? ==
+
+
+ Any and all feedback and patches are welcome. I am very excited about
this
+ package, and I'd like to see it prove helpful to more people than just
myself.
+
+?????????????????????????????????????
???
+?????????????????????????????????????
???
+???
\ No newline at end of file
From codesite-noreply at google.com Sun May 10 08:01:35 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Sun, 10 May 2009 12:01:35 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r977 - form up
Message-ID: <0016e641db129bcd6f04698d9f6c@google.com>
Author: tashen.hatena
Date: Sun May 10 04:30:07 2009
New Revision: 977
Modified:
wiki/TutorialJa.wiki
Log:
form up
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Sun May 10 04:30:07 2009
@@ -80,7 +80,10 @@
less fun to write. Hopefully, ActiveLdap will remedy all of these
problems!
-LDAP?????????????????? Ruby/LDAP ????????????
??? LDAP API ????????????????API???????????
??????????????????????????????????????
????LDAP?????????????????????ActiveLdap ?????
???????
+LDAP?????????????????? Ruby/LDAP ????????????
??
+? LDAP API ????????????????API??????????????
??
+?????????????????????????????????????
LDAP?
+????????????????????ActiveLdap ????????????
Getting Started
@@ -88,9 +91,12 @@
= ?? =
- ActiveLdap does have some overhead when you get started. You must not
only install the package and all of it's requirements, but you must also
make customizations that will let it work in your environment.
+ ActiveLdap does have some overhead when you get started. You must not
only
+ install the package and all of it's requirements, but you must also make
+ customizations that will let it work in your environment.
-ActiveLdap ????????????????????????????????
???????????????????????
+ActiveLdap ????????????????????????????????
??
+?????????????????????
Requirements
@@ -140,12 +146,13 @@
install.
-??????? gem ??????????
+??????? gem ??????
{{{
gem install activeldap
}}}
-?????????????????irb ?????????????? require
???true ??????????????????
+?????????????????irb ?????????????? require
???
+true ??????????????????
{{{
$ irb -rubygems
irb(main):001:0> require 'active_ldap'
@@ -153,36 +160,58 @@
irb(main):002:0>
}}}
-?? require ? false ??????????????????????????
??????????????????????????????
+?? require ? false ??????????????????????????
??
+????????????????????????????
?obsolete ????????????????
Customizations
== ?????? ==
- Now that ActiveLdap is installed and working, we still have a few more
steps to make it useful for programming.
-ActiveLdap ????????????????????????????????
???????????????
+ Now that ActiveLdap is installed and working, we still have a few more
steps
+ to make it useful for programming.
- Let's say that you are writing a Ruby program for managing user and
group accounts in LDAP. I will use this as the running example throughout
the document.
-????LDAP?????/????????????????? Ruby ??????
??????????????????????????????????????
???
+ActiveLdap ????????????????????????????????
??
+?????????????
+
+ Let's say that you are writing a Ruby program for managing user and group
+ accounts in LDAP. I will use this as the running example throughout the
+ document.
+
+????LDAP?????/????????????????? Ruby ??????
??
+?????????????????????????????????????
??
+
+ You will want to make a directory called 'ldapadmin? wherever is
convenient.
+ Under this directory, you'll want to make sure you have a 'lib?
directory.
- You will want to make a directory called 'ldapadmin? wherever is
convenient. Under this directory, you'll want to make sure you have a 'lib?
directory.
$ cd ~
$ mkdir ldapadmin
$ cd ldapadmin
$ mkdir lib
$ cd lib
-????????`ldapadmin'????????????????????????
??? lib ???????????????????
+
+????????`ldapadmin'????????????????????????
??
+? lib ???????????????????
+
{{{
$ cd ~
$ mkdir -p ldapadmin/lib
$ cd ldapadmin/lib
}}}
- The lib directory is where we'll be making customizations. You can, of
course, make this changes somewhere in Ruby's default search path to make
this accessible to every Ruby scripts. Enough of my babbling, I'm sure
you'd like to know what we're going to put in lib/.
-lib ???????????????????????????????????
???? Ruby ???????????????? Ruby ????????????
????????????????????????????????? lib/ ??
?????????????????????????????
+ The lib directory is where we'll be making customizations. You can, of
course,
+ make this changes somewhere in Ruby's default search path to make this
+ accessible to every Ruby scripts. Enough of my babbling, I'm sure you'd
like
+ to know what we're going to put in lib/.
+
+lib ???????????????????????????????????
???
+? Ruby ???????????????? Ruby ??????????????
???
+???????????????????????????? lib/ ??????
???
+??????????????????????
+
+ We're going to put extension classes in there. What are extension
classes you
+ say . . .
- We're going to put extension classes in there. What are extension
classes you say . . .
??????????????????????????????????
@@ -192,15 +221,19 @@
= ??? =
- This section covers using ActiveLdap from writing extension classes to
writing applications that use them.
+ This section covers using ActiveLdap from writing extension classes to
+ writing applications that use them.
-????? ActiveLdap ?????????????????????????
???????????????????
+????? ActiveLdap ?????????????????????????
????
+???????????????
-Just to give a taste of what's to come, here is a quick example using irb:
+ Just to give a taste of what's to come, here is a quick example using
irb:
irb> require 'active_ldap'
-??????????????????irb ????????????????
???? ActiveLdap ? require ????
+??????????????????irb ????????????????
????
+ActiveLdap ? require ????
+
{{{
irb> require 'active_ldap'
}}}
@@ -216,7 +249,8 @@
Here's an extension class that maps to the LDAP Group objects:
-?? ActiveLdap::Base ??????????????? base ??? LDAP
Group ????????????????????
+?? ActiveLdap::Base ??????????????? base ??? LDAP
Group ??
+??????????????????
{{{
irb> class Group < ActiveLdap::Base
@@ -252,7 +286,8 @@
== ActiveLdap ????? ==
- Extension classes are classes that are subclassed from ActiveLdap::Base.
They are used to represent objects in your LDAP server abstractly.
+ Extension classes are classes that are subclassed from ActiveLdap::Base.
They
+ are used to represent objects in your LDAP server abstractly.
Why do I need them?
From codesite-noreply at google.com Thu May 21 14:05:28 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Thu, 21 May 2009 18:05:28 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r978 - Edited wiki
page through web user interface.
Message-ID: <000e0cd1b43e358ed4046a6ffd7b@google.com>
Author: tashen.hatena
Date: Thu May 21 11:05:07 2009
New Revision: 978
Modified:
wiki/TutorialJa.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Thu May 21 11:05:07 2009
@@ -13,19 +13,18 @@
oriented interface to LDAP entries.
ActiveLdap ? LDAP ???????????????????LDAP??????
-LDIF???????????????????????????????????
??
+LDIF???????????????????????????????????
??
???????????????API?????????????????
-ActiveLdap ????????????ActiveRecord ????????
-ActiveLdap ? LDAP ????????????????????????????
-?????
+ActiveLdap ????????????ActiveRecord ???????? ActiveLdap
+??LDAP ?????????????????????????????????
The target audience is system administrators and LDAP users everywhere
that need quick, clean access to LDAP in Ruby.
-???????????????????????LDAP????????????
???
-?LDAP???????????????????
+?????????????LDAP????????????????LDAP????
??
+?????????????
What's LDAP?
@@ -45,11 +44,13 @@
LDAP?????????????????????????????????
LDAP???
????????????????????LDAP???????????????
??
-??LDAP????????????????????????????????
????
-?????????????????????????????????????
???
-??LDAP? Unix ?????????????????????????????
???
-?????????????????????????????????????
???
-Micrsoft ActiveDirectory ???????????????
+??LDAP?????????????????????????????????
??
+????????????????????????????????????
??
+
+??????????????? LDAP???? Unix ????????????
???
+?????????????????????????????????????
???
+???????Micrsoft ActiveDirectory???? ActiveLdap ???????
???
+?? "Directory" ???????????????
Further reading:
@@ -83,21 +84,24 @@
LDAP?????????????????? Ruby/LDAP ????????????
??
? LDAP API ????????????????API??????????????
??
?????????????????????????????????????
LDAP?
-????????????????????ActiveLdap ????????????
+????????????????????ActiveLdap ???????????
??
Getting Started
-= ?? =
+= ???? =
ActiveLdap does have some overhead when you get started. You must not
only
install the package and all of it's requirements, but you must also make
customizations that will let it work in your environment.
-
-ActiveLdap ????????????????????????????????
??
-?????????????????????
+ ??????????
+ ActiveLdap ???????????????????????
+
+ ???? configuration.rb ??????????????????????
+ ????????????????????????????????
+
Requirements
* A Ruby implementation: Ruby 1.8.x, 1.9.1 or JRuby 1.1
@@ -218,7 +222,7 @@
Usage
-= ??? =
+= ???? =
This section covers using ActiveLdap from writing extension classes to
@@ -249,8 +253,9 @@
Here's an extension class that maps to the LDAP Group objects:
-?? ActiveLdap::Base ??????????????? base ??? LDAP
Group ??
-??????????????????
+???ActiveLdap::Base ?????????????????????????
???
+???????? base ??????? LDAP ? Group ????????????
??
+???????
{{{
irb> class Group < ActiveLdap::Base
@@ -261,17 +266,25 @@
Here is the Group class in use:
-??????????????????????????
+
+??????
+??????????????????? Group ???? setup_connection ??
? :base ??? ou=Groups ?????????????????????????
Group ????????????ou=Groups ??? LDAP ???????????
??
+
+????????????????????????
{{{
+ # ???????????
irb> all_groups = Group.find(:all).collect {|group| group.cn}
=> ["root", "daemon", "bin", "sys", "adm", "tty", ..., "develop"]
+ # develop ????? LDAP ?????????
irb> group = Group.find("develop")
=> # ...>
+ # develop ????? cn ???
irb> group.cn
=> "develop"
+ # develop ????? gid_number ???
irb> group.gid_number
=> 1003
}}}
@@ -296,9 +309,9 @@
attributes on to a Ruby class.
-ActiveLdap ?????? ActiveLdap::Base ????????????? LDAP?
-???????????Ruby????????????????????????
???
-????
+ActiveLdap ?????? ActiveLdap::Base ????????????? LDAP?
?
+??????????Ruby?????????????????????????
?
+?????
ActiveLdap::Base ??????????????????????? LDAP ???
??
???????(ActiveRecord????) Ruby ????????????????
???
From codesite-noreply at google.com Sat May 30 06:09:20 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Sat, 30 May 2009 10:09:20 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r979 - Edited wiki
page through web user interface.
Message-ID: <000e0cd2421cf5508d046b1e62b8@google.com>
Author: tashen.hatena
Date: Sat May 30 03:08:37 2009
New Revision: 979
Modified:
wiki/TutorialJa.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Sat May 30 03:08:37 2009
@@ -17,7 +17,7 @@
???????????????API?????????????????
ActiveLdap ????????????ActiveRecord ???????? ActiveLdap
-??LDAP ?????????????????????????????????
+??LDAP ????????????????????????????????
The target audience is system administrators and LDAP users everywhere
@@ -268,7 +268,9 @@
??????
-??????????????????? Group ???? setup_connection ??
? :base ??? ou=Groups ?????????????????????????
Group ????????????ou=Groups ??? LDAP ???????????
??
+??????????????????? Group ???? setup_connection ??
?:
+base ??? ou=Groups ?????????????????????????
Group?
+???????????ou=Groups ???????? LDAP ??????????
???
????????????????????????
{{{
@@ -308,14 +310,11 @@
background work to make easy-to-use objects by mapping the LDAP object's
attributes on to a Ruby class.
+ActiveLdap ?????? ActiveLdap::Base ????????????? LDAP
???
+???????????????????????????
-ActiveLdap ?????? ActiveLdap::Base ????????????? LDAP?
?
-??????????Ruby?????????????????????????
?
-?????
-
-ActiveLdap::Base ??????????????????????? LDAP ???
??
-???????(ActiveRecord????) Ruby ????????????????
???
-??????
+?????? LDAP ????????????? Ruby ????????????
???
+???????????????????????????
Special Methods
@@ -327,10 +326,10 @@
extension class. In the above example, I only made one special method
call
inside the Group class. More than likely, you will want to more than
that.
-LDAP ??????????? Ruby ???????????????????
-ActiveLdap????????????????????????????????
???
-?????????Group ?????????? ldap_mapping ????????
??
-??????????????????????????????
+LDAP ?????????? Ruby ???????????????????
ActiveLdap
+?????????????????????????????????????
???
+????Group ?????????? ldap_mapping ?????????????
???
+????????????????????????
ldap_mapping
@@ -341,8 +340,9 @@
ldap_mapping is the only required method to setup an extension class for
use
with ActiveLdap. It must be called inside of a subclass as shown above.
-ldap_mapping ? ActiveLdap ????????????????????????
-???????????
+
+ldap_mapping ? ActiveLdap ????????????????????????
??
+?????????
Below is a much more realistic Group class:
@@ -352,7 +352,8 @@
{{{
class Group < ActiveLdap::Base
ldap_mapping :dn_attribute => 'cn',
- :prefix => 'ou=Groups', :classes => ['top', 'posixGroup']
+ :prefix => 'ou=Groups',
+ :classes => ['top', 'posixGroup']
:scope => :one
end
}}}
@@ -361,8 +362,10 @@
As you can see, this method is used for defining how this class maps in
to
LDAP. Let's say that my LDAP tree looks something like this:
-??????? LDAP?????? ? Group ?????????????????
??
-?????????????? LDAP ????????????????????
+Group ??????????? LDAP ???????????????????
+ldap_mapping ????????????????????????
+
+?????? LDAP ????????????????????
{{{
* dc=dataspill,dc=org
@@ -381,12 +384,17 @@
as the beginning of the distinguished name.
ou=People ??????????????????ou=Groups ?????????
???
-??????????????ldap_mapping ? LDAP ?????????????
??
-????? Group ??????? :prefix ???????????
-ou=Groups,dc=dataspill,dc=org ????????????????
? :dn_attribute
-??? 'cn' ????????????????????????????Group
???
-????? LDAP????(ou=Groups,dc=dataspill,dc=org ???????)???
??
-DN ?cn ????????????????
+??????????????
+
+ldap_mapping ? LDAP ??????????????????????????
Group
+???????????????
+
+:prefix ???????????ou=Groups,dc=dataspill,dc=org ???????
???
+???????
+
+:dn_attribute??? 'cn' ?????????????????????????
???
+Group ???????? LDAP??????(ou=Groups,dc=dataspill,dc=org ??
?LDAP
+??????)?????DN ?cn ????????????????
Just for clarity, here's how the arguments map out:
@@ -410,8 +418,9 @@
??? :scope, :classes, :dn_attribute ??????????????????
:scope ? ou=Groups ???????????????????????????
???
-????cn=develop,ou=DevGroups,ou=Groups,dc=dataspill,dc=org ??????
???
-???
+????cn=develop,ou=DevGroups,ou=Groups,dc=dataspill,dc=org ????
LDAP ??
+??????????????? ???
??:base,
+:one, :sub ??????????????
Something's missing: :classes. :classes is used to tell ActiveLdap what
@@ -423,7 +432,7 @@
method e.g. Group#add_class(*values).
:classes ? ActiveLdap ??????????????????????????
-?????????LDAP ????????????????LDAP????????
??
+?????????LDAP ????????????????LDAP????????
??
?????????????????ActiveLdap ???? :classes ??????
???????????????? 'top' ??????????????????
?
??add_class ??????????????????????
@@ -444,10 +453,12 @@
defaults to super class's value or 'cn?. If :prefix is left off, it will
default to 'ou=PLURALIZED_CLASSNAME?. In this case, it would
be 'ou=Groups?.
-:classes ????????????????????? :dn_attribute ????
???
-????????????????????cn ????????
-:prefix??????????????'ou=??????????????????
???
-?'ou=Groups'??????
+
+:classes ???????????????????:dn_attribute ???????
??
+??????????????????cn ????????
+
+:prefix??????????????'ou=??????????????????
??
+??'ou=Groups'??????
:classes should be an Array. :dn_attribute should be a String and so
should
@@ -463,9 +474,9 @@
tying objects together across the LDAP tree. Often, user objects will be
members of, or belong_to, Group objects.
-???????LDAP????????????????????????????
??
-??User ???????Group??????????????belongs_to ????
??
-???????
+???????LDAP????????????????????????????
???
+????????? User ??????? Group ???????????????
?
+belongs_to ????????????
{{{
* dc=dataspill,dc=org
@@ -495,14 +506,15 @@
If we look at the LDAP entry for 'drewry?, we do not see any references
to
group 'develop?. In order to remedy that, we can use belongs_to
-??????????? 'drewry' ???????????'develop' ?????
???
-?????????????????????????????? belongs_to ?
???
-???
+????'drewry' ?????????? 'develop' ?????????????
???
+???????????????? belongs_to ???????
+???????
{{{
irb> class User < ActiveLdap::Base
irb* ldap_mapping :dn_attribute => 'uid', :prefix
=> 'People', :classes => ['top','account']
- irb* belongs_to :groups, :class_name => 'Group', :many
=> 'memberUid', :foreign_key => 'uid'
+ irb* belongs_to :groups, :foreign_key => 'uid',
+ irb* :class_name => 'Group', :many => 'memberUid',
irb* end
}}}
@@ -554,43 +566,67 @@
assumed to be the dn_attribute. With this in mind, the above definition
could
become:
-belongs_to ?????????????
-
-????????????????????????????????? :groups
??
-????????? groups ????????????????????????
Hash
-???ldap_mapping ??????
-
-:class_name ???????LDAP?????????? String ????????
??????
-User ?????????????? Group ??????????????
??'Group'
-???????????????? Ruby ??????????????????
????
-????:class_name => "MyLdapModule::Group" ???????????????
?????
-???????
-
-:foreign_key ???????LDAP??????????????????????
??
-????????????????:foreign_key ??????????????
-:dn_attribute??????????????
-
-:many ????????LDAP?????????????????
??:foreign_key ?
-????????????????LDAP???????????????????
??
-:foreign_key ? uid?:many ? memberUid ?????????????RDB???
?
-?????????????????????????????????????
??
-:foreign_key????????????????????????????
-
-:primary_key ???????????LDAP??????????????????
-gidNumber ????????????????????????????????
??
-??
+belongs_to ???????????????????
?
+???????????? Group ??????????????????????
??
+????
+???????
{{{
irb> class User < ActiveLdap::Base
irb* ldap_mapping :dn_attribute => 'uid', :prefix
=> 'People', :classes => ['top','account']
- irb* belongs_to :groups, :class_name => 'Group', :many => 'memberUid'
+ irb*
+ irb* belongs_to :primary_group, :foreign_key => 'gidNumber',
+ irb* :class_name => 'Group', :primary_key => 'gidNumber'
+ irb*
+ irb* belongs_to :groups, :foreign_key => 'uid',
+ irb* :class_name => 'Group', :many => 'memberUid',
irb* end
}}}
+belongs_to ????????????????????????????????
??:
+primary_group ? :groups ?????????????????????????
??
+?????? Hash???ldap_mapping ????????????
+?????????????????? Group ????????
???
+?????????????
+
+:class_name ??????????????? String ????????????
+"Group" ?????????????????????????????????
???
+?????:class_name => "MyLdapModule::Group" ??????????????
??
+???????????
+
+:foreign_key ?? RDB ?????????????????????????
+:foreign_key?????????????? :dn_attribute ??????????
??
+
+????????????????ActiveRecord
???
+???????????????????????? :many ? :primary_key ??
??
+????????????????? :primary_key ??????????
+
+:primary_key ? :foreign_key ?????????????????????
+:class_name ???????????????????????????????
???
+??????????????????????????????:primary_group
??
+????????primary_group ???????????? User ???
gidNumber??
+? Grop ?????? gidNumber ??????????????????????
?
+??
+
+:many ? :primary_key ??????????????? :primary_key ????
???
+???????????Group???????????????? :groups ???
???
+?????:primary_key ????????????
+
+RDB ???????????????????????????????? LDAP
???
+???????????????????????????? User ? Group ??
??
+????????
+
+???????????????????????????????????
?? :many
+?????????????????
+
+??????:foreign_key ??????????????????????
+:primary_key ???????????????????????????????
+:many ?????????
+
In addition, you can do simple membership tests by doing the following:
-????????????????????????????
+??:many ???????????????????????????????
{{{
irb> me.groups.member? 'root'
@@ -682,7 +718,7 @@
query. This is the simplest example of .find.
.find ? ldap_mapping ???????????????????????
ActiveRecord
-????LDAP????????????
+????LDAP??????????????
?????????dn_attribute ??????????????????????
??
??
@@ -1002,7 +1038,7 @@
This exception is raised when delete fails. It will include LDAP error
information that was passed up during the error.
-LDAP???????????????????????????????? LDAP
?
+LDAP??????????????????????????????????
LDAP ?
??????????????
=== SaveError ===
@@ -1013,9 +1049,9 @@
logs or doing an Ethereal dump of the connection will often provide
better
insight.
-LDAP ???????????????????????????????LDAP??
??
-??? Ethereal ?????????????????????????????
??
-??
+LDAP ?????????????????????????????????
LDAP??
+????? Ethereal ???????????????????????????
???
+???
=== AuthenticationError ===
From codesite-noreply at google.com Sat May 30 06:16:20 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Sat, 30 May 2009 10:16:20 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r980 - Edited wiki
page through web user interface.
Message-ID: <000e0cd151fe0874a9046b1e7c09@google.com>
Author: tashen.hatena
Date: Sat May 30 03:15:29 2009
New Revision: 980
Modified:
wiki/TutorialJa.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Sat May 30 03:15:29 2009
@@ -311,7 +311,7 @@
attributes on to a Ruby class.
ActiveLdap ?????? ActiveLdap::Base ????????????? LDAP
???
-???????????????????????????
+??????????????????????????
?????? LDAP ????????????? Ruby ????????????
???
???????????????????????????
@@ -386,8 +386,8 @@
ou=People ??????????????????ou=Groups ?????????
???
??????????????
-ldap_mapping ? LDAP ??????????????????????????
Group
-???????????????
+ldap_mapping ? LDAP ???????????????????????????
??
+?? Group ???????????????
:prefix ???????????ou=Groups,dc=dataspill,dc=org ???????
???
???????
@@ -514,7 +514,7 @@
irb> class User < ActiveLdap::Base
irb* ldap_mapping :dn_attribute => 'uid', :prefix
=> 'People', :classes => ['top','account']
irb* belongs_to :groups, :foreign_key => 'uid',
- irb* :class_name => 'Group', :many => 'memberUid',
+ irb* :class_name => 'Group', :many => 'memberUid'
irb* end
}}}
From codesite-noreply at google.com Sat May 30 08:57:40 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Sat, 30 May 2009 12:57:40 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r981 - Edited wiki
page through web user interface.
Message-ID: <000e0cd296ac00a63b046b20bda6@google.com>
Author: tashen.hatena
Date: Sat May 30 05:56:34 2009
New Revision: 981
Modified:
wiki/TutorialJa.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Sat May 30 05:56:34 2009
@@ -583,8 +583,8 @@
irb* end
}}}
-belongs_to ????????????????????????????????
??:
-primary_group ? :groups ?????????????????????????
??
+belongs_to ????????????????????????????????
??
+:primary_group ? :groups ????????????????????????
???
?????? Hash???ldap_mapping ????????????
?????????????????? Group ????????
???
?????????????
@@ -594,8 +594,14 @@
?????:class_name => "MyLdapModule::Group" ??????????????
??
???????????
-:foreign_key ?? RDB ?????????????????????????
-:foreign_key?????????????? :dn_attribute ??????????
??
+:foreign_key ????????????????????????:foreign_key?
??
+??????????? :dn_attribute ????????????
+
+???:foreign_key ? uid ????????????????????????
??
+??ActiveLdap ?? :foreign_key ?? "??????????????????
??
+?????????????????????????????????????
??
+belongs_to ???? :foreign_key ?????????????????????
??
+????????????????
????????????????ActiveRecord
???
???????????????????????? :many ? :primary_key ??
??
From codesite-noreply at google.com Sun May 31 08:04:26 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Sun, 31 May 2009 12:04:26 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r982 - Edited wiki
page through web user interface.
Message-ID: <000e0cd2dc58744723046b341c66@google.com>
Author: tashen.hatena
Date: Sun May 31 05:03:35 2009
New Revision: 982
Modified:
wiki/TutorialJa.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Sun May 31 05:03:35 2009
@@ -572,15 +572,17 @@
???????
{{{
- irb> class User < ActiveLdap::Base
- irb* ldap_mapping :dn_attribute => 'uid', :prefix
=> 'People', :classes => ['top','account']
- irb*
- irb* belongs_to :primary_group, :foreign_key => 'gidNumber',
- irb* :class_name => 'Group', :primary_key => 'gidNumber'
- irb*
- irb* belongs_to :groups, :foreign_key => 'uid',
- irb* :class_name => 'Group', :many => 'memberUid',
- irb* end
+class User < ActiveLdap::Base
+ ldap_mapping :dn_attribute => 'uid', :prefix => 'People', :classes =>
['top','account']
+
+ # ?????????????????????
+ belongs_to :primary_group, :foreign_key => 'gidNumber',
+ :class_name => 'Group', :primary_key => 'gidNumber'
+
+ # ?????????????????
+ belongs_to :groups, :foreign_key => 'uid',
+ :class_name => 'Group', :many => 'memberUid',
+end
}}}
belongs_to ????????????????????????????????
??
@@ -597,11 +599,11 @@
:foreign_key ????????????????????????:foreign_key?
??
??????????? :dn_attribute ????????????
-???:foreign_key ? uid ????????????????????????
??
-??ActiveLdap ?? :foreign_key ?? "??????????????????
??
-?????????????????????????????????????
??
-belongs_to ???? :foreign_key ?????????????????????
??
-????????????????
+???:foreign_key ? uid ????????????????????????
+ActiveLdap ?? :foreign_key ?? "????????????????????
???
+??????????????????????????????????
belongs_to
+???? :foreign_key ??????????????????????????
???
+??????????
????????????????ActiveRecord
???
???????????????????????? :many ? :primary_key ??
??
@@ -654,19 +656,26 @@
???????????
{{{
- class Group < ActiveLdap::Base
- ldap_mapping :dn_attribute => 'cn', :prefix => 'ou=Groups', :classes
=> ['top', 'posixGroup']
- has_many :members, :class_name => "User", :wrap
=> "memberUid", :primary_key => 'uid'
- end
+class Group < ActiveLdap::Base
+ ldap_mapping :dn_attribute => 'cn', :prefix => 'ou=Groups', :classes =>
['top', 'posixGroup']
+
+ # ?????????????????????
+ has_many :primary_members, :foreign_key => 'gidNumber',
+ :class_name => "User", :primary_key => 'gidNumber'
+
+ # ????????????(memberUid????)????
+ has_many :members, :wrap => "memberUid",
+ :class_name => "User", :primary_key => 'uid'
+end
}}}
Now we can see that group develop has user 'drewry? as a member, and it
can
even return all responses in object form just like belongs_to methods.
-??? develop ????? 'drewry' ???????????????????
???
-?? belongs_to ????????????? members ????????????
??
-??????
+??? develop ????? 'drewry' ???????????????????
??
+belongs_to ?????????????? members ?????????????
???
+????
{{{
irb> develop = Group.find('develop')
@@ -687,11 +696,11 @@
:class_name ???????????????????????????????
?????
? String???????
-:wrap ???? :primary_key ?????????????????:primary_key
??
-??????????????????????????:class_name
?:primary_key ?
-:wrap ?????????????????????????
-:primary_key ??????????:class_name ?????????
? :dn_attribute ??
-??????
+:wrap ? :foreign_key ??????????????????????????
???
+?????????????????? :class_name ???????????
+:primary_key ??????? ???????? belongs_to ???
? :primary_key ?
+:many ????????????? :foreign_key ???????????????
??
+????????RDB ?????????????????????????
Using these new classes
From codesite-noreply at google.com Sun May 31 09:31:36 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Sun, 31 May 2009 13:31:36 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r983 - Edited wiki
page through web user interface.
Message-ID: <000e0cd172a42fb28a046b3554a9@google.com>
Author: tashen.hatena
Date: Sun May 31 06:30:35 2009
New Revision: 983
Modified:
wiki/TutorialJa.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Sun May 31 06:30:35 2009
@@ -696,11 +696,12 @@
:class_name ???????????????????????????????
?????
? String???????
-:wrap ? :foreign_key ??????????????????????????
???
-?????????????????? :class_name ???????????
-:primary_key ??????? ???????? belongs_to ???
? :primary_key ?
-:many ????????????? :foreign_key ???????????????
??
-????????RDB ?????????????????????????
+:wrap ??????????????????????????????????
+:class_name ??????????? :primary_key ? :wrap ?????????
??
+???????? ????? User ?????????????????????
+
+:primary_key ??????????:class_name ?????????
? :dn_attribute
+????????
Using these new classes
From codesite-noreply at google.com Sun May 31 10:01:45 2009
From: codesite-noreply at google.com (codesite-noreply at google.com)
Date: Sun, 31 May 2009 14:01:45 +0000
Subject: [activeldap-commit] [ruby-activeldap commit] r984 - revert
Message-ID: <001636e1fca9046a92046b35c0f7@google.com>
Author: tashen.hatena
Date: Sun May 31 06:54:19 2009
New Revision: 984
Modified:
wiki/TutorialJa.wiki
Log:
revert
Modified: wiki/TutorialJa.wiki
==============================================================================
--- wiki/TutorialJa.wiki (original)
+++ wiki/TutorialJa.wiki Sun May 31 06:54:19 2009
@@ -575,10 +575,6 @@
class User < ActiveLdap::Base
ldap_mapping :dn_attribute => 'uid', :prefix => 'People', :classes =>
['top','account']
- # ?????????????????????
- belongs_to :primary_group, :foreign_key => 'gidNumber',
- :class_name => 'Group', :primary_key => 'gidNumber'
-
# ?????????????????
belongs_to :groups, :foreign_key => 'uid',
:class_name => 'Group', :many => 'memberUid',
@@ -586,10 +582,9 @@
}}}
belongs_to ????????????????????????????????
??
-:primary_group ? :groups ????????????????????????
???
-?????? Hash???ldap_mapping ????????????
-?????????????????? Group ????????
???
-?????????????
+:groups ?????????????????????????????????
Hash?
+??ldap_mapping ??????????????
???
+????????????? Group ?????????????????????
???
:class_name ??????????????? String ????????????
"Group" ?????????????????????????????????
???