rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpie...@apache.org
Subject svn commit: r1141931 - in /incubator/rave/trunk/rave-portal/src: main/java/org/apache/rave/portal/repository/ main/java/org/apache/rave/portal/repository/impl/ main/java/org/apache/rave/portal/service/ main/java/org/apache/rave/portal/service/impl/ mai...
Date Fri, 01 Jul 2011 13:17:07 GMT
Author: mpierce
Date: Fri Jul  1 13:17:06 2011
New Revision: 1141931

URL: http://svn.apache.org/viewvc?rev=1141931&view=rev
Log:
(RAVE-89) In-progress commits for basic user registration. Still need to confirm passwords,
provide default layouts, etc.

Added:
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java
    incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/NewAccountRequestReceived.jsp
    incubator/rave/trunk/rave-portal/src/main/webapp/newaccount.jsp
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/controller/NewAccountControllerTest.java
Modified:
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/UserRepository.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/impl/JpaUserRepository.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/UserService.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java
    incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext-security.xml
    incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/tags/rave_generic_page.tag

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/UserRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/UserRepository.java?rev=1141931&r1=1141930&r2=1141931&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/UserRepository.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/UserRepository.java
Fri Jul  1 13:17:06 2011
@@ -22,4 +22,4 @@ import org.apache.rave.portal.model.User
 
 public interface UserRepository extends Repository<User>{
     User getByUsername(String username);
-}
\ No newline at end of file
+}

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/impl/JpaUserRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/impl/JpaUserRepository.java?rev=1141931&r1=1141930&r2=1141931&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/impl/JpaUserRepository.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repository/impl/JpaUserRepository.java
Fri Jul  1 13:17:06 2011
@@ -23,12 +23,14 @@ import org.apache.commons.lang.NotImplem
 import org.apache.rave.portal.model.User;
 import org.apache.rave.portal.repository.UserRepository;
 import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
 import javax.persistence.TypedQuery;
 
 import static org.apache.rave.portal.repository.impl.util.JpaUtil.getSingleResult;
+import static org.apache.rave.portal.repository.impl.util.JpaUtil.saveOrUpdate;
 
 /**
  */
@@ -51,7 +53,9 @@ public class JpaUserRepository implement
     }
 
     @Override
-    public User save(User item) {
-        throw new NotImplementedException("Save is not implemented for this repository");
+	 @Transactional
+    public User save(User user) {
+		  return saveOrUpdate(user.getUserId(),manager,user);
+		  //        throw new NotImplementedException("Save is not implemented for this repository");
     }
 }

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/UserService.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/UserService.java?rev=1141931&r1=1141930&r2=1141931&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/UserService.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/UserService.java
Fri Jul  1 13:17:06 2011
@@ -41,4 +41,9 @@ public interface UserService extends Use
      * Un-sets the currently authenticated user
      */
     void clearAuthenticatedUser();
+
+	 /**
+	  * Registers a new user object.
+	  */
+	 void registerNewUser(User user);
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java?rev=1141931&r1=1141930&r2=1141931&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java
Fri Jul  1 13:17:06 2011
@@ -34,6 +34,7 @@ import org.springframework.security.core
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  *
@@ -106,4 +107,9 @@ public class DefaultUserService implemen
         });
         return securityContext;
     }
+
+	 @Override
+	 public void registerNewUser(User user) {
+		  userRepository.save(user);
+	 }
 }
\ No newline at end of file

