02-18-2011 01:52 AM
public void removeAuthority(String parentName, String childName)
{
List<NodeRef> sitesBefore = null;
List<NodeRef> sitesAfter;
if (!childName.startsWith("GROUP_")) {
sitesBefore = getVisibleSites(childName, null);
}
authorityDAO.removeAuthority(parentName, childName);
if (sitesBefore != null) {
sitesAfter = getVisibleSites(childName, sitesBefore);
}
}
private List<NodeRef> getVisibleSites(String childName, final List<NodeRef> excludes) {
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<List<NodeRef>>() {
public List<NodeRef> doWork() throws Exception
{
String luceneSearch = "PATH:\"/app:company_home/st:sites/*\"";
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, luceneSearch);
List<NodeRef> sites = rs.getNodeRefs();
if (excludes != null) {
sites.removeAll(excludes);
}
QName name = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "name");
for (NodeRef site: sites) {
Serializable siteName = nodeService.getProperty(site, name);
System.out.println("siteName = " + siteName);
}
return sites;
}
}, childName);
}
02-23-2011 01:49 PM
if (permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.ALLOWED) {
/* This is a valid nodeRef */
}
else {
/* the user cannot access this node */
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.