mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
AW-542 Guest user can not see any Categories
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2456 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -23,7 +23,6 @@ import java.io.Reader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.StringTokenizer;
|
||||
@@ -353,6 +352,7 @@ public class ImporterBootstrap implements ApplicationListener
|
||||
// Create import binding
|
||||
BootstrapBinding binding = new BootstrapBinding();
|
||||
binding.setConfiguration(configuration);
|
||||
binding.setLocation(importLocation);
|
||||
String messages = bootstrapView.getProperty(VIEW_MESSAGES_PROPERTY);
|
||||
if (messages != null && messages.length() > 0)
|
||||
{
|
||||
@@ -431,6 +431,12 @@ public class ImporterBootstrap implements ApplicationListener
|
||||
{
|
||||
private Properties configuration = null;
|
||||
private ResourceBundle resourceBundle = null;
|
||||
private Location bootstrapLocation = null;
|
||||
|
||||
private static final String IMPORT_LOCATION_UUID = "bootstrap.location.uuid";
|
||||
private static final String IMPORT_LOCATION_NODEREF = "bootstrap.location.noderef";
|
||||
private static final String IMPORT_LOCATION_PATH = "bootstrap.location.path";
|
||||
|
||||
|
||||
/**
|
||||
* Set Import Configuration
|
||||
@@ -462,6 +468,16 @@ public class ImporterBootstrap implements ApplicationListener
|
||||
this.resourceBundle = resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Location
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
public void setLocation(Location location)
|
||||
{
|
||||
this.bootstrapLocation = location;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.view.ImporterBinding#getValue(java.lang.String)
|
||||
*/
|
||||
@@ -476,6 +492,22 @@ public class ImporterBootstrap implements ApplicationListener
|
||||
{
|
||||
value = resourceBundle.getString(key);
|
||||
}
|
||||
if (value == null && bootstrapLocation != null)
|
||||
{
|
||||
if (key.equals(IMPORT_LOCATION_UUID))
|
||||
{
|
||||
value = bootstrapLocation.getNodeRef().getId();
|
||||
}
|
||||
else if (key.equals(IMPORT_LOCATION_NODEREF))
|
||||
{
|
||||
value = bootstrapLocation.getNodeRef().toString();
|
||||
}
|
||||
else if (key.equals(IMPORT_LOCATION_PATH))
|
||||
{
|
||||
value = bootstrapLocation.getPath();
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@@ -53,6 +53,7 @@ import org.alfresco.service.cmr.search.SearchParameters;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AccessPermission;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
@@ -95,6 +96,7 @@ public class ImporterComponent
|
||||
private RuleService ruleService;
|
||||
private PermissionService permissionService;
|
||||
private AuthorityService authorityService;
|
||||
private AuthenticationService authenticationService;
|
||||
private OwnableService ownableService;
|
||||
|
||||
// binding markers
|
||||
@@ -184,6 +186,14 @@ public class ImporterComponent
|
||||
this.authorityService = authorityService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param authenticationService authenticationService
|
||||
*/
|
||||
public void setAuthenticationService(AuthenticationService authenticationService)
|
||||
{
|
||||
this.authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ownableService ownableService
|
||||
*/
|
||||
@@ -948,8 +958,13 @@ public class ImporterComponent
|
||||
{
|
||||
// Resolve path to node reference
|
||||
NodeRef nodeRef = null;
|
||||
importedRef = bindPlaceHolder(importedRef, binding);
|
||||
|
||||
if (importedRef.startsWith("/"))
|
||||
if (importedRef.equals("/"))
|
||||
{
|
||||
nodeRef = sourceNodeRef;
|
||||
}
|
||||
else if (importedRef.startsWith("/"))
|
||||
{
|
||||
// resolve absolute path
|
||||
SearchParameters searchParameters = new SearchParameters();
|
||||
@@ -1197,7 +1212,7 @@ public class ImporterComponent
|
||||
// apply permissions
|
||||
List<AccessPermission> permissions = null;
|
||||
AccessStatus writePermission = permissionService.hasPermission(nodeRef, PermissionService.CHANGE_PERMISSIONS);
|
||||
if (writePermission.equals(AccessStatus.ALLOWED))
|
||||
if (authenticationService.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
||||
{
|
||||
permissions = node.getAccessControlEntries();
|
||||
for (AccessPermission permission : permissions)
|
||||
@@ -1377,7 +1392,7 @@ public class ImporterComponent
|
||||
// Apply permissions
|
||||
List<AccessPermission> permissions = null;
|
||||
AccessStatus writePermission = permissionService.hasPermission(existingNodeRef, PermissionService.CHANGE_PERMISSIONS);
|
||||
if (writePermission.equals(AccessStatus.ALLOWED))
|
||||
if (authenticationService.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
||||
{
|
||||
boolean inheritPermissions = node.getInheritPermissions();
|
||||
if (!inheritPermissions)
|
||||
|
@@ -60,6 +60,7 @@ public class ViewParser implements Parser
|
||||
private static final String VIEW_ID_ATTR = "id";
|
||||
private static final String VIEW_IDREF_ATTR = "idref";
|
||||
private static final String VIEW_PATHREF_ATTR = "pathref";
|
||||
private static final String VIEW_NODEREF_ATTR = "noderef";
|
||||
private static final QName VIEW_METADATA = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "metadata");
|
||||
private static final QName VIEW_VALUE_QNAME = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "value");
|
||||
private static final QName VIEW_VALUES_QNAME = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "values");
|
||||
@@ -409,30 +410,36 @@ public class ViewParser implements Parser
|
||||
node.setReference(true);
|
||||
|
||||
// Extract Import scoped reference Id if explicitly defined
|
||||
String idRef = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_IDREF_ATTR);
|
||||
String pathRef = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_PATHREF_ATTR);
|
||||
String idRefAttr = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_IDREF_ATTR);
|
||||
String pathRefAttr = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_PATHREF_ATTR);
|
||||
String nodeRefAttr = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_NODEREF_ATTR);
|
||||
|
||||
if ((idRef != null && idRef.length() > 0) && (pathRef != null && pathRef.length() > 0))
|
||||
if ((idRefAttr != null && idRefAttr.length() > 0) && (pathRefAttr != null && pathRefAttr.length() > 0) && (nodeRefAttr != null && nodeRefAttr.length() > 0))
|
||||
{
|
||||
// Do not support both IDREF and PATHREF
|
||||
throw new ImporterException("Only one of " + VIEW_IDREF_ATTR + " or " + VIEW_PATHREF_ATTR + " can be specified.");
|
||||
throw new ImporterException("Only one of " + VIEW_IDREF_ATTR + " or " + VIEW_PATHREF_ATTR + " or " + VIEW_NODEREF_ATTR + " can be specified.");
|
||||
}
|
||||
if (idRef != null && idRef.length() > 0)
|
||||
if (nodeRefAttr != null)
|
||||
{
|
||||
NodeRef nodeRef = new NodeRef(nodeRefAttr);
|
||||
node.setUUID(nodeRef.getId());
|
||||
}
|
||||
else if (idRefAttr != null && idRefAttr.length() > 0)
|
||||
{
|
||||
// retrieve uuid from previously imported node
|
||||
NodeRef nodeRef = getImportReference(parserContext, idRef);
|
||||
NodeRef nodeRef = getImportReference(parserContext, idRefAttr);
|
||||
if (nodeRef == null)
|
||||
{
|
||||
throw new ImporterException("Cannot find node referenced by id " + idRef);
|
||||
throw new ImporterException("Cannot find node referenced by id " + idRefAttr);
|
||||
}
|
||||
node.setUUID(nodeRef.getId());
|
||||
}
|
||||
else if (pathRef != null && pathRef.length() > 0)
|
||||
else if (pathRefAttr != null && pathRefAttr.length() > 0)
|
||||
{
|
||||
NodeRef referencedRef = parserContext.importer.resolvePath(pathRef);
|
||||
NodeRef referencedRef = parserContext.importer.resolvePath(pathRefAttr);
|
||||
if (referencedRef == null)
|
||||
{
|
||||
throw new ImporterException("Cannot find node referenced by path " + pathRef);
|
||||
throw new ImporterException("Cannot find node referenced by path " + pathRefAttr);
|
||||
}
|
||||
node.setUUID(referencedRef.getId());
|
||||
}
|
||||
@@ -766,8 +773,8 @@ public class ViewParser implements Parser
|
||||
*/
|
||||
private void processEndType(ParserContext parserContext, NodeContext node)
|
||||
{
|
||||
NodeRef nodeRef = node.getNodeRef();
|
||||
importNode(parserContext, node);
|
||||
NodeRef nodeRef = node.getNodeRef();
|
||||
node.getImporter().childrenImported(nodeRef);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user