Merge branch 'master' of github.com:wso2/carbon-device-mgt

revert-70aa11f8
Chatura Dilan Perera 8 years ago
commit 40cabd0064

@ -18,6 +18,7 @@
*/
package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import com.google.gson.JsonArray;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
@ -127,8 +128,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
request.setSince(sinceDate);
result = dms.getAllDevices(request);
if (result == null || result.getData() == null || result.getData().size() <= 0) {
return Response.status(Response.Status.OK).entity("No device is modified " +
"after the timestamp provided in 'since' filter").build();
return Response.status(Response.Status.OK).entity(new JsonArray()).build();
}
} else {
result = dms.getAllDevices(request);

@ -416,12 +416,23 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
boolean isOwnershipProvided = false;
String status = request.getStatus();
boolean isStatusProvided = false;
Date since = request.getSince();
boolean isSinceProvided = false;
try {
conn = this.getConnection();
String sql = "SELECT COUNT(d1.ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID, d.NAME, d.DEVICE_IDENTIFICATION, " +
"t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID " +
"AND d.TENANT_ID = ?";
"t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t";
//Add query for last updated timestamp
if (since != null) {
sql = sql + " , DM_DEVICE_DETAIL dt";
isSinceProvided = true;
}
sql = sql + " WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?";
//Add query for last updated timestamp
if (isSinceProvided) {
sql = sql + " AND dt.DEVICE_ID = d.ID AND dt.UPDATE_TIMESTAMP > ?";
}
if (deviceType != null && !deviceType.isEmpty()) {
sql = sql + " AND t.NAME = ?";
isDeviceTypeProvided = true;
@ -452,12 +463,16 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId);
int paramIdx = 2;
if (isSinceProvided) {
stmt.setLong(paramIdx++, since.getTime());
}
if (isDeviceTypeProvided) {
stmt.setString(paramIdx++, request.getDeviceType());
}
if (isDeviceNameProvided) {
stmt.setString(paramIdx++, request.getDeviceName() + "%");
}
stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) {
stmt.setString(paramIdx++, request.getOwnership());

@ -59,8 +59,21 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " +
"d1.DEVICE_IDENTIFICATION, e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, " +
"e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, " +
"d.NAME, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t " +
"WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?";
"d.NAME, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE " +
"FROM DM_DEVICE d, DM_DEVICE_TYPE t ";
//Add the query to filter active devices on timestamp
if (since != null) {
sql = sql + ", DM_DEVICE_DETAIL dt";
isSinceProvided = true;
}
sql = sql + " WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?";
//Add query for last updated timestamp
if (isSinceProvided) {
sql = sql + " AND dt.DEVICE_ID = d.ID AND dt.UPDATE_TIMESTAMP > ?";
}
//Add the query for device-type
if (deviceType != null && !deviceType.isEmpty()) {
@ -73,12 +86,6 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
isDeviceNameProvided = true;
}
//Add query for last updated timestamp
if (since != null) {
sql = sql + " AND d.LAST_UPDATED_TIMESTAMP > ?";
isSinceProvided = true;
}
sql = sql + ") d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?";
//Add the query for ownership
@ -102,15 +109,16 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId);
int paramIdx = 2;
if (isSinceProvided) {
stmt.setLong(paramIdx++, since.getTime());
}
if (isDeviceTypeProvided) {
stmt.setString(paramIdx++, request.getDeviceType());
}
if (isDeviceNameProvided) {
stmt.setString(paramIdx++, request.getDeviceName() + "%");
}
if (isSinceProvided) {
stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime()));
}
stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) {
stmt.setString(paramIdx++, request.getOwnership());

@ -102,7 +102,7 @@ public class OperationManagerImpl implements OperationManager {
DeviceIDHolder deviceIDHolder = DeviceManagerUtil.validateDeviceIdentifiers(deviceIds);
List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList();
if (validDeviceIds.size() > 0) {
List<DeviceIdentifier> authorizedDeviceList = this.getAuthorizedDevices(operation, deviceIds);
List<DeviceIdentifier> authorizedDeviceList = this.getAuthorizedDevices(operation, validDeviceIds);
if (authorizedDeviceList.size() <= 0) {
log.info("User : " + getUser() + " is not authorized to perform operations on given device-list.");
return null;
@ -123,7 +123,7 @@ public class OperationManagerImpl implements OperationManager {
//TODO have to create a sql to load device details from deviceDAO using single query.
String operationCode = operationDto.getCode();
for (DeviceIdentifier deviceId : deviceIds) {
for (DeviceIdentifier deviceId : authorizedDeviceList) {
Device device = getDevice(deviceId);
enrolmentId = device.getEnrolmentInfo().getId();
//Do not repeat the task operations

@ -58,10 +58,12 @@ under the License. --}}
<!-- page-content-wrapper -->
<div class="page-content-wrapper">
{{defineZone "contentTitle"}}
<div class="container-fluid body-wrapper">
<div class="container-fluid ">
<div class="body-wrapper">
{{defineZone "content"}}
</div>
</div>
</div>
<!-- /page-content-wrapper -->
<footer class="footer">

@ -19,7 +19,8 @@
{{unit "cdmf.unit.ui.title" pageTitle="Login"}}
{{#zone "content"}}
<div class="container col-xs-12 col-sm-6 col-md-6 col-lg-3 col-centered wr-content wr-login col-centered">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 col-sm-offset-3 col-md-offset-3 col-lg-offset-4">
<p class="page-sub-title">Login</p>
<hr />
@ -53,4 +54,5 @@
</form>
</div>
</div>
</div>
{{/zone}}

@ -17,7 +17,7 @@
}}
{{#zone "navMenu-icon"}}
<span class="icon fw-stack">
<i class="fw fw-tiles fw-stack-1x toggle-icon-up"></i>
<i class="fw fw-menu fw-stack-1x toggle-icon-down"></i>
</span>
{{/zone}}
@ -105,8 +105,7 @@
data-offset-top="80">
<ul class="sidebar-messages">
</ul>
<h4 class="text-center"><a href="{{appContext}}notification-listing" class="text-center">Show all notifications</a>
</h4>
<div class="text-center"><a href="{{appContext}}notification-listing" class="btn btn-primary">Show all notifications</a></div>
</div>
{{/zone}}
{{#zone "bottomJs"}}

@ -734,10 +734,6 @@ header .brand h1 {
text-transform: uppercase;
}
header .auth {
margin: 0 -15px;
}
header .dropdown {
display: inline-block;
color: #ffffff;
@ -859,7 +855,7 @@ header .dropdown[aria-expanded=true], header .dropdown:hover {
line-height: 50px;
text-transform: uppercase;
background: #010F1F;
height: 50px;
height: 40px;
font-size: 14px;
}
@ -3606,7 +3602,6 @@ a.cu-btn, a.cu-btn-inner {
font-weight:400;
display: inline-block;
text-transform: uppercase;
height: 53px;
padding: 13px 10px;
}
@ -5051,6 +5046,7 @@ a.wr-side-panel-toggle-btn.selected {
height: 100%;
background: #ffffff;
border: 1px solid #e8e8e8;
margin-bottom:40px;
}
.wr-advance-operations .row:first-child {

@ -1,4 +1,5 @@
{
"version": "1.0.0",
"extends": "uuf.unit.theme"
"extends": "uuf.unit.theme",
"enabled": false
}

@ -46,9 +46,11 @@
<!-- page-content-wrapper -->
<div class="page-content-wrapper">
{{defineZone "contentTitle"}}
<div class="container-fluid body-wrapper">
<div class="container-fluid ">
<div class="body-wrapper">
{{defineZone "content"}}
</div>
</div>
</div>
<!-- /page-content-wrapper -->

@ -35,9 +35,11 @@
<!-- page-content-wrapper -->
<div class="page-content-wrapper">
<div class="container-fluid body-wrapper">
<div class="container-fluid ">
<div class="body-wrapper">
{{defineZone "content"}}
</div>
</div>
</div>
<!-- /page-content-wrapper -->

@ -16,13 +16,18 @@
under the License.
}}
{{#zone "userMenu"}}
<ul class="nav navbar-right float-remove-xs text-center-xs">
<li class="visible-inline-block">
<a href="#" class="dropdown" data-toggle="dropdown">
<span class="hidden-xs add-padding-left-3x">
<span class="icon fw-stack fw-lg">
<i class="fw fw-circle fw-stack-2x"></i>
<i class="fw fw-user fw-stack-1x fw-inverse"></i>
</span>
<span class="hidden-xs add-padding-left-1x">
{{@user.username}}<span class="caret"></span>
</span>
<span class="icon fw-stack fw-lg"><i class="fw fw-user fw-stack-1x"></i></span>
</a>
<ul class="dropdown-menu float-remove-xs position-static-xs text-center-xs remove-margin-xs slideInDown"
<ul class="dropdown-menu dropdown-menu-right float-remove-xs position-static-xs text-center-xs remove-margin-xs slideInDown"
role="menu">
<li class="dropdown-header visible-xs">
{{@user.username}}<span class="caret"></span>
@ -34,4 +39,6 @@
</li>
{{/defineZone}}
</ul>
</li>
</ul>
{{/zone}}

@ -622,10 +622,6 @@ header .brand {
}
}
header .auth {
margin: 0 -15px;
}
header .dropdown {
display: inline-block;
color: @base-light-color;

@ -26,6 +26,7 @@
{{~css "lib/font-wso2_1.2/css/font-wso2.css" combine=false}}
<!-- Theme LESS -->
{{~css "less/theme.less" combine=false}}
{{~css "css/theme-wso2.css"}}
{{/zone}}
{{~#zone "topJs"}}

@ -109,7 +109,7 @@ public class OAuthExtUtils {
try {
Map<String, String> appScopes;
ApiMgtDAO apiMgtDAO = new ApiMgtDAO();
ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance();
//Get all the scopes and permissions against the scopes defined for the APIs subscribed to the application.
appScopes = apiMgtDAO.getScopeRolesOfApplication(consumerKey);

@ -49,6 +49,10 @@
<artifactId>org.wso2.carbon.device.mgt.api.feature</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.wso2.carbon.commons</groupId>-->
<!--<artifactId>org.wso2.carbon.email.verification</artifactId>-->
@ -123,8 +127,12 @@
<bundleDef>
com.fasterxml.jackson.core:jackson-annotations:${jackson-annotations.version}
</bundleDef>
<!-- Below should be bundled with the email verification -->
</bundles>
<importBundles>
<importBundleDef>org.wso2.orbit.org.apache.pdfbox:pdfbox:${orbit.version.pdfbox}</importBundleDef>
</importBundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>
<importFeatureDef>org.wso2.carbon.apimgt.core:${carbon.api.mgt.version}</importFeatureDef>

@ -48,6 +48,10 @@
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.identity.authenticator.backend.oauth</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt.client</artifactId>
</dependency>
</dependencies>
<build>
@ -80,6 +84,9 @@
org.wso2.carbon.devicemgt:org.wso2.carbon.identity.authenticator.backend.oauth:${carbon.device.mgt.version}
</bundleDef>
</bundles>
<importBundles>
<importBundleDef>org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.keymgt.client:${carbon.api.mgt.version}</importBundleDef>
</importBundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
</importFeatureDef>

@ -53,6 +53,10 @@
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt</artifactId>
</dependency>
</dependencies>
<build>
@ -116,6 +120,9 @@
org.wso2.carbon.devicemgt:org.wso2.carbon.policy.information.point:${carbon.device.mgt.version}
</bundleDef>
</bundles>
<importBundles>
<importBundleDef>org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.keymgt:${carbon.api.mgt.version}</importBundleDef>
</importBundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
</importFeatureDef>

@ -40,6 +40,14 @@
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.throttle.core</artifactId>
</dependency>
</dependencies>
<build>
@ -93,6 +101,10 @@
<bundleDef>org.wso2.carbon.devicemgt:org.wso2.carbon.webapp.authenticator.framework:${carbon.device.mgt.version}
</bundleDef>
</bundles>
<importBundles>
<importBundleDef>org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.core:${carbon.api.mgt.version}</importBundleDef>
<importBundleDef>org.wso2.carbon:org.wso2.carbon.throttle.core:${carbon.throttle.module.version}</importBundleDef>
</importBundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>
<importFeatureDef>org.wso2.carbon.apimgt.core:${carbon.api.mgt.version}</importFeatureDef>

@ -708,7 +708,11 @@
<artifactId>h2-database-engine</artifactId>
<version>${orbit.version.h2.engine}</version>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
<version>${owasp.encoder.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2.transport</groupId>
<artifactId>axis2-transport-mail</artifactId>
@ -738,6 +742,11 @@
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus.orbit.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>${orbit.version.pdfbox}</version>
</dependency>
<!-- End of Orbit dependencies -->
@ -917,14 +926,6 @@
<artifactId>org.wso2.carbon.apimgt.core</artifactId>
<version>${carbon.api.mgt.version}</version>
<exclusions>
<exclusion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt.stub</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.usage.publisher</artifactId>
@ -945,10 +946,6 @@
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.ganalytics.publisher</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.throttle.core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- End of API Management dependencies -->
@ -1502,17 +1499,21 @@
<artifactId>jackson-annotations</artifactId>
<version>${jackson-annotations.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
<version>${owasp.encoder.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt.client</artifactId>
<version>${carbon.api.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.throttle.core</artifactId>
<version>${carbon.throttle.module.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -1801,7 +1802,7 @@
<version.commons.lang>2.6.0.wso2v1</version.commons.lang>
<!-- Carbon API Management -->
<carbon.api.mgt.version>5.0.4</carbon.api.mgt.version>
<carbon.api.mgt.version>5.0.5</carbon.api.mgt.version>
<carbon.api.mgt.version.range>(5.0.0,6.0.0]</carbon.api.mgt.version.range>
<!-- Carbon Analytics Commons -->
@ -1884,6 +1885,10 @@
<owasp.encoder.version>1.2.0.wso2v1</owasp.encoder.version>
<hibernate-validator.version>5.0.2.Final</hibernate-validator.version>
<!-- apache pdfbox version -->
<orbit.version.pdfbox>1.8.10.wso2v2</orbit.version.pdfbox>
<carbon.throttle.module.version>4.2.1</carbon.throttle.module.version>
</properties>
</project>

Loading…
Cancel
Save