2011-11-08 28 views

回答

0

感謝您answer

其實,我在考慮使用ACL集團和引用機制,當我問這個問題的。 這將有助於權限和共享。

  • 對於每個關係,爲每個用戶創建一組(用戶A的好友)

  • 當創建用戶>

    • 創建用戶組>
      • 創建用戶之間的引用和組使用reference_catalog(我不知道如何或甚至可能)
      • 添加新組localroles對用戶的文件夾(關係-角色映射可通過ControlPanel控制爲配置)
  • 當創建關係 - >爲所有用戶創建新組(需要一定的時間,但會很少使用)

  • 添加/刪除關係 - >添加/關聯組中刪除用戶

更新:看來,幾乎所有我需要的是通過實施包。

4

我建議使用annotations並創建多棵樹。對於前:

import BTrees 
from zope import annotation 

FOLLOWERS_KEY = "my.product.followers" 
FOLLOWS_KEY = "my.product.follows" 
FRIENDS_KEY = "my.product.friends" 

portal = self.context.portal_url.getPortalObject() 
annotations = annotation.interfaces.IAnnotations(portal) 

if not annotations.get(FOLLOWERS_KEY, None): 
    annotations[FOLLOWERS_KEY] = BTrees.IIBTree.IITreeSet() 
if not annotations.get(FOLLOWS_KEY, None): 
    annotations[FOLLOWS_KEY] = BTrees.IIBTree.IITreeSet() 
if not annotations.get(FRIENDS_KEY, None): 
    annotations[FRIENDS_KEY] = BTrees.IIBTree.IITreeSet() 

followers = annotation.get(FOLLOWERS_KEY) 
follows = annotation.get(FOLLOWS_KEY) 
friends = annotation.get(FRIENDS_KEY) 
+2

對於IIBTrees,假設您會使用整數鍵?這將如何映射到特定用戶(在索引的兩端)?我可能會建議使用OOBTree實例來代替IIBTree實例的註釋對象。我強烈建議使用('namespace','id')的元組作爲你的人類/用戶/主體標識符,例如:following = {('email','[email protected]'):[('member',' sdupton'),]。另外:請記住像「follow」這樣的關係是不對稱的(我遵循你,並不總是這樣);如果您需要另一個方向的索引('followed_by'),請添加一個索引。 – sdupton

+0

是的,你是對的。 IIBTree只是一個例子,我的觀點是使用註釋。絕對OOBTrees更合適。 –

相關問題