dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24267
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11861: Exposing all system for admin users
------------------------------------------------------------
revno: 11861
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-02 14:36:55 +0200
message:
Exposing all system for admin users
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.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-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java 2013-09-01 21:38:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java 2013-09-02 12:36:55 +0000
@@ -60,26 +60,46 @@
private String javaVersion;
private String javaVendor;
-
+
+ private String javaIoTmpDir;
+
+ private String javaOpts;
+
private String osName;
private String osArchitecture;
private String osVersion;
- private String javaIoTmpDir;
-
private String externalDirectory;
private DatabaseInfo databaseInfo;
- private String javaOpts;
-
private String memoryInfo;
- private int cpuCores;
+ private Integer cpuCores;
// -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
+ public void clearSensitiveInfo()
+ {
+ this.revision = null;
+ this.javaVersion = null;
+ this.javaVendor = null;
+ this.javaIoTmpDir = null;
+ this.javaOpts = null;
+ this.osName = null;
+ this.osArchitecture = null;
+ this.osVersion = null;
+ this.externalDirectory = null;
+ this.databaseInfo = null;
+ this.memoryInfo = null;
+ this.cpuCores = null;
+ }
+
+ // -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
@@ -167,6 +187,8 @@
this.environmentVariable = environmentVariable;
}
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getJavaVersion()
{
return javaVersion;
@@ -177,6 +199,8 @@
this.javaVersion = javaVersion;
}
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getJavaVendor()
{
return javaVendor;
@@ -187,6 +211,32 @@
this.javaVendor = javaVendor;
}
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getJavaIoTmpDir()
+ {
+ return javaIoTmpDir;
+ }
+
+ public void setJavaIoTmpDir( String javaIoTmpDir )
+ {
+ this.javaIoTmpDir = javaIoTmpDir;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getJavaOpts()
+ {
+ return javaOpts;
+ }
+
+ public void setJavaOpts( String javaOpts )
+ {
+ this.javaOpts = javaOpts;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getOsName()
{
return osName;
@@ -197,6 +247,8 @@
this.osName = osName;
}
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getOsArchitecture()
{
return osArchitecture;
@@ -207,6 +259,8 @@
this.osArchitecture = osArchitecture;
}
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getOsVersion()
{
return osVersion;
@@ -217,16 +271,8 @@
this.osVersion = osVersion;
}
- public String getJavaIoTmpDir()
- {
- return javaIoTmpDir;
- }
-
- public void setJavaIoTmpDir( String javaIoTmpDir )
- {
- this.javaIoTmpDir = javaIoTmpDir;
- }
-
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getExternalDirectory()
{
return externalDirectory;
@@ -237,6 +283,8 @@
this.externalDirectory = externalDirectory;
}
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public DatabaseInfo getDatabaseInfo()
{
return databaseInfo;
@@ -247,16 +295,8 @@
this.databaseInfo = databaseInfo;
}
- public String getJavaOpts()
- {
- return javaOpts;
- }
-
- public void setJavaOpts( String javaOpts )
- {
- this.javaOpts = javaOpts;
- }
-
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getMemoryInfo()
{
return memoryInfo;
@@ -267,12 +307,14 @@
this.memoryInfo = memoryInfo;
}
- public int getCpuCores()
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public Integer getCpuCores()
{
return cpuCores;
}
- public void setCpuCores( int cpuCores )
+ public void setCpuCores( Integer cpuCores )
{
this.cpuCores = cpuCores;
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java 2013-09-01 21:38:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java 2013-09-02 12:36:55 +0000
@@ -74,7 +74,7 @@
@Autowired
private Notifier notifier;
-
+
//--------------------------------------------------------------------------
// UID Generator
//--------------------------------------------------------------------------
@@ -146,8 +146,15 @@
public void getSystemInfo( HttpServletRequest request, HttpServletResponse response ) throws IOException
{
SystemInfo info = systemService.getSystemInfo();
+
info.setContextPath( ContextUtils.getContextPath( request ) );
info.setUserAgent( request.getHeader( ContextUtils.HEADER_USER_AGENT ) );
+
+ if ( !currentUserService.currentUserIsSuper() )
+ {
+ info.clearSensitiveInfo();
+ }
+
JacksonUtils.toJson( response.getOutputStream(), info );
}
}