mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
Merged V2.1 to HEAD
6386: Fix for AR-1649 6387: Fix for AR-1645 6388: Updated Polish messages 6389: Updated security providers 6392: Add support to log in as guest with any password (if guest is allowed) 6393: AR-1562 : Cannot directly exit/disable Alfresco JavaScript Debugger window 6394: Allow creation of PropertyValue persisted properties without knowing the type QName 6397: Log Serializable properties don't cause infinte waits 6398: Build fix and tidy up for authentication chaining Resolved conflicted state of 'root\projects\repository\source\java\org\alfresco\repo\security\authentication\AuthenticationUtil.java' 6402: AR-1643 Web Script args object does not handle multi-value arguments 6407: Removed use of QName "{}silly" as a data type definition. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6728 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
1050a3cb98
commit
a3ddf17f8e
@ -2310,9 +2310,9 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Use the default Cryptix JCE provider
|
// Use the default Bouncy Castle
|
||||||
|
|
||||||
setJCEProvider("cryptix.jce.provider.CryptixCrypto");
|
setJCEProvider("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if any domain mappings have been specified
|
// Check if any domain mappings have been specified
|
||||||
|
@ -72,6 +72,7 @@ import org.alfresco.service.cmr.avm.deploy.DeploymentReport;
|
|||||||
import org.alfresco.service.cmr.avm.deploy.DeploymentService;
|
import org.alfresco.service.cmr.avm.deploy.DeploymentService;
|
||||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||||
import org.alfresco.service.cmr.avmsync.AVMSyncException;
|
import org.alfresco.service.cmr.avmsync.AVMSyncException;
|
||||||
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.remote.RepoRemote;
|
import org.alfresco.service.cmr.remote.RepoRemote;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
@ -111,10 +112,10 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
fService.setStoreProperty("main", QName.createQName(null, ".dns.main"),
|
fService.setStoreProperty("main", QName.createQName(null, ".dns.main"),
|
||||||
new PropertyValue(QName.createQName(null, "silly"), "Nothing."));
|
new PropertyValue(DataTypeDefinition.TEXT, "Nothing."));
|
||||||
fService.createStore("test");
|
fService.createStore("test");
|
||||||
fService.setStoreProperty("test", QName.createQName(null, ".dns.test.main"),
|
fService.setStoreProperty("test", QName.createQName(null, ".dns.test.main"),
|
||||||
new PropertyValue(QName.createQName(null, "silly"), "Nothing."));
|
new PropertyValue(DataTypeDefinition.TEXT, "Nothing."));
|
||||||
setupBasicTree0();
|
setupBasicTree0();
|
||||||
authService.authenticateAsGuest();
|
authService.authenticateAsGuest();
|
||||||
// assertEquals(0, fLockingService.getUsersLocks("admin").size());
|
// assertEquals(0, fLockingService.getUsersLocks("admin").size());
|
||||||
@ -195,7 +196,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
QName name = QName.createQName("silly.uri", "SillyProperty");
|
QName name = QName.createQName("silly.uri", "SillyProperty");
|
||||||
PropertyValue value = new PropertyValue(name, "Silly Property Value");
|
PropertyValue value = new PropertyValue(DataTypeDefinition.TEXT, "Silly Property Value");
|
||||||
fService.setNodeProperty("main:/a/b/c/foo", name, value);
|
fService.setNodeProperty("main:/a/b/c/foo", name, value);
|
||||||
fService.createSnapshot("main", null, null);
|
fService.createSnapshot("main", null, null);
|
||||||
results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}SillyProperty")+":\"Silly\"");
|
results = searchService.query(storeRef, "lucene", LuceneQueryParser.escape("@{silly.uri}SillyProperty")+":\"Silly\"");
|
||||||
@ -5162,7 +5163,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
QName name = QName.createQName("silly.uri", "SillyProperty");
|
QName name = QName.createQName("silly.uri", "SillyProperty");
|
||||||
PropertyValue value = new PropertyValue(name, "Silly Property Value");
|
PropertyValue value = new PropertyValue(DataTypeDefinition.TEXT, "Silly Property Value");
|
||||||
fService.setStoreProperty("main", name, value);
|
fService.setStoreProperty("main", name, value);
|
||||||
PropertyValue found = fService.getStoreProperty("main", name);
|
PropertyValue found = fService.getStoreProperty("main", name);
|
||||||
assertEquals(value.toString(), found.toString());
|
assertEquals(value.toString(), found.toString());
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.domain;
|
package org.alfresco.repo.domain;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.PipedInputStream;
|
|
||||||
import java.io.PipedOutputStream;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -515,12 +515,16 @@ public class PropertyValue implements Cloneable, Serializable
|
|||||||
setMultiValued(true);
|
setMultiValued(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Does the client consider the type to be important?
|
||||||
|
if (typeQName != null)
|
||||||
{
|
{
|
||||||
// Convert the value to the type required. This ensures that any type conversion issues
|
// Convert the value to the type required. This ensures that any type conversion issues
|
||||||
// are caught early and prevent the scenario where the data in the DB cannot be given
|
// are caught early and prevent the scenario where the data in the DB cannot be given
|
||||||
// back out because it is unconvertable.
|
// back out because it is unconvertable.
|
||||||
ValueType valueType = makeValueType(typeQName);
|
ValueType valueType = makeValueType(typeQName);
|
||||||
value = valueType.convert(value);
|
value = valueType.convert(value);
|
||||||
|
}
|
||||||
// get the persisted type
|
// get the persisted type
|
||||||
ValueType persistedValueType = this.actualType.getPersistedType(value);
|
ValueType persistedValueType = this.actualType.getPersistedType(value);
|
||||||
// convert to the persistent type
|
// convert to the persistent type
|
||||||
@ -705,27 +709,41 @@ public class PropertyValue implements Cloneable, Serializable
|
|||||||
*/
|
*/
|
||||||
private Serializable cloneSerializable(Serializable original)
|
private Serializable cloneSerializable(Serializable original)
|
||||||
{
|
{
|
||||||
|
ObjectOutputStream objectOut = null;
|
||||||
|
ByteArrayOutputStream byteOut = null;
|
||||||
|
ObjectInputStream objectIn = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Connect the pipes
|
// Write the object out to a byte array
|
||||||
PipedOutputStream pipeOut = new PipedOutputStream();
|
byteOut = new ByteArrayOutputStream();
|
||||||
PipedInputStream pipeIn = new PipedInputStream();
|
objectOut = new ObjectOutputStream(byteOut);
|
||||||
pipeOut.connect(pipeIn);
|
|
||||||
|
|
||||||
ObjectOutputStream objectOut = new ObjectOutputStream(pipeOut);
|
|
||||||
ObjectInputStream objectIn = new ObjectInputStream(pipeIn);
|
|
||||||
|
|
||||||
// Now write the object
|
|
||||||
objectOut.writeObject(original);
|
objectOut.writeObject(original);
|
||||||
// Read the new object in
|
objectOut.flush();
|
||||||
Object newObj = objectIn.readObject();
|
|
||||||
|
objectIn = new ObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
|
||||||
|
Object target = objectIn.readObject();
|
||||||
// Done
|
// Done
|
||||||
return (Serializable) newObj;
|
return (Serializable) target;
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Failed to clone serializable object: " + original, e);
|
throw new AlfrescoRuntimeException("Failed to clone serializable object: " + original, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (objectOut != null)
|
||||||
|
{
|
||||||
|
try { objectOut.close(); } catch (Throwable e) {}
|
||||||
|
}
|
||||||
|
if (byteOut != null)
|
||||||
|
{
|
||||||
|
try { byteOut.close(); } catch (Throwable e) {}
|
||||||
|
}
|
||||||
|
if (objectIn != null)
|
||||||
|
{
|
||||||
|
try { objectIn.close(); } catch (Throwable e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.jscript;
|
package org.alfresco.repo.jscript;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
import javax.swing.WindowConstants;
|
import javax.swing.WindowConstants;
|
||||||
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
@ -46,19 +48,17 @@ import org.mozilla.javascript.tools.shell.Global;
|
|||||||
*
|
*
|
||||||
* @author davidc
|
* @author davidc
|
||||||
*/
|
*/
|
||||||
public class AlfrescoRhinoScriptDebugger extends Dim
|
public class AlfrescoRhinoScriptDebugger
|
||||||
{
|
{
|
||||||
// Logger
|
// Logger
|
||||||
private static final Log logger = LogFactory.getLog(AlfrescoRhinoScriptDebugger.class);
|
private static final Log logger = LogFactory.getLog(AlfrescoRhinoScriptDebugger.class);
|
||||||
|
|
||||||
private boolean active = false;
|
|
||||||
private boolean visible = false;
|
|
||||||
private ContextFactory factory = null;
|
private ContextFactory factory = null;
|
||||||
private Global global = null;
|
private AlfrescoDim dim = null;
|
||||||
private AlfrescoRhinoScriptDebugger dim = null;
|
|
||||||
private SwingGui gui = null;
|
private SwingGui gui = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the Debugger
|
* Start the Debugger
|
||||||
*/
|
*/
|
||||||
@ -77,15 +77,20 @@ public class AlfrescoRhinoScriptDebugger extends Dim
|
|||||||
public synchronized void activate()
|
public synchronized void activate()
|
||||||
{
|
{
|
||||||
factory = ContextFactory.getGlobal();
|
factory = ContextFactory.getGlobal();
|
||||||
global = new Global();
|
Global global = new Global();
|
||||||
global.init(factory);
|
global.init(factory);
|
||||||
dim = new AlfrescoRhinoScriptDebugger();
|
global.setIn(System.in);
|
||||||
dim.setScopeProvider(IProxy.newScopeProvider((Scriptable)global));
|
global.setOut(System.out);
|
||||||
gui = new SwingGui(dim, "Alfresco JavaScript Debugger");
|
global.setErr(System.err);
|
||||||
gui.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
dim = new AlfrescoDim();
|
||||||
active = true;
|
ScopeProvider sp = IProxy.newScopeProvider((Scriptable)global);
|
||||||
|
dim.setScopeProvider(sp);
|
||||||
|
gui = new AlfrescoGui(dim, "Alfresco JavaScript Debugger", this);
|
||||||
|
gui.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
gui.setExitAction((Runnable)sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the debugger
|
* Show the debugger
|
||||||
*/
|
*/
|
||||||
@ -97,15 +102,14 @@ public class AlfrescoRhinoScriptDebugger extends Dim
|
|||||||
}
|
}
|
||||||
|
|
||||||
dim.setBreakOnExceptions(true);
|
dim.setBreakOnExceptions(true);
|
||||||
dim.setBreakOnEnter(true);
|
dim.setBreak();
|
||||||
dim.setBreakOnReturn(true);
|
|
||||||
dim.attachTo(factory);
|
dim.attachTo(factory);
|
||||||
gui.pack();
|
gui.pack();
|
||||||
gui.setSize(600, 460);
|
gui.setSize(600, 460);
|
||||||
gui.setVisible(true);
|
gui.setVisible(true);
|
||||||
visible = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the Debugger
|
* Hide the Debugger
|
||||||
*/
|
*/
|
||||||
@ -115,7 +119,6 @@ public class AlfrescoRhinoScriptDebugger extends Dim
|
|||||||
{
|
{
|
||||||
dim.detach();
|
dim.detach();
|
||||||
gui.dispose();
|
gui.dispose();
|
||||||
visible = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +129,7 @@ public class AlfrescoRhinoScriptDebugger extends Dim
|
|||||||
*/
|
*/
|
||||||
public boolean isVisible()
|
public boolean isVisible()
|
||||||
{
|
{
|
||||||
return visible;
|
return isActive() && gui.isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,10 +139,12 @@ public class AlfrescoRhinoScriptDebugger extends Dim
|
|||||||
*/
|
*/
|
||||||
public boolean isActive()
|
public boolean isActive()
|
||||||
{
|
{
|
||||||
return active;
|
return gui != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class AlfrescoDim extends Dim
|
||||||
|
{
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.mozilla.javascript.tools.debugger.Dim#objectToString(java.lang.Object)
|
* @see org.mozilla.javascript.tools.debugger.Dim#objectToString(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@ -152,22 +157,43 @@ public class AlfrescoRhinoScriptDebugger extends Dim
|
|||||||
@SuppressWarnings("synthetic-access")
|
@SuppressWarnings("synthetic-access")
|
||||||
public String doWork() throws Exception
|
public String doWork() throws Exception
|
||||||
{
|
{
|
||||||
return AlfrescoRhinoScriptDebugger.super.objectToString(arg0);
|
return AlfrescoDim.super.objectToString(arg0);
|
||||||
}
|
}
|
||||||
}, AuthenticationUtil.getSystemUserName());
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
private static class AlfrescoGui extends SwingGui
|
||||||
* Class to consolidate all internal implementations of interfaces to avoid
|
|
||||||
* class generation bloat.
|
|
||||||
*/
|
|
||||||
private static class IProxy implements Runnable, ScopeProvider
|
|
||||||
{
|
{
|
||||||
|
private static final long serialVersionUID = 5053205080777378416L;
|
||||||
|
private AlfrescoRhinoScriptDebugger debugger;
|
||||||
|
|
||||||
|
public AlfrescoGui(Dim dim, String title, AlfrescoRhinoScriptDebugger debugger)
|
||||||
|
{
|
||||||
|
super(dim, title);
|
||||||
|
this.debugger = debugger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
String cmd = e.getActionCommand();
|
||||||
|
if (cmd.equals("Exit"))
|
||||||
|
{
|
||||||
|
debugger.hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
super.actionPerformed(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class IProxy implements Runnable, ScopeProvider
|
||||||
|
{
|
||||||
// Constants for 'type'.
|
// Constants for 'type'.
|
||||||
public static final int EXIT_ACTION = 1;
|
public static final int EXIT_ACTION = 1;
|
||||||
|
|
||||||
public static final int SCOPE_PROVIDER = 2;
|
public static final int SCOPE_PROVIDER = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,7 +221,7 @@ public class AlfrescoRhinoScriptDebugger extends Dim
|
|||||||
*/
|
*/
|
||||||
public static ScopeProvider newScopeProvider(Scriptable scope)
|
public static ScopeProvider newScopeProvider(Scriptable scope)
|
||||||
{
|
{
|
||||||
IProxy scopeProvider = new IProxy(SCOPE_PROVIDER);
|
IProxy scopeProvider = new IProxy(EXIT_ACTION);
|
||||||
scopeProvider.scope = scope;
|
scopeProvider.scope = scope;
|
||||||
return scopeProvider;
|
return scopeProvider;
|
||||||
}
|
}
|
||||||
@ -225,5 +251,4 @@ public class AlfrescoRhinoScriptDebugger extends Dim
|
|||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ public class ADMLuceneTest extends TestCase
|
|||||||
writer.putContent("The quick brown fox jumped over the lazy dog and ate the Alfresco Tutorial, in pdf format, along with the following stop words; a an and are"
|
writer.putContent("The quick brown fox jumped over the lazy dog and ate the Alfresco Tutorial, in pdf format, along with the following stop words; a an and are"
|
||||||
+ " as at be but by for if in into is it no not of on or such that the their then there these they this to was will with: "
|
+ " as at be but by for if in into is it no not of on or such that the their then there these they this to was will with: "
|
||||||
+ " and random charcters \u00E0\u00EA\u00EE\u00F0\u00F1\u00F6\u00FB\u00FF");
|
+ " and random charcters \u00E0\u00EA\u00EE\u00F0\u00F1\u00F6\u00FB\u00FF");
|
||||||
System.out.println("Size is " + writer.getSize());
|
//System.out.println("Size is " + writer.getSize());
|
||||||
|
|
||||||
nodeService.addChild(rootNodeRef, n8, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}eight-0"));
|
nodeService.addChild(rootNodeRef, n8, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}eight-0"));
|
||||||
nodeService.addChild(n1, n8, ASSOC_TYPE_QNAME, QName.createQName("{namespace}eight-1"));
|
nodeService.addChild(n1, n8, ASSOC_TYPE_QNAME, QName.createQName("{namespace}eight-1"));
|
||||||
@ -2527,6 +2527,49 @@ public class ADMLuceneTest extends TestCase
|
|||||||
assertNotNull(results.getRow(0).getValue(QName.createQName(TEST_NAMESPACE, "any-many-ista")));
|
assertNotNull(results.getRow(0).getValue(QName.createQName(TEST_NAMESPACE, "any-many-ista")));
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
|
// proximity searches
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "TEXT:\"Tutorial Alfresco\"~0", null, null);
|
||||||
|
assertEquals(0, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "TEXT:\"Tutorial Alfresco\"~1", null, null);
|
||||||
|
assertEquals(0, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "TEXT:\"Tutorial Alfresco\"~2", null, null);
|
||||||
|
assertEquals(1, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "TEXT:\"Tutorial Alfresco\"~3", null, null);
|
||||||
|
assertEquals(1, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Alfresco Tutorial\"", null, null);
|
||||||
|
assertEquals(1, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"", null, null);
|
||||||
|
assertEquals(0, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"~0", null, null);
|
||||||
|
assertEquals(0, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"~1", null, null);
|
||||||
|
assertEquals(0, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"~2", null, null);
|
||||||
|
assertEquals(1, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"~3", null, null);
|
||||||
|
assertEquals(1, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
// multi ml text
|
// multi ml text
|
||||||
|
|
||||||
QName multimlQName = QName.createQName(TEST_NAMESPACE, "mltext-many-ista");
|
QName multimlQName = QName.createQName(TEST_NAMESPACE, "mltext-many-ista");
|
||||||
|
@ -262,7 +262,7 @@ public class LuceneAnalyser extends Analyzer
|
|||||||
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
|
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
|
||||||
if (propertyDef != null)
|
if (propertyDef != null)
|
||||||
{
|
{
|
||||||
if (propertyDef.getDataType().equals(DataTypeDefinition.MLTEXT))
|
if (propertyDef.getDataType().getName().equals(DataTypeDefinition.MLTEXT))
|
||||||
{
|
{
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,8 @@ public class LuceneQueryParser extends QueryParser
|
|||||||
|
|
||||||
private IndexReader indexReader;
|
private IndexReader indexReader;
|
||||||
|
|
||||||
|
private int internalSlop = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a query string, returning a {@link org.apache.lucene.search.Query}.
|
* Parses a query string, returning a {@link org.apache.lucene.search.Query}.
|
||||||
*
|
*
|
||||||
@ -168,6 +170,21 @@ public class LuceneQueryParser extends QueryParser
|
|||||||
super(arg0);
|
super(arg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Query getFieldQuery(String field, String queryText, int slop) throws ParseException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
internalSlop = slop;
|
||||||
|
Query query = getFieldQuery(field, queryText);
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
internalSlop = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected Query getFieldQuery(String field, String queryText) throws ParseException
|
protected Query getFieldQuery(String field, String queryText) throws ParseException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -1019,7 +1036,7 @@ public class LuceneQueryParser extends QueryParser
|
|||||||
{
|
{
|
||||||
// phrase query:
|
// phrase query:
|
||||||
MultiPhraseQuery mpq = new MultiPhraseQuery();
|
MultiPhraseQuery mpq = new MultiPhraseQuery();
|
||||||
mpq.setSlop(phraseSlop);
|
mpq.setSlop(internalSlop);
|
||||||
ArrayList<Term> multiTerms = new ArrayList<Term>();
|
ArrayList<Term> multiTerms = new ArrayList<Term>();
|
||||||
for (int i = 0; i < v.size(); i++)
|
for (int i = 0; i < v.size(); i++)
|
||||||
{
|
{
|
||||||
@ -1053,7 +1070,7 @@ public class LuceneQueryParser extends QueryParser
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MultiPhraseQuery q = new MultiPhraseQuery();
|
MultiPhraseQuery q = new MultiPhraseQuery();
|
||||||
q.setSlop(phraseSlop);
|
q.setSlop(internalSlop);
|
||||||
for (int i = 0; i < v.size(); i++)
|
for (int i = 0; i < v.size(); i++)
|
||||||
{
|
{
|
||||||
t = (org.apache.lucene.analysis.Token) v.get(i);
|
t = (org.apache.lucene.analysis.Token) v.get(i);
|
||||||
|
@ -39,9 +39,8 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class abstract the support required to set up and query the Acegi context for security enforcement.
|
* This class abstract the support required to set up and query the Acegi context for security enforcement. There are
|
||||||
*
|
* some simple default method implementations to support simple authentication.
|
||||||
* There are some simple default method implementations to support simple authentication.
|
|
||||||
*
|
*
|
||||||
* @author Andy Hind
|
* @author Andy Hind
|
||||||
*/
|
*/
|
||||||
@ -50,7 +49,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
|
|
||||||
// Name of the system user
|
// Name of the system user
|
||||||
|
|
||||||
private static final String SYSTEM_USER_NAME = "System";
|
static final String SYSTEM_USER_NAME = "System";
|
||||||
|
|
||||||
private Boolean allowGuestLogin = null;
|
private Boolean allowGuestLogin = null;
|
||||||
|
|
||||||
@ -64,6 +63,23 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
this.allowGuestLogin = allowGuestLogin;
|
this.allowGuestLogin = allowGuestLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void authenticate(String userName, char[] password) throws AuthenticationException
|
||||||
|
{
|
||||||
|
if ((userName != null) && (userName.equalsIgnoreCase(PermissionService.GUEST_AUTHORITY)))
|
||||||
|
{
|
||||||
|
setGuestUserAsCurrentUser();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
authenticateImpl(userName, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void authenticateImpl(String userName, char[] password)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explicitly set the current user to be authenticated.
|
* Explicitly set the current user to be authenticated.
|
||||||
*
|
*
|
||||||
@ -97,8 +113,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
ud = getUserDetails(userName);
|
ud = getUserDetails(userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(ud, "", ud
|
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(ud, "", ud.getAuthorities());
|
||||||
.getAuthorities());
|
|
||||||
auth.setDetails(ud);
|
auth.setDetails(ud);
|
||||||
auth.setAuthenticated(true);
|
auth.setAuthenticated(true);
|
||||||
return setCurrentAuthentication(auth);
|
return setCurrentAuthentication(auth);
|
||||||
@ -133,28 +148,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
*/
|
*/
|
||||||
public Authentication setCurrentAuthentication(Authentication authentication)
|
public Authentication setCurrentAuthentication(Authentication authentication)
|
||||||
{
|
{
|
||||||
if (authentication == null)
|
return AuthenticationUtil.setCurrentAuthentication(authentication);
|
||||||
{
|
|
||||||
clearCurrentSecurityContext();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Context context = ContextHolder.getContext();
|
|
||||||
SecureContext sc = null;
|
|
||||||
if ((context == null) || !(context instanceof SecureContext))
|
|
||||||
{
|
|
||||||
sc = new SecureContextImpl();
|
|
||||||
ContextHolder.setContext(sc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sc = (SecureContext) context;
|
|
||||||
}
|
|
||||||
authentication.setAuthenticated(true);
|
|
||||||
sc.setAuthentication(authentication);
|
|
||||||
return authentication;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,12 +159,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
*/
|
*/
|
||||||
public Authentication getCurrentAuthentication() throws AuthenticationException
|
public Authentication getCurrentAuthentication() throws AuthenticationException
|
||||||
{
|
{
|
||||||
Context context = ContextHolder.getContext();
|
return AuthenticationUtil.getCurrentAuthentication();
|
||||||
if ((context == null) || !(context instanceof SecureContext))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return ((SecureContext) context).getAuthentication();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,12 +170,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
*/
|
*/
|
||||||
public String getCurrentUserName() throws AuthenticationException
|
public String getCurrentUserName() throws AuthenticationException
|
||||||
{
|
{
|
||||||
Context context = ContextHolder.getContext();
|
return AuthenticationUtil.getCurrentUserName();
|
||||||
if ((context == null) || !(context instanceof SecureContext))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return getUserName(((SecureContext) context).getAuthentication());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,7 +275,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
*/
|
*/
|
||||||
public void clearCurrentSecurityContext()
|
public void clearCurrentSecurityContext()
|
||||||
{
|
{
|
||||||
ContextHolder.setContext(null);
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,7 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent
|
|||||||
/**
|
/**
|
||||||
* Authenticate
|
* Authenticate
|
||||||
*/
|
*/
|
||||||
public void authenticate(String userName, char[] password) throws AuthenticationException
|
protected void authenticateImpl(String userName, char[] password) throws AuthenticationException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -234,6 +234,11 @@ public class AuthenticationTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGuest()
|
||||||
|
{
|
||||||
|
authenticationService.authenticate("GUEST", "".toCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
public void testCreateUsers()
|
public void testCreateUsers()
|
||||||
{
|
{
|
||||||
authenticationService.createAuthentication("GUEST", "".toCharArray());
|
authenticationService.createAuthentication("GUEST", "".toCharArray());
|
||||||
|
@ -139,6 +139,13 @@ public abstract class AuthenticationUtil
|
|||||||
* Authentication
|
* Authentication
|
||||||
*/
|
*/
|
||||||
public static Authentication setCurrentAuthentication(Authentication authentication)
|
public static Authentication setCurrentAuthentication(Authentication authentication)
|
||||||
|
{
|
||||||
|
if (authentication == null)
|
||||||
|
{
|
||||||
|
clearCurrentSecurityContext();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Context context = ContextHolder.getContext();
|
Context context = ContextHolder.getContext();
|
||||||
SecureContext sc = null;
|
SecureContext sc = null;
|
||||||
@ -165,6 +172,7 @@ public abstract class AuthenticationUtil
|
|||||||
|
|
||||||
return authentication;
|
return authentication;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void logNDC(String userName)
|
public static void logNDC(String userName)
|
||||||
{
|
{
|
||||||
|
@ -34,8 +34,7 @@ import net.sf.acegisecurity.providers.encoding.BaseDigestPasswordEncoder;
|
|||||||
import org.apache.commons.codec.DecoderException;
|
import org.apache.commons.codec.DecoderException;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.codec.binary.Hex;
|
import org.apache.commons.codec.binary.Hex;
|
||||||
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
import cryptix.jce.provider.CryptixCrypto;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -62,7 +61,7 @@ public class MD4PasswordEncoderImpl extends BaseDigestPasswordEncoder implements
|
|||||||
}
|
}
|
||||||
catch (NoSuchAlgorithmException e)
|
catch (NoSuchAlgorithmException e)
|
||||||
{
|
{
|
||||||
Security.addProvider(new CryptixCrypto());
|
Security.addProvider(new BouncyCastleProvider());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class SimpleAcceptOrRejectAllAuthenticationComponentImpl extends Abstract
|
|||||||
this.accept = accept;
|
this.accept = accept;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void authenticate(String userName, char[] password) throws AuthenticationException
|
public void authenticateImpl(String userName, char[] password) throws AuthenticationException
|
||||||
{
|
{
|
||||||
if(accept)
|
if(accept)
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ public class JAASAuthenticationComponent extends AbstractAuthenticationComponent
|
|||||||
/**
|
/**
|
||||||
* Implement Authentication
|
* Implement Authentication
|
||||||
*/
|
*/
|
||||||
public void authenticate(String userName, char[] password) throws AuthenticationException
|
protected void authenticateImpl(String userName, char[] password) throws AuthenticationException
|
||||||
{
|
{
|
||||||
|
|
||||||
LoginContext lc;
|
LoginContext lc;
|
||||||
|
@ -62,7 +62,7 @@ public class LDAPAuthenticationComponentImpl extends AbstractAuthenticationCompo
|
|||||||
/**
|
/**
|
||||||
* Implement the authentication method
|
* Implement the authentication method
|
||||||
*/
|
*/
|
||||||
public void authenticate(String userName, char[] password) throws AuthenticationException
|
protected void authenticateImpl(String userName, char[] password) throws AuthenticationException
|
||||||
{
|
{
|
||||||
InitialDirContext ctx = null;
|
InitialDirContext ctx = null;
|
||||||
try
|
try
|
||||||
|
@ -507,7 +507,7 @@ public class NTLMAuthenticationComponentImpl extends AbstractAuthenticationCompo
|
|||||||
* @param password char[]
|
* @param password char[]
|
||||||
* @throws AuthenticationException
|
* @throws AuthenticationException
|
||||||
*/
|
*/
|
||||||
public void authenticate(String userName, char[] password) throws AuthenticationException
|
protected void authenticateImpl(String userName, char[] password) throws AuthenticationException
|
||||||
{
|
{
|
||||||
// Debug
|
// Debug
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user