Author: shane.bryzak(a)jboss.com
Date: 2008-01-20 01:43:40 -0500 (Sun, 20 Jan 2008)
New Revision: 7159
Removed:
trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/Register.java
Modified:
trunk/examples/seamspace/
trunk/examples/seamspace/resources/WEB-INF/pages.xml
trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java
trunk/examples/seamspace/view/register.xhtml
Log:
JBSEAM-2495
Property changes on: trunk/examples/seamspace
___________________________________________________________________
Name: svn:ignore
+ build
dist
exploded-archives
Modified: trunk/examples/seamspace/resources/WEB-INF/pages.xml
===================================================================
--- trunk/examples/seamspace/resources/WEB-INF/pages.xml 2008-01-20 06:41:39 UTC (rev
7158)
+++ trunk/examples/seamspace/resources/WEB-INF/pages.xml 2008-01-20 06:43:40 UTC (rev
7159)
@@ -129,11 +129,11 @@
</redirect>
</exception>
- <exception class="org.jboss.seam.security.AuthorizationException">
+ <!--exception
class="org.jboss.seam.security.AuthorizationException">
<end-conversation/>
<redirect view-id="/security_error.xhtml">
<message severity="error">You do not have permission to do
this</message>
</redirect>
- </exception>
+ </exception-->
</pages>
Deleted: trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/Register.java
===================================================================
--- trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/Register.java 2008-01-20
06:41:39 UTC (rev 7158)
+++ trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/Register.java 2008-01-20
06:43:40 UTC (rev 7159)
@@ -1,30 +0,0 @@
-package org.jboss.seam.example.seamspace;
-
-import javax.ejb.Local;
-import javax.security.auth.login.LoginException;
-
-@Local
-public interface Register
-{
- void start();
- void next();
- void uploadPicture() throws LoginException;
- String getPassword();
- void setPassword(String password);
- String getConfirm();
- void setConfirm(String confirm);
- String getGender();
- void setGender(String gender);
-
- byte[] getPicture();
- void setPicture(byte[] picture);
-
- String getPictureContentType();
- void setPictureContentType(String contentType);
-
- boolean isVerified();
-
- void accountCreated(MemberAccount account);
-
- void destroy();
-}
Modified:
trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java
===================================================================
---
trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java 2008-01-20
06:41:39 UTC (rev 7158)
+++
trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java 2008-01-20
06:43:40 UTC (rev 7159)
@@ -1,9 +1,10 @@
package org.jboss.seam.example.seamspace;
+import static org.jboss.seam.ScopeType.CONVERSATION;
+
import java.util.Date;
import javax.ejb.Remove;
-import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import org.jboss.seam.annotations.Begin;
@@ -14,14 +15,16 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.security.Identity;
+import org.jboss.seam.security.RunAsOperation;
import org.jboss.seam.security.management.IdentityManager;
import org.jboss.seam.security.management.JpaIdentityStore;
-@Stateful
+@Scope(CONVERSATION)
@Name("register")
-public class RegisterAction implements Register
+public class RegisterAction
{
@In(required = false) @Out
private Member newMember;
@@ -95,13 +98,22 @@
@End
public void uploadPicture()
- {
- identityManager.createAccount(username, password);
- identityManager.grantRole(username, "user");
-
+ {
newMember.setMemberSince(new Date());
- entityManager.persist(newMember);
+ entityManager.persist(newMember);
+ new RunAsOperation() {
+ @Override
+ public String[] getRoles() {
+ return new String[] { "admin" };
+ }
+
+ public void execute() {
+ identityManager.createAccount(username, password);
+ identityManager.grantRole(username, "user");
+ }
+ }.run();
+
newAccount.setMember(newMember);
newAccount = entityManager.merge(newAccount);
Modified: trunk/examples/seamspace/view/register.xhtml
===================================================================
--- trunk/examples/seamspace/view/register.xhtml 2008-01-20 06:41:39 UTC (rev 7158)
+++ trunk/examples/seamspace/view/register.xhtml 2008-01-20 06:43:40 UTC (rev 7159)
@@ -48,7 +48,7 @@
<div class="formRow">
<h:outputLabel
for="username">Username<em>*</em></h:outputLabel>
- <h:inputText id="username"
value="#{newMember.username}" required="true"/>
+ <h:inputText id="username"
value="#{register.username}" required="true"/>
<div class="validationError"><h:message
for="username"/></div>
</div>
Show replies by date