roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1616370 - in /roller/trunk/app/src: main/java/org/apache/roller/weblogger/business/ main/java/org/apache/roller/weblogger/business/jpa/ main/java/org/apache/roller/weblogger/pojos/ main/java/org/apache/roller/weblogger/ui/core/ main/java/o...
Date Wed, 06 Aug 2014 23:23:53 GMT
Author: gmazza
Date: Wed Aug  6 23:23:53 2014
New Revision: 1616370

URL: http://svn.apache.org/r1616370
Log:
Removed roller_userattribute table from Roller data model; replaced with openid_url column
in Roller_user table.

Removed:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/UserAttribute.java
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/UserAttribute.orm.xml
    roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/UserAttributeTest.java
Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/UserManager.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/User.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerSession.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
    roller/trunk/app/src/main/resources/META-INF/persistence.xml
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/User.orm.xml
    roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm
    roller/trunk/app/src/main/resources/sql/createdb.vm

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/UserManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/UserManager.java?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/UserManager.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/UserManager.java Wed
Aug  6 23:23:53 2014
@@ -24,7 +24,6 @@ import java.util.Map;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.pojos.RollerPermission;
 import org.apache.roller.weblogger.pojos.User;
-import org.apache.roller.weblogger.pojos.UserAttribute;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
 
@@ -90,10 +89,10 @@ public interface UserManager {
      * Lookup a user by UserName.
      * 
      * This lookup is restricted to 'enabled' users by default.  So this method
-     * should return null if the user is found but is not enabled.
+     * will return null if the user is found but is not enabled.
      * 
      * @param userName User Name of user to lookup.
-     * @return UsUserhe user, or null if not found or is disabled.
+     * @return The user, or null if not found or not enabled.
      * @throws WebloggerException If there is a problem.
      */
     User getUserByUserName(String userName) throws WebloggerException;
@@ -102,12 +101,25 @@ public interface UserManager {
      * Lookup a user by UserName with the given enabled status.
      * 
      * @param userName User Name of user to lookup.
-     * @return The user, or null if not found or doesn't match the proper enabled status.
+     * @param enabled True if user is enabled, false otherwise.
+     * @return The user, or null if not found or of the proper enabled status.
      * @throws WebloggerException If there is a problem.
      */
     User getUserByUserName(String userName, Boolean enabled)
         throws WebloggerException;
-    
+
+    /**
+     * Lookup a user by Open ID URL.
+     *
+     * This lookup is restricted to 'enabled' users by default.  So this method
+     * will return null if the user is found but is not enabled.
+     *
+     * @param openIdUrl OpenIdUrl of user to lookup.
+     * @return The user, or null if not found or not enabled.
+     * @throws WebloggerException If there is a problem.
+     */
+    User getUserByOpenIdUrl(String openIdUrl)
+            throws WebloggerException;
 
     /**
      * Lookup a group of users.
@@ -130,8 +142,7 @@ public interface UserManager {
             Date    endDate,
             int     offset,
             int     length) throws WebloggerException;
-    
-    
+
     /**
      * Lookup users whose usernames or email addresses start with a string.
      *
@@ -159,60 +170,7 @@ public interface UserManager {
     List<User> getUsersByLetter(char letter, int offset, int length)
         throws WebloggerException;
     
-        
-    //----------------------------------------------------- user attribute CRUD
 
-    
-    /**
-     * Lookup a user by User attribute
-     * 
-     * @param name attribute name
-     * @param value attribute value
-     * @return User the user, or null if not found or is disabled.
-     * @throws WebloggerException If there is a problem
-     */
-    User getUserByAttribute(String name, String value) throws WebloggerException;
-    
-    /**
-     * Lookup a user by User attribute
-     * 
-     * @param name     Attribute name
-     * @param value    Attribute value
-     * @param enabled  True if only enable user should be returned
-     * @return The user, or null if not found or is disabled.
-     * @throws WebloggerException If there is a problem
-     */
-    User getUserByAttribute(String name, String value, Boolean enabled) throws WebloggerException;
-    
-    
-    /**
-     * Get user attribute value
-     * @param userName User
-     * @param attribute Atribute name
-     * @return List of user attributes
-     */
-    UserAttribute getUserAttribute(String userName, String attribute) throws WebloggerException;
-    
-    
-    /**
-     * Set user atribute value
-     * @param userName User
-     * @param attribute Atribute name     
-     * @param value Atribute value
-     * @throws org.apache.roller.weblogger.WebloggerException
-     */
-    void setUserAttribute(String userName, String attribute, String value) throws WebloggerException;
-    
-    
-    /**
-     * Get attribributes for a user. 
-     * @param userName Username that uniquely idenifies user.
-     * @return List of attributes.
-     * @throws org.apache.roller.weblogger.WebloggerException
-     */
-    List<UserAttribute> getUserAttributes(String userName) throws WebloggerException;
-    
-    
     //-------------------------------------------------------- permissions CRUD
 
     

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
Wed Aug  6 23:23:53 2014
@@ -37,7 +37,6 @@ import org.apache.roller.weblogger.confi
 import org.apache.roller.weblogger.pojos.GlobalPermission;
 import org.apache.roller.weblogger.pojos.RollerPermission;
 import org.apache.roller.weblogger.pojos.User;
-import org.apache.roller.weblogger.pojos.UserAttribute;
 import org.apache.roller.weblogger.pojos.UserRole;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
@@ -82,12 +81,6 @@ public class JPAUserManagerImpl implemen
 
         // remove entry from cache mapping
         this.userNameToIdMap.remove(userName);
-        
-        // remove all associated attributes
-        List<UserAttribute> atts = getUserAttributes(userName);
-        for (UserAttribute att : atts) {
-            this.strategy.remove(att);
-        }
     }
 
     
@@ -135,7 +128,26 @@ public class JPAUserManagerImpl implemen
         return getUserByUserName(userName, Boolean.TRUE);
     }
 
