Merged V2.2 to HEAD

8405: Added causal exception to the runtime generated
   8408: AR-2136, AR-2137, AR-2138
   8410: WCM-1110, WCM-1111
   8417: Stopped chiba:match() function from being inserted into bindings for xforms model elements of type xs:integer.
   8419: Fixes for correct use of .empty in name spaces of QNames
   8420: Finally fixes WCM-1108 and WCM-1109
   8489: Merged V2.1 to V2.2
      8482: Fix For AR-2163
   8507: Merged V2.1 to V2.2
      8504: Fix for AR-2165 - respect repo read only setting during authentication


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8508 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-11 13:19:00 +00:00
parent fcf5487c5a
commit 399fe7ac67
18 changed files with 450 additions and 69 deletions

View File

@@ -354,7 +354,7 @@ ALTER TABLE alf_qname DROP INDEX t_fk_alf_qn_ns;
ALTER TABLE alf_qname DROP FOREIGN KEY t_fk_alf_qn_ns;
-- Remove the FILLER- values from the namespace uri
UPDATE alf_namespace SET uri = 'empty' WHERE uri = 'FILLER-';
UPDATE alf_namespace SET uri = '.empty' WHERE uri = 'FILLER-';
UPDATE alf_namespace SET uri = SUBSTR(uri, 8) WHERE uri LIKE 'FILLER-%';
--

View File

@@ -355,7 +355,7 @@ DROP INDEX t_fk_alf_qn_ns;
ALTER TABLE alf_qname DROP CONSTRAINT t_fk_alf_qn_ns;
-- Remove the FILLER- values from the namespace uri
UPDATE alf_namespace SET uri = 'empty' WHERE uri = 'FILLER-';
UPDATE alf_namespace SET uri = '.empty' WHERE uri = 'FILLER-';
UPDATE alf_namespace SET uri = SUBSTR(uri, 8) WHERE uri LIKE 'FILLER-%';
--

View File

@@ -213,3 +213,10 @@ patch.wcmPermissionPatch.result=Updated ACLs: ACLS are moved to the staging area
patch.avmWebProjectInheritPermissions.description=Break inheritance of permissions on wca:webfolder object to hide access by default.
patch.avmWebProjectInheritPermissions.result=Removed inheritance of permissions on all wca:webfolder objects.
patch.wcmPostPermissionSnapshotPatch.description=Snapshot stores (after fixing ACLs so they are only set on the staging area store).
patch.wcmPostPermissionSnapshotPatch.result=Snapshot complete after WCM ACL changes.

View File

@@ -1391,6 +1391,30 @@
</property>
</bean>
<bean id="patch.wcmPostPermissionSnapshotPatch" class="org.alfresco.repo.admin.patch.impl.WCMPostPermissionSnapshotPatch" parent="basePatch" >
<property name="id"><value>patch.wcmPostPermissionSnapshotPatch</value></property>
<property name="description"><value>patch.wcmPostPermissionSnapshotPatch.description</value></property>
<property name="fixesFromSchema"><value>0</value></property>
<property name="fixesToSchema"><value>122</value></property>
<property name="targetSchema"><value>123</value></property>
<!-- helper beans -->
<property name="avmService">
<ref bean="AVMService" />
</property>
<property name="avmSnapShotTriggeredIndexingMethodInterceptor">
<ref bean="avmSnapShotTriggeredIndexingMethodInterceptor" />
</property>
<property name="aclDaoComponent">
<ref bean="aclDaoComponent" />
</property>
<property name="dependsOn" >
<list>
<ref bean="patch.wcmPermissionPatch" />
</list>
</property>
</bean>
<bean id="patch.avmWebProjectInheritPermissions02" class="org.alfresco.repo.admin.patch.impl.AVMWebProjectInheritPermissionsPatch" parent="basePatch">
<property name="id"><value>patch.avmWebProjectInheritPermissions02</value></property>
<property name="description"><value>patch.avmWebProjectInheritPermissions.description</value></property>

View File

