← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11753: wip, sharing of dashboards

 

------------------------------------------------------------
revno: 11753
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-08-22 19:09:11 +0200
message:
  wip, sharing of dashboards
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/Dashboard.hbm.xml
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties


--
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/common/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java	2013-08-13 12:03:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java	2013-08-22 17:09:11 +0000
@@ -28,6 +28,7 @@
  */
 
 import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.dashboard.Dashboard;
 import org.hisp.dhis.datadictionary.DataDictionary;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.document.Document;
@@ -107,6 +108,8 @@
         addType( org.hisp.dhis.mapping.Map.class, "map", "F_MAP_EXTERNAL", "F_MAP_PUBLIC_ADD", null );
         addType( Chart.class, "chart", "F_CHART_EXTERNAL", "F_CHART_PUBLIC_ADD", null );
         addType( ReportTable.class, "reportTable", "F_REPORTTABLE_EXTERNAL", "F_REPORTTABLE_PUBLIC_ADD", null );
+
+        addType( Dashboard.class, "dashboard", null, "F_DASHBOARD_PUBLIC_ADD", null );
     }
 
     public static boolean isSupported( String type )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-08-13 16:43:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-08-22 17:09:11 +0000
@@ -625,6 +625,8 @@
         executeSql( "alter table validationrulegroup rename column validationgroupid to validationrulegroupid" );
         executeSql( "alter table sqlview rename column viewid to sqlviewid" );
 
+        executeSql( "UPDATE dashboard SET publicaccess='--------' WHERE publicaccess is null" );
+
         executeSql( "UPDATE optionset SET version=1 WHERE version IS NULL" );
 
         log.info( "Tables updated" );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/Dashboard.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/Dashboard.hbm.xml	2013-07-22 21:08:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/Dashboard.hbm.xml	2013-08-22 17:09:11 +0000
@@ -16,12 +16,24 @@
     &identifiableProperties;
 
     <property name="name" column="name" not-null="true" unique="false" length="230" />
-    
+
     <list name="items" table="dashboard_items" cascade="all-delete-orphan">
       <key column="dashboardid" foreign-key="fk_dashboard_items_dashboardid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="dashboarditemid" class="org.hisp.dhis.dashboard.DashboardItem" foreign-key="fk_dashboard_items_dashboarditemid" />
+      <many-to-many column="dashboarditemid" class="org.hisp.dhis.dashboard.DashboardItem"
+        foreign-key="fk_dashboard_items_dashboarditemid" />
     </list>
 
+    <!-- Access properties -->
+    <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_dashboard_userid" />
+
+    <property name="publicAccess" length="8" />
+
+    <set name="userGroupAccesses" table="dashboardusergroupaccesses">
+      <cache usage="read-write" />
+      <key column="dashboardid" />
+      <many-to-many class="org.hisp.dhis.user.UserGroupAccess" column="usergroupaccessid" unique="true" />
+    </set>
+
   </class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java	2013-08-22 11:57:33 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java	2013-08-22 17:09:11 +0000
@@ -281,7 +281,9 @@
 
     @SuppressWarnings( "unchecked" )
     @RequestMapping( value = { "/assignedPrograms" }, produces = { "application/json", "text/*" } )
-    public void getPrograms( HttpServletResponse response, @RequestParam Map<String, String> parameters ) throws IOException, NotAuthenticatedException
+    public void getPrograms( HttpServletResponse response, @RequestParam Map<String, String> parameters,
+        @RequestParam( defaultValue = "1" ) Integer type )
+        throws IOException, NotAuthenticatedException
     {
         User currentUser = currentUserService.getCurrentUser();
 
@@ -293,7 +295,7 @@
         Set<OrganisationUnit> userOrganisationUnits = new HashSet<OrganisationUnit>();
         Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
         Set<Program> programs = new HashSet<Program>();
-        Map<String, Collection<Program>> programAssociations = new HashMap<String, Collection<Program>>();
+        Map<String, List<Program>> programAssociations = new HashMap<String, List<Program>>();
 
         if ( currentUser.getOrganisationUnits().isEmpty() && currentUser.getUserCredentials().getAllAuthorities().contains( "ALL" ) )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml	2013-08-13 11:06:13 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml	2013-08-22 17:09:11 +0000
@@ -259,6 +259,7 @@
     <property name="authorities">
       <set>
         <value>ALL</value>
+        <value>F_DASHBOARD_PUBLIC_ADD</value>
         <value>F_CHART_PUBLIC_ADD</value>
         <value>F_MAP_PUBLIC_ADD</value>
         <value>F_USERGROUP_PUBLIC_ADD</value>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2013-08-18 18:54:32 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2013-08-22 17:09:11 +0000
@@ -1,3 +1,6 @@
+
+#sharingDialog()
+
 <script type="text/javascript">
 var i18n_share_your_interpretation_of = '$encoder.jsEscape( $i18n.getString( "share_your_interpretation_of" ), "'")';
 var i18n_interpretation_was_shared = '$encoder.jsEscape( $i18n.getString( "interpretation_was_shared" ), "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties	2013-08-13 11:06:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties	2013-08-22 17:09:11 +0000
@@ -108,6 +108,7 @@
 F_REPORTTABLE_DELETE=Delete Report Table
 F_REPORT_VIEW=View Report
 F_CHART_PUBLIC_ADD=Add/Update Public Chart
+F_DASHBOARD_PUBLIC_ADD=Add/Update Public Dashboard
 F_CHART_EXTERNAL=Chart External Access
 F_CHART_ADD=Add/Update Chart
 F_CHART_DELETE=Delete Chart