特定のユーザーが書き込み/読み取りできるすべてのルートノードを返さなければならないメソッドを作成します。 特定のユーザーがルートノードに対して{Write、read}権限を持っているかどうかを確認する方法
は現在、私はやっている次:public List<String> getAllowedRootPaths(String username) throws RepositoryException {
SecuritySupport securitySupport = Components.getComponent(SecuritySupport.class);
UserManager userManager = securitySupport.getUserManager();
myUser = userManager.getUser(username);
Session session = MgnlContext.getJCRSession("website");
List<String> results = new ArrayList<String>();
if (getRoles().contains("rootPublisher")) {
//check user access and add to array
}
return results;
}
public Collection<String> getRoles() {
return magnoliaUser.getAllRoles();
}
私の古い方法は
HierarchyManager hm = MgnlContext.getHierarchyManager("website");
とテスト
hm.isGranted(node.getPath(), Permission.READ)
を使用していたが、厥は廃止以来、私は現在探しています別の解決策が必要です。私はセッションがAccessRightsのテストを持っていることを知っていますが、私はユーザセッションのためだけに働くようです。
誰かが、手動でロールをつかんでint値を調べることなく、アイデアを持っているのかもしれません。
挨拶、 Hellfiend
作品は完璧、ありがとう! – hellfiend