@@ -49,16 +49,23 @@ public class AVMPermissionsPatch extends AbstractPatch
@Override
protected String applyInternal() throws Exception
{
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
Long maxId = aclDaoComponent.getMaxAclId();
Thread progressThread = null;
if (aclDaoComponent.supportsProgressTracking())
{
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
Long maxId = aclDaoComponent.getMaxAclId();
Thread progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
progressThread.start();
progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
progressThread.start();
}
Map<ACLType, Integer> summary = accessControlListDao.patchAcls();
progressThread.interrupt();
progressThread.join();
if (progressThread != null)
{
progressThread.interrupt();
progressThread.join();
}
// build the result message
String msg = I18NUtil.getMessage(MSG_SUCCESS, summary.get(ACLType.DEFINING), summary.get(ACLType.LAYERED));

View File

@@ -25,6 +25,7 @@
package org.alfresco.repo.admin.patch.impl;
import java.util.List;
import java.util.Map;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.WCMAppModel;
@@ -89,11 +90,15 @@ public class WCMPermissionPatch extends AbstractPatch
@Override
protected String applyInternal() throws Exception
{
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
Long maxId = aclDaoComponent.getMaxAclId();
Thread progressThread = null;
if (aclDaoComponent.supportsProgressTracking())
{
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
Long maxId = aclDaoComponent.getMaxAclId();
Thread progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
progressThread.start();
progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
progressThread.start();
}
List<AVMStoreDescriptor> stores = avmService.getStores();
for (AVMStoreDescriptor store : stores)
@@ -130,8 +135,11 @@ public class WCMPermissionPatch extends AbstractPatch
}
}
progressThread.interrupt();
progressThread.join();
if (progressThread != null)
{
progressThread.interrupt();
progressThread.join();
}
// build the result message
String msg = I18NUtil.getMessage(MSG_SUCCESS);
@@ -182,6 +190,30 @@ public class WCMPermissionPatch extends AbstractPatch
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, store.getName() + ":/www");
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
QName propQName = QName.createQName(null, ".web_project.noderef");
PropertyValue pValue = avmService.getStoreProperty(store.getName(), propQName);
if (pValue != null)
{
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
// Apply sepcific user permissions as set on the web project
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : userInfoRefs)
{
NodeRef userInfoRef = ref.getChildRef();
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
if (userrole.equals("ContentManager"))
{
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.CHANGE_PERMISSIONS, true);
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.READ_PERMISSIONS, true);
}
}
}
}
private void setSandBoxMasks(AVMStoreDescriptor sandBoxStore)
@@ -195,6 +227,7 @@ public class WCMPermissionPatch extends AbstractPatch
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, sandBoxStore.getName() + ":/www");
Map<QName, PropertyValue> woof = avmService.getStoreProperties(stagingAreaName);
PropertyValue pValue = avmService.getStoreProperty(stagingAreaName, propQName);
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);

View File

@@ -0,0 +1,150 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.admin.patch.impl;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.repo.admin.patch.AbstractPatch;
import org.alfresco.repo.domain.hibernate.AclDaoComponentImpl;
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor;
import org.alfresco.repo.search.impl.lucene.AVMLuceneIndexer;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
/**
* Snap shot all stores after applying the staging are permissions patch
*
* @author andyh
*/
public class WCMPostPermissionSnapshotPatch extends AbstractPatch
{
private static final String MSG_SUCCESS = "patch.wcmPostPermissionSnapshotPatch.result";
AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor;
AVMService avmService;
AclDaoComponentImpl aclDaoComponent;
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
{
this.avmSnapShotTriggeredIndexingMethodInterceptor = avmSnapShotTriggeredIndexingMethodInterceptor;
}
public void setAclDaoComponent(AclDaoComponentImpl aclDaoComponent)
{
this.aclDaoComponent = aclDaoComponent;
}
@Override
protected String applyInternal() throws Exception
{
List<AVMStoreDescriptor> stores = avmService.getStores();
Thread progressThread = null;
Long toDo = aclDaoComponent.getNewInStore();
List<AVMLuceneIndexer> indexers = new ArrayList<AVMLuceneIndexer>(stores.size());
for (AVMStoreDescriptor storeDesc : stores)
{
AVMLuceneIndexer indexer = avmSnapShotTriggeredIndexingMethodInterceptor.getIndexer(storeDesc.getName());
indexers.add(indexer);
}
progressThread = new Thread(new ProgressWatcher(toDo, indexers), "WCMPactchProgressWatcher");
progressThread.start();
for (AVMStoreDescriptor storeDesc : stores)
{
if (avmService.getStoreRoot(-1, storeDesc.getName()).getLayerID() == -1)
{
avmService.createSnapshot(storeDesc.getName(), "PermissionPatch", "Snapshot after 2.2 permission patch");
AVMLuceneIndexer indexer = avmSnapShotTriggeredIndexingMethodInterceptor.getIndexer(storeDesc.getName());
indexer.flushPending();
}
}
progressThread.interrupt();
progressThread.join();
// build the result message
String msg = I18NUtil.getMessage(MSG_SUCCESS);
// done
return msg;
}
private class ProgressWatcher implements Runnable
{
private boolean running = true;
Long toDo;
List<AVMLuceneIndexer> indexers;
ProgressWatcher(Long toDo, List<AVMLuceneIndexer> indexers)
{
this.toDo = toDo;
this.indexers = indexers;
}
public void run()
{
while (running)
{
try
{
Thread.sleep(60000);
}
catch (InterruptedException e)
{
running = false;
}
if (running)
{
long done = 0;
for(AVMLuceneIndexer indexer : indexers)
{
if(indexer != null)
{
done += indexer.getIndexedDocCount();
}
}
reportProgress(toDo, done);
}
}
}
}
}

