- org.alfresco.service.cmr.repository.ContentService.getReader=ACL_NODE.0.cm:content.ReadContent
- org.alfresco.service.cmr.repository.ContentService.getWriter=ACL_NODE.0.cm:content.WriteContent
+ org.alfresco.service.cmr.repository.ContentService.getReader=ACL_NODE.0.sys:base.ReadContent
+ org.alfresco.service.cmr.repository.ContentService.getWriter=ACL_NODE.0.sys:base.WriteContent
org.alfresco.service.cmr.repository.ContentService.isTransformable=ACL_ALLOW
org.alfresco.service.cmr.repository.ContentService.transform=ACL_ALLOW
org.alfresco.service.cmr.repository.ContentService.getTempWriter=ACL_ALLOW
diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties
index 20bb465d58..34603a641c 100644
--- a/config/alfresco/version.properties
+++ b/config/alfresco/version.properties
@@ -11,8 +11,8 @@ version.label=
# Edition label
-version.edition=Open Source
+version.edition=Community Network
# Schema number
-version.schema=5
+version.schema=6
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/CategoryRootPermissionPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/CategoryRootPermissionPatch.java
new file mode 100644
index 0000000000..269d66c326
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/CategoryRootPermissionPatch.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2005 Alfresco, Inc.
+ *
+ * Licensed under the Mozilla Public License version 1.1
+ * with a permitted attribution clause. You may obtain a
+ * copy of the License at
+ *
+ * http://www.alfresco.org/legal/license.txt
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ */
+package org.alfresco.repo.admin.patch.impl;
+
+import java.util.List;
+
+import org.alfresco.i18n.I18NUtil;
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.importer.ImporterBootstrap;
+import org.alfresco.service.cmr.admin.PatchException;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.search.SearchService;
+import org.alfresco.service.cmr.security.PermissionService;
+import org.alfresco.service.namespace.NamespaceService;
+
+/**
+ * Grant Consumer role to Guest in Category Root folder.
+ *
+ * This patch expects the folder to be present.
+ */
+public class CategoryRootPermissionPatch extends AbstractPatch
+{
+ private static final String MSG_RESULT = "patch.categoryRootPermission.result";
+ private static final String ERR_NOT_FOUND = "patch.categoryRootPermission.err.not_found";
+
+ private PermissionService permissionService;
+ private ImporterBootstrap spacesBootstrap;
+ private SearchService searchService;
+ private NamespaceService namespaceService;
+ private NodeService nodeService;
+
+
+ public void setPermissionService(PermissionService permissionService)
+ {
+ this.permissionService = permissionService;
+ }
+
+ public void setSpacesBootstrap(ImporterBootstrap spacesBootstrap)
+ {
+ this.spacesBootstrap = spacesBootstrap;
+ }
+
+ public void setNodeService(NodeService nodeService)
+ {
+ this.nodeService = nodeService;
+ }
+
+ public void setSearchService(SearchService searchService)
+ {
+ this.searchService = searchService;
+ }
+
+ public void setNamespaceService(NamespaceService namespaceService)
+ {
+ this.namespaceService = namespaceService;
+ }
+
+
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ String categoryRootPath = "/cm:categoryRoot";
+
+ // find category root
+ NodeRef rootNodeRef = nodeService.getRootNode(spacesBootstrap.getStoreRef());
+ List nodeRefs = searchService.selectNodes(rootNodeRef, categoryRootPath, null, namespaceService, false);
+ if (nodeRefs.size() == 0)
+ {
+ String msg = I18NUtil.getMessage(ERR_NOT_FOUND, categoryRootPath);
+ throw new PatchException(msg);
+ }
+ NodeRef categoryRootRef = nodeRefs.get(0);
+
+ // apply permission
+ permissionService.setPermission(categoryRootRef, PermissionService.GUEST_AUTHORITY, PermissionService.READ, true);
+
+ // done
+ String msg = I18NUtil.getMessage(MSG_RESULT, categoryRootPath);
+ return msg;
+ }
+}
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/GuestPersonPermissionPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/GuestPersonPermissionPatch.java
new file mode 100644
index 0000000000..e879b8d4ec
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/GuestPersonPermissionPatch.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2005 Alfresco, Inc.
+ *
+ * Licensed under the Mozilla Public License version 1.1
+ * with a permitted attribution clause. You may obtain a
+ * copy of the License at
+ *
+ * http://www.alfresco.org/legal/license.txt
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ */
+package org.alfresco.repo.admin.patch.impl;
+
+import org.alfresco.i18n.I18NUtil;
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.security.PermissionService;
+import org.alfresco.service.cmr.security.PersonService;
+
+/**
+ * Change Guest Person permission from Guest to Read
+ *
+ * Guest (now Consumer) permission is not valid for cm:person type.
+ */
+public class GuestPersonPermissionPatch extends AbstractPatch
+{
+ private static final String MSG_SUCCESS = "patch.guestPersonPermission.result";
+
+ private PersonService personService;
+
+ private PermissionService permissionService;
+
+ private String guestId = "guest";
+
+ public GuestPersonPermissionPatch()
+ {
+ super();
+ }
+
+ public void setGuestId(String guestId)
+ {
+ this.guestId = guestId;
+ }
+
+ public void setPermissionService(PermissionService permissionService)
+ {
+ this.permissionService = permissionService;
+ }
+
+ public void setPersonService(PersonService personService)
+ {
+ this.personService = personService;
+ }
+
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ if (personService.personExists(guestId))
+ {
+ NodeRef personRef = personService.getPerson(guestId);
+ permissionService.setInheritParentPermissions(personRef, false);
+ permissionService.deletePermission(personRef, guestId, PermissionService.CONSUMER, true);
+ permissionService.setPermission(personRef, guestId, PermissionService.READ, true);
+ }
+
+ return I18NUtil.getMessage(MSG_SUCCESS);
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/GuestUserPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/GuestUserPatch.java
index bd9a1e9347..6786b2e5cd 100644
--- a/source/java/org/alfresco/repo/admin/patch/impl/GuestUserPatch.java
+++ b/source/java/org/alfresco/repo/admin/patch/impl/GuestUserPatch.java
@@ -177,7 +177,7 @@ public class GuestUserPatch extends AbstractPatch
NodeRef personRef = personService.getPerson(guestId);
permissionService.setInheritParentPermissions(personRef, false);
- permissionService.setPermission(personRef, guestId, PermissionService.READ, true);
+ permissionService.setPermission(personRef, guestId, PermissionService.CONSUMER, true);
}
@@ -237,8 +237,8 @@ public class GuestUserPatch extends AbstractPatch
private void setGuestHomePermissions(NodeRef nodeRef)
{
permissionService.setInheritParentPermissions(nodeRef, false);
- permissionService.setPermission(nodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.GUEST, true);
- permissionService.setPermission(nodeRef, guestId, PermissionService.GUEST, true);
+ permissionService.setPermission(nodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER, true);
+ permissionService.setPermission(nodeRef, guestId, PermissionService.CONSUMER, true);
}
private NodeRef setCompanyHomeSpacePermissions(NodeRef storeRootNodeRef, String companyHomeChildName)
@@ -259,7 +259,7 @@ public class GuestUserPatch extends AbstractPatch
NodeRef companyHomeRef = nodeRefs.get(0);
permissionService.setInheritParentPermissions(companyHomeRef, false);
- permissionService.setPermission(companyHomeRef, PermissionService.ALL_AUTHORITIES, PermissionService.GUEST,
+ permissionService.setPermission(companyHomeRef, PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER,
true);
return companyHomeRef;
}
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/SpacesRootPermissionPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/SpacesRootPermissionPatch.java
new file mode 100644
index 0000000000..26f21356a3
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/SpacesRootPermissionPatch.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2005 Alfresco, Inc.
+ *
+ * Licensed under the Mozilla Public License version 1.1
+ * with a permitted attribution clause. You may obtain a
+ * copy of the License at
+ *
+ * http://www.alfresco.org/legal/license.txt
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ */
+package org.alfresco.repo.admin.patch.impl;
+
+import org.alfresco.i18n.I18NUtil;
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.importer.ImporterBootstrap;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.security.PermissionService;
+
+/**
+ * Change Spaces Root Node permission from Guest to Read
+ *
+ * Guest (now Consumer) permission is not valid for sys:store_root type.
+ */
+public class SpacesRootPermissionPatch extends AbstractPatch
+{
+ private static final String MSG_SUCCESS = "patch.spacesRootPermission.result";
+
+ private ImporterBootstrap spacesBootstrap;
+ private NodeService nodeService;
+ private PermissionService permissionService;
+
+
+ public SpacesRootPermissionPatch()
+ {
+ super();
+ }
+
+ public void setSpacesBootstrap(ImporterBootstrap spacesBootstrap)
+ {
+ this.spacesBootstrap = spacesBootstrap;
+ }
+
+ public void setNodeService(NodeService nodeService)
+ {
+ this.nodeService = nodeService;
+ }
+
+ public void setPermissionService(PermissionService permissionService)
+ {
+ this.permissionService = permissionService;
+ }
+
+
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ NodeRef rootNodeRef = nodeService.getRootNode(spacesBootstrap.getStoreRef());
+ permissionService.deletePermission(rootNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER, true);
+ permissionService.setPermission(rootNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
+
+ return I18NUtil.getMessage(MSG_SUCCESS);
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/UpdateGuestPermissionPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/UpdateGuestPermissionPatch.java
new file mode 100644
index 0000000000..14d9d5819c
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/UpdateGuestPermissionPatch.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2005 Alfresco, Inc.
+ *
+ * Licensed under the Mozilla Public License version 1.1
+ * with a permitted attribution clause. You may obtain a
+ * copy of the License at
+ *
+ * http://www.alfresco.org/legal/license.txt
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ */
+package org.alfresco.repo.admin.patch.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.alfresco.i18n.I18NUtil;
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.security.permissions.impl.hibernate.PermissionReference;
+import org.alfresco.repo.security.permissions.impl.hibernate.PermissionReferenceImpl;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.springframework.orm.hibernate3.HibernateCallback;
+import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
+
+/**
+ * The permission 'Guest' has been renamed to 'Consumer'.
+ *
+ * @author David Caruana
+ */
+public class UpdateGuestPermissionPatch extends AbstractPatch
+{
+ private static final String MSG_SUCCESS = "patch.updateGuestPermission.result";
+
+ private HibernateHelper helper;
+
+ public UpdateGuestPermissionPatch()
+ {
+ helper = new HibernateHelper();
+ }
+
+ public void setSessionFactory(SessionFactory sessionFactory)
+ {
+ this.helper.setSessionFactory(sessionFactory);
+ }
+
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ List createdNames = helper.createPermissionReferences();
+ int updatedPermEntries = helper.updatePermissionEntries();
+
+ // build the result message
+ String msg = I18NUtil.getMessage(MSG_SUCCESS, createdNames, updatedPermEntries);
+ // done
+ return msg;
+ }
+
+ private static class HibernateHelper extends HibernateDaoSupport
+ {
+ private static final String NAME_OLD = "Guest";
+ private static final String NAME_NEW = "Consumer";
+ private static final String[] NAMES = new String[] {"Consumer"};
+
+ private static final String QUERY_UPDATE_PERM_ENTRY_NAME = "permission.patch.UpdatePermissionName";
+
+
+ public List createPermissionReferences()
+ {
+ List createdNames = new ArrayList(4);
+ for (String name : NAMES)
+ {
+ // create permission references as required, double checking for their existence first
+ PermissionReference ref = new PermissionReferenceImpl();
+ ref.setTypeUri(ContentModel.TYPE_CMOBJECT.getNamespaceURI());
+ ref.setTypeName(ContentModel.TYPE_CMOBJECT.getLocalName());
+ ref.setName(name);
+
+ // it acts as its own key
+ PermissionReference found = (PermissionReference) getHibernateTemplate().get(
+ PermissionReferenceImpl.class,
+ ref);
+
+ if (found == null)
+ {
+ // it was not found, so create it
+ getHibernateTemplate().save(ref);
+ createdNames.add(name);
+ }
+ }
+ return createdNames;
+ }
+
+ public int updatePermissionEntries()
+ {
+ HibernateCallback callback = new HibernateCallback()
+ {
+ public Object doInHibernate(Session session)
+ {
+ // flush any outstanding entities
+ session.flush();
+
+ Query query = session.getNamedQuery(HibernateHelper.QUERY_UPDATE_PERM_ENTRY_NAME);
+ query.setString("nameNew", NAME_NEW)
+ .setString("nameOld", NAME_OLD);
+ int updateCount = query.executeUpdate();
+ return new Integer(updateCount);
+ }
+ };
+ Integer updateCount = (Integer) getHibernateTemplate().execute(callback);
+ // done
+ return updateCount.intValue();
+ }
+
+ }
+}
diff --git a/source/java/org/alfresco/repo/domain/hibernate/AppliedPatch.hbm.xml b/source/java/org/alfresco/repo/domain/hibernate/AppliedPatch.hbm.xml
index f0a6bd7974..4b2611990c 100644
--- a/source/java/org/alfresco/repo/domain/hibernate/AppliedPatch.hbm.xml
+++ b/source/java/org/alfresco/repo/domain/hibernate/AppliedPatch.hbm.xml
@@ -43,6 +43,7 @@
where
appliedPatch.appliedOnDate >= :fromDate and
appliedPatch.appliedOnDate <= :toDate
+ order by appliedPatch.appliedOnDate
]]>
diff --git a/source/java/org/alfresco/repo/importer/ImporterBootstrap.java b/source/java/org/alfresco/repo/importer/ImporterBootstrap.java
index 17a9c5645c..6efb178564 100644
--- a/source/java/org/alfresco/repo/importer/ImporterBootstrap.java
+++ b/source/java/org/alfresco/repo/importer/ImporterBootstrap.java
@@ -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;
}
diff --git a/source/java/org/alfresco/repo/importer/ImporterComponent.java b/source/java/org/alfresco/repo/importer/ImporterComponent.java
index 5114b29010..41db85b96f 100644
--- a/source/java/org/alfresco/repo/importer/ImporterComponent.java
+++ b/source/java/org/alfresco/repo/importer/ImporterComponent.java
@@ -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 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 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)
diff --git a/source/java/org/alfresco/repo/importer/view/ViewParser.java b/source/java/org/alfresco/repo/importer/view/ViewParser.java
index 9d6691c793..850a6dd2f4 100644
--- a/source/java/org/alfresco/repo/importer/view/ViewParser.java
+++ b/source/java/org/alfresco/repo/importer/view/ViewParser.java
@@ -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);
}
diff --git a/source/java/org/alfresco/repo/security/authentication/AbstractAuthenticationComponent.java b/source/java/org/alfresco/repo/security/authentication/AbstractAuthenticationComponent.java
index e7ecd2a03b..b16324a41d 100644
--- a/source/java/org/alfresco/repo/security/authentication/AbstractAuthenticationComponent.java
+++ b/source/java/org/alfresco/repo/security/authentication/AbstractAuthenticationComponent.java
@@ -79,10 +79,10 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
gas[0] = new GrantedAuthorityImpl("ROLE_SYSTEM");
ud = new User(SYSTEM_USER_NAME, "", true, true, true, true, gas);
}
- else if (userName.equalsIgnoreCase(PermissionService.GUEST))
+ else if (userName.equalsIgnoreCase(PermissionService.GUEST_AUTHORITY))
{
GrantedAuthority[] gas = new GrantedAuthority[0];
- ud = new User(PermissionService.GUEST.toLowerCase(), "", true, true, true, true, gas);
+ ud = new User(PermissionService.GUEST_AUTHORITY.toLowerCase(), "", true, true, true, true, gas);
}
else
{
@@ -215,7 +215,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
*/
public String getGuestUserName()
{
- return PermissionService.GUEST.toLowerCase();
+ return PermissionService.GUEST_AUTHORITY.toLowerCase();
}
/**
@@ -227,7 +227,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
{
if(implementationAllowsGuestLogin())
{
- return setCurrentUser(PermissionService.GUEST);
+ return setCurrentUser(PermissionService.GUEST_AUTHORITY);
}
else
{
@@ -238,7 +238,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
{
if(allowGuestLogin.booleanValue())
{
- return setCurrentUser(PermissionService.GUEST);
+ return setCurrentUser(PermissionService.GUEST_AUTHORITY);
}
else
{
diff --git a/source/java/org/alfresco/repo/security/authority/SimpleAuthorityServiceImpl.java b/source/java/org/alfresco/repo/security/authority/SimpleAuthorityServiceImpl.java
index 1d81bb40ee..5c7047d96d 100644
--- a/source/java/org/alfresco/repo/security/authority/SimpleAuthorityServiceImpl.java
+++ b/source/java/org/alfresco/repo/security/authority/SimpleAuthorityServiceImpl.java
@@ -43,7 +43,7 @@ public class SimpleAuthorityServiceImpl implements AuthorityService
private Set adminSet = Collections.singleton(PermissionService.ADMINISTRATOR_AUTHORITY);
- private Set guestSet = Collections.singleton(PermissionService.GUEST);
+ private Set guestSet = Collections.singleton(PermissionService.GUEST_AUTHORITY);
private Set allSet = Collections.singleton(PermissionService.ALL_AUTHORITIES);
diff --git a/source/java/org/alfresco/repo/security/authority/SimpleAuthorityServiceTest.java b/source/java/org/alfresco/repo/security/authority/SimpleAuthorityServiceTest.java
index a9bd6fe681..f62c83f753 100644
--- a/source/java/org/alfresco/repo/security/authority/SimpleAuthorityServiceTest.java
+++ b/source/java/org/alfresco/repo/security/authority/SimpleAuthorityServiceTest.java
@@ -129,7 +129,7 @@ public class SimpleAuthorityServiceTest extends TestCase
assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).contains(
PermissionService.ALL_AUTHORITIES));
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).size());
- assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).contains(PermissionService.GUEST));
+ assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).contains(PermissionService.GUEST_AUTHORITY));
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.OWNER).size());
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.ROLE).size());
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
diff --git a/source/java/org/alfresco/repo/security/permissions/impl/PermissionServiceImpl.java b/source/java/org/alfresco/repo/security/permissions/impl/PermissionServiceImpl.java
index 3e979fb7d0..02207ccafb 100644
--- a/source/java/org/alfresco/repo/security/permissions/impl/PermissionServiceImpl.java
+++ b/source/java/org/alfresco/repo/security/permissions/impl/PermissionServiceImpl.java
@@ -41,7 +41,6 @@ import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.service.cmr.security.PermissionService;
-import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.EqualsHelper;
import org.apache.commons.logging.Log;
diff --git a/source/java/org/alfresco/repo/security/permissions/impl/hibernate/Permission.hbm.xml b/source/java/org/alfresco/repo/security/permissions/impl/hibernate/Permission.hbm.xml
index 7b436eb7d2..eba019a626 100644
--- a/source/java/org/alfresco/repo/security/permissions/impl/hibernate/Permission.hbm.xml
+++ b/source/java/org/alfresco/repo/security/permissions/impl/hibernate/Permission.hbm.xml
@@ -149,5 +149,14 @@
typeName = :typeNameOld and
name in ('Coordinator', 'Contributor', 'Editor', 'Guest')
+
+
+ update
+ org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntryImpl as entry
+ set
+ name = :nameNew
+ where
+ name = :nameOld
+
\ No newline at end of file
diff --git a/source/java/org/alfresco/service/cmr/security/AuthorityType.java b/source/java/org/alfresco/service/cmr/security/AuthorityType.java
index 63b2821d8e..5d1b12234a 100644
--- a/source/java/org/alfresco/service/cmr/security/AuthorityType.java
+++ b/source/java/org/alfresco/service/cmr/security/AuthorityType.java
@@ -110,7 +110,7 @@ public enum AuthorityType
public String getFixedString()
{
- return PermissionService.GUEST;
+ return PermissionService.GUEST_AUTHORITY;
}
public boolean isPrefixed()
@@ -219,7 +219,7 @@ public enum AuthorityType
{
authorityType = AuthorityType.OWNER;
}
- else if (authority.equalsIgnoreCase(PermissionService.GUEST))
+ else if (authority.equalsIgnoreCase(PermissionService.GUEST_AUTHORITY))
{
authorityType = AuthorityType.GUEST;
}
diff --git a/source/java/org/alfresco/service/cmr/security/PermissionService.java b/source/java/org/alfresco/service/cmr/security/PermissionService.java
index effa503a3d..9ae6de5a49 100644
--- a/source/java/org/alfresco/service/cmr/security/PermissionService.java
+++ b/source/java/org/alfresco/service/cmr/security/PermissionService.java
@@ -44,6 +44,7 @@ public interface PermissionService
public static final String ADMINISTRATOR_AUTHORITY = "ROLE_ADMINISTRATOR";
+ public static final String GUEST_AUTHORITY = "guest";
@@ -101,7 +102,7 @@ public interface PermissionService
public static final String EDITOR = "Editor";
- public static final String GUEST = "Guest";
+ public static final String CONSUMER = "Consumer";
public static final String LOCK = "Lock";
diff --git a/source/java/org/alfresco/service/cmr/view/Exporter.java b/source/java/org/alfresco/service/cmr/view/Exporter.java
index 24fd90985a..a9da31d6b2 100644
--- a/source/java/org/alfresco/service/cmr/view/Exporter.java
+++ b/source/java/org/alfresco/service/cmr/view/Exporter.java
@@ -17,7 +17,6 @@
package org.alfresco.service.cmr.view;
import java.io.InputStream;
-import java.util.Collection;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -163,6 +162,14 @@ public interface Exporter
*/
public void endProperties(NodeRef nodeRef);
+ /**
+ * Export start of value collection
+ *
+ * @param nodeRef the node reference
+ * @param property the property name
+ */
+ public void startValueCollection(NodeRef nodeRef, QName property);
+
/**
* Export single valued property
*
@@ -173,16 +180,15 @@ public interface Exporter
public void value(NodeRef nodeRef, QName property, Object value);
/**
- * Export multi valued property
+ * Export end of value collection
*
* @param nodeRef the node reference
* @param property the property name
- * @param value the value
*/
- public void value(NodeRef nodeRef, QName property, Collection values);
+ public void endValueCollection(NodeRef nodeRef, QName property);
/**
- * Export content stream
+ * Export content stream property
*
* @param nodeRef the node reference
* @param property the property name
diff --git a/source/java/org/alfresco/tools/Export.java b/source/java/org/alfresco/tools/Export.java
index 61a74b4419..721c3a699b 100644
--- a/source/java/org/alfresco/tools/Export.java
+++ b/source/java/org/alfresco/tools/Export.java
@@ -18,10 +18,9 @@ package org.alfresco.tools;
import java.io.File;
import java.io.InputStream;
-import java.util.Collection;
-import org.alfresco.repo.exporter.FileExportPackageHandler;
import org.alfresco.repo.exporter.ACPExportPackageHandler;
+import org.alfresco.repo.exporter.FileExportPackageHandler;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -239,6 +238,7 @@ public final class Export extends Tool
}
catch(ExporterException e)
{
+ e.printStackTrace();
throw new ToolException("Failed to export", e);
}
}
@@ -552,16 +552,23 @@ public final class Export extends Tool
}
/* (non-Javadoc)
- * @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable)
+ * @see org.alfresco.service.cmr.view.Exporter#startValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
- public void value(NodeRef nodeRef, QName property, Object value)
+ public void startValueCollection(NodeRef nodeRef, QName property)
{
}
/* (non-Javadoc)
- * @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Collection)
+ * @see org.alfresco.service.cmr.view.Exporter#endValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
- public void value(NodeRef nodeRef, QName property, Collection values)
+ public void endValueCollection(NodeRef nodeRef, QName property)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable)
+ */
+ public void value(NodeRef nodeRef, QName property, Object value)
{
}
@@ -627,10 +634,7 @@ public final class Export extends Tool
*/
public void endReference(NodeRef nodeRef)
{
- // TODO Auto-generated method stub
-
}
-
}
}