Merged V2.2 to HEAD

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8386 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-02-26 19:02:20 +00:00
parent 218cb33e75
commit bbc2156235
3 changed files with 33 additions and 7 deletions

View File

@@ -149,6 +149,7 @@
<bean id="webscripts.authenticator.jsr168.webclient" class="org.alfresco.repo.web.scripts.portlet.WebClientPortletAuthenticatorFactory">
<property name="repository" ref="webscripts.repo" />
<property name="authenticationService" ref="AuthenticationService" />
<property name="transactionService" ref="TransactionService" />
</bean>
<!-- Facebook Authenticator -->

View File

@@ -27,11 +27,13 @@ package org.alfresco.repo.web.scripts.portlet;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.transaction.UserTransaction;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.web.scripts.Repository;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.web.app.servlet.AuthenticationHelper;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.scripts.Authenticator;
@@ -54,6 +56,7 @@ public class WebClientPortletAuthenticatorFactory implements PortletAuthenticato
// dependencies
private AuthenticationService authenticationService;
private TransactionService transactionService;
private Repository repository;
/**
@@ -72,6 +75,14 @@ public class WebClientPortletAuthenticatorFactory implements PortletAuthenticato
this.repository = repository;
}
/**
* @param transactionService
*/
public void setTransactionService(TransactionService transactionService)
{
this.transactionService = transactionService;
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.portlet.PortletAuthenticatorFactory#create(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
*/
@@ -173,6 +184,13 @@ public class WebClientPortletAuthenticatorFactory implements PortletAuthenticato
*/
private void createWebClientUser(PortletSession session)
{
UserTransaction tx = null;
try
{
// start a txn as this method interacts with public services
tx = transactionService.getUserTransaction();
tx.begin();
NodeRef personRef = repository.getPerson();
User user = new User(authenticationService.getCurrentUserName(), authenticationService.getCurrentTicket(), personRef);
NodeRef homeRef = repository.getUserHome(personRef);
@@ -181,6 +199,13 @@ public class WebClientPortletAuthenticatorFactory implements PortletAuthenticato
user.setHomeSpaceId(homeRef.getId());
}
session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user, PortletSession.APPLICATION_SCOPE);
tx.commit();
}
catch (Throwable e)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
/**

View File

@@ -34,7 +34,7 @@
<f:selectItem itemValue="existing" itemLabel="#{msg.website_create_existing}:" />
</h:selectOneRadio>
<h:panelGroup id="grp-1">
<f:verbatim><div style="height:180px;*height:184px;margin-left:28px;width:90%;overflow:auto" class='selectListTable'></f:verbatim>
<f:verbatim><div style="height:180px;*height:184px;margin-left:28px;width:90%;overflow-x:none;overflow-y:auto" class='selectListTable'></f:verbatim>
<a:selectList id="website-list" value="#{WizardManager.bean.sourceWebProject}" style="width:100%" itemStyleClass="selectListItem">
<a:listItems id="website-items" value="#{WizardManager.bean.webProjectsList}" cacheValue="false" />
</a:selectList>