-    
+    @Override
+    public User getUserByOpenIdUrl(String openIdUrl) throws WebloggerException {
+        if (openIdUrl == null) {
+            throw new WebloggerException("OpenID URL cannot be null");
+        }
+
+        TypedQuery<User> query;
+        User user;
+        query = strategy.getNamedQuery(
+                "User.getByOpenIdUrl", User.class);
+        query.setParameter(1, openIdUrl);
+        try {
+            user = query.getSingleResult();
+        } catch (NoResultException e) {
+            user = null;
+        }
+        return user;
+    }
+
+
     public User getUserByUserName(String userName, Boolean enabled)
             throws WebloggerException {
 
@@ -149,7 +161,7 @@ public class JPAUserManagerImpl implemen
 
             User user = this.getUser(
                     this.userNameToIdMap.get(userName));
-            if(user != null) {
+            if (user != null) {
                 // only return the user if the enabled status matches
                 if(enabled == null || enabled.equals(user.getEnabled())) {
                     log.debug("userNameToIdMap CACHE HIT - "+userName);
@@ -311,103 +323,6 @@ public class JPAUserManagerImpl implemen
         return results.get(0);
     }
 
-    
-    public User getUserByAttribute(String name, String value) throws WebloggerException {
-        return getUserByAttribute(name, value, Boolean.TRUE);
-    }
-
-    
-    public User getUserByAttribute(String name, String value, Boolean enabled) throws WebloggerException
{
-        
-        if (value == null) {
-            throw new WebloggerException("user attribute cannot be null!");
-        }
-
-        String[] parts = value.split("&");
-        value = parts[0];
-
-        TypedQuery<UserAttribute> attrQuery = strategy.getNamedQuery("UserAttribute.getByAttrNameAndAttrValue",
-                UserAttribute.class);
-        attrQuery.setParameter(1, name);
-        attrQuery.setParameter(2, value);
-        UserAttribute attribute;
-
-        try {
-            attribute = attrQuery.getSingleResult();
-        } catch (NoResultException e) {
-            return null;
-        }
-
-        Object[] params;
-        TypedQuery<User> userQuery;
-        if (enabled != null) {
-            userQuery = strategy.getNamedQuery("User.getByUserName&Enabled", User.class);
-            params = new Object[]{attribute.getUserName(), enabled};
-        } else {
-            userQuery = strategy.getNamedQuery("User.getByUserName", User.class);
-            params = new Object[]{attribute.getUserName()};
-        }
-        for (int i = 0; i < params.length; i++) {
-            userQuery.setParameter(i + 1, params[i]);
-        }
-        User user;
-        try {
-            user = userQuery.getSingleResult();
-        } catch (NoResultException e) {
-            user = null;
-        }
-
-        return user;
-    }
-
-    
-    public UserAttribute getUserAttribute(String userName, String attribute) throws WebloggerException
{
-        TypedQuery<UserAttribute> q = strategy.getNamedQuery("UserAttribute.getByUserNameAndAttrName",
UserAttribute.class);
-        q.setParameter(1, userName);
-        q.setParameter(2, attribute);
-        try {
-            return q.getSingleResult();
-        } catch (NoResultException e) {            
-            return null;
-        }
-    }
-
-    
-    public List<UserAttribute> getUserAttributes(String userName) throws WebloggerException
{
-        TypedQuery<UserAttribute> q = strategy.getNamedQuery("UserAttribute.getByUserName",
UserAttribute.class);
-        q.setParameter(1, userName);
-        try {
-            return q.getResultList();
-        } catch (NoResultException e) {            
-            return null;
-        }
-    }
-
-    
-    public void setUserAttribute(String userName, String attribute, String value) throws
WebloggerException {
-        UserAttribute userAttribute = null;
-        TypedQuery<UserAttribute> q = strategy.getNamedQuery("UserAttribute.getByUserNameAndAttrName",
-                UserAttribute.class);
-        q.setParameter(1, userName);
-        q.setParameter(2, attribute);
-        try {
-            userAttribute = q.getSingleResult();
-        } catch (NoResultException ignored) {
-        }
-        if (userAttribute != null) {
-            if (value.equals("")) {
-                this.strategy.remove(userAttribute);
-            } else {
-                userAttribute.setValue(value);
-                this.strategy.store(userAttribute);
-            }
-        } else {
-            userAttribute = new UserAttribute(userName, attribute, value);
-            this.strategy.store(userAttribute);
-        }
-    }
-
-    
     public User getUserByActivationCode(String activationCode) throws WebloggerException
{
         if (activationCode == null) {
             throw new WebloggerException("activationcode is null");
@@ -684,6 +599,3 @@ public class JPAUserManagerImpl implemen
         }
     }
 }
-
-
-

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/User.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/User.java?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/User.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/User.java Wed Aug  6
23:23:53 2014
@@ -41,6 +41,7 @@ public class User implements Serializabl
     private String  id = UUIDGenerator.generateUUID();
     private String  userName;
     private String  password;
+    private String  openIdUrl;
     private String  screenName;
     private String  fullName;
     private String  emailAddress;
@@ -69,8 +70,7 @@ public class User implements Serializabl
         this.timeZone = timeZone;
         this.enabled = isEnabled;
     }
-    
-    
+
     /**
      * Id of the User.
      */
@@ -125,8 +125,18 @@ public class User implements Serializabl
             setPassword(newPassword);
         }
     }
