← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19517: support deletion of OAuth2 clients in UI

 

------------------------------------------------------------
revno: 19517
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-06-25 11:16:58 +0700
message:
  support deletion of OAuth2 clients in UI
added:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/oauth2/OAuth2ClientDeletionHandler.java
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/oauth2Clients.js


--
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
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/oauth2/OAuth2ClientDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/oauth2/OAuth2ClientDeletionHandler.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/oauth2/OAuth2ClientDeletionHandler.java	2015-06-25 04:16:58 +0000
@@ -0,0 +1,43 @@
+package org.hisp.dhis.oauth2;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.system.deletion.DeletionHandler;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class OAuth2ClientDeletionHandler extends DeletionHandler
+{
+    @Override
+    protected String getClassName()
+    {
+        return OAuth2Client.class.getName();
+    }
+}

=== 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	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-06-25 04:16:58 +0000
@@ -855,6 +855,8 @@
 
   <bean id="oAuth2ClientService" class="org.hisp.dhis.oauth2.DefaultOAuth2ClientService" />
 
+  <bean class="org.hisp.dhis.oauth2.OAuth2ClientDeletionHandler" />
+
   <bean id="org.hisp.dhis.setting.SystemSettingManager" class="org.hisp.dhis.setting.DefaultSystemSettingManager">
     <property name="systemSettingStore" ref="org.hisp.dhis.setting.SystemSettingStore" />
     <property name="flags">

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java	2015-06-19 07:35:50 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java	2015-06-25 04:16:58 +0000
@@ -66,6 +66,7 @@
 import org.hisp.dhis.mapping.Map;
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.minmax.MinMaxDataElement;
+import org.hisp.dhis.oauth2.OAuth2Client;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
@@ -345,7 +346,7 @@
     {
         return null;
     }
-    
+
     public void deleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
     {
     }
@@ -498,11 +499,11 @@
     {
         return null;
     }
-    
+
     public void deleteMetaDataFilter( MetaDataFilter metaDataFilter )
     {
     }
-    
+
     public String allowDeleteMetaDataFilter( MetaDataFilter metaDataFilter )
     {
         return null;
@@ -543,7 +544,7 @@
     public void deleteTrackedEntityAttributeGroup( TrackedEntityAttributeGroup attributeGroup )
     {
     }
-   
+
     public String allowDeleteRelationship( Relationship relationship )
     {
         return null;
@@ -606,7 +607,7 @@
     public void deleteProgramStageInstance( ProgramStageInstance programStageInstance )
     {
     }
-    
+
     public String allowDeleteProgramRule( ProgramRule programRule )
     {
         return null;
@@ -615,7 +616,7 @@
     public void deleteProgramRule( ProgramRule programRule )
     {
     }
-    
+
     public String allowDeleteProgramRuleVariable( ProgramRuleVariable programRuleVariable )
     {
         return null;
@@ -624,7 +625,7 @@
     public void deleteProgramRuleVariable( ProgramRuleVariable programRuleVariable )
     {
     }
-    
+
     public String allowDeleteProgramRuleAction( ProgramRuleAction programRuleAction )
     {
         return null;
@@ -660,16 +661,16 @@
     public void deleteProgramValidation( ProgramValidation programValidation )
     {
     }
-    
+
     public void deleteProgramIndicator( ProgramIndicator programIndicator )
     {
     }
-    
+
     public String allowDeleteProgramIndicator( ProgramIndicator programIndicator )
     {
         return null;
     }
-    
+
     public String allowDeleteValidationCriteria( ValidationCriteria validationCriteria )
     {
         return null;
@@ -759,7 +760,7 @@
     {
         return null;
     }
-    
+
     public void deleteCategoryOptionGroup( CategoryOptionGroup categoryOptionGroup )
     {
     }
@@ -768,40 +769,49 @@
     {
         return null;
     }
-    
+
     public void deleteCategoryOptionGroupSet( CategoryOptionGroupSet categoryOptionGroupSet )
     {
     }
-    
+
     public String allowDeleteCategoryOptionGroupSet( CategoryOptionGroupSet categoryOptionGroupSet )
     {
         return null;
     }
-    
+
     public void deleteTrackedEntity( TrackedEntity trackedEntity )
     {
     }
-    
+
     public String allowDeleteTrackedEntity( TrackedEntity trackedEntity )
     {
         return null;
     }
-    
+
     public void deleteEventReport( EventReport eventReport )
     {
     }
-    
+
     public String allowDeleteEventReport( EventReport eventReport )
     {
         return null;
     }
-        
+
     public void deleteEventChart( EventChart eventChart )
     {
     }
-    
+
     public String allowDeleteEventChart( EventChart eventChart )
     {
         return null;
     }
+
+    public void deleteOAuth2Client( OAuth2Client oAuth2Client )
+    {
+    }
+
+    public String allowDeleteOAuth2Client( OAuth2Client oAuth2Client )
+    {
+        return null;
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/oauth2Clients.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/oauth2Clients.js	2015-06-25 03:36:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/oauth2Clients.js	2015-06-25 04:16:58 +0000
@@ -3,5 +3,12 @@
 }
 
 function deleteO2Client(context) {
-  console.log(context);
+  if( window.confirm(i18n_confirm_delete) ) {
+    $.ajax({
+      url: '../api/oAuth2Clients/' + context.uid,
+      type: 'DELETE'
+    }).done(function() {
+      location.reload();
+    });
+  }
 }
\ No newline at end of file