Fixing the conflicts

4.x.x
geethkokila 8 years ago
commit d8303356cd

@ -63,7 +63,7 @@ public class ApiApplicationRegistrationServiceImpl implements ApiApplicationRegi
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(username); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(username);
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService(); APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
applicationName, APIUtil.getAllowedApisTags().toArray(new String[APIUtil.getAllowedApisTags().size()]), applicationName, APIUtil.getDefaultTags(),
ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username, false, ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username, false,
ApiApplicationConstants.DEFAULT_VALIDITY_PERIOD); ApiApplicationConstants.DEFAULT_VALIDITY_PERIOD);
return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build(); return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build();

@ -31,6 +31,7 @@ import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.service.RealmService;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -95,8 +96,13 @@ public class APIUtil {
return deviceManagementProviderService; return deviceManagementProviderService;
} }
public static String[] getDefaultTags() throws DeviceManagementException {
String[] allowedApisTags = new String[1];
allowedApisTags[0] = DEFAULT_CDMF_API_TAG;
return allowedApisTags;
}
public static List<String> getAllowedApisTags() throws DeviceManagementException { public static List<String> getAllowedApisTags() throws DeviceManagementException {
//Todo get allowed cdmf service tags from config.
List<String> allowedApisTags = getDeviceManagementProviderService().getAvailableDeviceTypes(); List<String> allowedApisTags = getDeviceManagementProviderService().getAvailableDeviceTypes();
allowedApisTags.add(DEFAULT_CDMF_API_TAG); allowedApisTags.add(DEFAULT_CDMF_API_TAG);
allowedApisTags.add(DEFAULT_CERT_API_TAG); allowedApisTags.add(DEFAULT_CERT_API_TAG);

@ -87,6 +87,10 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
throw new APIManagerException ( throw new APIManagerException (
"Api application creation failed for " + applicationName + " to the user " + username); "Api application creation failed for " + applicationName + " to the user " + username);
} }
SubscriptionList subscriptionList = storeClient.getSubscriptions().subscriptionsGet
(null, application.getApplicationId(), "", 0, 100, CONTENT_TYPE, null);
List<Subscription> needToSubscribe = new ArrayList<>();
// subscribe to apis. // subscribe to apis.
if (tags != null && tags.length > 0) { if (tags != null && tags.length > 0) {
for (String tag: tags) { for (String tag: tags) {
@ -100,32 +104,33 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
if (apiList.getList() != null && apiList.getList().size() > 0) { if (apiList.getList() != null && apiList.getList().size() > 0) {
for (APIInfo apiInfo : apiList.getList()) { for (APIInfo apiInfo : apiList.getList()) {
Subscription subscription = new Subscription();
//fix for APIMANAGER-5566 admin-AT-tenant1.com-Tenant1API1-1.0.0
String id = apiInfo.getProvider().replace("@", "-AT-") String id = apiInfo.getProvider().replace("@", "-AT-")
+ "-" + apiInfo.getName()+ "-" + apiInfo.getVersion(); + "-" + apiInfo.getName()+ "-" + apiInfo.getVersion();
subscription.setApiIdentifier(id);
subscription.setApplicationId(application.getApplicationId());
subscription.tier(ApiApplicationConstants.DEFAULT_TIER);
SubscriptionList subscriptionList = storeClient.getSubscriptions().subscriptionsGet
(id, application.getApplicationId(), "", 0, 100, CONTENT_TYPE, null);
boolean subscriptionExist = false; boolean subscriptionExist = false;
if (subscriptionList.getList() != null && subscriptionList.getList().size() > 0) { if (subscriptionList.getList() != null && subscriptionList.getList().size() > 0) {
for (Subscription subs : subscriptionList.getList()) { for (Subscription subs : subscriptionList.getList()) {
if (subs.getApiIdentifier().equals(id) && subs.getApplicationId().equals( if (subs.getApiIdentifier().equals(id)) {
application.getApplicationId())) {
subscriptionExist = true; subscriptionExist = true;
break; break;
} }
} }
} }
if (!subscriptionExist) { if (!subscriptionExist) {
storeClient.getIndividualSubscription().subscriptionsPost(subscription, CONTENT_TYPE); Subscription subscription = new Subscription();
//fix for APIMANAGER-5566 admin-AT-tenant1.com-Tenant1API1-1.0.0
subscription.setApiIdentifier(id);
subscription.setApplicationId(application.getApplicationId());
subscription.tier(ApiApplicationConstants.DEFAULT_TIER);
needToSubscribe.add(subscription);
} }
} }
} }
} }
} }
if (!needToSubscribe.isEmpty()) {
storeClient.getIndividualSubscription().subscriptionsPost(needToSubscribe, CONTENT_TYPE);
}
//end of subscription //end of subscription
List<ApplicationKey> applicationKeys = application.getKeys(); List<ApplicationKey> applicationKeys = application.getKeys();

