mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Guest and LDAP progress
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2127 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -192,6 +192,9 @@
|
|||||||
<property name="authenticationManager">
|
<property name="authenticationManager">
|
||||||
<ref bean="authenticationManager" />
|
<ref bean="authenticationManager" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="allowGuestLogin">
|
||||||
|
<value>true</value>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
26
config/alfresco/bootstrap/alfrescoUserStore.xml
Normal file
26
config/alfresco/bootstrap/alfrescoUserStore.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"
|
||||||
|
xmlns:cm="http://www.alfresco.org/model/content/1.0"
|
||||||
|
xmlns:sys="http://www.alfresco.org/model/system/1.0"
|
||||||
|
xmlns:usr="http://www.alfresco.org/model/user/1.0"
|
||||||
|
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
||||||
|
|
||||||
|
<sys:container view:childName="${alfresco_user_store.system_container.childname}">
|
||||||
|
<sys:children>
|
||||||
|
<sys:container view:childName="${alfresco_user_store.user_container.childname}">
|
||||||
|
<sys:children>
|
||||||
|
<usr:user view:childName="usr:user">
|
||||||
|
<usr:username>admin</usr:username>
|
||||||
|
<usr:password>209c6174da490caeb422f3fa5a7ae634</usr:password>
|
||||||
|
<usr:enabled>true</usr:enabled>
|
||||||
|
<usr:accountExpires>false</usr:accountExpires>
|
||||||
|
<usr:credentialsExpire>false</usr:credentialsExpire>
|
||||||
|
<usr:accountLocked>false</usr:accountLocked>
|
||||||
|
</usr:user>
|
||||||
|
</sys:children>
|
||||||
|
</sys:container>
|
||||||
|
<sys:container view:childName="${alfresco_user_store.authorities_container.childname}">
|
||||||
|
</sys:container>
|
||||||
|
</sys:children>
|
||||||
|
</sys:container>
|
||||||
|
|
||||||
|
</view:view>
|
@@ -5,6 +5,12 @@
|
|||||||
<!-- NOTE: all replaced properties referenced from repository.properties file must also be
|
<!-- NOTE: all replaced properties referenced from repository.properties file must also be
|
||||||
mapped in the application-context.xml importerBootstrap/configuration section -->
|
mapped in the application-context.xml importerBootstrap/configuration section -->
|
||||||
<cm:folder view:childName="${spaces.company_home.childname}">
|
<cm:folder view:childName="${spaces.company_home.childname}">
|
||||||
|
<view:acl view:inherit="false">
|
||||||
|
<view:ace view:access="ALLOWED">
|
||||||
|
<view:authority>GROUP_EVERYONE</view:authority>
|
||||||
|
<view:permission>Read</view:permission>
|
||||||
|
</view:ace>
|
||||||
|
</view:acl>
|
||||||
<app:uifacets />
|
<app:uifacets />
|
||||||
<cm:name>${spaces.company_home.name}</cm:name>
|
<cm:name>${spaces.company_home.name}</cm:name>
|
||||||
<app:icon>space-icon-default</app:icon>
|
<app:icon>space-icon-default</app:icon>
|
||||||
@@ -41,6 +47,23 @@
|
|||||||
</cm:folder>
|
</cm:folder>
|
||||||
</cm:contains>
|
</cm:contains>
|
||||||
</cm:folder>
|
</cm:folder>
|
||||||
|
<cm:folder view:childName="${spaces.guest_home.childname}">
|
||||||
|
<view:acl view:inherit="false">
|
||||||
|
<view:ace view:access="ALLOWED">
|
||||||
|
<view:authority>Guest</view:authority>
|
||||||
|
<view:permission>Read</view:permission>
|
||||||
|
</view:ace>
|
||||||
|
<view:ace view:access="ALLOWED">
|
||||||
|
<view:authority>GROUP_EVERYONE</view:authority>
|
||||||
|
<view:permission>Read</view:permission>
|
||||||
|
</view:ace>
|
||||||
|
</view:acl>
|
||||||
|
<app:uifacets />
|
||||||
|
<cm:name>${spaces.guest_home.name}</cm:name>
|
||||||
|
<app:icon>space-icon-default</app:icon>
|
||||||
|
<cm:title>${spaces.guest_home.name}</cm:title>
|
||||||
|
<cm:description>${spaces.guest_home.description}</cm:description>
|
||||||
|
</cm:folder>
|
||||||
</cm:contains>
|
</cm:contains>
|
||||||
</cm:folder>
|
</cm:folder>
|
||||||
|
|
||||||
|
31
config/alfresco/bootstrap/system.xml
Normal file
31
config/alfresco/bootstrap/system.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"
|
||||||
|
xmlns:cm="http://www.alfresco.org/model/content/1.0"
|
||||||
|
xmlns:sys="http://www.alfresco.org/model/system/1.0"
|
||||||
|
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
||||||
|
|
||||||
|
<sys:container view:childName="${system.system_container.childname}">
|
||||||
|
<sys:children>
|
||||||
|
<sys:container view:childName="${system.people_container.childname}">
|
||||||
|
<sys:children>
|
||||||
|
<cm:person view:childName="cm:person">
|
||||||
|
<cm:userName>admin</cm:userName>
|
||||||
|
<cm:firstName>Administrator</cm:firstName>
|
||||||
|
<cm:lastName></cm:lastName>
|
||||||
|
<cm:email></cm:email>
|
||||||
|
<cm:organizationId></cm:organizationId>
|
||||||
|
<cm:homeFolder>/${spaces.company_home.childname}</cm:homeFolder>
|
||||||
|
</cm:person>
|
||||||
|
<cm:person view:childName="cm:person">
|
||||||
|
<cm:userName>Guest</cm:userName>
|
||||||
|
<cm:firstName>Guest</cm:firstName>
|
||||||
|
<cm:lastName></cm:lastName>
|
||||||
|
<cm:email></cm:email>
|
||||||
|
<cm:organizationId></cm:organizationId>
|
||||||
|
<cm:homeFolder>/${spaces.company_home.childname}/${spaces.guest_home.childname}</cm:homeFolder>
|
||||||
|
</cm:person>
|
||||||
|
</sys:children>
|
||||||
|
</sys:container>
|
||||||
|
</sys:children>
|
||||||
|
</sys:container>
|
||||||
|
|
||||||
|
</view:view>
|
@@ -2,12 +2,14 @@
|
|||||||
xmlns:cm="http://www.alfresco.org/model/content/1.0"
|
xmlns:cm="http://www.alfresco.org/model/content/1.0"
|
||||||
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
||||||
|
|
||||||
|
<!--
|
||||||
<cm:folder>
|
<cm:folder>
|
||||||
<app:uifacets />
|
<app:uifacets />
|
||||||
<cm:name>${tutorial.space.name}</cm:name>
|
<cm:name>${tutorial.space.name}</cm:name>
|
||||||
<cm:description>${tutorial.space.description}</cm:description>
|
<cm:description>${tutorial.space.description}</cm:description>
|
||||||
<app:icon>space-icon-doc</app:icon>
|
<app:icon>space-icon-doc</app:icon>
|
||||||
<cm:contains>
|
<cm:contains>
|
||||||
|
-->
|
||||||
<cm:content>
|
<cm:content>
|
||||||
<app:uifacets />
|
<app:uifacets />
|
||||||
<cm:name>${tutorial.document.name}</cm:name>
|
<cm:name>${tutorial.document.name}</cm:name>
|
||||||
@@ -15,7 +17,9 @@
|
|||||||
<cm:description>${tutorial.document.description}</cm:description>
|
<cm:description>${tutorial.document.description}</cm:description>
|
||||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/${tutorial.document.name}|mimetype=application/pdf|size=|encoding=</cm:content>
|
<cm:content>contentUrl=classpath:alfresco/bootstrap/${tutorial.document.name}|mimetype=application/pdf|size=|encoding=</cm:content>
|
||||||
</cm:content>
|
</cm:content>
|
||||||
|
<!--
|
||||||
</cm:contains>
|
</cm:contains>
|
||||||
</cm:folder>
|
</cm:folder>
|
||||||
|
-->
|
||||||
|
|
||||||
</view:view>
|
</view:view>
|
||||||
|
@@ -709,7 +709,53 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="importerBootstrap" class="org.alfresco.repo.importer.ImporterBootstrap" init-method="bootstrap" depends-on="systemBootstrap">
|
|
||||||
|
<bean id="alfrescoUserStoreBootstrap" class="org.alfresco.repo.importer.ImporterBootstrap" init-method="bootstrap" depends-on="systemBootstrap">
|
||||||
|
<property name="transactionService">
|
||||||
|
<ref bean="transactionComponent"/>
|
||||||
|
</property>
|
||||||
|
<property name="nodeService">
|
||||||
|
<ref bean="nodeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="importerService">
|
||||||
|
<ref bean="importerComponent"/>
|
||||||
|
</property>
|
||||||
|
<property name="namespaceService">
|
||||||
|
<ref bean="namespaceService"/>
|
||||||
|
</property>
|
||||||
|
<property name="authenticationComponent">
|
||||||
|
<ref bean="authenticationComponent" />
|
||||||
|
</property>
|
||||||
|
<property name="storeUrl">
|
||||||
|
<value>${alfresco_user_store.store}</value>
|
||||||
|
</property>
|
||||||
|
<property name="allowWrite">
|
||||||
|
<value>${server.transaction.allow-writes}</value>
|
||||||
|
</property>
|
||||||
|
<property name="configuration">
|
||||||
|
<props>
|
||||||
|
<prop key="alfresco_user_store.system_container.childname">${alfresco_user_store.system_container.childname}</prop>
|
||||||
|
<prop key="alfresco_user_store.user_container.childname">${alfresco_user_store.user_container.childname}</prop>
|
||||||
|
<prop key="alfresco_user_store.authorities_container.childname">${alfresco_user_store.authorities_container.childname}</prop>
|
||||||
|
</props>
|
||||||
|
</property>
|
||||||
|
<!-- To specify a locale other than the system default, uncomment the following
|
||||||
|
<property name="locale">
|
||||||
|
<value>en_GB</value>
|
||||||
|
</property>
|
||||||
|
-->
|
||||||
|
<property name="bootstrapViews">
|
||||||
|
<list>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/alfrescoUserStore.xml</prop>
|
||||||
|
</props>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
<bean id="importerBootstrap" class="org.alfresco.repo.importer.ImporterBootstrap" init-method="bootstrap" depends-on="alfrescoUserStoreBootstrap">
|
||||||
<property name="transactionService">
|
<property name="transactionService">
|
||||||
<ref bean="transactionComponent"/>
|
<ref bean="transactionComponent"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -734,6 +780,9 @@
|
|||||||
<property name="configuration">
|
<property name="configuration">
|
||||||
<props>
|
<props>
|
||||||
<prop key="spaces.company_home.childname">${spaces.company_home.childname}</prop>
|
<prop key="spaces.company_home.childname">${spaces.company_home.childname}</prop>
|
||||||
|
<prop key="spaces.guest_home.childname">${spaces.guest_home.childname}</prop>
|
||||||
|
<prop key="system.system_container.childname">${system.system_container.childname}</prop>
|
||||||
|
<prop key="system.people_container.childname">${system.people_container.childname}</prop>
|
||||||
<prop key="spaces.dictionary.childname">${spaces.dictionary.childname}</prop>
|
<prop key="spaces.dictionary.childname">${spaces.dictionary.childname}</prop>
|
||||||
<prop key="spaces.templates.childname">${spaces.templates.childname}</prop>
|
<prop key="spaces.templates.childname">${spaces.templates.childname}</prop>
|
||||||
<prop key="spaces.templates.content.childname">${spaces.templates.content.childname}</prop>
|
<prop key="spaces.templates.content.childname">${spaces.templates.content.childname}</prop>
|
||||||
@@ -757,7 +806,11 @@
|
|||||||
<prop key="messages">alfresco/messages/bootstrap-spaces</prop>
|
<prop key="messages">alfresco/messages/bootstrap-spaces</prop>
|
||||||
</props>
|
</props>
|
||||||
<props>
|
<props>
|
||||||
<prop key="path">/${spaces.company_home.childname}</prop>
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/system.xml</prop>
|
||||||
|
</props>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/${spaces.company_home.childname}/${spaces.guest_home.childname}</prop>
|
||||||
<prop key="location">alfresco/bootstrap/tutorial.xml</prop>
|
<prop key="location">alfresco/bootstrap/tutorial.xml</prop>
|
||||||
<prop key="messages">alfresco/messages/bootstrap-tutorial</prop>
|
<prop key="messages">alfresco/messages/bootstrap-tutorial</prop>
|
||||||
</props>
|
</props>
|
||||||
|
@@ -14,3 +14,6 @@ spaces.templates.content.description=Content templates
|
|||||||
|
|
||||||
spaces.savedsearches.name=Saved Searches
|
spaces.savedsearches.name=Saved Searches
|
||||||
spaces.savedsearches.description=Saved Searches
|
spaces.savedsearches.description=Saved Searches
|
||||||
|
|
||||||
|
spaces.guest_home.name=Guest Home
|
||||||
|
spaces.guest_home.description=The guest root space
|
||||||
|
@@ -62,15 +62,30 @@ mail.password=
|
|||||||
system.store=system://system
|
system.store=system://system
|
||||||
system.descriptor.childname=sys:descriptor
|
system.descriptor.childname=sys:descriptor
|
||||||
|
|
||||||
|
# User config
|
||||||
|
|
||||||
|
alfresco_user_store.store=user://alfrescoUserStore
|
||||||
|
alfresco_user_store.system_container.childname=sys:system
|
||||||
|
alfresco_user_store.user_container.childname=sys:people
|
||||||
|
alfresco_user_store.authorities_container.childname=sys:authorities
|
||||||
|
|
||||||
# Spaces Configuration
|
# Spaces Configuration
|
||||||
|
|
||||||
spaces.store=workspace://SpacesStore
|
spaces.store=workspace://SpacesStore
|
||||||
spaces.company_home.childname=app:company_home
|
spaces.company_home.childname=app:company_home
|
||||||
|
spaces.guest_home.childname=app:guest_home
|
||||||
spaces.dictionary.childname=app:dictionary
|
spaces.dictionary.childname=app:dictionary
|
||||||
spaces.templates.childname=app:space_templates
|
spaces.templates.childname=app:space_templates
|
||||||
spaces.templates.content.childname=app:content_templates
|
spaces.templates.content.childname=app:content_templates
|
||||||
spaces.savedsearches.childname=app:saved_searches
|
spaces.savedsearches.childname=app:saved_searches
|
||||||
|
|
||||||
|
# Folders for storing people
|
||||||
|
|
||||||
|
system.system_container.childname=sys:system
|
||||||
|
system.people_container.childname=sys:people
|
||||||
|
|
||||||
# Are user names case sensitive?
|
# Are user names case sensitive?
|
||||||
|
|
||||||
user.name.caseSensitive=false
|
user.name.caseSensitive=false
|
||||||
|
|
||||||
|
|
||||||
|
29
source/java/org/alfresco/repo/importer/ExportSource.java
Normal file
29
source/java/org/alfresco/repo/importer/ExportSource.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* 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.importer;
|
||||||
|
|
||||||
|
import org.dom4j.io.XMLWriter;
|
||||||
|
|
||||||
|
public interface ExportSource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Generate XML suitable for use with the importer.
|
||||||
|
*
|
||||||
|
* @param writer
|
||||||
|
*/
|
||||||
|
public void generateExport(XMLWriter writer);
|
||||||
|
}
|
114
source/java/org/alfresco/repo/importer/ExportSourceImporter.java
Normal file
114
source/java/org/alfresco/repo/importer/ExportSourceImporter.java
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* 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.importer;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.Writer;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.alfresco.service.cmr.view.ImporterBinding;
|
||||||
|
import org.alfresco.service.cmr.view.ImporterService;
|
||||||
|
import org.alfresco.service.cmr.view.Location;
|
||||||
|
import org.alfresco.util.TempFileProvider;
|
||||||
|
import org.dom4j.io.OutputFormat;
|
||||||
|
import org.dom4j.io.XMLWriter;
|
||||||
|
|
||||||
|
public class ExportSourceImporter implements ImporterJobSPI
|
||||||
|
{
|
||||||
|
private ImporterService importerService;
|
||||||
|
|
||||||
|
private ExportSource exportSource;
|
||||||
|
|
||||||
|
private StoreRef storeRef;
|
||||||
|
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
public ExportSourceImporter()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImporterService(ImporterService importerService)
|
||||||
|
{
|
||||||
|
this.importerService = importerService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExportSource(ExportSource exportSource)
|
||||||
|
{
|
||||||
|
this.exportSource = exportSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doImport()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File tempFile = TempFileProvider.createTempFile("ExportSourceImporter-", ".xml");
|
||||||
|
Writer writer = new BufferedWriter(new FileWriter(tempFile));
|
||||||
|
XMLWriter xmlWriter = createXMLExporter(writer);
|
||||||
|
exportSource.generateExport(xmlWriter);
|
||||||
|
xmlWriter.close();
|
||||||
|
|
||||||
|
Reader reader = new BufferedReader(new FileReader(tempFile));
|
||||||
|
|
||||||
|
Location location = new Location(storeRef);
|
||||||
|
location.setPath(path);
|
||||||
|
|
||||||
|
importerService.importView(reader, location, REPLACE_BINDING, null);
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
catch (IOException io)
|
||||||
|
{
|
||||||
|
throw new ExportSourceImporterException("Failed to import", io);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private XMLWriter createXMLExporter(Writer writer)
|
||||||
|
{
|
||||||
|
// Define output format
|
||||||
|
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||||
|
format.setNewLineAfterDeclaration(false);
|
||||||
|
format.setIndentSize(3);
|
||||||
|
format.setEncoding("UTF-8");
|
||||||
|
|
||||||
|
// Construct an XML Exporter
|
||||||
|
|
||||||
|
XMLWriter xmlWriter = new XMLWriter(writer, format);
|
||||||
|
return xmlWriter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ImporterBinding REPLACE_BINDING = new ImporterBinding()
|
||||||
|
{
|
||||||
|
|
||||||
|
public UUID_BINDING getUUIDBinding()
|
||||||
|
{
|
||||||
|
return UUID_BINDING.REPLACE_EXISTING;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue(String key)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* 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.importer;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
|
||||||
|
public class ExportSourceImporterException extends AlfrescoRuntimeException
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment for <code>serialVersionUID</code>
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -2366069362776024153L;
|
||||||
|
|
||||||
|
public ExportSourceImporterException(String msgId)
|
||||||
|
{
|
||||||
|
super(msgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExportSourceImporterException(String msgId, Object[] msgParams)
|
||||||
|
{
|
||||||
|
super(msgId, msgParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExportSourceImporterException(String msgId, Throwable cause)
|
||||||
|
{
|
||||||
|
super(msgId, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExportSourceImporterException(String msgId, Object[] msgParams, Throwable cause)
|
||||||
|
{
|
||||||
|
super(msgId, msgParams, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -569,7 +569,7 @@ public class ImporterComponent
|
|||||||
searchParameters.addStore(importedRef.context.getNodeRef().getStoreRef());
|
searchParameters.addStore(importedRef.context.getNodeRef().getStoreRef());
|
||||||
searchParameters.setLanguage(SearchService.LANGUAGE_LUCENE);
|
searchParameters.setLanguage(SearchService.LANGUAGE_LUCENE);
|
||||||
searchParameters.setQuery("PATH:\"" + importedRef.value + "\"");
|
searchParameters.setQuery("PATH:\"" + importedRef.value + "\"");
|
||||||
searchParameters.excludeDataInTheCurrentTransaction(true);
|
searchParameters.excludeDataInTheCurrentTransaction(false);
|
||||||
ResultSet resultSet = searchService.query(searchParameters);
|
ResultSet resultSet = searchService.query(searchParameters);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
40
source/java/org/alfresco/repo/importer/ImporterJob.java
Normal file
40
source/java/org/alfresco/repo/importer/ImporterJob.java
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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.importer;
|
||||||
|
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
|
||||||
|
public class ImporterJob implements Job
|
||||||
|
{
|
||||||
|
public ImporterJob()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute(JobExecutionContext executionContext) throws JobExecutionException
|
||||||
|
{
|
||||||
|
ImporterJobSPI importerJob = (ImporterJobSPI) executionContext.getJobDetail().getJobDataMap()
|
||||||
|
.get("bean");
|
||||||
|
if (importerJob != null)
|
||||||
|
{
|
||||||
|
importerJob.doImport();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
22
source/java/org/alfresco/repo/importer/ImporterJobSPI.java
Normal file
22
source/java/org/alfresco/repo/importer/ImporterJobSPI.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* 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.importer;
|
||||||
|
|
||||||
|
public interface ImporterJobSPI
|
||||||
|
{
|
||||||
|
public void doImport();
|
||||||
|
}
|
@@ -81,7 +81,7 @@ import org.apache.lucene.search.TermQuery;
|
|||||||
* behaviour if used on its own.
|
* behaviour if used on its own.
|
||||||
*
|
*
|
||||||
* @author andyh
|
* @author andyh
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LuceneIndexerImpl extends LuceneBase implements LuceneIndexer
|
public class LuceneIndexerImpl extends LuceneBase implements LuceneIndexer
|
||||||
{
|
{
|
||||||
|
@@ -3128,6 +3128,7 @@ public class LuceneTest extends TestCase
|
|||||||
ResultSet results = test.serviceRegistry.getSearchService().query(sp);
|
ResultSet results = test.serviceRegistry.getSearchService().query(sp);
|
||||||
|
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
|
//test.dictionaryService.getType(test.nodeService.getType(test.rootNodeRef)).getDefaultAspects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.alfresco.repo.security.authentication;
|
package org.alfresco.repo.security.authentication;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
|
||||||
import net.sf.acegisecurity.Authentication;
|
import net.sf.acegisecurity.Authentication;
|
||||||
import net.sf.acegisecurity.GrantedAuthority;
|
import net.sf.acegisecurity.GrantedAuthority;
|
||||||
@@ -30,11 +31,9 @@ import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
|||||||
import net.sf.acegisecurity.providers.dao.User;
|
import net.sf.acegisecurity.providers.dao.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class abstract the support required to set up and query the Acegi
|
* This class abstract the support required to set up and query the Acegi context for security enforcement.
|
||||||
* context for security enforcement.
|
|
||||||
*
|
*
|
||||||
* There are some simple default method implementations to support simple
|
* There are some simple default method implementations to support simple authentication.
|
||||||
* authentication.
|
|
||||||
*
|
*
|
||||||
* @author Andy Hind
|
* @author Andy Hind
|
||||||
*/
|
*/
|
||||||
@@ -45,11 +44,18 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
|
|
||||||
private static final String SYSTEM_USER_NAME = "System";
|
private static final String SYSTEM_USER_NAME = "System";
|
||||||
|
|
||||||
|
private Boolean allowGuestLogin = null;
|
||||||
|
|
||||||
public AbstractAuthenticationComponent()
|
public AbstractAuthenticationComponent()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAllowGuestLogin(Boolean allowGuestLogin)
|
||||||
|
{
|
||||||
|
this.allowGuestLogin = allowGuestLogin;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explicitly set the current user to be authenticated.
|
* Explicitly set the current user to be authenticated.
|
||||||
*
|
*
|
||||||
@@ -59,11 +65,11 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
*/
|
*/
|
||||||
public Authentication setCurrentUser(String userName) throws AuthenticationException
|
public Authentication setCurrentUser(String userName) throws AuthenticationException
|
||||||
{
|
{
|
||||||
if(userName == null)
|
if (userName == null)
|
||||||
{
|
{
|
||||||
throw new AuthenticationException("Null user name");
|
throw new AuthenticationException("Null user name");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UserDetails ud = null;
|
UserDetails ud = null;
|
||||||
@@ -73,6 +79,11 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
gas[0] = new GrantedAuthorityImpl("ROLE_SYSTEM");
|
gas[0] = new GrantedAuthorityImpl("ROLE_SYSTEM");
|
||||||
ud = new User(SYSTEM_USER_NAME, "", true, true, true, true, gas);
|
ud = new User(SYSTEM_USER_NAME, "", true, true, true, true, gas);
|
||||||
}
|
}
|
||||||
|
else if (userName.equals(PermissionService.GUEST))
|
||||||
|
{
|
||||||
|
GrantedAuthority[] gas = new GrantedAuthority[0];
|
||||||
|
ud = new User(PermissionService.GUEST, "", true, true, true, true, gas);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ud = getUserDetails(userName);
|
ud = getUserDetails(userName);
|
||||||
@@ -199,6 +210,46 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
return SYSTEM_USER_NAME;
|
return SYSTEM_USER_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the Guest User
|
||||||
|
*/
|
||||||
|
public String getGuestUserName()
|
||||||
|
{
|
||||||
|
return PermissionService.GUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the guest user as the current user.
|
||||||
|
*/
|
||||||
|
public Authentication setGuestUserAsCurrentUser() throws AuthenticationException
|
||||||
|
{
|
||||||
|
if (allowGuestLogin == null)
|
||||||
|
{
|
||||||
|
if(implementationAllowsGuestLogin())
|
||||||
|
{
|
||||||
|
return setCurrentUser(PermissionService.GUEST);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AuthenticationException("Guest authentication is not allowed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(allowGuestLogin.booleanValue())
|
||||||
|
{
|
||||||
|
return setCurrentUser(PermissionService.GUEST);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AuthenticationException("Guest authentication is not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract boolean implementationAllowsGuestLogin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the current security information
|
* Remove the current security information
|
||||||
*/
|
*/
|
||||||
@@ -224,8 +275,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the NTML mode - none - supports MD4 hash to integrate - or it can
|
* Get the NTML mode - none - supports MD4 hash to integrate - or it can asct as an NTLM authentication
|
||||||
* asct as an NTLM authentication
|
|
||||||
*/
|
*/
|
||||||
public NTLMMode getNTLMMode()
|
public NTLMMode getNTLMMode()
|
||||||
{
|
{
|
||||||
|
@@ -72,6 +72,14 @@ public interface AuthenticationComponent
|
|||||||
public Authentication setSystemUserAsCurrentUser();
|
public Authentication setSystemUserAsCurrentUser();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the guest user as the current user.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Authentication setGuestUserAsCurrentUser();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the system user
|
* Get the name of the system user
|
||||||
*
|
*
|
||||||
@@ -79,6 +87,14 @@ public interface AuthenticationComponent
|
|||||||
*/
|
*/
|
||||||
public String getSystemUserName();
|
public String getSystemUserName();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the guest user
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getGuestUserName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current user name.
|
* Get the current user name.
|
||||||
*
|
*
|
||||||
|
@@ -96,5 +96,12 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent
|
|||||||
{
|
{
|
||||||
return NTLMMode.MD4_PROVIDER;
|
return NTLMMode.MD4_PROVIDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean implementationAllowsGuestLogin()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -147,4 +147,10 @@ public class AuthenticationServiceImpl implements AuthenticationService
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void authenticateAsGuest() throws AuthenticationException
|
||||||
|
{
|
||||||
|
authenticationComponent.setGuestUserAsCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -751,6 +751,12 @@ public class AuthenticationTest extends TestCase
|
|||||||
// assertNull(dao.getUserOrNull("Andy"));
|
// assertNull(dao.getUserOrNull("Andy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAbstractAuthenticationComponentGuestUserSupport()
|
||||||
|
{
|
||||||
|
authenticationComponent.setGuestUserAsCurrentUser();
|
||||||
|
assertEquals(authenticationComponent.getCurrentUserName(), authenticationComponent.getGuestUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testPassThroughLogin()
|
public void testPassThroughLogin()
|
||||||
{
|
{
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.security.authentication;
|
package org.alfresco.repo.security.authentication;
|
||||||
|
|
||||||
|
import net.sf.acegisecurity.Authentication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation of an AuthenticationComponent can be configured to accept or reject all attempts to login.
|
* This implementation of an AuthenticationComponent can be configured to accept or reject all attempts to login.
|
||||||
*
|
*
|
||||||
@@ -54,4 +56,12 @@ public class SimpleAcceptOrRejectAllAuthenticationComponentImpl extends Abstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean implementationAllowsGuestLogin()
|
||||||
|
{
|
||||||
|
return accept;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1003,8 +1003,8 @@ public class PermissionServiceImpl implements PermissionServiceSPI, Initializing
|
|||||||
|
|
||||||
// Default deny
|
// Default deny
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -186,7 +186,7 @@ public class PersonServiceImpl implements PersonService
|
|||||||
{
|
{
|
||||||
HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
||||||
properties.put(ContentModel.PROP_USERNAME, userName);
|
properties.put(ContentModel.PROP_USERNAME, userName);
|
||||||
properties.put(ContentModel.PROP_HOMEFOLDER, getCompanyHome());
|
properties.put(ContentModel.PROP_HOMEFOLDER, getHomeFolder());
|
||||||
properties.put(ContentModel.PROP_FIRSTNAME, userName);
|
properties.put(ContentModel.PROP_FIRSTNAME, userName);
|
||||||
properties.put(ContentModel.PROP_LASTNAME, "");
|
properties.put(ContentModel.PROP_LASTNAME, "");
|
||||||
properties.put(ContentModel.PROP_EMAIL, "");
|
properties.put(ContentModel.PROP_EMAIL, "");
|
||||||
@@ -194,6 +194,11 @@ public class PersonServiceImpl implements PersonService
|
|||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NodeRef getHomeFolder()
|
||||||
|
{
|
||||||
|
return getCompanyHome();
|
||||||
|
}
|
||||||
|
|
||||||
public NodeRef createPerson(Map<QName, Serializable> properties)
|
public NodeRef createPerson(Map<QName, Serializable> properties)
|
||||||
{
|
{
|
||||||
String caseSensitiveUserName = DefaultTypeConverter.INSTANCE.convert(String.class, properties
|
String caseSensitiveUserName = DefaultTypeConverter.INSTANCE.convert(String.class, properties
|
||||||
|
@@ -90,6 +90,13 @@ public interface AuthenticationService
|
|||||||
*/
|
*/
|
||||||
public void authenticate(String userName, char[] password) throws AuthenticationException;
|
public void authenticate(String userName, char[] password) throws AuthenticationException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authenticate as the guest user. This may not be allowed and throw an exception.
|
||||||
|
*
|
||||||
|
* @throws AuthenticationException
|
||||||
|
*/
|
||||||
|
public void authenticateAsGuest() throws AuthenticationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the currently authenticated user.
|
* Get the name of the currently authenticated user.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user