View File

@@ -83,7 +83,7 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
"asp.store = :store and " +
"asp.name = :name");
query.setEntity("store", store);
query.setParameter("name", qnameEntity);
query.setEntity("name", qnameEntity);
return (AVMStoreProperty)query.uniqueResult();
}
}

View File

@@ -53,6 +53,7 @@ import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.InvalidStoreRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.util.EqualsHelper;
import org.alfresco.util.Pair;
/**
@@ -232,6 +233,9 @@ public class AVMAccessControlListDAO implements AccessControlListDAO
public void updateChangedAcls(NodeRef startingPoint, List<AclChange> changes)
{
// If their are no actual changes there is nothing to do (the changes are all in TX and have already COWed so they can just change)
boolean hasChanges = false;
Long after = null;
for (AclChange change : changes)
{
@@ -243,7 +247,22 @@ public class AVMAccessControlListDAO implements AccessControlListDAO
{
after = change.getAfter();
}
if(!EqualsHelper.nullSafeEquals(change.getTypeBefore(), change.getTypeAfter()))
{
hasChanges = true;
}
if(!EqualsHelper.nullSafeEquals(change.getBefore(), change.getAfter()))
{
hasChanges = true;
}
}
if(!hasChanges)
{
return;
}
Long inherited = null;
if (after != null)
{
@@ -253,6 +272,8 @@ public class AVMAccessControlListDAO implements AccessControlListDAO
updateChangedAclsImpl(startingPoint, changes, SetMode.ALL, inherited, after, indirections);
}
private void updateChangedAclsImpl(NodeRef startingPoint, List<AclChange> changes, SetMode mode, Long inherited, Long setAcl, Map<Long, Set<Long>> indirections)
{
hibernateSessionHelper.mark();

View File

@@ -102,6 +102,8 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
static String QUERY_GET_LAYERED_FILES = "permission.GetLayeredFiles";
static String QUERY_GET_NEW_IN_STORE = "permission.GetNewInStore";
/** Access to QName entities */
private QNameDAO qnameDAO;
@@ -1825,14 +1827,22 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
try
{
Session session = getSession();
session.connection().setTransactionIsolation(1);
Query query = getSession().getNamedQuery("permission.GetAVMHeadNodeCount");
Long answer = (Long) query.uniqueResult();
return answer;
int isolationLevel = session.connection().getTransactionIsolation();
try
{
session.connection().setTransactionIsolation(1);
Query query = getSession().getNamedQuery("permission.GetAVMHeadNodeCount");
Long answer = (Long) query.uniqueResult();
return answer;
}
finally
{
session.connection().setTransactionIsolation(isolationLevel);
}
}
catch (SQLException e)
{
throw new AlfrescoRuntimeException("Failed to set TX isolation level");
throw new AlfrescoRuntimeException("Failed to set TX isolation level", e);
}
}
@@ -1842,34 +1852,78 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
try
{
Session session = getSession();
session.connection().setTransactionIsolation(1);
Query query = getSession().getNamedQuery("permission.GetMaxAclId");
Long answer = (Long) query.uniqueResult();
return answer;
int isolationLevel = session.connection().getTransactionIsolation();
try
{
session.connection().setTransactionIsolation(1);
Query query = getSession().getNamedQuery("permission.GetMaxAclId");
Long answer = (Long) query.uniqueResult();
return answer;
}
finally
{
session.connection().setTransactionIsolation(isolationLevel);
}
}
catch (SQLException e)
{
throw new AlfrescoRuntimeException("Failed to set TX isolation level");
throw new AlfrescoRuntimeException("Failed to set TX isolation level", e);
}
}
public boolean supportsProgressTracking()
{
try
{
Session session = getSession();
return session.connection().getMetaData().supportsTransactionIsolationLevel(1);
}
catch (SQLException e)
{
return false;
}
}
public Long getAVMNodeCountWithNewACLS(Long above)
{
try
{
Session session = getSession();
session.connection().setTransactionIsolation(1);
Query query = getSession().getNamedQuery("permission.GetAVMHeadNodeCountWherePermissionsHaveChanged");
query.setParameter("above", above);
Long answer = (Long) query.uniqueResult();
return answer;
int isolationLevel = session.connection().getTransactionIsolation();
try
{
session.connection().setTransactionIsolation(1);
Query query = getSession().getNamedQuery("permission.GetAVMHeadNodeCountWherePermissionsHaveChanged");
query.setParameter("above", above);
Long answer = (Long) query.uniqueResult();
return answer;
}
finally
{
session.connection().setTransactionIsolation(isolationLevel);
}
}
catch (SQLException e)
{
throw new AlfrescoRuntimeException("Failed to set TX isolation level");
throw new AlfrescoRuntimeException("Failed to set TX isolation level", e);
}
}
public Long getNewInStore()
{
HibernateCallback callback = new HibernateCallback()
{
public Object doInHibernate(Session session)
{
Query query = session.getNamedQuery(QUERY_GET_NEW_IN_STORE);
return query.uniqueResult();
}
};
Long count = (Long) getHibernateTemplate().execute(callback);
return count;
}
@SuppressWarnings("unchecked")
public List<Indirection> getLayeredDirectories()
{
@@ -1883,9 +1937,9 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
};
List<Object[]> results = (List<Object[]>) getHibernateTemplate().execute(callback);
ArrayList<Indirection> indirections = new ArrayList<Indirection>(results.size());
for(Object[] row : results)
for (Object[] row : results)
{
Long from = (Long)row[0];
Long from = (Long) row[0];
String to = (String) row[1];
Integer version = (Integer) row[2];
indirections.add(new Indirection(from, to, version));
@@ -1906,9 +1960,9 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
};
List<Object[]> results = (List<Object[]>) getHibernateTemplate().execute(callback);
ArrayList<Indirection> indirections = new ArrayList<Indirection>(results.size());
for(Object[] row : results)
for (Object[] row : results)
{
Long from = (Long)row[0];
Long from = (Long) row[0];
String to = (String) row[1];
Integer version = (Integer) row[2];
indirections.add(new Indirection(from, to, version));
@@ -1961,8 +2015,6 @@ public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoCo
return toVersion;
}
}
}