@ -22,6 +22,8 @@ import feign.Param;
import feign.RequestLine; import feign.RequestLine;
import org.wso2.carbon.apimgt.integration.client.store.model.Subscription; import org.wso2.carbon.apimgt.integration.client.store.model.Subscription;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30")
public interface SubscriptionindividualApi { public interface SubscriptionindividualApi {
@ -42,6 +44,21 @@ public interface SubscriptionindividualApi {
}) })
Subscription subscriptionsPost(Subscription body, @Param("contentType") String contentType); Subscription subscriptionsPost(Subscription body, @Param("contentType") String contentType);
/**
* Add new subscriptions
* Add new subscriptions
* @param body Subscription objects that should to be added (required)
* @param contentType Media type of the entity in the body. Default is JSON. (required)
* @return Subscription
*/
@RequestLine("POST /subscriptions/multiple")
@Headers({
"Content-type: application/json",
"Accept: application/json",
"Content-Type: {contentType}"
})
List<Subscription> subscriptionsPost(List<Subscription> body, @Param("contentType") String contentType);
/** /**
* Remove subscription * Remove subscription
* Remove subscription * Remove subscription

@ -53,7 +53,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
String sql = "INSERT INTO DM_DEVICE(DESCRIPTION, NAME, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, " + String sql = "INSERT INTO DM_DEVICE(DESCRIPTION, NAME, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, " +
"LAST_UPDATED_TIMESTAMP, TENANT_ID) " + "LAST_UPDATED_TIMESTAMP, TENANT_ID) " +
"VALUES (?, ?, ?, ?, ?, ?)"; "VALUES (?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(sql, new String[]{"id"}); stmt = conn.prepareStatement(sql, new String[] {"id"});
stmt.setString(1, device.getDescription()); stmt.setString(1, device.getDescription());
stmt.setString(2, device.getName()); stmt.setString(2, device.getName());
stmt.setInt(3, typeId); stmt.setInt(3, typeId);
@ -85,7 +85,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
String sql = "UPDATE DM_DEVICE SET NAME = ?, DESCRIPTION = ?, LAST_UPDATED_TIMESTAMP = ? " + String sql = "UPDATE DM_DEVICE SET NAME = ?, DESCRIPTION = ?, LAST_UPDATED_TIMESTAMP = ? " +
"WHERE DEVICE_TYPE_ID = (SELECT ID FROM DM_DEVICE_TYPE WHERE NAME = ? AND PROVIDER_TENANT_ID = ?) " + "WHERE DEVICE_TYPE_ID = (SELECT ID FROM DM_DEVICE_TYPE WHERE NAME = ? AND PROVIDER_TENANT_ID = ?) " +
"AND DEVICE_IDENTIFICATION = ? AND TENANT_ID = ?"; "AND DEVICE_IDENTIFICATION = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql, new String[]{"id"}); stmt = conn.prepareStatement(sql, new String[] {"id"});
stmt.setString(1, device.getName()); stmt.setString(1, device.getName());
stmt.setString(2, device.getDescription()); stmt.setString(2, device.getDescription());
stmt.setTimestamp(3, new Timestamp(new Date().getTime())); stmt.setTimestamp(3, new Timestamp(new Date().getTime()));
@ -142,7 +142,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
@Override @Override
public Device getDevice(DeviceIdentifier deviceIdentifier, Date since, int tenantId) public Device getDevice(DeviceIdentifier deviceIdentifier, Date since, int tenantId)
throws DeviceManagementDAOException { throws DeviceManagementDAOException {
Connection conn; Connection conn;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -150,11 +150,11 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " + 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, " + "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, " + "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " +
"t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_DETAIL dt " + "t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_DETAIL dt " +
"WHERE t.NAME = ? AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ? AND dt.DEVICE_ID = d.ID " + "WHERE t.NAME = ? AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ? AND dt.DEVICE_ID = d.ID " +
"AND dt.UPDATE_TIMESTAMP > ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?"; "AND dt.UPDATE_TIMESTAMP > ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?" ;
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
int paramIdx = 1; int paramIdx = 1;
stmt.setString(paramIdx++, deviceIdentifier.getType()); stmt.setString(paramIdx++, deviceIdentifier.getType());
@ -168,7 +168,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while listing device for type " + throw new DeviceManagementDAOException("Error occurred while listing device for type " +
"'" + deviceIdentifier.getType() + "'", e); "'" + deviceIdentifier.getType() + "'", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -177,7 +177,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
@Override @Override
public Device getDevice(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status status, int tenantId) throws public Device getDevice(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status status, int tenantId) throws
DeviceManagementDAOException { DeviceManagementDAOException {
Connection conn; Connection conn;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -185,11 +185,11 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " + 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, " + "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, " + "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " +
"t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " + "t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " +
"t.NAME = ? AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID " + "t.NAME = ? AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID " +
"AND TENANT_ID = ? AND e.STATUS = ?"; "AND TENANT_ID = ? AND e.STATUS = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, deviceIdentifier.getType()); stmt.setString(1, deviceIdentifier.getType());
stmt.setString(2, deviceIdentifier.getId()); stmt.setString(2, deviceIdentifier.getId());
@ -202,7 +202,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while listing devices for type " + throw new DeviceManagementDAOException("Error occurred while listing devices for type " +
"'" + deviceIdentifier.getType() + "'", e); "'" + deviceIdentifier.getType() + "'", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -249,11 +249,11 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " + 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, " + "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, " + "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " +
"t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " + "t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " +
"d.ID = ? AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID " + "d.ID = ? AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID " +
"AND TENANT_ID = ?"; "AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, deviceId); stmt.setInt(1, deviceId);
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
@ -264,7 +264,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving device for id " + throw new DeviceManagementDAOException("Error occurred while retrieving device for id " +
"'" + deviceId + "'", e); "'" + deviceId + "'", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -346,11 +346,11 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT e1.OWNER, e1.OWNERSHIP, e1.ENROLMENT_ID, e1.DEVICE_ID, e1.STATUS, e1.DATE_OF_LAST_UPDATE," + String sql = "SELECT e1.OWNER, e1.OWNERSHIP, e1.ENROLMENT_ID, e1.DEVICE_ID, e1.STATUS, e1.DATE_OF_LAST_UPDATE," +
" e1.DATE_OF_ENROLMENT, d.DESCRIPTION, d.NAME AS DEVICE_NAME, d.DEVICE_IDENTIFICATION, t.NAME " + " e1.DATE_OF_ENROLMENT, d.DESCRIPTION, d.NAME AS DEVICE_NAME, d.DEVICE_IDENTIFICATION, t.NAME " +
"AS DEVICE_TYPE FROM DM_DEVICE d, (SELECT e.OWNER, e.OWNERSHIP, e.ID AS ENROLMENT_ID, " + "AS DEVICE_TYPE FROM DM_DEVICE d, (SELECT e.OWNER, e.OWNERSHIP, e.ID AS ENROLMENT_ID, " +
"e.DEVICE_ID, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e WHERE " + "e.DEVICE_ID, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e WHERE " +
"e.TENANT_ID = ? AND e.OWNER = ?) e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID " + "e.TENANT_ID = ? AND e.OWNER = ?) e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID " +
"AND t.ID = d.DEVICE_TYPE_ID"; "AND t.ID = d.DEVICE_TYPE_ID";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, username); stmt.setString(2, username);
@ -422,8 +422,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(d1.DEVICE_ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID AS DEVICE_ID FROM " + String sql = "SELECT COUNT(d1.DEVICE_ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID AS DEVICE_ID FROM " +
"DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?) d1 WHERE " + "DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?) d1 WHERE " +
"d1.DEVICE_ID = e.DEVICE_ID AND e.OWNER = ? AND TENANT_ID = ?"; "d1.DEVICE_ID = e.DEVICE_ID AND e.OWNER = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, username); stmt.setString(2, username);
@ -455,8 +455,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(d1.DEVICE_ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID AS DEVICE_ID FROM " + String sql = "SELECT COUNT(d1.DEVICE_ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID AS DEVICE_ID FROM " +
"DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?) d1 WHERE " + "DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?) d1 WHERE " +
"d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?"; "d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
@ -493,7 +493,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(d1.ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID, d.NAME, d.DEVICE_IDENTIFICATION, " + 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"; "t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t";
//Add query for last updated timestamp //Add query for last updated timestamp
if (since != null) { if (since != null) {
@ -561,7 +561,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving information of all " + throw new DeviceManagementDAOException("Error occurred while retrieving information of all " +
"registered devices", e); "registered devices", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -577,8 +577,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(d1.ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, " + String sql = "SELECT COUNT(d1.ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, " +
"DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND t.NAME = ? " + "DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND t.NAME = ? " +
"AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?"; "AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, type); stmt.setString(1, type);
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
@ -603,8 +603,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(e1.DEVICE_ID) AS DEVICE_COUNT FROM DM_DEVICE d, (SELECT e.DEVICE_ID " + String sql = "SELECT COUNT(e1.DEVICE_ID) AS DEVICE_COUNT FROM DM_DEVICE d, (SELECT e.DEVICE_ID " +
"FROM DM_ENROLMENT e WHERE e.TENANT_ID = ? AND e.OWNER = ?) " + "FROM DM_ENROLMENT e WHERE e.TENANT_ID = ? AND e.OWNER = ?) " +
"e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID AND t.ID = d.DEVICE_TYPE_ID"; "e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID AND t.ID = d.DEVICE_TYPE_ID";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, username); stmt.setString(2, username);
@ -615,7 +615,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while fetching the list of devices belongs to '" + throw new DeviceManagementDAOException("Error occurred while fetching the list of devices belongs to '" +
username + "'", e); username + "'", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, null); DeviceManagementDAOUtil.cleanupResources(stmt, null);
} }
@ -630,8 +630,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(d1.ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, " + String sql = "SELECT COUNT(d1.ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, " +
"DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID AND d.NAME LIKE ? AND d.TENANT_ID = ?) d1 " + "DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID AND d.NAME LIKE ? AND d.TENANT_ID = ?) d1 " +
"WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?"; "WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, deviceName + "%"); stmt.setString(1, deviceName + "%");
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
@ -643,7 +643,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while fetching the device count that matches " + throw new DeviceManagementDAOException("Error occurred while fetching the device count that matches " +
"'" + deviceName + "'", e); "'" + deviceName + "'", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, null); DeviceManagementDAOUtil.cleanupResources(stmt, null);
} }
@ -658,8 +658,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(d.ID) AS DEVICE_COUNT FROM (SELECT e.DEVICE_ID FROM DM_ENROLMENT e WHERE " + String sql = "SELECT COUNT(d.ID) AS DEVICE_COUNT FROM (SELECT e.DEVICE_ID FROM DM_ENROLMENT e WHERE " +
"TENANT_ID = ? AND OWNERSHIP = ?) e, DM_DEVICE d, " + "TENANT_ID = ? AND OWNERSHIP = ?) e, DM_DEVICE d, " +
"DM_DEVICE_TYPE t WHERE d.ID = e.DEVICE_ID AND d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?"; "DM_DEVICE_TYPE t WHERE d.ID = e.DEVICE_ID AND d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, ownerShip); stmt.setString(2, ownerShip);
@ -671,7 +671,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while fetching the list of devices that matches to ownership " + throw new DeviceManagementDAOException("Error occurred while fetching the list of devices that matches to ownership " +
"'" + ownerShip + "'", e); "'" + ownerShip + "'", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, null); DeviceManagementDAOUtil.cleanupResources(stmt, null);
} }
@ -686,8 +686,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(d.ID) AS DEVICE_COUNT FROM (SELECT e.DEVICE_ID FROM DM_ENROLMENT e WHERE " + String sql = "SELECT COUNT(d.ID) AS DEVICE_COUNT FROM (SELECT e.DEVICE_ID FROM DM_ENROLMENT e WHERE " +
"TENANT_ID = ? AND STATUS = ?) e, DM_DEVICE d, " + "TENANT_ID = ? AND STATUS = ?) e, DM_DEVICE d, " +
"DM_DEVICE_TYPE t WHERE d.ID = e.DEVICE_ID AND d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?"; "DM_DEVICE_TYPE t WHERE d.ID = e.DEVICE_ID AND d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, status); stmt.setString(2, status);
@ -699,7 +699,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while fetching the list of devices that matches to status " + throw new DeviceManagementDAOException("Error occurred while fetching the list of devices that matches to status " +
"'" + status + "'", e); "'" + status + "'", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, null); DeviceManagementDAOUtil.cleanupResources(stmt, null);
} }
@ -716,7 +716,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
conn = this.getConnection(); conn = this.getConnection();
String sql = "INSERT INTO DM_ENROLMENT(DEVICE_ID, OWNER, OWNERSHIP, STATUS,DATE_OF_ENROLMENT, " + String sql = "INSERT INTO DM_ENROLMENT(DEVICE_ID, OWNER, OWNERSHIP, STATUS,DATE_OF_ENROLMENT, " +
"DATE_OF_LAST_UPDATE, TENANT_ID) VALUES(?, ?, ?, ?, ?, ?, ?)"; "DATE_OF_LAST_UPDATE, TENANT_ID) VALUES(?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(sql, new String[]{"id"}); stmt = conn.prepareStatement(sql, new String[] {"id"});
stmt.setInt(1, device.getId()); stmt.setInt(1, device.getId());
stmt.setString(2, device.getEnrolmentInfo().getOwner()); stmt.setString(2, device.getEnrolmentInfo().getOwner());
stmt.setString(3, device.getEnrolmentInfo().getOwnership().toString()); stmt.setString(3, device.getEnrolmentInfo().getOwnership().toString());
@ -837,10 +837,10 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT ID AS ENROLMENT_ID, DEVICE_ID, OWNER, OWNERSHIP, STATUS, DATE_OF_ENROLMENT, " + String sql = "SELECT ID AS ENROLMENT_ID, DEVICE_ID, OWNER, OWNERSHIP, STATUS, DATE_OF_ENROLMENT, " +
"DATE_OF_LAST_UPDATE, TENANT_ID FROM DM_ENROLMENT WHERE DEVICE_ID = (SELECT d.ID " + "DATE_OF_LAST_UPDATE, TENANT_ID FROM DM_ENROLMENT WHERE DEVICE_ID = (SELECT d.ID " +
"FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID " + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID " +
"AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) " + "AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) " +
"AND TENANT_ID = ?"; "AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, deviceId.getId()); stmt.setString(1, deviceId.getId());
stmt.setString(2, deviceId.getType()); stmt.setString(2, deviceId.getType());
@ -853,7 +853,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
return enrolmentInfo; return enrolmentInfo;
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving the enrolment " + throw new DeviceManagementDAOException("Error occurred while retrieving the enrolment " +
"of device '" + deviceId + "'", e); "of device '" + deviceId + "'", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -868,10 +868,10 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT ID AS ENROLMENT_ID, DEVICE_ID, OWNER, OWNERSHIP, STATUS, DATE_OF_ENROLMENT, " + String sql = "SELECT ID AS ENROLMENT_ID, DEVICE_ID, OWNER, OWNERSHIP, STATUS, DATE_OF_ENROLMENT, " +
"DATE_OF_LAST_UPDATE, TENANT_ID FROM DM_ENROLMENT WHERE DEVICE_ID = (SELECT d.ID " + "DATE_OF_LAST_UPDATE, TENANT_ID FROM DM_ENROLMENT WHERE DEVICE_ID = (SELECT d.ID " +
"FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID " + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID " +
"AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) " + "AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) " +
"AND TENANT_ID = ? AND STATUS in ('ACTIVE','UNREACHABLE','INACTIVE')"; "AND TENANT_ID = ? AND STATUS in ('ACTIVE','UNREACHABLE','INACTIVE')";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, deviceId.getId()); stmt.setString(1, deviceId.getId());
stmt.setString(2, deviceId.getType()); stmt.setString(2, deviceId.getType());
@ -884,8 +884,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
return enrolmentInfo; return enrolmentInfo;
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving the enrolment " + throw new DeviceManagementDAOException("Error occurred while retrieving the enrolment " +
"information of device '" + deviceId.getId() + "' of type : " "information of device '" + deviceId.getId() + "' of type : "
+ deviceId.getType(), e); + deviceId.getType(), e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -899,8 +899,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, DM_DEVICE_TYPE t " + String sql = "SELECT e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, DM_DEVICE_TYPE t " +
"WHERE d.DEVICE_TYPE_ID = t.ID AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) dtm " + "WHERE d.DEVICE_TYPE_ID = t.ID AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) dtm " +
"WHERE e.DEVICE_ID = dtm.ID AND e.STATUS = ? AND e.TENANT_ID = ?;"; "WHERE e.DEVICE_ID = dtm.ID AND e.STATUS = ? AND e.TENANT_ID = ?;";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, deviceId.getId()); stmt.setString(1, deviceId.getId());
stmt.setString(2, deviceId.getType()); stmt.setString(2, deviceId.getType());
@ -1029,7 +1029,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
* *
* @param timestamp Timestamp in long, after which the devices have been updated. * @param timestamp Timestamp in long, after which the devices have been updated.
* @param tenantId Tenant id of the currently logged in user. * @param tenantId Tenant id of the currently logged in user.
* @return A collection of devices that have been updated after the provided timestamp * @return A collection of devices that have been updated after the provided timestamp
* @throws DeviceManagementDAOException * @throws DeviceManagementDAOException
*/ */
public List<Device> getDevices(long timestamp, int tenantId) throws DeviceManagementDAOException { public List<Device> getDevices(long timestamp, int tenantId) throws DeviceManagementDAOException {
@ -1084,5 +1084,4 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
return tenants; return tenants;
} }
} }

@ -316,6 +316,22 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
@Override @Override
public List<Integer> getDeviceEnrolledTenants() throws DeviceManagementException {
try {
DeviceManagementDAOFactory.openConnection();
return deviceDAO.getDeviceEnrolledTenants();
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the tenants " +
"which have device enrolled.", e);
} catch (SQLException e) {
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
} finally {
DeviceManagementDAOFactory.closeConnection();
}
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManager deviceManager = this.getDeviceManager(deviceId.getType()); DeviceManager deviceManager = this.getDeviceManager(deviceId.getType());
if (deviceManager == null) { if (deviceManager == null) {

@ -31,6 +31,8 @@ import org.wso2.carbon.device.mgt.core.task.DeviceTaskManager;
import org.wso2.carbon.ntask.core.Task; import org.wso2.carbon.ntask.core.Task;
import org.wso2.carbon.user.api.Tenant; import org.wso2.carbon.user.api.Tenant;
import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import java.util.List;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -60,7 +62,6 @@ public class DeviceDetailsRetrieverTask implements Task {
@Override @Override
public void execute() { public void execute() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Device details retrieving task started to run."); log.debug("Device details retrieving task started to run.");
} }
@ -97,6 +98,7 @@ public class DeviceDetailsRetrieverTask implements Task {
"from device manager provider service.", e); "from device manager provider service.", e);
} }
} }
} }

@ -40,7 +40,6 @@
} }
}, },
"errorPages": { "errorPages": {
"404": "cdmf.page.error-404",
"default": "uuf.page.error" "default": "uuf.page.error"
} }
} }

