首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ActiveLdap具有在OU和OU之间创建关系的能力,OU具有多人和多组

ActiveLdap具有在OU和OU之间创建关系的能力,OU具有多人和多组
EN

Stack Overflow用户
提问于 2013-09-28 05:08:26
回答 1查看 207关注 0票数 0

有没有办法用这种方案来配置ActiveLdap?

代码语言:javascript
复制
* 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
     |- ...

我试着使用这样的东西:

代码语言:javascript
复制
class Domain < ActiveLdap::Base
  ldap_mapping :dn_attribute => 'o',
               :prefix => '',
               :classes => %w(inetdomainauthinfo top maildomain organization)
end

但是我不知道如何正确地创建Person.rb。

EN

回答 1

Stack Overflow用户

发布于 2013-09-28 14:09:08

找到答案了,谢谢口平。

代码语言:javascript
复制
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
end
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19060099

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档