View File

@@ -38,7 +38,7 @@ public class NamespaceEntityImpl implements NamespaceEntity, Serializable
{
private static final long serialVersionUID = -6781559184013949845L;
protected static final String EMPTY_URI_SUBSTITUTE = ".empty";
public static final String EMPTY_URI_SUBSTITUTE = ".empty";
private Long id;
private Long version;

View File

@@ -424,6 +424,14 @@
]]>
</query>
<query name="permission.GetNewInStore">
<![CDATA[
select count(*)
from org.alfresco.repo.avm.AVMNodeImpl node
where storeNew is not null
]]>
</query>
<!--

View File

@@ -84,6 +84,10 @@ public class QNameEntityImpl implements QNameEntity, Serializable
if (qname == null )
{
String namespaceUri = namespace.getUri();
if (namespaceUri.equals(NamespaceEntityImpl.EMPTY_URI_SUBSTITUTE))
{
namespaceUri = "";
}
qname = QName.createQName(namespaceUri, localName);
}
return qname;

View File

@@ -485,4 +485,18 @@ public class AVMSnapShotTriggeredIndexingMethodInterceptor implements MethodInte
avmIndexer.createIndex(store, IndexMode.SYNCHRONOUS);
}
}
public AVMLuceneIndexer getIndexer(String store)
{
StoreRef storeRef = AVMNodeConverter.ToStoreRef(store);
Indexer indexer = indexerAndSearcher.getIndexer(storeRef);
if (indexer instanceof AVMLuceneIndexer)
{
AVMLuceneIndexer avmIndexer = (AVMLuceneIndexer) indexer;
return avmIndexer;
}
return null;
}
}