@ -1,25 +1,25 @@
{ {
"appContext": "/devicemgt/", "appContext": "/devicemgt/",
"isCloud": false, "isCloud": true,
"cloudConfig": { "cloudConfig": {
"upgradeNowURL": "", "upgradeNowURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/payment-plans.jag?cloud-type=device_cloud",
"monetizationURL": "", "monetizationURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/monetization-dashboard.jag",
"requestExtensionURL": "", "requestExtensionURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/contact-us.jag?cloud-type=device_cloud&amp;request-extension=true",
"publisherURL": "", "publisherURL": "",
"storeURL": "", "storeURL": "",
"contactUsURL": "", "contactUsURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/contact-us.jag",
"apiCloudDocURL": "https://docs.wso2.com/display/APICloud/WSO2+API+Cloud+Documentation", "apiCloudDocURL": "https://docs.wso2.com/display/APICloud/WSO2+API+Cloud+Documentation",
"appCloudDocURL": "https://docs.wso2.com/display/AppCloud/WSO2+App+Cloud+Documentation", "appCloudDocURL": "https://docs.wso2.com/display/AppCloud/WSO2+App+Cloud+Documentation",
"deviceCloudDocURL": "https://docs.wso2.com/display/DeviceCloud/WSO2+Device+Cloud+Documentation", "deviceCloudDocURL": "https://docs.wso2.com/display/DeviceCloud/WSO2+Device+Cloud+Documentation",
"apiCloudWalkthroughURL": "https://api.clouddev.wso2.com/publisher?interactiveTutorial=true", "apiCloudWalkthroughURL": "https://api.clouddev.wso2.com/publisher?interactiveTutorial=true",
"profileURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/user-profile.jag", "profileURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/user-profile.jag",
"changePasswordURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/change-password.jag", "changePasswordURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/change-password.jag",
"logoutURL": "https://api.clouddev.wso2.com/publisher/site/pages/logout.jag", "logoutURL": "https://devicemgt.cloud.wso2.com/devicemgt/logout",
"apiCloudURL": "", "apiCloudURL": "",
"appCloudURL": "", "appCloudURL": "",
"deviceCloudURL": "", "deviceCloudURL": "",
"oraganizationURL": "", "oraganizationURL": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag",
"membersURL": "" "membersURL": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag"
}, },
"httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%", "httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%",
"httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port", "httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port",

@ -0,0 +1,48 @@
{{!-- Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the
specific language governing permissions and limitations
under the License. --}}
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/style.css">
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/font-mf.css">
<title>
{{defineZone "title"}}
</title>
</head>
<body>
<div class="sky">
<section>
<div class="error-400">
<img src="https://error.cloud.wso2.com/images/400-error.svg">
</div>
<div class="text-label">
<h1>{{#defineZone "messageTitle"}}Oops something went wrong{{/defineZone}}</h1>
<h2>{{defineZone "messageDescription"}}</h2>
<div style="clear: both"></div>
<div class="button-label">
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag"><label class="label-back">Back to Cloud </label></a>
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag"><label class="label-report"> Report Issue </label></a>
</div>
</div>
</section>
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>
</body>
</html>

@ -48,7 +48,7 @@ var groupModule = {};
} }
return serviceInvokers.XMLHttp.get( return serviceInvokers.XMLHttp.get(
endPoint, function (responsePayload) { endPoint, function (responsePayload) {
return responsePayload["responseText"]; return parse(responsePayload["responseText"]);
}, },
function (responsePayload) { function (responsePayload) {
log.error(responsePayload["responseText"]); log.error(responsePayload["responseText"]);

@ -463,7 +463,13 @@ var userModule = function () {
publicMethods.isAuthorized = function (permission) { publicMethods.isAuthorized = function (permission) {
var carbon = require("carbon"); var carbon = require("carbon");
var carbonServer = application.get("carbonServer"); var carbonServer = application.get("carbonServer");
var carbonUser = session.get(constants.USER_SESSION_KEY); var carbonUser;
try {
carbonUser = session.get(constants.USER_SESSION_KEY);
} catch (e) {
log.error("User object was not found in the session");
carbonUser = null;
}
var utility = require('/app/modules/utility.js').utility; var utility = require('/app/modules/utility.js').utility;
if (!carbonUser) { if (!carbonUser) {
log.error("User object was not found in the session"); log.error("User object was not found in the session");

@ -40,7 +40,7 @@ var handlers = function () {
"as input - setupTokenPairByPasswordGrantType(x, y)"); "as input - setupTokenPairByPasswordGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " +
@ -84,7 +84,7 @@ var handlers = function () {
"as input - setupTokenPairBySamlGrantType(x, y)"); "as input - setupTokenPairBySamlGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " +
@ -129,7 +129,7 @@ var handlers = function () {
"as input - setupTokenPairBySamlGrantType(x, y)"); "as input - setupTokenPairBySamlGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " +
@ -224,44 +224,44 @@ var handlers = function () {
} }
}; };
privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) { // privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) {
if (!username) { // if (!username) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context. No username of logged in user is found as " + // "client credentials to session context. No username of logged in user is found as " +
"input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} else { // } else {
if (devicemgtProps["gatewayEnabled"]) { // if (devicemgtProps["gatewayEnabled"]) {
var tenantBasedWebSocketClientAppCredentials // var tenantBasedWebSocketClientAppCredentials
= tokenUtil.getTenantBasedWebSocketClientAppCredentials(username); // = tokenUtil.getTenantBasedWebSocketClientAppCredentials(username);
if (!tenantBasedWebSocketClientAppCredentials) { // if (!tenantBasedWebSocketClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " +
"based client credentials to session context as the server is unable " + // "based client credentials to session context as the server is unable " +
"to obtain such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "to obtain such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} else { // } else {
var encodedTenantBasedWebSocketClientAppCredentials = // var encodedTenantBasedWebSocketClientAppCredentials =
tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" + // tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" +
tenantBasedWebSocketClientAppCredentials["clientSecret"]); // tenantBasedWebSocketClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context. // // setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], // session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
encodedTenantBasedWebSocketClientAppCredentials); // encodedTenantBasedWebSocketClientAppCredentials);
} // }
} else { // } else {
var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials(); // var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials();
if (!dynamicClientAppCredentials) { // if (!dynamicClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context as the server is unable to obtain " + // "client credentials to session context as the server is unable to obtain " +
"dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} // }
var encodedTenantBasedWebSocketClientAppCredentials = // var encodedTenantBasedWebSocketClientAppCredentials =
tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" + // tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" +
dynamicClientAppCredentials["clientSecret"]); // dynamicClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context. // // setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], // session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
encodedTenantBasedWebSocketClientAppCredentials); // encodedTenantBasedWebSocketClientAppCredentials);
} // }
} // }
}; // };
return publicMethods; return publicMethods;
}(); }();

@ -35,18 +35,18 @@
<div class="tile-icon"><i class="fw fw-mobile"></i></div> <div class="tile-icon"><i class="fw fw-mobile"></i></div>
<div class="tile-stats"> <div class="tile-stats">
<span id="device-count">{{deviceCount}}</span> <span id="device-count">{{deviceCount}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
{{#if deviceCount}} {{#if deviceCount}}
<a href="{{@app.context}}/devices"> <a href="{{@app.context}}/devices">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i> <i class="fw fw-view fw-stack-1x"></i>
</span> </span>
View View
</a> </a>
{{/if}} {{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/device/enroll"> <a href="{{@app.context}}/device/enroll">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
@ -66,7 +66,7 @@
<div class="tile-icon"><i class="fw fw-group"></i></div> <div class="tile-icon"><i class="fw fw-group"></i></div>
<div class="tile-stats"> <div class="tile-stats">
<span id="group-count">{{groupCount}}</span> <span id="group-count">{{groupCount}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
{{#if groupCount}} {{#if groupCount}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/groups"> <a href="{{@app.context}}/groups">
@ -77,14 +77,16 @@
View View
</a> </a>
{{/if}} {{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/group/add">
<a href="{{@app.context}}/group/add">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
</span> </span>
Add Add
</a> </a>
</span> </span>
</div> </div>
</div> </div>
@ -97,7 +99,7 @@
<div class="tile-icon"><i class="fw fw-user"></i></div> <div class="tile-icon"><i class="fw fw-user"></i></div>
<div class="tile-stats"> <div class="tile-stats">
<span id="user-count">{{userCount}}</span> <span id="user-count">{{userCount}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
{{#if userCount}} {{#if userCount}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/users"> <a href="{{@app.context}}/users">
@ -108,14 +110,16 @@
View View
</a> </a>
{{/if}} {{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/user/add"> {{#unless isCloud}}
<a href="{{@app.context}}/user/add">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
</span> </span>
Add Add
</a> </a>
{{/unless}}
</span> </span>
</div> </div>
</div> </div>
@ -128,7 +132,7 @@
<div class="tile-icon"><i class="fw fw-policy"></i></div> <div class="tile-icon"><i class="fw fw-policy"></i></div>
<div class="tile-stats"> <div class="tile-stats">
<span id="policy-count">{{policyCount}}</span> <span id="policy-count">{{policyCount}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
{{#if policyCount}} {{#if policyCount}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policies"> <a href="{{@app.context}}/policies">
@ -139,14 +143,16 @@
View View
</a> </a>
{{/if}} {{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policy/add">
<a href="{{@app.context}}/policy/add">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
</span> </span>
Add Add
</a> </a>
</span> </span>
</div> </div>
</div> </div>
@ -171,13 +177,15 @@
</a> </a>
{{/if}} {{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/role/add"> {{#unless isCloud}}
<a href="{{@app.context}}/role/add">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
</span> </span>
Add Add
</a> </a>
{{/unless}}
</span> </span>
</div> </div>
</div> </div>

@ -40,6 +40,7 @@ function onRequest() {
viewModel.userCount = userModule.getUsersCount(); viewModel.userCount = userModule.getUsersCount();
viewModel.policyCount = policyModule.getPoliciesCount(); viewModel.policyCount = policyModule.getPoliciesCount();
viewModel.roleCount = userModule.getRolesCount(); viewModel.roleCount = userModule.getRolesCount();
viewModel.isCloud = devicemgtProps.isCloud;
return viewModel; return viewModel;
} }

@ -152,6 +152,7 @@
</div> </div>
</div> </div>
</div>
<!-- /content/body --> <!-- /content/body -->
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -57,7 +57,7 @@
Assign from My Devices Assign from My Devices
</a> </a>
</li> </li>
<li> <!--<li>
<a href="{{@app.context}}/group/{{group.id}}/analytics" class="cu-btn"> <a href="{{@app.context}}/group/{{group.id}}/analytics" class="cu-btn">
<span class="icon fw-stack"> <span class="icon fw-stack">
<i class="fw fw-statistics fw-stack-1x"></i> <i class="fw fw-statistics fw-stack-1x"></i>
@ -65,7 +65,7 @@
</span> </span>
View Analytics View Analytics
</a> </a>
</li> </li>-->
{{else}} {{else}}
{{#if permissions.enroll}} {{#if permissions.enroll}}
<li> <li>
@ -91,7 +91,8 @@
<div id="device_overview"> <div id="device_overview">
<div class="media-left col-lg-2"> <div class="media-left col-lg-2">
<div class="icon"> <div class="icon">
<img src="/devicemgt/public/cdmf.page.groups/images/group-icon.png" style="background-color: #11375b; height: 152px;"> <img src="/devicemgt/public/cdmf.page.groups/images/group-icon.png"
style="background-color: #11375b; height: 152px;">
</div> </div>
</div> </div>
<div class="media-body asset-desc add-padding-left-5x"> <div class="media-body asset-desc add-padding-left-5x">
@ -139,7 +140,7 @@
{{unit "cdmf.unit.device.operation-mod"}} {{unit "cdmf.unit.device.operation-mod"}}
{{#if deviceCount}} {{#if deviceCount}}
<div id="loading-content" class="col-centered"> <div id="loading-content" class="col-centered">
<i class="fw fw-settings fw-spin fw-2x"></i> <i class="fw fw-wso2-logo fw-pulse fw-2x"></i>
Loading devices . . . Loading devices . . .
<br> <br>
</div> </div>
@ -214,11 +215,11 @@
</thead> </thead>
<tbody id="ast-container"> <tbody id="ast-container">
<br class="c-both" /> <br class="c-both"/>
</tbody> </tbody>
</table> </table>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
<div id="content-filter-types" style="display: none"> <div id="content-filter-types" style="display: none">
<div class="sort-title">Sort By</div> <div class="sort-title">Sort By</div>
<div class="sort-options"> <div class="sort-options">
@ -236,13 +237,13 @@
<i class="fw fw-devices fw-3x"></i> <i class="fw fw-devices fw-3x"></i>
</h3> </h3>
<h3 class="text-muted"> <h3 class="text-muted">
You don't have any device You don't have any
{{#if group}} {{#if group}}
assigned to this group devices assigned to this group. Let's add a device!
{{else}} {{else}}
enrolled enrolled devices. Let's enroll a device!
{{/if}} {{/if}}
at the moment.
</h3> </h3>
<h3> <h3>
{{#if group}} {{#if group}}
@ -256,7 +257,7 @@
</a> </a>
{{else}} {{else}}
{{#if permissions.enroll}} {{#if permissions.enroll}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/device/enroll" class="btn-operations btn-default"> <a href="{{@app.context}}/device/enroll" class="btn-operations btn-default">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
@ -427,7 +428,7 @@
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>Exception at backend. Try Later.</h3> <h3>Exception at backend. Try Later.</h3>
<br /> <br/>
<div class="buttons"> <div class="buttons">
<a href="#" id="device-400-link" class="btn-operations"> <a href="#" id="device-400-link" class="btn-operations">
Ok Ok
@ -443,7 +444,7 @@
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>Operation not permitted.</h3> <h3>Operation not permitted.</h3>
<br /> <br/>
<div class="buttons"> <div class="buttons">
<a href="#" id="device-403-link" class="btn-operations"> <a href="#" id="device-403-link" class="btn-operations">
Ok Ok
@ -458,9 +459,10 @@
<div class="modal-content"> <div class="modal-content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>You don't have any groups to add this device. Please add group <h3>
first.</h3> You don't have any device group to add this device. Let's add a new
<br /> device group!</h3>
<br/>
<div class="buttons"> <div class="buttons">
<a href="{{@app.context}}/group/add" class="btn-operations"> <a href="{{@app.context}}/group/add" class="btn-operations">
Add New Group Add New Group
@ -480,7 +482,7 @@
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>Device does not exist.</h3> <h3>Device does not exist.</h3>
<br /> <br/>
<div class="buttons"> <div class="buttons">
<a href="#" id="remove-device-409-link" class="btn-operations"> <a href="#" id="remove-device-409-link" class="btn-operations">
Ok Ok

@ -315,7 +315,7 @@ function loadDevices(searchType, searchParam) {
{ {
targets: 6, targets: 6,
data: 'status', data: 'status',
class: 'text-right content-fill text-left-on-grid-view no-wrap', class: 'text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix',
render: function (status, type, row, meta) { render: function (status, type, row, meta) {
var deviceType = row.deviceType; var deviceType = row.deviceType;
var deviceIdentifier = row.deviceIdentifier; var deviceIdentifier = row.deviceIdentifier;
@ -326,7 +326,7 @@ function loadDevices(searchType, searchParam) {
if (analyticsEnabled(row.deviceType)) { if (analyticsEnabled(row.deviceType)) {
html += '<a href="' + context + '/device/' + deviceType + '/analytics?deviceId=' + html += '<a href="' + context + '/device/' + deviceType + '/analytics?deviceId=' +
deviceIdentifier + '&deviceName=' + row.name + '" ' + 'data-click-event="remove-form"' + deviceIdentifier + '&deviceName=' + row.name + '" ' + 'data-click-event="remove-form"' +
' class="btn padding-reduce-on-grid-view"><span class="fw-stack">' + ' class="btn padding-reduce-on-grid-view" data-placement="top" data-toggle="tooltip" data-original-title="Analytics"><span class="fw-stack">' +
'<i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>' + '<i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>' +
'<span class="hidden-xs hidden-on-grid-view">Analytics</span>'; '<span class="hidden-xs hidden-on-grid-view">Analytics</span>';
} }
@ -337,24 +337,24 @@ function loadDevices(searchType, searchParam) {
+ +
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
+ '" data-devicename="' + + '" data-devicename="' +
row.name + '"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' + row.name + '" data-placement="top" data-toggle="tooltip" data-original-title="Group"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' +
'<i class="fw fw-group fw-stack-1x"></i></span>' + '<i class="fw fw-group fw-stack-1x"></i></span>' +
'<span class="hidden-xs hidden-on-grid-view">Group</span></a>'; '<span class="hidden-xs hidden-on-grid-view">Group</span></a>';
} }
html += // html +=
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" ' // '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" '
+ 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType // + 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
+ '" data-devicename="' + row.name + '">' // + '" data-devicename="' + row.name + '" data-placement="top" data-toggle="tooltip" data-original-title="Edit">'
+ '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' // + '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>'
+ '<i class="fw fw-edit fw-stack-1x"></i></span>' // + '<i class="fw fw-edit fw-stack-1x"></i></span>'
+ '<span class="hidden-xs hidden-on-grid-view">Edit</span></a>'; // + '<span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
var groupOwner = $('#group_owner').text(); var groupOwner = $('#group_owner').text();
if (groupId && groupOwner != "wso2.system.user") { if (groupId && groupOwner != "wso2.system.user") {
html += html +=
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-device-link" ' '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-device-link" '
+ 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType + 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
+ '" data-devicename="' + row.name + '">' + '" data-devicename="' + row.name + '" data-placement="top" data-toggle="tooltip" data-original-title="Remove from group">'
+ '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' + '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>'
+ '<i class="fw fw-delete fw-stack-1x"></i></span>' + '<i class="fw fw-delete fw-stack-1x"></i></span>'
+ '<span class="hidden-xs hidden-on-grid-view">Remove from group</span>'; + '<span class="hidden-xs hidden-on-grid-view">Remove from group</span>';
@ -362,7 +362,7 @@ function loadDevices(searchType, searchParam) {
html += html +=
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-device-link" ' '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-device-link" '
+ 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType + 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
+ '" data-devicename="' + row.name + '">' + '" data-devicename="' + row.name + '" data-placement="top" data-toggle="tooltip" data-original-title="Delete">'
+ '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' + '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>'
+ '<i class="fw fw-delete fw-stack-1x"></i></span>' + '<i class="fw fw-delete fw-stack-1x"></i></span>'
+ '<span class="hidden-xs hidden-on-grid-view">Delete</span>'; + '<span class="hidden-xs hidden-on-grid-view">Delete</span>';
@ -460,11 +460,12 @@ function loadDevices(searchType, searchParam) {
$("#loading-content").remove(); $("#loading-content").remove();
attachDeviceEvents(); attachDeviceEvents();
if($('.advance-search').length < 1){ // Temporary disable
/*if($('.advance-search').length < 1){
$(this).closest('.dataTables_wrapper').find('div[id$=_filter] input') $(this).closest('.dataTables_wrapper').find('div[id$=_filter] input')
.after('<a href="'+context+'/devices/search"' + .after('<a href="'+context+'/devices/search"' +
' class="advance-search add-padding-3x">Advance Search</a>'); ' class="advance-search add-padding-3x">Advance Search</a>');
} }*/
}, { }, {
"placeholder": "Search By Device Name", "placeholder": "Search By Device Name",

@ -1,6 +0,0 @@
{
"version": "1.0.0",
"uri": "/error/404",
"layout": "uuf.layout.default",
"isAnonymous": true
}

@ -17,22 +17,6 @@
}} }}
{{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}} {{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}}
{{#zone "breadcrumbs"}} {{#zone "messageDescription"}}
<li> {{@page.params.status}} - {{@page.params.message}}
<a href="{{@app.context}}/">
<i class="icon fw fw-home"></i>
</a>
</li>
{{/zone}}
{{#zone "content"}}
<div class="message message-danger">
<h4><i class="icon fw fw-error"></i>An Error Occurred!</h4>
<div style="padding-left: 25px;">
<h5><b>HTTP Status : {{@page.params.status}}</b></h5>
<p style="white-space: pre-wrap;">{{@page.params.message}}</p>
</div>
</div>
{{/zone}} {{/zone}}

@ -0,0 +1,5 @@
{
"version": "1.0.0",
"uri": "/errors/default",
"layout" : "cdmf.layout.error"
}

@ -65,7 +65,7 @@
{{else}} {{else}}
<div id="ast-container" class="ast-container list-view"> <div id="ast-container" class="ast-container list-view">
<div class="ctrl-info-panel col-centered text-center wr-login"> <div class="ctrl-info-panel col-centered text-center wr-login">
<h2>You don't have any device assigned to this group to view analytics.</h2> <h2>You don't have any device assigned to this group to view analytics. Let's add a new device group!</h2>
<br/> <br/>
<p class="text-center"> <p class="text-center">
<a href="{{@app.context}}/devices" class="wr-btn"> <a href="{{@app.context}}/devices" class="wr-btn">

@ -21,19 +21,26 @@
{{#zone "content"}} {{#zone "content"}}
<div class="container container-bg white-bg"> <div class="container container-bg white-bg">
<div class="col-md-12 col-lg-6 col-centered wr-content wr-login col-centered sign-panel"> <div class="col-md-12 col-lg-6 col-centered wr-content wr-login col-centered sign-panel" id="group-create-form">
<p class="page-sub-title">Add New Group</p> <p class="page-sub-title">Add New Group</p>
<p>Create new device group on IoT Server</p> <p>Create new device group on
{{#if isCloud}}
Device Cloud
{{else}}
IoT Server
{{/if}}
.
</p>
<!-- validation --> <!-- validation -->
<span class="wr-validation-summary hidden center-block col-centered"> <span class="wr-validation-summary hidden center-block col-centered">
<strong class="label label-danger col-centered"></strong> <strong class="label label-danger col-centered"></strong>
</span> </span>
<hr/> <hr/>
<div class="form-login-box"> <div class="form-login-box" >
<label class="wr-input-label">Group Name</label> <label class="wr-input-label">Group Name</label>
<div class="form-group wr-input-control"> <div class="form-group wr-input-control">
@ -51,12 +58,34 @@
<div class="wr-input-control"> <div class="wr-input-control">
<button class="wr-btn" id="add-group-btn"> <button class="wr-btn" id="add-group-btn">
Add</button> Add
</button>
<button class="wr-btn" onclick="window.location = '{{@app.context}}/groups';return false;"> <button class="wr-btn" onclick="window.location = '{{@app.context}}/groups';return false;">
Cancel</button> Cancel
</button>
</div> </div>
</div> </div>
</div> </div>
<div id="group-created-msg" class="container col-centered wr-content hidden">
<div class="wr-form">
<p class="page-sub-title">Group was created successfully.</p>
<br>Please click <b>"Add Another Group"</b>, if you wish to add another group or click
<b>"View Group List"</b> to complete the process and go back to the group list.
<hr/>
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/groups'">View User List
</button>
<a href="{{@app.context}}/group/add" class="cu-btn-inner">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add Another Group
</a>
</div>
</div>
</div> </div>
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -25,6 +25,7 @@
function onRequest(context) { function onRequest(context) {
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var page = {}; var page = {};
page["isCloud"] = devicemgtProps.isCloud;
page["groupNameJSRegEx"] = devicemgtProps.groupValidationConfig.groupNameJSRegEx; page["groupNameJSRegEx"] = devicemgtProps.groupValidationConfig.groupNameJSRegEx;
page["groupNameRegExViolationErrorMsg"] = devicemgtProps.groupValidationConfig.groupNameRegExViolationErrorMsg; page["groupNameRegExViolationErrorMsg"] = devicemgtProps.groupValidationConfig.groupNameRegExViolationErrorMsg;
page["groupNameHelpMsg"] = devicemgtProps.groupValidationConfig.groupNameHelpMsg; page["groupNameHelpMsg"] = devicemgtProps.groupValidationConfig.groupNameHelpMsg;

@ -45,13 +45,8 @@ $(function () {
var successCallback = function (jqXHR, status, resp) { var successCallback = function (jqXHR, status, resp) {
if (resp.status == 201) { if (resp.status == 201) {
$('.wr-validation-summary strong').text("Group created. You will be redirected to groups"); $("#group-create-form").addClass("hidden");
$('.wr-validation-summary').removeClass("hidden"); $("#group-created-msg").removeClass("hidden");
$('.wr-validation-summary strong').removeClass("label-danger");
$('.wr-validation-summary strong').addClass("label-success");
setTimeout(function () {
window.location = "../groups";
}, 1500);
} else { } else {
displayErrors(resp.status); displayErrors(resp.status);
} }

@ -82,7 +82,7 @@
<h3 class="text-muted"> <h3 class="text-muted">
<i class="fw fw-group fw-3x"></i> <i class="fw fw-group fw-3x"></i>
</h3> </h3>
<h3 class="text-muted">You don't have any group registered at the moment</h3> <h3 class="text-muted">You don't have any device group. Let's add a new device group!</h3>
{{#if permissions.ADD_GROUP}} {{#if permissions.ADD_GROUP}}
<h3> <h3>
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
@ -103,7 +103,7 @@
<div class="modal-header"> <div class="modal-header">
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
<span> <span>
<span class="fw-stack"> <span class="fw-stack add-margin-right-2x">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-share fw-stack-1x"></i> <i class="fw fw-share fw-stack-1x"></i>
</span> Group Sharing </span> Group Sharing
@ -145,7 +145,7 @@
<div class="modal-header"> <div class="modal-header">
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
<span> <span>
<span class="fw-stack"> <span class="fw-stack add-margin-right-2x">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-bookmark fw-stack-1x"></i> <i class="fw fw-bookmark fw-stack-1x"></i>
</span> Group Sharing Role </span> Group Sharing Role
@ -262,7 +262,7 @@
<div class="modal-header"> <div class="modal-header">
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
<span> <span>
<span class="fw-stack"> <span class="fw-stack add-margin-right-2x">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-edit fw-stack-1x"></i> <i class="fw fw-edit fw-stack-1x"></i>
</span> Update Group </span> Update Group

@ -180,33 +180,33 @@ function loadGroups() {
{ {
targets: 4, targets: 4,
data: 'id', data: 'id',
class: 'text-right content-fill text-left-on-grid-view no-wrap', class: 'text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix',
render: function (id, type, row, meta) { render: function (id, type, row, meta) {
var html = ''; var html = '';
if ($.hasPermission("VIEW_GROUP_DEVICES")) { if ($.hasPermission("VIEW_GROUP_DEVICES")) {
html += '<a href="group/' + row.groupId /*html += '<a href="group/' + row.groupId
+ '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' + + '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
'<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>' '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
+ +
'<span class="hidden-xs hidden-on-grid-view">Analytics</span></a>'; '<span class="hidden-xs hidden-on-grid-view">Analytics</span></a>';*/
} }
if (row.owner != "wso2.system.user") { if (row.owner != "wso2.system.user") {
if ($.hasPermission("SHARE_GROUP")) { // if ($.hasPermission("SHARE_GROUP")) {
html += // html +=
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view share-group-link" data-group-id="' // '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view share-group-link" data-group-id="'
+ row.groupId + '" ' + // + row.groupId + '" ' +
'data-group-owner="' + row.owner // 'data-group-owner="' + row.owner
+ '"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-share fw-stack-1x"></i></span>' // + '" data-placement="top" data-toggle="tooltip" data-original-title="Share"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-share fw-stack-1x"></i></span>'
+ // +
'<span class="hidden-xs hidden-on-grid-view">Share</span></a>'; // '<span class="hidden-xs hidden-on-grid-view">Share</span></a>';
} // }
if ($.hasPermission("UPDATE_GROUP")) { if ($.hasPermission("UPDATE_GROUP")) {
html += html +=
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-group-link" data-group-name="' '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-group-link" data-group-name="'
+ row.name + '" ' + + row.name + '" ' +
'data-group-owner="' + row.owner + '" data-group-description="' + row.description 'data-group-owner="' + row.owner + '" data-group-description="' + row.description
+ '" data-group-id="' + row.groupId + '" data-group-id="' + row.groupId
+ '"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' + + '" data-placement="top" data-toggle="tooltip" data-original-title="Edit"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' +
'<i class="fw fw-edit fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>'; '<i class="fw fw-edit fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
} }
if ($.hasPermission("REMOVE_GROUP")) { if ($.hasPermission("REMOVE_GROUP")) {
@ -214,7 +214,7 @@ function loadGroups() {
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-group-link" data-group-id="' '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-group-link" data-group-id="'
+ row.groupId + '" ' + + row.groupId + '" ' +
'data-group-owner="' + row.owner 'data-group-owner="' + row.owner
+ '"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i>' + '" data-placement="top" data-toggle="tooltip" data-original-title="Delete"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i>'
+ +
'</span><span class="hidden-xs hidden-on-grid-view">Delete</span></a>'; '</span><span class="hidden-xs hidden-on-grid-view">Delete</span></a>';
} }

@ -91,7 +91,7 @@
<h3 class="text-muted"> <h3 class="text-muted">
<i class="fw fw-policy fw-3x"></i> <i class="fw fw-policy fw-3x"></i>
</h3> </h3>
<h3 class="text-muted">You do not have any device policy at the moment</h3> <h3 class="text-muted">You don't have any device policies. Let's add a new policy!</h3>
{{#if permissions.ADD_ADMIN_POLICY}} {{#if permissions.ADD_ADMIN_POLICY}}
<h3> <h3>
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->

@ -142,8 +142,14 @@ function loadRoles() {
class: "text-right content-fill text-left-on-grid-view no-wrap", class: "text-right content-fill text-left-on-grid-view no-wrap",
data: null, data: null,
render: function (data, type, row, meta) { render: function (data, type, row, meta) {
return '' + var isCloud = false;
'<a onclick="javascript:loadRoleBasedActionURL(\'edit\', \'' + data.name + '\')" ' + if ($('#is-cloud').length > 0){
isCloud = true;
}
var innerhtml = '';
var editLink = '<a onclick="javascript:loadRoleBasedActionURL(\'edit\', \'' + data.name + '\')" ' +
'data-role="' + data.name + '" ' + 'data-role="' + data.name + '" ' +
'data-click-event="edit-form" ' + 'data-click-event="edit-form" ' +
'class="btn padding-reduce-on-grid-view edit-role-link">' + 'class="btn padding-reduce-on-grid-view edit-role-link">' +
@ -156,8 +162,9 @@ function loadRoles() {
'</span>' + '</span>' +
'</span>' + '</span>' +
'<span class="hidden-xs hidden-on-grid-view">Edit</span>' + '<span class="hidden-xs hidden-on-grid-view">Edit</span>' +
'</a>' + '</a>';
'<a onclick="javascript:loadRoleBasedActionURL(\'edit-permission\', \'' + data.name + '\')" ' +
var editPermissionLink = '<a onclick="javascript:loadRoleBasedActionURL(\'edit-permission\', \'' + data.name + '\')" ' +
'data-role="' + data.name + '" ' + 'data-role="' + data.name + '" ' +
'data-click-event="edit-form" ' + 'data-click-event="edit-form" ' +
'class="btn padding-reduce-on-grid-view edit-permission-link">' + 'class="btn padding-reduce-on-grid-view edit-permission-link">' +
@ -170,8 +177,9 @@ function loadRoles() {
'</span>' + '</span>' +
'</span>' + '</span>' +
'<span class="hidden-xs hidden-on-grid-view">Edit Permission</span>' + '<span class="hidden-xs hidden-on-grid-view">Edit Permission</span>' +
'</a>' + '</a>';
'<a data-role="' + data.name + '" ' +
var removeLink = '<a data-role="' + data.name + '" ' +
'data-click-event="remove-form" ' + 'data-click-event="remove-form" ' +
'class="btn padding-reduce-on-grid-view remove-role-link">' + 'class="btn padding-reduce-on-grid-view remove-role-link">' +
'<span class="fw-stack">' + '<span class="fw-stack">' +
@ -180,6 +188,11 @@ function loadRoles() {
'</span>' + '</span>' +
'<span class="hidden-xs hidden-on-grid-view">Remove</span>' + '<span class="hidden-xs hidden-on-grid-view">Remove</span>' +
'</a>'; '</a>';
if (!isCloud) {
innerhtml = editLink + editPermissionLink + removeLink;
}
return innerhtml;
} }
} }
]; ];

@ -35,6 +35,7 @@
{{/zone}} {{/zone}}
{{#zone "navbarActions"}} {{#zone "navbarActions"}}
{{#unless isCloud}}
<li> <li>
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/role/add" class="cu-btn"> <a href="{{@app.context}}/role/add" class="cu-btn">
@ -45,16 +46,22 @@
Add Role Add Role
</a> </a>
</li> </li>
{{/unless}}
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
<div id="loading-content" class="col-centered"> <div id="loading-content" class="col-centered">
{{#unless isCloud}}
{{#if removePermitted}} {{#if removePermitted}}
<input type="hidden" id="can-remove" value="true" /> <input type="hidden" id="can-remove" value="true" />
{{/if}} {{/if}}
{{#if editPermitted}} {{#if editPermitted}}
<input type="hidden" id="can-edit" value="true" /> <input type="hidden" id="can-edit" value="true" />
{{/if}} {{/if}}
{{/unless}}
{{#if isCloud}}
<input type="hidden" id="is-cloud" value="true" />
{{/if}}
<i class="fw fw-settings fw-spin fw-2x"></i> <i class="fw fw-settings fw-spin fw-2x"></i>
Loading roles . . . Loading roles . . .
<br> <br>

@ -32,6 +32,7 @@ function onRequest(context) {
} }
context["adminRole"] = deviceMgtProps["adminRole"]; context["adminRole"] = deviceMgtProps["adminRole"];
context["isCloud"] = deviceMgtProps["isCloud"];
return context; return context;
} }

@ -37,94 +37,99 @@
{{#zone "content"}} {{#zone "content"}}
{{#if canView}} {{#if canView}}
{{#zone "contentTitle"}} {{#zone "contentTitle"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">
<label class="device-id device-select" data-username="{{user.username}}"> <label class="device-id device-select" data-username="{{user.username}}">
{{#if user.firstname}} {{#if user.firstname}}
{{user.firstname}} {{user.lastname}} {{user.firstname}} {{user.lastname}}
{{else}} {{else}}
{{user.username}} {{user.username}}
{{/if}} {{/if}}
</label> </label>
</div>
</div> </div>
</div> {{/zone}}
{{/zone}}
<div class="row no-gutter add-padding-5x add-margin-top-5x" style="border: 1px solid #e4e4e4;"> <div class="row no-gutter add-padding-5x add-margin-top-5x" style="border: 1px solid #e4e4e4;">
<div class="media"> <div class="media">
<div class="media-left media-middle asset-image col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="media-left media-middle asset-image col-xs-2 col-sm-2 col-md-2 col-lg-2">
<div class="thumbnail icon" style="margin-bottom: 43px"><i class="square-element text fw fw-user"></i> <div class="thumbnail icon" style="margin-bottom: 43px"><i
class="square-element text fw fw-user"></i>
</div>
<div class="media">
{{#unless isCloud}}
{{#if editPermitted}}
<button class="wr-btn"
onclick="location.href='{{@app.context}}/users/edit-user?username={{user.username}}';"
id="sortUpdateBtn"
style="width: 100%; vertical-align: bottom; background-color: #7fa030;"><span><i
class="fw fw-edit"></i> Edit</span></button>
{{/if}}
{{/unless}}
</div>
</div> </div>
<div class="media"> <div class="media-body asset-desc add-padding-left-5x">
{{#if editPermitted}} <div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Profile Overview
<button class="wr-btn" </div>
onclick="location.href='{{@app.context}}/users/edit-user?username={{user.username}}';" {{#defineZone "user-detail-properties"}}
id="sortUpdateBtn" <table class="table table-responsive table-striped" id="members">
style="width: 100%; vertical-align: bottom; background-color: #7fa030;"><span><i <tbody>
class="fw fw-edit"></i> Edit</span></button> <tr role="row" class="even">
{{/if}} <td class="sorting_1" style="padding:10px 15px; width: 7%;">Username</td>
<td style="padding:10px 15px;">{{user.username}}</td>
</tr>
<tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px;">First Name</td>
<td style="padding:10px 15px;">{{user.firstname}}</td>
</tr>
<tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px;">Last Name</td>
<td style="padding:10px 15px;">{{user.lastname}}</td>
</tr>
<tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px;">Email</td>
<td style="padding:10px 15px;">{{user.emailAddress}}</td>
</tr>
<tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px;">Roles</td>
<td style="padding:10px 15px;">
{{#each userRoles}}
<option selected="selected">{{this}}</option>
{{/each}}
</td>
</tr>
</tbody>
</table>
{{/defineZone}}
</div> </div>
</div> </div>
<div class="media-body asset-desc add-padding-left-5x"> <div class="media">
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Profile Overview</div> <div class="media-left col-xs-12 col-sm-2 col-md-2 col-lg-2">
{{#defineZone "user-detail-properties"}} <ul class="list-group" role="tablist">
<table class="table table-responsive table-striped" id="members"> <li class="active"><a class="list-group-item" href="#enrolled_devices" role="tab"
<tbody> data-toggle="tab" aria-controls="enrolled_devices">Enrolled Devices</a>
<tr role="row" class="even"> </li>
<td class="sorting_1" style="padding:10px 15px; width: 7%;">Username</td> </ul>
<td style="padding:10px 15px;">{{user.username}}</td> </div>
</tr> {{#defineZone "user-enrolled-devices"}}
<tr role="row" class="odd"> <div class="media-body add-padding-left-5x remove-padding-xs tab-content">
<td class="sorting_1" style="padding:10px 15px;">First Name</td> <div class="panel-group tab-content">
<td style="padding:10px 15px;">{{user.firstname}}</td> <div class="panel panel-default tab-pane active" id="enrolled_devices"
</tr> role="tabpanel" aria-labelledby="enrolled_devices">
<tr role="row" class="even"> <div class="panel-heading">Enrolled Devices by
<td class="sorting_1" style="padding:10px 15px;">Last Name</td> {{#if user.firstname}}
<td style="padding:10px 15px;">{{user.lastname}}</td> {{user.firstname}} {{user.lastname}}
</tr> {{else}}
<tr role="row" class="even"> {{user.username}}
<td class="sorting_1" style="padding:10px 15px;">Email</td> {{/if}}
<td style="padding:10px 15px;">{{user.emailAddress}}</td> </div>
</tr> <div class="panel-body">
<tr role="row" class="even"> <div id="enrolled_devices-container">
<td class="sorting_1" style="padding:10px 15px;">Roles</td> <div class="panel-body">
<td style="padding:10px 15px;"> {{#each devices}}
{{#each userRoles}} <div class="wr-list-group wr-sortable policy-list">
<option selected="selected">{{this}}</option>
{{/each}}
</td>
</tr>
</tbody>
</table>
{{/defineZone}}
</div>
</div>
<div class="media">
<div class="media-left col-xs-12 col-sm-2 col-md-2 col-lg-2">
<ul class="list-group" role="tablist">
<li class="active"><a class="list-group-item" href="#enrolled_devices" role="tab"
data-toggle="tab" aria-controls="enrolled_devices">Enrolled Devices</a>
</li>
</ul>
</div>
{{#defineZone "user-enrolled-devices"}}
<div class="media-body add-padding-left-5x remove-padding-xs tab-content">
<div class="panel-group tab-content">
<div class="panel panel-default tab-pane active" id="enrolled_devices"
role="tabpanel" aria-labelledby="enrolled_devices">
<div class="panel-heading">Enrolled Devices by
{{#if user.firstname}}
{{user.firstname}} {{user.lastname}}
{{else}}
{{user.username}}
{{/if}}
</div>
<div class="panel-body">
<div id="enrolled_devices-container">
<div class="panel-body">
{{#each devices}}
<div class="wr-list-group wr-sortable policy-list">
<span class="list-group-item" id="{{id}}"> <span class="list-group-item" id="{{id}}">
<div class="row"> <div class="row">
<div class="col-lg-3 clearfix"> <div class="col-lg-3 clearfix">
@ -155,19 +160,19 @@
</div> </div>
</div> </div>
</span> </span>
</div> </div>
{{/each}} {{/each}}
</div>
<br class="c-both"/>
</div> </div>
<br class="c-both"/>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> {{/defineZone}}
{{/defineZone}} </div>
</div> </div>
</div> {{else}}
{{else}}
<h1 class="page-sub-title"> <h1 class="page-sub-title">
Permission Denied Permission Denied
</h1> </h1>

@ -20,6 +20,7 @@ function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var username = request.getParameter("username"); var username = request.getParameter("username");
var user = userModule.getUser(username)["content"]; var user = userModule.getUser(username)["content"];
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var userName = request.getParameter("username"); var userName = request.getParameter("username");
@ -45,5 +46,8 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
canView = true; canView = true;
} }
return {"user": user, "userRoles": userRoles, "devices": devices, "canView": canView};
var isCloud = deviceMgtProps.isCloud;
return {"user": user, "userRoles": userRoles, "devices": devices, "canView": canView, "isCloud" : isCloud};
} }

@ -337,31 +337,31 @@ function loadUsers() {
} }
}, },
{ {
class: "text-right content-fill text-left-on-grid-view no-wrap", class: "text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix",
data: null, data: null,
render: function (data, type, row, meta) { render: function (data, type, row, meta) {
var editbtn = '<a data-toggle="tooltip" data-placement="bottom" title="Edit User"href="' + context + var editbtn = '<a data-toggle="tooltip" data-placement="top" title="Edit User"href="' + context +
'/user/edit?username=' + encodeURIComponent(data.filter) + '" data-username="' + data.filter + '" ' + '/user/edit?username=' + encodeURIComponent(data.filter) + '" data-username="' + data.filter + '" ' +
'data-click-event="edit-form" ' + 'data-click-event="edit-form" ' +
'class="btn padding-reduce-on-grid-view edit-user-link"> ' + 'class="btn padding-reduce-on-grid-view edit-user-link" data-placement="top" data-toggle="tooltip" data-original-title="Edit"> ' +
'<span class="fw-stack"> ' + '<span class="fw-stack"> ' +
'<i class="fw fw-circle-outline fw-stack-2x"></i>' + '<i class="fw fw-circle-outline fw-stack-2x"></i>' +
'<i class="fw fw-edit fw-stack-1x"></i>' + '<i class="fw fw-edit fw-stack-1x"></i>' +
'</span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>'; '</span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
var resetPasswordbtn = '<a data-toggle="tooltip" data-placement="bottom" title="Reset Password" href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' + var resetPasswordbtn = '<a data-toggle="tooltip" data-placement="top" title="Reset Password" href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' +
'data-click-event="edit-form" ' + 'data-click-event="edit-form" ' +
'onclick="javascript:resetPassword(\'' + data.filter + '\')" ' + 'onclick="javascript:resetPassword(\'' + data.filter + '\')" ' +
'class="btn padding-reduce-on-grid-view remove-user-link">' + 'class="btn padding-reduce-on-grid-view remove-user-link" data-placement="top" data-toggle="tooltip" data-original-title="Reset Password">' +
'<span class="fw-stack">' + '<span class="fw-stack">' +
'<i class="fw fw-circle-outline fw-stack-2x"></i>' + '<i class="fw fw-circle-outline fw-stack-2x"></i>' +
'<i class="fw fw-key fw-stack-1x"></i>' + '<i class="fw fw-key fw-stack-1x"></i>' +
'</span><span class="hidden-xs hidden-on-grid-view">Reset Password</span></a>'; '</span><span class="hidden-xs hidden-on-grid-view">Reset Password</span></a>';
var removebtn = '<a data-toggle="tooltip" data-placement="bottom" title="Remove User" href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' + var removebtn = '<a data-toggle="tooltip" data-placement="top" title="Remove User" href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' +
'data-click-event="remove-form" ' + 'data-click-event="remove-form" ' +
'onclick="javascript:removeUser(\'' + data.filter + '\')" ' + 'onclick="javascript:removeUser(\'' + data.filter + '\')" ' +
'class="btn padding-reduce-on-grid-view remove-user-link">' + 'class="btn padding-reduce-on-grid-view remove-user-link" data-placement="top" data-toggle="tooltip" data-original-title="Remove">' +
'<span class="fw-stack">' + '<span class="fw-stack">' +
'<i class="fw fw-circle-outline fw-stack-2x"></i>' + '<i class="fw fw-circle-outline fw-stack-2x"></i>' +
'<i class="fw fw-delete fw-stack-1x"></i>' + '<i class="fw fw-delete fw-stack-1x"></i>' +

@ -35,6 +35,7 @@
{{/zone}} {{/zone}}
{{#zone "navbarActions"}} {{#zone "navbarActions"}}
{{#unless isCloud}}
<li> <li>
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/user/add"> <a href="{{@app.context}}/user/add">
@ -45,18 +46,21 @@
Add User Add User
</a> </a>
</li> </li>
{{/unless}}
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
<input type="hidden" id="user" value="{{user.username}}"> <input type="hidden" id="user" value="{{user.username}}">
<!-- content --> <!-- content -->
<div id="loading-content" class="col-centered"> <div id="loading-content" class="col-centered">
{{#if canManage}} {{#unless isCloud}}
<input type="hidden" id="can-remove" value="true"/> {{#if canManage}}
<input type="hidden" id="can-edit" value="true"/> <input type="hidden" id="can-remove" value="true"/>
<input type="hidden" id="can-invite" value="true"/> <input type="hidden" id="can-edit" value="true"/>
<input type="hidden" id="can-reset-password" value="true"/> <input type="hidden" id="can-invite" value="true"/>
{{/if}} <input type="hidden" id="can-reset-password" value="true"/>
{{/if}}
{{/unless}}
{{#if canView}} {{#if canView}}
<input type="hidden" id="can-view" value="true"/> <input type="hidden" id="can-view" value="true"/>
{{/if}} {{/if}}
@ -108,14 +112,16 @@
Enter new password Enter new password
<br><br> <br><br>
<div> <div>
<input type="password" autocomplete="off" class="form-control modal-input operationDataKeys new-password" <input type="password" autocomplete="off"
class="form-control modal-input operationDataKeys new-password"
data-key="message"/> data-key="message"/>
</div> </div>
<br> <br>
Retype new password Retype new password
<br><br> <br><br>
<div> <div>
<input type="password" autocomplete="off" class="form-control modal-input operationDataKeys confirmed-password" <input type="password" autocomplete="off"
class="form-control modal-input operationDataKeys confirmed-password"
data-key="message"/> data-key="message"/>
</div> </div>
<br> <br>

@ -33,6 +33,7 @@ function onRequest(context) {
page["currentUser"] = userModule.getCarbonUser().username; page["currentUser"] = userModule.getCarbonUser().username;
page["adminUser"] = deviceMgtProps["adminUser"].split("@")[0]; page["adminUser"] = deviceMgtProps["adminUser"].split("@")[0];
page["isCloud"] = deviceMgtProps["isCloud"];
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
page.canManage = true; page.canManage = true;

@ -103,6 +103,14 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
fnCreatedRow: fnCreatedRow, fnCreatedRow: fnCreatedRow,
"fnDrawCallback": fnDrawCallback, "fnDrawCallback": fnDrawCallback,
initComplete: function () { initComplete: function () {
//loading tooltips
if (typeof $.fn.tooltip == 'function') {
$('[data-toggle="tooltip"]').tooltip();
} else {
console.warn('Warning : Dependency missing - Bootstrap Tooltip Library');
}
this.api().columns().every(function () { this.api().columns().every(function () {
var column = this; var column = this;

@ -6,7 +6,7 @@
* Opens a modal popup with input to enter multiple email addresses to send invites * Opens a modal popup with input to enter multiple email addresses to send invites
*/ */
function toggleEmailInvite(){ function toggleEmailInvite(){
modalDialog.header('<h4 class="pull-left modal-title"><span class="fw-stack add-margin-right-1x">' + modalDialog.header('<h4 class="pull-left modal-title"><span class="fw-stack add-margin-right-2x">' +
'<i class="fw fw-user fw-stack-2x"></i>' + '<i class="fw fw-user fw-stack-2x"></i>' +
'<span class="fw-stack fw-move-right fw-move-bottom">' + '<span class="fw-stack fw-move-right fw-move-bottom">' +
'<i class="fw fw-circle-outline fw-stack-2x"></i>' + '<i class="fw fw-circle-outline fw-stack-2x"></i>' +

@ -19,7 +19,7 @@
<div id="qr-code-modal" data-enrollment-url="{{@unit.params.enrollmentURL}}" class="hidden"> <div id="qr-code-modal" data-enrollment-url="{{@unit.params.enrollmentURL}}" class="hidden">
<div class="modal-header"> <div class="modal-header">
<h4 class="pull-left modal-title"> <h4 class="pull-left modal-title">
<span class="fw-stack"> <span class="fw-stack add-margin-right-2x">
<i class="fw fw-mobile fw-stack-2x"></i> <i class="fw fw-mobile fw-stack-2x"></i>
<span class="fw-stack fw-move-right fw-move-bottom"> <span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>

@ -22,87 +22,87 @@
<span class="icon fw-stack fw-lg"> <span class="icon fw-stack fw-lg">
<i class="fw fw-organization fw-stack-1x" title=" {{@user.domain}}"></i> <i class="fw fw-organization fw-stack-1x" title=" {{@user.domain}}"></i>
</span> </span>
<span class="hidden-xs"> <span class="hidden-xs username">
{{@user.domain}} {{@user.domain}}
</span> </span>
</a> </a>
</li> </li>
<li class="visible-inline-block"> <!--<li class="visible-inline-block">-->
<a href="#" target="_blank" class="dropdown" data-toggle="dropdown" title="Account"> <!--<a href="#" target="_blank" class="dropdown" data-toggle="dropdown" title="Account">-->
<span class="icon fw-stack fw-lg" style="color: red"> <!--<span class="icon fw-stack fw-lg" style="color: red">-->
<i class="fw fw-resource fw-stack-1x" title="Account"></i> <!--<i class="fw fw-resource fw-stack-1x" title="Account"></i>-->
</span> <!--</span>-->
<span class="hidden-xs" style="color: red"> <!--<span class="hidden-xs" style="color: red">-->
Trial 14 days to upgrade <!--Trial 14 days to upgrade-->
</span> <!--</span>-->
<span class="caret"></span> <!--<span class="caret"></span>-->
</a> <!--</a>-->
<ul class="dropdown-menu dropdown-menu-right 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"> <!--role="menu">-->
<li> <!--<li>-->
<a title="Upgrade Now" <!--<a title="Upgrade Now"-->
href="{{upgradeNowURL}}" <!--href="{{upgradeNowURL}}"-->
target="_self"> <!--target="_self">-->
<i class="fw fw-export" title="Upgrade Now"></i> Upgrade Now <!--<i class="fw fw-export" title="Upgrade Now"></i> Upgrade Now-->
</a> <!--</a>-->
</li> <!--</li>-->
<li> <!--<li>-->
<a title="Monetization" <!--<a title="Monetization"-->
href="{{monetizationURL}}" <!--href="{{monetizationURL}}"-->
target="_self"> <!--target="_self">-->
<i class="fa fa-money fa-lg" title="Monetization"></i> Monetization <!--<i class="fa fa-money fa-lg" title="Monetization"></i> Monetization-->
</a> <!--</a>-->
</li> <!--</li>-->
<li> <!--<li>-->
<a title="Request Extension" <!--<a title="Request Extension"-->
href="{{requestExtensionURL}}" <!--href="{{requestExtensionURL}}"-->
target="_blank"> <!--target="_blank">-->
<i class="fw fw-mail" title="Request Extension"></i> Request Extension <!--<i class="fw fw-mail" title="Request Extension"></i> Request Extension-->
</a> <!--</a>-->
</li> <!--</li>-->
</ul> <!--</ul>-->
</li> <!--</li>-->
<li class="visible-inline-block"> <!--<li class="visible-inline-block">-->
<a href="#" target="null" class="dropdown" data-toggle="dropdown" title="App Management"> <!--<a href="#" target="null" class="dropdown" data-toggle="dropdown" title="App Management">-->
<span class="icon fw-stack fw-lg"> <!--<span class="icon fw-stack fw-lg">-->
<i class="fw fw-settings fw-stack-1x" title="App Management"></i> <!--<i class="fw fw-settings fw-stack-1x" title="App Management"></i>-->
</span> <!--</span>-->
<span class="hidden-xs"> <!--<span class="hidden-xs">-->
App Management <!--App Management-->
</span> <!--</span>-->
<span class="caret"></span> <!--<span class="caret"></span>-->
</a> <!--</a>-->
<ul class="dropdown-menu dropdown-menu-right 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"> <!--role="menu">-->
<li class="visible-inline-block"> <!--<li class="visible-inline-block">-->
<a title="Mobile App Publisher" href="{{publisherURL}}" <!--<a title="Mobile App Publisher" href="{{publisherURL}}"-->
target="_self"> <!--target="_self">-->
<i class="fw fw-user" title="Mobilr App Publisher"></i> App Publisher <!--<i class="fw fw-user" title="Mobilr App Publisher"></i> App Publisher-->
</a> <!--</a>-->
</li> <!--</li>-->
<li class="visible-inline-block"> <!--<li class="visible-inline-block">-->
<a title="App Store " href="{{storeURL}}" <!--<a title="App Store " href="{{storeURL}}"-->
target="_self"> <!--target="_self">-->
<i class="fw fw-store" title="App Store"></i> App Store <!--<i class="fw fw-store" title="App Store"></i> App Store-->
</a> <!--</a>-->
</li> <!--</li>-->
</ul> <!--</ul>-->
</li> <!--</li>-->
<li class="visible-inline-block"> <li class="visible-inline-block">
<a href="{{contactUsURL}}" target="_self" <a href="{{contactUsURL}}" target="_self"
@ -175,12 +175,8 @@
<i class="fw fw-circle-outline fw-stack-2x" title="User"></i> <i class="fw fw-circle-outline fw-stack-2x" title="User"></i>
<i class="fw fw-user fw-stack-1x" title="User"></i> <i class="fw fw-user fw-stack-1x" title="User"></i>
</span> </span>
<span class="hidden-xs"> <span class="hidden-xs username">
{{#if isSuperTenant }}
{{@user.username}}</span><span class="caret"></span> {{@user.username}}</span><span class="caret"></span>
{{else}}
{{@user.username}}@{{@user.domain}}</span><span class="caret"></span>
{{/if}}
</a> </a>
<ul class="dropdown-menu dropdown-menu-right 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"> role="menu">
@ -229,17 +225,17 @@
<div id="popover-content" class="hide"> <div id="popover-content" class="hide">
<div class="cloud-apps"> <div class="cloud-apps">
<a href="{{apiCloudURL}}https://api.cloud.wso2.com/publisher" target="_self" class="cloud-block add-padding-top-3x"> <a href="{{apiCloudURL}}" target="_self" class="cloud-block add-padding-top-3x">
<i class="fw fw-api fw-3x"></i> <i class="fw fw-api fw-3x"></i>
<div class="cloud-name">API Cloud</div> <div class="cloud-name">API Cloud</div>
</a> </a>
<a href="{{appCloudURL}}https://apps.cloud.wso2.com/appmgt" target="_self" class="cloud-block add-padding-top-3x"> <a href="{{appCloudURL}}" target="_self" class="cloud-block add-padding-top-3x">
<i class="fw fw-application fw-3x"></i> <i class="fw fw-application fw-3x"></i>
<div class="cloud-name">App Cloud</div> <div class="cloud-name">App Cloud</div>
</a> </a>
<a href="{{deviceCloudURL}}https://devicemgt.cloud.wso2.com/devicemgt" target="_self" class="cloud-block add-padding-top-3x"> <a href="{{deviceCloudURL}}" target="_self" class="cloud-block add-padding-top-3x">
<i class="fw fw-mobile fw-3x"></i> <i class="fw fw-mobile fw-3x"></i>
<div class="cloud-name">Device Cloud</div> <div class="cloud-name">Device Cloud</div>
</a> </a>
@ -249,12 +245,12 @@
<div class="cloud-actions"> <div class="cloud-actions">
<h3>Manage your cloud</h3> <h3>Manage your cloud</h3>
<a href="{{oraganizationURL}}https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag" target="_self" class="cloud-block-invert add-padding-top-3x"> <a href="{{oraganizationURL}}" target="_self" class="cloud-block-invert add-padding-top-3x">
<i class="fw fw-organization fw-3x"></i> <i class="fw fw-organization fw-3x"></i>
<div class="cloud-name">Organization</div> <div class="cloud-name">Organization</div>
</a> </a>
<a href="{{membersURL}}https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag" target="_self" class="cloud-block-invert add-padding-top-3x"> <a href="{{membersURL}}" target="_self" class="cloud-block-invert add-padding-top-3x">
<i class="fa fa-users fa-3x"></i> <i class="fa fa-users fa-3x"></i>
<div class="cloud-name">Members</div> <div class="cloud-name">Members</div>
</a> </a>

@ -18,6 +18,7 @@
function onRequest(context) { function onRequest(context) {
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var user = context.user; var user = context.user;
var isSuperTenant = false; var isSuperTenant = false;
if (user.tenantId == -1234){ if (user.tenantId == -1234){
@ -26,5 +27,19 @@ function onRequest(context) {
var viewModal = {}; var viewModal = {};
viewModal.isSuperTenant = isSuperTenant; viewModal.isSuperTenant = isSuperTenant;
viewModal.USER_SESSION_KEY = session.get(constants["USER_SESSION_KEY"]); viewModal.USER_SESSION_KEY = session.get(constants["USER_SESSION_KEY"]);
viewModal.isCloud = mdmProps.isCloud;
viewModal.contactUsURL = mdmProps.cloudConfig.contactUsURL;
viewModal.apiCloudDocURL = mdmProps.cloudConfig.apiCloudDocURL;
viewModal.appCloudDocURL = mdmProps.cloudConfig.appCloudDocURL;
viewModal.deviceCloudDocURL = mdmProps.cloudConfig.deviceCloudDocURL;
viewModal.apiCloudWalkthroughURL = mdmProps.cloudConfig.apiCloudWalkthroughURL;
viewModal.profileURL = mdmProps.cloudConfig.profileURL;
viewModal.changePasswordURL = mdmProps.cloudConfig.changePasswordURL;
viewModal.logoutURL = mdmProps.cloudConfig.logoutURL;
viewModal.apiCloudURL = mdmProps.cloudConfig.apiCloudURL;
viewModal.appCloudURL = mdmProps.cloudConfig.appCloudURL;
viewModal.deviceCloudURL = mdmProps.cloudConfig.deviceCloudURL;
viewModal.oraganizationURL = mdmProps.cloudConfig.oraganizationURL;
viewModal.membersURL = mdmProps.cloudConfig.membersURL;
return viewModal; return viewModal;
} }

@ -42,7 +42,7 @@
<div class="modal-header"> <div class="modal-header">
<h4 class="pull-left modal-title"> <h4 class="pull-left modal-title">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-user fw-stack-2x"></i> <i class="fw fw-user fw-stack-2x user-icon-black"></i>
<span class="fw-stack fw-move-right fw-move-bottom"> <span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-circle fw-stack-2x fw-stroke text-info"></i> <i class="fw fw-circle fw-stack-2x fw-stroke text-info"></i>

@ -18,8 +18,8 @@
{{#if isCloud}} {{#if isCloud}}
{{#zone "productName"}}WSO2 Cloud{{/zone}} {{#zone "productName"}}WSO2 Cloud{{/zone}}
{{#zone "productNameResponsive"}}WSO2 Cloud{{/zone}} {{#zone "productNameResponsive"}} Cloud{{/zone}}
{{else}} {{else}}
{{#zone "productName"}}WSO2 IoT Server{{/zone}} {{#zone "productName"}}WSO2 IoT Server{{/zone}}
{{#zone "productNameResponsive"}}WSO2 IoT Server{{/zone}} {{#zone "productNameResponsive"}} IoT Server{{/zone}}
{{/if}} {{/if}}

@ -30,6 +30,8 @@
</a> </a>
</li> </li>
{{/if}} {{/if}}
{{#unless isCloud}}
{{#if permissions.VIEW_DASHBOARD}} {{#if permissions.VIEW_DASHBOARD}}
<li> <li>
<a href="javascript:statisticLoad('/portal/t/{{currentUser.domain}}/dashboards/device-statistics-dashboard/')"> <a href="javascript:statisticLoad('/portal/t/{{currentUser.domain}}/dashboards/device-statistics-dashboard/')">
@ -57,6 +59,9 @@
</div> </div>
</li> </li>
{{/if}} {{/if}}
{{/unless}}
{{#if permissions.LIST_GROUPS}} {{#if permissions.LIST_GROUPS}}
<li> <li>
<a href="{{@app.context}}/groups"> <a href="{{@app.context}}/groups">
@ -81,6 +86,8 @@
{{#if permissions.LIST_POLICIES}} {{#if permissions.LIST_POLICIES}}
<li><a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li> <li><a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
{{/if}} {{/if}}
{{#unless isCloud}}
{{#if permissions.TENANT_CONFIGURATION}} {{#if permissions.TENANT_CONFIGURATION}}
<li><a><i class="fw fw-settings"></i>Configuration Management</a> <li><a><i class="fw fw-settings"></i>Configuration Management</a>
<ul> <ul>
@ -92,6 +99,10 @@
</ul> </ul>
</li> </li>
{{/if}} {{/if}}
{{/unless}}
{{/zone}} {{/zone}}
{{#zone "navbarCollapsableRightItems"}} {{#zone "navbarCollapsableRightItems"}}

@ -52,6 +52,7 @@ function onRequest(context) {
context["isAuthorizedForNotifications"] = isAuthorizedForNotifications; context["isAuthorizedForNotifications"] = isAuthorizedForNotifications;
context["currentUser"] = currentUser; context["currentUser"] = currentUser;
context["appContext"] = mdmProps["appContext"]; context["appContext"] = mdmProps["appContext"];
context["isCloud"] = mdmProps["isCloud"];
return context; return context;
} }

@ -16,12 +16,10 @@
* under the License. * under the License.
*/ */
.wr-input-control .helper { .wr-input-control .helper {
font-weight: 100; font-weight: 100;
} }
.wr-input-control .cus-col-25 { .wr-input-control .cus-col-25 {
float: left; float: left;
width: 25%; width: 25%;
@ -53,6 +51,12 @@
/*padding-left:20px;*/ /*padding-left:20px;*/
/*}*/ /*}*/
.user-icon-black {
color: black !important;
}
/**/
/* wizard */ /* wizard */
.wr-wizard { .wr-wizard {
@ -99,6 +103,9 @@
} }
@media only screen and (min-width: 768px) { @media only screen and (min-width: 768px) {
header .username {
max-width: calc(100% - 100px);
}
body > .page-content-wrapper > .container, body > .page-content-wrapper > .container,
body > .page-content-wrapper > .container-fluid { body > .page-content-wrapper > .container-fluid {
margin: 1% 1% 1%; margin: 1% 1% 1%;
@ -110,6 +117,15 @@ header .brand h1 {
text-transform: none !important; text-transform: none !important;
} }
header .username {
display: inline-block;
max-width: 180px;
white-space: nowrap;
overflow: hidden !important;
text-overflow: ellipsis;
vertical-align: middle;
}
.visible-inline-block { .visible-inline-block {
display: inline-block !important; display: inline-block !important;
} }
@ -121,18 +137,22 @@ header .brand h1 {
max-width: 32em; max-width: 32em;
background-color: #006690 background-color: #006690
} }
.cloud-menu .popover-title,.navbar-header .popover-title {
.cloud-menu .popover-title, .navbar-header .popover-title {
background-color: #006690; background-color: #006690;
font-size: 16px; font-size: 16px;
border-bottom: none; border-bottom: none;
font-weight: 400; font-weight: 400;
} }
.cloud-menu .popover.bottom>.arrow{
margin-left:-2px; .cloud-menu .popover.bottom > .arrow {
margin-left: -2px;
} }
.cloud-menu .popover.bottom>.arrow:after,.navbar-header .popover.bottom>.arrow:after{
.cloud-menu .popover.bottom > .arrow:after, .navbar-header .popover.bottom > .arrow:after {
border-bottom-color: #006690; border-bottom-color: #006690;
} }
.cloud-block { .cloud-block {
float: left; float: left;
width: 8.2em; width: 8.2em;
@ -142,11 +162,13 @@ header .brand h1 {
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
} }
.cloud-name { .cloud-name {
font-size:14px; font-size: 14px;
margin-top: .5em; margin-top: .5em;
font-weight: 400; font-weight: 400;
} }
.cloud-menu-popover { .cloud-menu-popover {
position: relative; position: relative;
float: right; float: right;
@ -158,42 +180,50 @@ header .brand h1 {
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
} }
#cloud-menu-popover-xs { #cloud-menu-popover-xs {
color: #fff; color: #fff;
line-height:24px; line-height: 24px;
border: none; border: none;
margin-right: 15px!important; margin-right: 15px !important;
} }
.navbar-toggle{
border:none; .navbar-toggle {
border: none;
border-radius: 0px; border-radius: 0px;
} }
.navbar-header .popover { .navbar-header .popover {
border-radius: 0px; border-radius: 0px;
width: 21em; width: 21em;
max-width:32em; max-width: 32em;
background-color: #006690; background-color: #006690;
} }
.navbar-header .popover .popover-content{
padding:0px; .navbar-header .popover .popover-content {
padding: 0px;
} }
.cloud-menu .popover-content { .cloud-menu .popover-content {
padding: 0px; padding: 0px;
} }
.cloud-actions { .cloud-actions {
background-color: #005578; background-color: #005578;
float: left; float: left;
position: absolute; position: absolute;
width: 100%; width: 100%;
left: 0px; left: 0px;
overflow:hidden; overflow: hidden;
} }
.cloud-actions h3 { .cloud-actions h3 {
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
padding-left: 14px; padding-left: 14px;
margin-top: 10px; margin-top: 10px;
} }
.cloud-block-invert { .cloud-block-invert {
color: #fff; color: #fff;
float: left; float: left;
@ -210,21 +240,25 @@ header .brand h1 {
background-color: #fff; background-color: #fff;
cursor: pointer; cursor: pointer;
} }
.cloud-actions a:hover { .cloud-actions a:hover {
color: #d7d5d5; color: #d7d5d5;
background-color: #3d3d3d; background-color: #3d3d3d;
text-decoration: none text-decoration: none
} }
.cloud-apps a { .cloud-apps a {
text-decoration: none; text-decoration: none;
color: #006690 !important; color: #006690 !important;
cursor: pointer cursor: pointer
} }
.cloud-apps a:hover { .cloud-apps a:hover {
text-decoration: none; text-decoration: none;
color: #006690; color: #006690;
background-color: #c5c5c5; background-color: #c5c5c5;
} }
.cloud-apps .cloud-actions a { .cloud-apps .cloud-actions a {
color: #fff color: #fff
} }

@ -2028,6 +2028,11 @@ input[type=number].form-control {
.thumbnail.icon img { .thumbnail.icon img {
width: 100%; width: 100%;
padding: 10px;
}
.table .icon-only{
cursor: pointer;
} }
/* ======================================================================== /* ========================================================================
@ -6549,6 +6554,27 @@ select > option:hover {
color : #C7C7C7; color : #C7C7C7;
} }
/**
*
* Temporary navigation color fix for IoT cloud release
*
*/
header.header-default {
background: #181e22 !important;
height: 50px;
}
.navbar-collapse {
background: #37474F;
}
.dropdown-menu > li {
width: 100%;
}
/** End **/
/** /**
* *
* Temporary responsive fix for table listing action button width issue * Temporary responsive fix for table listing action button width issue
@ -6580,3 +6606,7 @@ select > option:hover {
} }
/** End **/ /** End **/
.tooltip-overflow-fix{
overflow: visible !important;
}

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/style.css">
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/font-mf.css">
</head>
<body>
<div class="sky">
<section>
<div class="error-400">
<img src="https://error.cloud.wso2.com/images/400-error.svg">
</div>
<div class="text-label">
<h1>Oops something went wrong </h1>
<h2>400 - Bad request</h2>
<div style="clear: both"></div>
<div class="button-label">
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag"><label class="label-back">Back to Cloud </label></a>
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag"><label class="label-report"> Report Issue </label></a>
</div>
</div>
</section>
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>
</body>
</html>

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/style.css">
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/font-mf.css">
</head>
<body>
<div class="sky">
<section>
<div class="error-400">
<img src="https://error.cloud.wso2.com/images/400-error.svg">
</div>
<div class="text-label">
<h1>Oops something went wrong </h1>
<h2>401 - Unauthorized</h2>
<div style="clear: both"></div>
<div class="button-label">
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag"><label class="label-back">Back to Cloud </label></a>
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag"><label class="label-report"> Report Issue </label></a>
</div>
</div>
</section>
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>
</body>
</html>

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/style.css">
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/font-mf.css">
</head>
<body>
<div class="sky">
<section>
<div class="error-400">
<img src="https://error.cloud.wso2.com/images/400-error.svg">
</div>
<div class="text-label">
<h1>Oops something went wrong </h1>
<h2>403 - Forbidden</h2>
<div style="clear: both"></div>
<div class="button-label">
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag"><label class="label-back">Back to Cloud </label></a>
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag"><label class="label-report"> Report Issue </label></a>
</div>
</div>
</section>
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>
</body>
</html>

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/style.css">
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/font-mf.css">
</head>
<body>
<div class="sky">
<section>
<div class="error-400">
<img src="https://error.cloud.wso2.com/images/400-error.svg">
</div>
<div class="text-label">
<h1>Oops something went wrong </h1>
<h2>404 - Page Not Found</h2>
<div style="clear: both"></div>
<div class="button-label">
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag"><label class="label-back">Back to Cloud </label></a>
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag"><label class="label-report"> Report Issue </label></a>
</div>
</div>
</section>
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>
</body>
</html>

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/style.css">
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/font-mf.css">
</head>
<body>
<div class="sky">
<section>
<div class="error-400">
<img src="https://error.cloud.wso2.com/images/400-error.svg">
</div>
<div class="text-label">
<h1>Oops something went wrong </h1>
<h2>405 - Method Not Allowed</h2>
<div style="clear: both"></div>
<div class="button-label">
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag"><label class="label-back">Back to Cloud </label></a>
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag"><label class="label-report"> Report Issue </label></a>
</div>
</div>
</section>
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>
</body>
</html>

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/style.css">
<link rel="stylesheet" href="https://error.cloud.wso2.com/style/font-mf.css">
</head>
<body>
<div class="sky">
<section>
<div class="error-400">
<img src="https://error.cloud.wso2.com/images/400-error.svg">
</div>
<div class="text-label">
<h1>Oops something went wrong </h1>
<h2>500 - Internal Server Error</h2>
<div style="clear: both"></div>
<div class="button-label">
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag"><label class="label-back">Back to Cloud </label></a>
<a href="https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag"><label class="label-report"> Report Issue </label></a>
</div>
</div>
</section>
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>
</body>
</html>

@ -17,7 +17,7 @@
}} }}
{{#zone "navbars"}} {{#zone "navbars"}}
<nav id="_uuf-navbar" class="navbar navbar-default affix" data-spy="affix" data-offset-top="50" <nav id="_uuf-navbar" class="navbar navbar-default" data-spy="affix" data-offset-top="50"
data-offset-bottom="40"> data-offset-bottom="40">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">

@ -23,17 +23,16 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl;
import org.wso2.carbon.ntask.core.Task; import org.wso2.carbon.ntask.core.Task;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder;
import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager; import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager;
import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -63,14 +62,14 @@ public class MonitoringTask implements Task {
} }
try { try {
// Tenant tenants[] = PolicyManagementDataHolder.getInstance().
// getRealmService().getTenantManager().getAllTenants();
PolicyManagementDataHolder.getInstance().
getRealmService().getTenantManager().getAllTenants();
DeviceManagementProviderService deviceManagementService = new DeviceManagementProviderServiceImpl(); DeviceManagementProviderService deviceManagementService = new DeviceManagementProviderServiceImpl();
List<Integer> tenants = deviceManagementService.getDeviceEnrolledTenants(); List<Integer> tenants = deviceManagementService.getDeviceEnrolledTenants();
for (Integer tenant : tenants) { for (Integer tenant : tenants) {
String tenantDomain = DeviceManagementDataHolder.getInstance(). String tenantDomain = PolicyManagementDataHolder.getInstance().
getRealmService().getTenantManager().getDomain(tenant); getRealmService().getTenantManager().getDomain(tenant);
try { try {
PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.startTenantFlow();

Loading…
Cancel
Save