歡迎您光臨本站 註冊首頁

如何建立該DIT

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

如何建立該DIT

公司的需求是這樣的,有三個ou:部門,員工,商家
部門有好幾個,不同的員工屬於不同的部門,每個部門都有一個組長。一個員工可以訪問一個或者多個商家,部門的組長可以訪問其組員所有可以訪問的商家。
目前dit的結構我還不知道如何建立比較合適,而且後期會有數據的更新,比方說有新員工進來。

我的想法是這樣的:

dc=com
    dc=example
        ou=部門
                cn=部門1
                cn=部門2
        ou=員工
                cn=張三
                cn=李四
        ou=商家
                cn=商家1
                cn=商家2


比方說要求,張三能訪問商家1,我直接在access里寫對應的條目,可以實現,但是如果數據量很大,建立與維護都會很困難,因為要更新access條目。
另外部門的組長可以訪問其組員所有可以訪問的商家不知道該如何實現。。。。
《解決方案》

dc=com
    dc=example
       ou=employee
              cn=department1
              cn=department2
                  cn=Manager,cn=department1,ou=employee,dc=example,dc=com (title=manager)
                  cn=Manager,cn=department2,ou=employee,dc=example,dc=com (title=manager)
                  cn=employee1,cn=department1,ou=employee,dc=example,dc=com (title=engineer)
                  cn=employee2,cn=department1,ou=employee,dc=example,dc=com (title=engineer)
                  cn=employee3,cn=department1,ou=employee,dc=example,dc=com (title=engineer)
      ou=customer
              cn=customer1
              cn=customer2

dn: cn=Manager,cn=department1,ou=employee,dc=example,dc=com
cn: Manager
cn: department1
cn: name
uid: name
title: manager

dn: cn=employee1,cn=department1,ou=employee,dc=example,dc=com
cn: employee1
cn: department1
cn: name
uid: name
title: engineer


## department1的Manager可以wirte本部門的所有customer信息
##所有員工都可以write自己的customer記錄
##所有用戶具有read許可權
access to dn.subtree="ou=customer,dc=example,dc=com" filter=(cn=department1)
        by dn="cn=Manager,cn=department1,ou=employee,dc=example,dc=com" write
        by self write
        by users read

## department2的Manager可以wirte本部門的所有customer信息
##所有員工都可以write自己的customer記錄
##所有用戶具有read許可權
access to dn.subtree="ou=customer,dc=example,dc=com" filter=(cn=department2)
        by dn="cn=Manager,cn=department2,ou=employee,dc=example,dc=com" write
        by self write
        by users read

## department3的Manager可以wirte本部門的所有customer信息
##所有員工都可以write自己的customer記錄
##所有用戶具有read許可權
access to dn.subtree="ou=customer,dc=example,dc=com" filter=(cn=department3)
        by dn="cn=Manager,cn=department2,ou=employee,dc=example,dc=com" write
        by self write
        by users read

這樣一來,不需要修改ACL除非公司的部門減少或者增加,這種改動應該是非常小的。
當新的員工加入的時候也不需要修改ACL, 因為員工的許可權是read或者write自己加入的客戶信息.
NOTE: 唯一的要求就是,每個員工自己的客戶紀錄的OWNER必須是自己。這樣(by self write)才能生效

[ 本帖最後由 sky天空之城 於 2009-3-23 14:32 編輯 ]
《解決方案》

回復 #1 Dreamhat 的帖子

不知道這樣是否可行

dc=com
    dc=example
        ou=部門
                cn=組長名字1(有group屬性,然後把該組下的員工添加進去)
                cn=組長名字2(有group屬性,然後把該組下的員工添加進去)
        ou=員工
                cn=張三
                cn=李四
        ou=商家
                cn=商家1
                cn=商家2


這樣就可以使用group.exact參數實現組長訪問旗下所有組員可以訪問的商家了
如果有1000個商家,就要寫1000條access規則了。。。。。:em16:
《解決方案》

或者就兩個ou
然後所有的策略全用access實現。。。:em16:

dc=com
    dc=example
        ou=員工
                cn=張三
                cn=李四
                cn=組長1
        ou=商家
                cn=商家1
                cn=商家2
《解決方案》

暫時沒用到這麼複雜的設計,但是我看到的最複雜的ACL設置,都可以用SET的寫法解決。建議你去看看http://www.openldap.org/faq/data/cache/1133.html
《解決方案》

直接用資料庫不是更方便一些嘛~~
用LDAP實現這功能不是不可以,只是太麻煩了~
《解決方案》

其實樓主自己也發現問題了,就是 ACL 的更新。所以還是建議用 SQL 這樣的資料庫來做更合適一些。

或者在 LDAP 里保存數據,SQL 只保存許可權控制相關的內容,這樣也許更合適一些,兼有 LDAP 的優勢和靈活的許可權控制。
《解決方案》

謝謝樓上各位
我把分數給打字最多的了,雖然我看不大懂:luya:
《解決方案》

原帖由 Dreamhat 於 2009-3-25 22:49 發表 http://bbs3.chinaunix.net/images/common/back.gif
謝謝樓上各位
我把分數給打字最多的了,雖然我看不大懂:luya:
:em06: :em06: :em06:

[火星人 ] 如何建立該DIT已經有115次圍觀

http://coctec.com/docs/service/show-post-23577.html