Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #1208 from zanata/ZNTA-1174-fix-connect-OpenID
Browse files Browse the repository at this point in the history
fix(ZNTA-1174): add OpenID credentials, transactions not committed
  • Loading branch information
seanf authored Jun 29, 2016
2 parents 44b6d8a + ded1abf commit f9c0d88
Show file tree
Hide file tree
Showing 99 changed files with 595 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import javax.inject.Inject;
import org.zanata.seam.security.ZanataJpaIdentityStore;
import org.zanata.dao.AccountDAO;
import org.zanata.dao.PersonDAO;
import org.zanata.model.HAccount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
import javax.annotation.Nullable;
import javax.enterprise.context.SessionScoped;
import javax.annotation.PostConstruct;
import javax.enterprise.inject.Model;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.dao.AccountDAO;
import org.zanata.model.HAccount;
import org.zanata.security.AuthenticationManager;
Expand All @@ -50,7 +54,9 @@
* href="mailto:[email protected]">[email protected]</a>
*/
@Named("accountMergeAction")
@javax.faces.bean.ViewScoped
@ViewScoped
@Model
@Transactional
public class AccountMergeAction implements Serializable {

@SessionScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.Date;

import javax.enterprise.inject.Model;
import javax.faces.application.FacesMessage;

import org.apache.commons.lang.time.DateUtils;
Expand All @@ -46,6 +47,8 @@

@Named("activate")
@GroupedConversationScoped
@Model
@Transactional
public class ActivateAction implements Serializable {

private static final long serialVersionUID = -8079131168179421345L;
Expand Down Expand Up @@ -111,7 +114,7 @@ public void execute() {
facesMessages.addGlobal(FacesMessage.SEVERITY_INFO,
"Your account was successfully activated. You can now sign in.");

urlUtil.redirectTo(urlUtil.signInPage());
urlUtil.redirectToInternal(urlUtil.signInPage());
conversation.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import javax.enterprise.inject.Model;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.model.Activity;
import org.zanata.model.HAccount;
import org.zanata.security.annotations.Authenticated;
Expand All @@ -36,9 +39,10 @@
* @author Alex Eng <a href="mailto:[email protected]">[email protected]</a>
*/
@Named("activityAction")
@javax.faces.bean.ViewScoped

@ViewScoped
@CheckLoggedIn
@Model
@Transactional
public class ActivityAction implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@

import lombok.Getter;
import lombok.Setter;

import javax.enterprise.inject.Model;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.dao.DocumentDAO;
import org.zanata.dao.PersonDAO;
import org.zanata.dao.ProjectDAO;
Expand All @@ -39,7 +44,9 @@
*
**/
@Named("adminStatsAction")
@javax.faces.bean.ViewScoped
@ViewScoped
@Model
@Transactional
public class AdminStatsAction implements Serializable {
/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@
package org.zanata.action;

import org.apache.commons.lang.StringUtils;

import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Model;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.ApplicationConfiguration;

/**
Expand All @@ -34,7 +39,9 @@
* href="mailto:[email protected]">[email protected]</a>
*/
@Named("applicationConfigurationAction")
@javax.enterprise.context.Dependent
@Dependent
@Model
@Transactional
public class ApplicationConfigurationAction {
@Inject
private ApplicationConfiguration applicationConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import lombok.extern.slf4j.Slf4j;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Model;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.model.HAccount;
import org.zanata.model.HPerson;
import org.zanata.seam.framework.EntityHome;
Expand All @@ -38,6 +40,8 @@
*/
@Named("authenticatedAccountHome")
@RequestScoped
@Model
@Transactional
@Slf4j
public class AuthenticatedAccountHome extends EntityHome<HAccount>
implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@
import org.zanata.ui.faces.FacesMessages;

/**
* Some of the event observers are migrated from org.jboss.seam.security.FacesSecurityEvents
* Some of the event observers are migrated from org.jboss.seam.security.FacesSecurityEvents.
* Most of these events are fired by ZanataIdentity.
* @see org.zanata.security.ZanataIdentity
* @see org.zanata.security.SpNegoIdentity
* @see org.zanata.exception.handler.AccessDeniedExceptionHandler
* @see org.zanata.exception.handler.NotLoggedInExceptionHandler
*/
@Dependent
@Slf4j
// TODO get these event observers working again
public class AuthenticationEvents implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down
6 changes: 4 additions & 2 deletions zanata-war/src/main/java/org/zanata/action/Breadcrumbs.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import java.util.List;
import java.util.Map;

import javax.enterprise.inject.Model;
import javax.faces.bean.ViewScoped;
import javax.inject.Named;

@Named("breadcrumbs")

@javax.faces.bean.ViewScoped
@ViewScoped
@Model
public class Breadcrumbs implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

import java.io.Serializable;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Model;
import javax.faces.context.FacesContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
Expand All @@ -30,12 +32,16 @@

import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.servlet.annotations.HttpParam;
import org.zanata.model.HLocale;
import org.zanata.service.ConfigurationService;

@Named("configurationAction")
@javax.enterprise.context.RequestScoped
@RequestScoped
@Model
@Transactional
@Slf4j
public class ConfigurationAction implements Serializable {
private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.enterprise.inject.Model;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.security.annotations.Authenticated;
import org.zanata.security.annotations.CheckLoggedIn;
import org.zanata.security.annotations.CheckPermission;
Expand Down Expand Up @@ -54,9 +57,10 @@
* @author Alex Eng <a href="mailto:[email protected]">[email protected]</a>
*/
@Named("contactAdminAction")
@javax.faces.bean.ViewScoped
@ViewScoped
@Model
@Transactional
@Slf4j

public class ContactAdminAction implements Serializable {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.annotation.Nonnull;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Model;
import javax.faces.application.FacesMessage;

import javax.annotation.PostConstruct;
Expand All @@ -32,6 +33,7 @@

import org.apache.deltaspike.core.api.scope.ConversationGroup;
import org.apache.deltaspike.core.api.scope.GroupedConversationScoped;
import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.async.handle.CopyTransTaskHandle;
import org.zanata.dao.ProjectIterationDAO;
import org.zanata.i18n.Messages;
Expand All @@ -53,6 +55,8 @@
*/
@Named("copyTransAction")
@RequestScoped
@Model
@Transactional
public class CopyTransAction extends CopyAction implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import lombok.Setter;

import lombok.extern.slf4j.Slf4j;

import javax.enterprise.context.Dependent;
import javax.inject.Inject;
import javax.inject.Named;
import org.zanata.async.AsyncTaskHandle;
Expand All @@ -50,8 +52,7 @@
* href="mailto:[email protected]">[email protected]</a>
*/

@Named("copyTransManager")
@javax.enterprise.context.Dependent
@Dependent
@Slf4j
// TODO This class should be merged with the copy trans service (?)
public class CopyTransManager implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@

import java.io.Serializable;
import java.util.List;
import javax.enterprise.inject.Model;
import javax.faces.bean.ViewScoped;
import javax.persistence.EntityManager;

import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.i18n.Messages;
import org.zanata.model.HCopyTransOptions;
import org.zanata.service.impl.CopyTransOptionFactory;
Expand All @@ -45,8 +49,9 @@
* href="mailto:[email protected]">[email protected]</a>
*/
@Named("copyTransOptionsModel")
@javax.faces.bean.ViewScoped

@ViewScoped
@Model
@Transactional
public class CopyTransOptionsModel implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import javax.enterprise.context.Dependent;
import javax.inject.Inject;
import javax.inject.Named;
import org.zanata.async.AsyncTaskHandleManager;
Expand All @@ -20,8 +21,7 @@
* @author Alex Eng <a href="mailto:[email protected]">[email protected]</a>
*/

@Named("copyVersionManager")
@javax.enterprise.context.Dependent
@Dependent
@Slf4j
public class CopyVersionManager implements Serializable {
private static final long serialVersionUID = 3414395834255069870L;
Expand Down
10 changes: 8 additions & 2 deletions zanata-war/src/main/java/org/zanata/action/DashboardAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@
import com.google.common.collect.Collections2;
import lombok.NonNull;
import org.apache.commons.lang.StringUtils;

import javax.enterprise.inject.Model;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.zanata.seam.security.ZanataJpaIdentityStore;
import org.zanata.security.annotations.Authenticated;
import org.zanata.security.annotations.CheckLoggedIn;
Expand All @@ -58,9 +63,10 @@
import lombok.Getter;

@Named("dashboardAction")
@javax.faces.bean.ViewScoped

@ViewScoped
@CheckLoggedIn
@Model
@Transactional
public class DashboardAction implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package org.zanata.action;

import lombok.extern.slf4j.Slf4j;

import javax.enterprise.inject.Model;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.codehaus.jackson.map.ObjectMapper;
import org.zanata.model.HAccount;
import org.zanata.rest.dto.User;
Expand All @@ -18,9 +22,10 @@


@Named("glossaryAction")
@javax.faces.bean.ViewScoped
@ViewScoped
@CheckLoggedIn
@Slf4j
@Slf4j@Model
@Transactional
public class GlossaryAction implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down
Loading

0 comments on commit f9c0d88

Please sign in to comment.