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:
David Caruana
2006-02-21 16:12:12 +00:00
parent 295d1cd0b6
commit cab7aa3b4e
28 changed files with 633 additions and 71 deletions

View File

@@ -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 <b>Consumer</b> role to <b>Guest</b> in <b>Category Root</b> folder.
* <p>
* 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<NodeRef> 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;
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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<String> 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<String> createPermissionReferences()
{
List<String> createdNames = new ArrayList<String>(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();
}
}
}

View File

@@ -43,6 +43,7 @@
where
appliedPatch.appliedOnDate >= :fromDate and
appliedPatch.appliedOnDate <= :toDate
order by appliedPatch.appliedOnDate
]]>
</query>

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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
{

View File

@@ -43,7 +43,7 @@ public class SimpleAuthorityServiceImpl implements AuthorityService
private Set<String> adminSet = Collections.singleton(PermissionService.ADMINISTRATOR_AUTHORITY);
private Set<String> guestSet = Collections.singleton(PermissionService.GUEST);
private Set<String> guestSet = Collections.singleton(PermissionService.GUEST_AUTHORITY);
private Set<String> allSet = Collections.singleton(PermissionService.ALL_AUTHORITIES);

View File

@@ -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());

View File

@@ -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;

View File

@@ -149,5 +149,14 @@
typeName = :typeNameOld and
name in ('Coordinator', 'Contributor', 'Editor', 'Guest')
</query>
<query name="permission.patch.UpdatePermissionName" >
update
org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntryImpl as entry
set
name = :nameNew
where
name = :nameOld
</query>
</hibernate-mapping>

View File

@@ -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;
}

View File

@@ -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";

View File

@@ -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

View File

@@ -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
}
}
}