有没有办法用这种方案来配置ActiveLdap?
* dc=example,dc=com
|+ o=domain1.com,dc=example,dc=com
\
|+ ou=People,o=domain1.com,dc=example,dc=com
\
|- cn=user1,ou=People,o=domain1.com,dc=example,dc=com
|- cn=user2,ou=People,o=domain1.com,dc=example,dc=com
|- ...
|+ ou=Groups,
\
|- cn=group1,ou=Groups,o=domain1.com,dc=example,dc=com
|- cn=group2,ou=Groups,o=domain1.com,dc=example,dc=com
|- ...
|- o=otherdomain.com,dc=example,dc=com
\
|+ ou=People,o=otherdomain.com,dc=example,dc=com
\
|- cn=user1,ou=People,o=otherdomain.com,dc=example,dc=com
|- cn=user2,ou=People,o=otherdomain.com,dc=example,dc=com
|- ...
|+ ou=Groups,
\
|- cn=group1,ou=Groups,o=otherdomain.com,dc=example,dc=com
|- cn=group2,ou=Groups,o=otherdomain.com,dc=example,dc=com
|- ...我试着使用这样的东西:
class Domain < ActiveLdap::Base
ldap_mapping :dn_attribute => 'o',
:prefix => '',
:classes => %w(inetdomainauthinfo top maildomain organization)
end但是我不知道如何正确地创建Person.rb。
发布于 2013-09-28 14:09:08
找到答案了,谢谢口平。
class Domain < ActiveLdap::Base
ldap_mapping :dn_attribute => 'o',
:prefix => '',
:classes => %w(inetdomainauthinfo top maildomain organization)
def user(uid)
User.find(uid, :prefix => "ou=People,o=#{o}")
end
def users
User.all(:prefix => "ou=People,o=#{o}")
end
def group(cn)
Group.find(cn, :prefix => "ou=Groups,o=#{o}")
end
def groups
Group.all(:prefix => "ou=Groups,o=#{o}")
end
end
class Group < ActiveLdap::Base
ldap_mapping :dn_attribute => 'cn',
:prefix => '',
:classes => %w(inetlocalmailrecipient inetmailgroupmanagement
top inetmailgroup groupofuniquenames)
def domain
Domain.find(dn.rdns[2]['o'])
end
end
class User < ActiveLdap::Base
ldap_mapping :dn_attribute => 'uid',
:prefix => '',
:classes => %w(top userpresenceprofile inetadmin
organizationalperson person inetuser inetlocalmailrecipient inetorgperson
inetsubscriber inetmailuser)
def domain
Domain.find(dn.rdns[2]['o'])
end
endhttps://stackoverflow.com/questions/19060099
复制相似问题