Alfresco 3.1의 Java 지원 웹 스크립트에서 그룹 노드를 얻는 방법

StackOverflow https://stackoverflow.com/questions/2075979

  •  21-09-2019
  •  | 
  •  

문제

JavaScript WebScript를 사용하면 다음 코드로 그룹 노드를 얻을 수 있습니다.

var group = People.getGroup(groupname);

이 코드와 동등한 Java 지원은 무엇입니까?

지금까지 나는 모든 그룹 이름 세트 만 얻을 수 있지만 세트를 반복하고 실제 그룹 노드를 얻을 수 있기를 원합니다.

//Gets all groups, but only as a set of groupnames
Set<String> groups = new HashSet<String>();
groups.addAll(authorityService.getAllAuthorities(AuthorityType.GROUP));
for (String groupname : groups) {
  //jscript equivalent - var group = People.getGroup(groupname);
}
도움이 되었습니까?

해결책

당신은 사용할 수 있습니다 org.alfresco.repo.security.authority.AuthorityDAO getAuthorityNodeRefOrNull 메소드 이름으로 그룹 노드를 가져 오는 방법.

불행히도 당국은 모든 그룹 노드를 얻는 방법을 제공하지 않지만 구현 org.alfresco.repo.security.authority.authoritydaoimpl의 코드를 보면 코드를 쉽게 복사 할 수 있습니다. 그다지 복잡하지 않습니다.

다른 팁

주어진 그룹에 대한 NODEREF를 제공하는 새로운 권한 서비스 방법이 곧 제공됩니다.

/**
 * Gets the authority node for the specified name
 * 
 * @param name The authority name
 *  
 * @return the reference to the authority node
 */
public NodeRef getAuthorityNodeRef(String name);

그래도 릴리스 버전의 Alfresco가 아니므로 Hugo가 제안한대로 당국에서 getauthoritynoderefornull을 호출해야합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top