View File

@@ -99,4 +99,10 @@ public interface AVMLuceneIndexer extends LuceneIndexer, BackgroundIndexerAware
* @return
*/
public boolean hasIndexBeenCreated(String store);
/**
* Get the number of docs this indexer has indexed so far
* @return
*/
public long getIndexedDocCount();
}

View File

@@ -129,6 +129,8 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
private int endVersion = -1;
private long indexedDocCount = 0;
/**
* Set the AVM Service
*
@@ -391,6 +393,7 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
}
if (desc.isLayeredDirectory() || desc.isLayeredFile())
{
incrementDocCount();
return docs;
}
@@ -538,6 +541,7 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
System.out.println("Is Root " + root);
System.out.println("Is deleted " + deleted);
}
incrementDocCount();
return docs;
}
@@ -1650,4 +1654,14 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
}
}
public synchronized long getIndexedDocCount()
{
return indexedDocCount;
}
private synchronized void incrementDocCount()
{
indexedDocCount++;
}
}

View File

@@ -102,6 +102,21 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
return transactionService;
}
public Boolean getAllowGuestLogin()
{
return allowGuestLogin;
}
public NodeService getNodeService()
{
return nodeService;
}
public PersonService getPersonService()
{
return personService;
}
public void authenticate(String userName, char[] password) throws AuthenticationException
{
// Support guest login from the login screen
@@ -136,33 +151,13 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
}
else
{
return transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Authentication>()
SetCurrentUserCallback callback = new SetCurrentUserCallback(userName);
Authentication auth = transactionService.getRetryingTransactionHelper().doInTransaction(callback, transactionService.isReadOnly(), false);
if ((auth == null) || (callback.ae != null))
{
public Authentication execute() throws Throwable
{
if (personService.personExists(userName))
{
NodeRef userNode = personService.getPerson(userName);
if (userNode != null)
{
// Get the person name and use that as the current user to line up with permission checks
String personName = (String) nodeService.getProperty(userNode, ContentModel.PROP_USERNAME);
return setCurrentUserImpl(personName);
}
else
{
// Set using the user name
return setCurrentUserImpl(userName);
}
}
else
{
// Set using the user name
return setCurrentUserImpl(userName);
}
}
}, false, false);
throw callback.ae;
}
return auth;
}
}
@@ -400,4 +395,48 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
return NTLMMode.NONE;
}
class SetCurrentUserCallback implements RetryingTransactionHelper.RetryingTransactionCallback<Authentication>
{
AuthenticationException ae = null;
String userName;
SetCurrentUserCallback(String userName)
{
this.userName = userName;
}
public Authentication execute() throws Throwable
{
try
{
if (personService.personExists(userName))
{
NodeRef userNode = personService.getPerson(userName);
if (userNode != null)
{
// Get the person name and use that as the current user to line up with permission checks
String personName = (String) nodeService.getProperty(userNode, ContentModel.PROP_USERNAME);
return setCurrentUserImpl(personName);
}
else
{
// Set using the user name
return setCurrentUserImpl(userName);
}
}
else
{
// Set using the user name
return setCurrentUserImpl(userName);
}
}
catch (AuthenticationException ae)
{
this.ae = ae;
return null;
}
}
}
}

View File

@@ -27,6 +27,8 @@ package org.alfresco.service.namespace;
import java.io.Serializable;
import java.util.Collection;
import org.alfresco.repo.domain.hibernate.NamespaceEntityImpl;
/**
* <code>QName</code> represents the qualified name of a Repository item. Each
* QName consists of a local name qualified by a namespace.
@@ -229,7 +231,7 @@ public final class QName implements QNamePattern, Serializable, Cloneable
*/
private QName(String namespace, String name, String prefix)
{
this.namespaceURI = (namespace == null) ? NamespaceService.DEFAULT_URI : namespace;
this.namespaceURI = ((namespace == null) || (namespace.equals(NamespaceEntityImpl.EMPTY_URI_SUBSTITUTE))) ? NamespaceService.DEFAULT_URI : namespace;
this.prefix = prefix;
this.localName = name;
this.hashCode = 0;