-    
-    
+
+    /**
+     * Open ID URL of the user, if provided.
+     */
+    public String getOpenIdUrl() {
+        return openIdUrl;
+    }
+
+    public void setOpenIdUrl(String openIdUrl) {
+        this.openIdUrl = openIdUrl;
+    }
+
     /**
      * Screen name of the user.
      */

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerSession.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerSession.java?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerSession.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerSession.java
Wed Aug  6 23:23:53 2014
@@ -33,7 +33,6 @@ import org.apache.roller.weblogger.confi
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.pojos.User;
-import org.apache.roller.weblogger.pojos.UserAttribute;
 import org.apache.roller.weblogger.ui.core.security.AutoProvision;
 
 
@@ -90,13 +89,11 @@ public class RollerSession 
                         if (openidurl.endsWith("/")) {
                             openidurl = openidurl.substring(0, openidurl.length() - 1);
                         }
-                        user = umgr.getUserByAttribute(
-                                UserAttribute.Attributes.OPENID_URL.toString(), 
-                                openidurl);
+                        user = umgr.getUserByOpenIdUrl(openidurl);
                     }
                     
                     // try one time to auto-provision, only happens if user==null
-                    // which means installation has SSO-enabled in security.xml
+                    // which means installation has LDAP enabled in security.xml
                     if (user == null && WebloggerConfig.getBooleanProperty("users.ldap.autoProvision.enabled"))
{
                         
                         // provisioning enabled, get provisioner and execute

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java
Wed Aug  6 23:23:53 2014
@@ -13,7 +13,6 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.pojos.User;
-import org.apache.roller.weblogger.pojos.UserAttribute;
 import org.springframework.dao.DataAccessResourceFailureException;
 import org.springframework.dao.DataRetrievalFailureException;
 
@@ -39,15 +38,13 @@ public class RollerUserDetailsService im
         try {
             UserManager umgr = roller.getUserManager();
             User userData;
-            // OpenID user
+            // OpenID user?
             if (userName.startsWith("http://") || userName.startsWith("https://")) {
                 if (userName.endsWith("/")) {
                     userName = userName.substring(0, userName.length() -1 );
                 }
                 try {
-                    userData = umgr.getUserByAttribute(
-                        UserAttribute.Attributes.OPENID_URL.toString(), 
-                        userName);
+                    userData = umgr.getUserByOpenIdUrl(userName);
                 } catch (WebloggerException ex) {
                     throw new DataRetrievalFailureException("ERROR in user lookup", ex);
                 }

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
Wed Aug  6 23:23:53 2014
@@ -26,7 +26,6 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.config.AuthMethod;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.User;
-import org.apache.roller.weblogger.pojos.UserAttribute;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.struts2.interceptor.validation.SkipValidation;
 
@@ -62,18 +61,7 @@ public class Profile extends UIAction {
         getBean().setPasswordConfirm(null);
         getBean().setLocale(ud.getLocale());
         getBean().setTimeZone(ud.getTimeZone());
-        
-        UserManager mgr = WebloggerFactory.getWeblogger().getUserManager();
-        try {
-            UserAttribute openIdUrl = mgr.getUserAttribute(
-                ud.getUserName(), UserAttribute.Attributes.OPENID_URL.toString());
-            if (openIdUrl != null) {
-                getBean().setOpenIdUrl(openIdUrl.getValue());
-            }
-        } catch (Exception ex) {
-            log.error("Unexpected error loading user OpenID url", ex);
-            addError("error in action", ex.toString());
-        }
+        getBean().setOpenIdUrl(ud.getOpenIdUrl());
         return INPUT;
     }
 
@@ -101,8 +89,7 @@ public class Profile extends UIAction {
                     if (openidurl != null && openidurl.endsWith("/")) {
                         openidurl = openidurl.substring(0, openidurl.length() - 1);
                     }
-                    mgr.setUserAttribute(existingUser.getUserName(), 
-                        UserAttribute.Attributes.OPENID_URL.toString(), openidurl);
+                    existingUser.setOpenIdUrl(openidurl);
                 } catch (Exception ex) {
                     log.error("Unexpected error saving user OpenID URL", ex);
                     addError("Error in action", ex.toString());

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
Wed Aug  6 23:23:53 2014
@@ -33,14 +33,12 @@ import org.apache.roller.weblogger.confi
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.User;
-import org.apache.roller.weblogger.pojos.UserAttribute;
 import org.apache.roller.weblogger.ui.core.RollerSession;
 import org.apache.roller.weblogger.ui.core.security.CustomUserRegistry;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.MailUtil;
 import org.apache.struts2.interceptor.ServletRequestAware;
 import org.apache.struts2.interceptor.validation.SkipValidation;
-//import org.springframework.security.userdetails.openid.OpenIDUserAttribute;
 
 
 /**
@@ -234,19 +232,17 @@ public class Register extends UIAction i
                     ud.setActivationCode(inActivationCode);
                 }
 
-                // save new user
-                mgr.addUser(ud);
-
                 String openidurl = getBean().getOpenIdUrl();
                 if (openidurl != null) {
                     if (openidurl.endsWith("/")) {
                         openidurl = openidurl.substring(0, openidurl.length() - 1);
                     }
-                    mgr.setUserAttribute(
-                            ud.getUserName(), UserAttribute.Attributes.OPENID_URL.toString(),
-                            openidurl);
+                    ud.setOpenIdUrl(openidurl);
                 }
 
+                // save new user
+                mgr.addUser(ud);
+
                 WebloggerFactory.getWeblogger().flush();
 
                 // now send activation email if necessary

Modified: roller/trunk/app/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/META-INF/persistence.xml?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/META-INF/persistence.xml (original)
+++ roller/trunk/app/src/main/resources/META-INF/persistence.xml Wed Aug  6 23:23:53 2014
@@ -27,7 +27,6 @@
     <mapping-file>org/apache/roller/weblogger/pojos/ObjectPermission.orm.xml</mapping-file>
     <mapping-file>org/apache/roller/weblogger/pojos/WeblogPermission.orm.xml</mapping-file>
     <mapping-file>org/apache/roller/weblogger/pojos/Weblog.orm.xml</mapping-file>
-    <mapping-file>org/apache/roller/weblogger/pojos/UserAttribute.orm.xml</mapping-file>
     <mapping-file>org/apache/roller/weblogger/pojos/OAuthConsumerRecord.orm.xml</mapping-file>
     <mapping-file>org/apache/roller/weblogger/pojos/OAuthAccessorRecord.orm.xml</mapping-file>
     <mapping-file>org/apache/roller/weblogger/pojos/MediaFile.orm.xml</mapping-file>

Modified: roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/User.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/User.orm.xml?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/User.orm.xml (original)
+++ roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/User.orm.xml Wed
Aug  6 23:23:53 2014
@@ -33,6 +33,9 @@
         <named-query name="User.getByUserName&amp;Enabled">
             <query>SELECT u FROM User u WHERE u.userName= ?1 AND u.enabled = ?2</query>
         </named-query>
+        <named-query name="User.getByOpenIdUrl">
+            <query>SELECT u FROM User u WHERE u.openIdUrl = ?1</query>
+        </named-query>
         <named-query name="User.getByUserNameOrEmailAddressStartsWith">
             <query>SELECT u FROM User u WHERE u.userName LIKE ?1 OR u.emailAddress
LIKE ?1</query>
         </named-query>
@@ -70,6 +73,9 @@
             <basic name="password">
                 <column name="passphrase" insertable="true" updatable="true" unique="false"/>
             </basic>
+            <basic name="openIdUrl">
+                <column name="openid_url" insertable="true" updatable="true" unique="false"/>
+            </basic>
             <basic name="fullName">
                 <column name="fullname" insertable="true" updatable="true" unique="true"/>
             </basic>

Modified: roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm (original)
+++ roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm Wed Aug  6 23:23:53 2014
@@ -33,6 +33,16 @@ update weblog set editorpage = 'editor-x
 #renameTable('rolleruser' 'roller_user')
 #renameTable('webpage' 'weblog_custom_template')
 
+-- openID value moved from deprecated roller_userattribute table to new roller_user.openid_url
column
+#addColumnNull('roller_user' 'openid_url'  "varchar(255)")
+
+update roller_user ru
+set openid_url = (select attrvalue from roller_userattribute rua where attrname = 'openid.url'
and ru.username = rua.username)
+where username in (select username from roller_userattribute rua where attrname = 'openid.url');
+
+-- roller_userattribute table no longer referenced by Roller application, can be
+-- manually dropped if your project is not using it for anything else
+
 create table custom_template_rendition (
     id varchar(48)  not null primary key,
     templateid varchar(48) not null,

Modified: roller/trunk/app/src/main/resources/sql/createdb.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/createdb.vm?rev=1616370&r1=1616369&r2=1616370&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/createdb.vm (original)
+++ roller/trunk/app/src/main/resources/sql/createdb.vm Wed Aug  6 23:23:53 2014
@@ -13,6 +13,7 @@ create table roller_user (
     id              varchar(48) not null primary key,
     username        varchar(255) not null,
     passphrase      varchar(255) not null,
+    openid_url      varchar(255),
     screenname      varchar(255) not null,
     fullname        varchar(255) not null,
     emailaddress    varchar(255) not null,
@@ -31,16 +32,6 @@ create table userrole (
 );
 create index ur_username_idx on userrole( username$!db.INDEXSIZE );
 
-create table roller_userattribute(
-    id        varchar(48) not null primary key,
-    username  varchar(255) not null,
-    attrname  varchar(255) not null,
-    attrvalue varchar(255) not null
-);    
-create index ua_username_idx  on roller_userattribute( username$!db.INDEXSIZE );
-create index ua_attrname_idx  on roller_userattribute( attrname$!db.INDEXSIZE );
-create index ua_attrvalue_idx on roller_userattribute( attrvalue$!db.INDEXSIZE );
-
 -- actions: comma separated list of actions permitted by permission
 -- objectid: for now this will always store weblogid
 -- objectType: for now this will always be 'Weblog'



Mime
View raw message