Added: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java?rev=1141931&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java
(added)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/controller/NewAccountController.java
Fri Jul  1 13:17:06 2011
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.apache.rave.portal.web.controller;
+
+import org.apache.rave.portal.service.UserService;
+import org.apache.rave.portal.web.util.ModelKeys;
+import org.apache.rave.portal.web.util.ViewNames;
+import org.apache.rave.portal.model.User;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+//probably should be deleted
+import java.util.Random;
+
+@Controller
+@RequestMapping(value = { "/newaccount/*", "/newaccount" })
+public class NewAccountController {
+
+    private final UserService userService;
+
+    @Autowired
+    public NewAccountController(UserService userService) {
+        System.out.println("New Account Controller constructed");
+        this.userService = userService;
+    }
+
+    @RequestMapping(method = RequestMethod.GET)
+	 //Needs to be specified by action.
+    public String create(Model model, @RequestParam String userName, @RequestParam String
password) {
+        // Must be implemented
+								 
+								 System.out.println("===============Creating New Account================");
+								 System.out.println("Username and password:"+userName+" "+password);
+								 User user=new User();
+								 user.setUsername(userName);
+								 user.setPassword(password);
+								 user.setExpired(false);
+								 user.setLocked(false);
+								 user.setEnabled(true);
+								 userService.registerNewUser(user);
+								 
+        return "redirect:login.jsp";
+    }
+		  
+
+}
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext-security.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext-security.xml?rev=1141931&r1=1141930&r2=1141931&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext-security.xml
(original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext-security.xml
Fri Jul  1 13:17:06 2011
@@ -27,34 +27,36 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
 			    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
 
-    <security:http auto-config="true" use-expressions="true" disable-url-rewriting="true">
-        <security:intercept-url pattern="/login.jsp*" filters="none" />
-        <security:intercept-url pattern="/css/**" access="permitAll"/>
-        <security:intercept-url pattern="/images/**" access="permitAll"/>
-        <security:intercept-url pattern="/script/**" access="permitAll"/>
-        <!-- all urls must be authenticated -->
-        <security:intercept-url pattern="/**"
-                                access="isAuthenticated()"/>
-        <security:openid-login user-service-ref="userService">
-            <security:attribute-exchange>
-                <!-- Supported by MyOpenID.com -->
-                <security:openid-attribute name="firstName" type="http://schema.openid.net/namePerson/first"/>
-                <security:openid-attribute name="lastName" type="http://schema.openid.net/namePerson/last"/>
-                <security:openid-attribute name="email" type="http://schema.openid.net/contact/email"
required="true"/>
-                <!-- security:openid-attribute name="language" type="http://schema.openid.net/language/pref"/>
-                    <security:openid-attribute name="birthDate" type="http://schema.openid.net/birthDate"/>
-                    <security:openid-attribute name="namePerson" type="http://schema.openid.net/namePerson"
required="true"/>
-                    <security:openid-attribute name="nickname" type="http://schema.openid.net/namePerson/friendly"
required="true"/>
-                    <security:openid-attribute name="country" type="http://schema.openid.net/contact/country/home"/>
-                    -->
-            </security:attribute-exchange>
-        </security:openid-login>
-        <security:form-login login-page="/login.jsp" />
-        <security:logout/>
-    </security:http>
-
-    <security:authentication-manager>
-		<security:authentication-provider
-			user-service-ref="userService" />
-	</security:authentication-manager>
+  <security:http auto-config="true" use-expressions="true" disable-url-rewriting="true">
+	 <security:intercept-url pattern="/newaccount.jsp*" access="permitAll"/>
+	 <security:intercept-url pattern="/app/newaccount*" access="permitAll"/>
+	 <security:intercept-url pattern="/login.jsp*" filters="none" />
+	 <security:intercept-url pattern="/css/**" access="permitAll"/>
+	 <security:intercept-url pattern="/images/**" access="permitAll"/>
+	 <security:intercept-url pattern="/script/**" access="permitAll"/>
+	 <!-- all urls must be authenticated -->
+	 <security:intercept-url pattern="/**"
+									 access="isAuthenticated()"/>
+	 <security:openid-login user-service-ref="userService">
+		<security:attribute-exchange>
+		  <!-- Supported by MyOpenID.com -->
+		  <security:openid-attribute name="firstName" type="http://schema.openid.net/namePerson/first"/>
+		  <security:openid-attribute name="lastName" type="http://schema.openid.net/namePerson/last"/>
+		  <security:openid-attribute name="email" type="http://schema.openid.net/contact/email"
required="true"/>
+		  <!-- security:openid-attribute name="language" type="http://schema.openid.net/language/pref"/>
+				 <security:openid-attribute name="birthDate" type="http://schema.openid.net/birthDate"/>
+				 <security:openid-attribute name="namePerson" type="http://schema.openid.net/namePerson"
required="true"/>
+				 <security:openid-attribute name="nickname" type="http://schema.openid.net/namePerson/friendly"
required="true"/>
+				 <security:openid-attribute name="country" type="http://schema.openid.net/contact/country/home"/>
+		  -->
+		</security:attribute-exchange>
+	 </security:openid-login>
+	 <security:form-login login-page="/login.jsp" />
+	 <security:logout/>
+  </security:http>
+  
+  <security:authentication-manager>
+	 <security:authentication-provider
+		  user-service-ref="userService" />
+  </security:authentication-manager>
 </beans>

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/tags/rave_generic_page.tag
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/tags/rave_generic_page.tag?rev=1141931&r1=1141930&r2=1141931&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/tags/rave_generic_page.tag (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/tags/rave_generic_page.tag Fri
Jul  1 13:17:06 2011
@@ -1,4 +1,3 @@
-<!DOCTYPE HTML>
 <%--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file

Added: incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/NewAccountRequestReceived.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/NewAccountRequestReceived.jsp?rev=1141931&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/NewAccountRequestReceived.jsp
(added)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/NewAccountRequestReceived.jsp
Fri Jul  1 13:17:06 2011
@@ -0,0 +1,20 @@
+<%--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   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.
+
+--%>
+Hollow World

Added: incubator/rave/trunk/rave-portal/src/main/webapp/newaccount.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/newaccount.jsp?rev=1141931&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/newaccount.jsp (added)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/newaccount.jsp Fri Jul  1 13:17:06 2011
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  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.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
+<%@ taglib tagdir="/WEB-INF/tags" prefix="rave"%>
+<rave:rave_generic_page pageTitle="New Account Application - Rave">
+	<div id="content">
+		<h1>Rave Account Application</h1>
+		<form id="newAccountForm" name="newAccountForm" action="app/newaccount">
+			<fieldset>
+				<p>
+					<label for="userNameField">Username:</label> <input
+						id="userNameField" type="text" name="userName" />
+				</p>
+				<p>
+					<label for="passwordField">Password:</label> <input
+						id="passwordField" type="password" name="password" />
+				</p>
+				<p>
+					<label for="passwordConfirmField">Confirm Password:</label> <input
+						id="passwordConfirmField" type="password" name="passwordConfirmed" />
+				</p>
+				<p>
+				<input type="submit" value="Create Account" />
+				</p>
+
+			</fieldset>
+
+		</form>
+	</div>
+</rave:rave_generic_page>
\ No newline at end of file

Added: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/controller/NewAccountControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/controller/NewAccountControllerTest.java?rev=1141931&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/controller/NewAccountControllerTest.java
(added)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/web/controller/NewAccountControllerTest.java
Fri Jul  1 13:17:06 2011
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.apache.rave.portal.web.controller;
+
+/**
+ * This is a test class for NewAccountController, which is used to make new user accounts
through
+ * a web form.
+ */
+public class NewAccountControllerTest {
+	 //Tests need to be implemented.
+}
\ No newline at end of file



Mime
View raw message