← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17835: Users, added field invitation to keep track of active invitations

 

------------------------------------------------------------
revno: 17835
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-12-30 14:02:09 +0100
message:
  Users, added field invitation to keep track of active invitations
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserCredentials.hbm.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java	2014-12-29 11:34:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java	2014-12-30 13:02:09 +0000
@@ -136,6 +136,11 @@
      * Indicates whether this user was originally self registered.
      */
     private boolean selfRegistered;
+    
+    /**
+     * Indicates whether this credentials is currently an invitation.
+     */
+    private boolean invitation;
 
     /**
      * Indicates whether this is user is disabled, which means the user cannot
@@ -604,6 +609,19 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public boolean isInvitation()
+    {
+        return invitation;
+    }
+
+    public void setInvitation( boolean invitation )
+    {
+        this.invitation = invitation;
+    }
+
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public boolean isDisabled()
     {
         return disabled;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java	2014-12-22 11:16:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java	2014-12-30 13:02:09 +0000
@@ -147,6 +147,7 @@
 
         user.setSurname( "(TBD)" );
         user.setFirstName( "(TBD)" );
+        user.getUserCredentials().setInvitation( true );
         userService.encodeAndSetPassword( user, rawPassword );
 
         return true;
@@ -303,6 +304,7 @@
         credentials.setRestoreCode( null );
         credentials.setRestoreToken( null );
         credentials.setRestoreExpiry( null );
+        credentials.setInvitation( false );
 
         userService.encodeAndSetPassword( credentials, newPassword );
         userService.updateUserCredentials( credentials );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java	2014-12-30 13:02:09 +0000
@@ -58,6 +58,7 @@
 
         executeSql( "update dataelement set domaintype='AGGREGATE' where domaintype='aggregate' or domaintype is null;" );
         executeSql( "update dataelement set domaintype='TRACKER' where domaintype='patient';" );
+        executeSql( "update users set invitation = false where invitation is null" );
         executeSql( "alter table dataelement alter column domaintype set not null;" );
         executeSql( "alter table programstageinstance alter column  status  type varchar(25);" );
         executeSql( "UPDATE programstageinstance SET status='ACTIVE' WHERE status='0';" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2014-12-28 15:55:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2014-12-30 13:02:09 +0000
@@ -124,7 +124,7 @@
         {
             hql += hlp.whereAnd() + " uc.selfRegistered = true ";
         }
-        
+                
         if ( params.getOrganisationUnit() != null )
         {
             hql += hlp.whereAnd() + " :organisationUnit in elements(u.organisationUnits) ";

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2014-12-29 12:52:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2014-12-30 13:02:09 +0000
@@ -943,7 +943,7 @@
   <!-- Startup routine definitions -->
 
   <bean id="org.hisp.dhis.startup.InitTableAlteror" class="org.hisp.dhis.startup.InitTableAlteror">
-    <property name="name" value="TableAlteror" />
+    <property name="name" value="InitTableAlteror" />
     <property name="runlevel" value="1" />
     <property name="skipInTests" value="true" />
   </bean>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserCredentials.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserCredentials.hbm.xml	2014-12-18 20:59:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserCredentials.hbm.xml	2014-12-30 13:02:09 +0000
@@ -54,6 +54,8 @@
     <property name="restoreExpiry" type="timestamp" />
 
     <property name="selfRegistered" />
+    
+    <property name="invitation" />
 
     <property name="disabled" />
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java	2014-12-22 11:16:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java	2014-12-30 13:02:09 +0000
@@ -307,6 +307,7 @@
         if ( ACCOUNT_ACTION_INVITE.equals( accountAction ) )
         {
             userCredentials.setUsername( inviteUsername );
+            userCredentials.setInvitation( true );
             user.setEmail( inviteEmail );
 
             securityService.prepareUserForInvite( user );