revert-70aa11f8
hasuniea 9 years ago
commit 8d14de91d8

@ -66,8 +66,12 @@ public interface ApplicationManager {
throws ApplicationManagementException;
void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws ApplicationManagementException;
void installApplicationForUsers(Operation operation, List<String> userNameList)
throws ApplicationManagementException;
void installApplicationForUserRoles(Operation operation, List<String> userRoleList)
throws ApplicationManagementException;
}

@ -18,9 +18,13 @@
*/
package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import java.util.List;
/**
* Composite interface that acts as the SPI exposing all device management as well as application management
@ -41,4 +45,6 @@ public interface DeviceManagementService extends ApplicationManager {
ApplicationManager getApplicationManager();
void notifyOperationToDevices(Operation operation, List<DeviceIdentifier> deviceIds) throws DeviceManagementException;
}

@ -22,7 +22,7 @@ import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import java.util.List;
public interface ApplicationManagementProviderService extends ApplicationManager {
public interface ApplicationManagementProviderService extends ApplicationManager{
void updateApplicationListInstalledInDevice(DeviceIdentifier deviceIdentifier,
List<Application> applications) throws ApplicationManagementException;

@ -24,14 +24,8 @@ import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
public class ApplicationManagerFactory {
private static DeviceManagementPluginRepository pluginRepository = new DeviceManagementPluginRepository();
public DeviceManagementPluginRepository getPluginRepository() {
return pluginRepository;
}
public static ApplicationManager getConnector(AppManagementConfig config) {
return new ApplicationManagerProviderServiceImpl(config, pluginRepository);
return new ApplicationManagerProviderServiceImpl(config);
}
}

@ -31,6 +31,7 @@ import org.wso2.carbon.device.mgt.common.TransactionManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
@ -39,6 +40,7 @@ import org.wso2.carbon.device.mgt.core.app.mgt.oauth.ServiceAuthenticator;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations;
import org.wso2.carbon.device.mgt.core.dao.*;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.internal.PluginInitializationListener;
import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceException;
import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceStub;
@ -52,13 +54,11 @@ import java.util.List;
/**
* Implements Application Manager interface
*/
public class ApplicationManagerProviderServiceImpl implements ApplicationManagementProviderService,
PluginInitializationListener {
public class ApplicationManagerProviderServiceImpl implements ApplicationManagementProviderService {
private ConfigurationContext configCtx;
private ServiceAuthenticator authenticator;
private String oAuthAdminServiceUrl;
private DeviceManagementPluginRepository pluginRepository;
private DeviceDAO deviceDAO;
private ApplicationDAO applicationDAO;
private ApplicationMappingDAO applicationMappingDAO;
@ -66,8 +66,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
private static final String GET_APP_LIST_URL = "store/apis/assets/mobileapp?domain=carbon.super&page=1";
private static final Log log = LogFactory.getLog(ApplicationManagerProviderServiceImpl.class);
public ApplicationManagerProviderServiceImpl(AppManagementConfig appManagementConfig,
DeviceManagementPluginRepository pluginRepository) {
public ApplicationManagerProviderServiceImpl(AppManagementConfig appManagementConfig) {
IdentityConfigurations identityConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig().
getDeviceManagementConfigRepository().getIdentityConfigurations();
@ -81,14 +80,12 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
throw new IllegalArgumentException("Error occurred while initializing Axis2 Configuration Context. " +
"Please check if an appropriate axis2.xml is provided", e);
}
this.pluginRepository = pluginRepository;
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
this.applicationDAO = DeviceManagementDAOFactory.getApplicationDAO();
this.applicationMappingDAO = DeviceManagementDAOFactory.getApplicationMappingDAO();
}
ApplicationManagerProviderServiceImpl(DeviceManagementPluginRepository pluginRepository) {
this.pluginRepository = pluginRepository;
ApplicationManagerProviderServiceImpl() {
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
this.applicationDAO = DeviceManagementDAOFactory.getApplicationDAO();
this.applicationMappingDAO = DeviceManagementDAOFactory.getApplicationMappingDAO();
@ -113,13 +110,100 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
}
@Override
public void installApplication(Operation operation, List<DeviceIdentifier> deviceIds)
public void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIds)
throws ApplicationManagementException {
for (DeviceIdentifier deviceId : deviceIds) {
DeviceManagementService dms =
this.getPluginRepository().getDeviceManagementService(deviceId.getType());
dms.installApplication(operation, deviceIds);
try {
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(operation, deviceIds);
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().notifyOperationToDevices
(operation, deviceIds);
} catch (OperationManagementException opeEx) {
String errorMsg = "Error in add operation at app installation:" + opeEx.getErrorMessage();
log.error(errorMsg, opeEx);
throw new ApplicationManagementException(errorMsg, opeEx);
}catch (DeviceManagementException deviceEx){
String errorMsg = "Error in notify operation at app installation:" + deviceEx.getErrorMessage();
log.error(errorMsg, deviceEx);
throw new ApplicationManagementException(errorMsg, deviceEx);
}
}
@Override
public void installApplicationForUsers(Operation operation, List<String> userNameList)
throws ApplicationManagementException {
String userName = null;
try {
List<Device> deviceList;
List<DeviceIdentifier> deviceIdentifierList = new ArrayList<>();
DeviceIdentifier deviceIdentifier;
for (String user : userNameList) {
userName = user;
deviceList = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevicesOfUser
(user);
for (Device device : deviceList) {
deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(Integer.toString(device.getId()));
deviceIdentifier.setType(device.getType());
deviceIdentifierList.add(deviceIdentifier);
}
}
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.addOperation(operation, deviceIdentifierList);
} catch (DeviceManagementException devEx) {
String errorMsg = "Error in get devices for user: "+userName+ " in app installation:" + devEx.getErrorMessage();
log.error(errorMsg, devEx);
throw new ApplicationManagementException(errorMsg, devEx);
} catch (OperationManagementException opeEx) {
String errorMsg = "Error in add operation at app installation:" + opeEx.getErrorMessage();
log.error(errorMsg, opeEx);
throw new ApplicationManagementException(errorMsg, opeEx);
}
}
@Override
public void installApplicationForUserRoles(Operation operation, List<String> userRoleList)
throws ApplicationManagementException {
String userRole = null;
try {
List<Device> deviceList;
List<DeviceIdentifier> deviceIdentifierList = new ArrayList<>();
DeviceIdentifier deviceIdentifier;
for (String role : userRoleList) {
userRole = role;
deviceList = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.getAllDevicesOfRole(userRole);
for (Device device : deviceList) {
deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(Integer.toString(device.getId()));
deviceIdentifier.setType(device.getType());
deviceIdentifierList.add(deviceIdentifier);
}
}
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.addOperation(operation, deviceIdentifierList);
} catch (DeviceManagementException devEx) {
String errorMsg = "Error in get devices for user role "+userRole+ " in app installation:"
+ devEx.getErrorMessage();
log.error(errorMsg, devEx);
throw new ApplicationManagementException(errorMsg, devEx);
} catch (OperationManagementException opeEx) {
String errorMsg = "Error in add operation at app installation:" + opeEx.getErrorMessage();
log.error(errorMsg, opeEx);
throw new ApplicationManagementException(errorMsg, opeEx);
}
}
@ -167,10 +251,6 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
throw new ApplicationManagementException(msg, e);
}
public DeviceManagementPluginRepository getPluginRepository() {
return pluginRepository;
}
@Override
public void updateApplicationListInstalledInDevice(
DeviceIdentifier deviceIdentifier, List<Application> applications) throws ApplicationManagementException {
@ -256,24 +336,4 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
}
}
@Override
public void registerDeviceManagementService(DeviceManagementService deviceManagementService) {
try {
pluginRepository.addDeviceManagementProvider(deviceManagementService);
} catch (DeviceManagementException e) {
log.error("Error occurred while registering device management plugin '" +
deviceManagementService.getType() + "'", e);
}
}
@Override
public void unregisterDeviceManagementService(DeviceManagementService deviceManagementService) {
try {
pluginRepository.removeDeviceManagementProvider(deviceManagementService);
} catch (DeviceManagementException e) {
log.error("Error occurred while un-registering device management plugin '" +
deviceManagementService.getType() + "'", e);
}
}
}

@ -32,7 +32,7 @@ public class AppManagementConfigurationManager {
private AppManagementConfig appManagementConfig;
private static AppManagementConfigurationManager appManagementConfigManager;
private static final String APP_MANAGER_CONFIG_FILE = "app-management-config.xml";
private static final String APP_MANAGER_CONFIG_FILE = "remote-appmanager-config.xml";
private static final String APP_MANAGER_CONFIG_PATH =
CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + APP_MANAGER_CONFIG_FILE;

@ -31,6 +31,7 @@ import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.permission.mgt.PermissionUtils;
import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.api.UserStoreManager;
import java.util.HashMap;
import java.util.List;
@ -215,7 +216,7 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori
UserRealm userRealm = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId);
if (userRealm != null && userRealm.getAuthorizationManager() != null) {
return userRealm.getAuthorizationManager()
.isUserAuthorized(username, PermissionUtils.getAbsolutePermissionPath(EMM_ADMIN_PERMISSION),
.isUserAuthorized(removeTenantDomain(username), PermissionUtils.getAbsolutePermissionPath(EMM_ADMIN_PERMISSION),
PermissionMethod.UI_EXECUTE);
}
return false;
@ -224,14 +225,18 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori
private String getUserName() {
String username = CarbonContext.getThreadLocalCarbonContext().getUsername();
if (username != null && !username.isEmpty()) {
return removeTenantDomain(username);
}
return null;
}
private String removeTenantDomain(String username) {
String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();
if (username.endsWith(tenantDomain)) {
return username.substring(0, username.lastIndexOf("@"));
}
return username;
}
return null;
}
private int getTenantId() {
return CarbonContext.getThreadLocalCarbonContext().getTenantId();

@ -101,12 +101,12 @@ import java.util.List;
public class DeviceManagementServiceComponent {
private static Log log = LogFactory.getLog(DeviceManagementServiceComponent.class);
private DeviceManagementPluginRepository pluginRepository = new DeviceManagementPluginRepository();
private static final Object LOCK = new Object();
private static List<PluginInitializationListener> listeners = new ArrayList<>();
private static List<DeviceManagementService> deviceManagers = new ArrayList<>();
private static List<DeviceManagerStartupListener> startupListeners = new ArrayList<>();
private DeviceManagementPluginRepository pluginRepository = new DeviceManagementPluginRepository();
@SuppressWarnings("unused")
protected void activate(ComponentContext componentContext) {
@ -208,7 +208,7 @@ public class DeviceManagementServiceComponent {
AppManagementConfig appConfig =
AppManagementConfigurationManager.getInstance().getAppManagementConfig();
bundleContext.registerService(ApplicationManagementProviderService.class.getName(),
new ApplicationManagerProviderServiceImpl(appConfig, pluginRepository), null);
new ApplicationManagerProviderServiceImpl(appConfig), null);
} catch (ApplicationManagementException e) {
log.error("Application management service not registered.", e);
}
@ -309,10 +309,6 @@ public class DeviceManagementServiceComponent {
DeviceManagementDataHolder.getInstance().setRegistryService(null);
}
private DeviceManagementPluginRepository getPluginRepository() {
return pluginRepository;
}
protected void setAPIManagerConfigurationService(APIManagerConfigurationService service) {
//do nothing
}

@ -28,6 +28,7 @@ import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorization
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;

@ -134,7 +134,8 @@ public class CommandOperationDAOImpl extends OperationDAOImpl {
while (rs.next()) {
commandOperation = new CommandOperation();
commandOperation.setId(rs.getInt("ID"));
commandOperation.setEnabled(rs.getInt("ENABLED") != 0);
//commandOperation.setEnabled(rs.getInt("ENABLED") != 0);
commandOperation.setEnabled(rs.getBoolean("ENABLED") != false);
commandOperation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
commandOperation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
commandOperation.setCreatedTimeStamp(rs.getString("CREATED_TIMESTAMP"));

@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
@ -161,6 +162,6 @@ public interface DeviceManagementProviderService extends OperationManager {
boolean setStatus(DeviceIdentifier deviceId, String currentOwner,
EnrolmentInfo.Status status) throws DeviceManagementException;
void notifyOperationToDevices(Operation operation, List<DeviceIdentifier> deviceIds)throws DeviceManagementException;
}

@ -21,6 +21,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
@ -792,6 +793,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
}
@Override
public void notifyOperationToDevices(Operation operation, List<DeviceIdentifier> deviceIds)
throws DeviceManagementException {
try {
for (DeviceIdentifier deviceId : deviceIds) {
DeviceManagementService dms =
getPluginRepository().getDeviceManagementService(deviceId.getType());
dms.notifyOperationToDevices(operation, deviceIds);
}
} catch (DeviceManagementException deviceMgtEx) {
String errorMsg = "Error in notify operations to plugins for app installation:" + deviceMgtEx.getErrorMessage();
log.error(errorMsg, deviceMgtEx);
throw new DeviceManagementException(errorMsg, deviceMgtEx);
}
}
@Override
public License getLicense(String deviceType, String languageCode) throws DeviceManagementException {
DeviceManager deviceManager = this.getDeviceManager(deviceType);

@ -58,6 +58,12 @@ public class TestDeviceManagementService implements DeviceManagementService {
return null;
}
@Override
public void notifyOperationToDevices(Operation operation, List<DeviceIdentifier> deviceIds)
throws DeviceManagementException {
}
@Override
public Application[] getApplications(String domain, int pageNumber, int size)
throws ApplicationManagementException {
@ -77,7 +83,19 @@ public class TestDeviceManagementService implements DeviceManagementService {
}
@Override
public void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
public void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws ApplicationManagementException {
}
@Override
public void installApplicationForUsers(Operation operation, List<String> userNameList)
throws ApplicationManagementException {
}
@Override
public void installApplicationForUserRoles(Operation operation, List<String> userRoleList)
throws ApplicationManagementException {
}

@ -83,7 +83,7 @@ public class ApplicationManagementProviderServiceTest {
deviceId.setType(device.getType());
AppManagementConfig appManagementConfig = new AppManagementConfig();
appMgtProvider = new ApplicationManagerProviderServiceImpl(deviceManagementPluginRepository);
appMgtProvider = new ApplicationManagerProviderServiceImpl();
try {
appMgtProvider.updateApplicationListInstalledInDevice(deviceId, applications);

@ -17,7 +17,7 @@
~ under the License.
-->
<AppManagementConfig>
<AppManagementConfig>
<Enabled>true</Enabled>
<AppManagerUrl>http:/www.google.com</AppManagerUrl>
</AppManagementConfig>
</AppManagementConfig>

@ -123,4 +123,6 @@ public interface FeatureDAO {
*/
boolean deleteFeaturesOfProfile(int profileId) throws FeatureManagerDAOException;
boolean deleteProfileFeatures(int featureId) throws FeatureManagerDAOException;
}

@ -20,7 +20,6 @@ package org.wso2.carbon.policy.mgt.core.dao.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.policy.mgt.common.Profile;
@ -28,14 +27,16 @@ import org.wso2.carbon.policy.mgt.common.ProfileFeature;
import org.wso2.carbon.policy.mgt.core.dao.FeatureDAO;
import org.wso2.carbon.policy.mgt.core.dao.FeatureManagerDAOException;
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagerDAOException;
import org.wso2.carbon.policy.mgt.core.dao.util.PolicyManagementDAOUtil;
import org.wso2.carbon.policy.mgt.core.util.PolicyManagerUtil;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@ -177,6 +178,29 @@ public class FeatureDAOImpl implements FeatureDAO {
}
}
@Override
public boolean deleteProfileFeatures(int featureId) throws FeatureManagerDAOException {
Connection conn;
PreparedStatement stmt = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
try {
conn = this.getConnection();
String query = "DELETE FROM DM_PROFILE_FEATURES WHERE ID = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(query);
stmt.setInt(1, featureId);
stmt.setInt(2, tenantId);
if (stmt.executeUpdate() > 0) {
return true;
}
return false;
} catch (SQLException e) {
throw new FeatureManagerDAOException("Error occurred while deleting the feature related to a profile.", e);
} finally {
PolicyManagementDAOUtil.cleanupResources(stmt, null);
}
}
@Override
public List<ProfileFeature> getAllProfileFeatures() throws FeatureManagerDAOException {
Connection conn;

@ -134,7 +134,7 @@ public class PolicyManagerImpl implements PolicyManager {
public Policy updatePolicy(Policy policy) throws PolicyManagementException {
try {
// Previous policy needs to be obtained before begining the transaction
// Previous policy needs to be obtained before beginning the transaction
Policy previousPolicy = this.getPolicy(policy.getId());
PolicyManagementDAOFactory.beginTransaction();
@ -144,7 +144,9 @@ public class PolicyManagerImpl implements PolicyManager {
List<ProfileFeature> existingFeaturesList = new ArrayList<>();
List<ProfileFeature> newFeaturesList = new ArrayList<>();
List<ProfileFeature> feturesToDelete = new ArrayList<>();
List<String> temp = new ArrayList<>();
List<String> updateDFes = new ArrayList<>();
List<ProfileFeature> updatedFeatureList = policy.getProfile().getProfileFeaturesList();
@ -158,6 +160,14 @@ public class PolicyManagerImpl implements PolicyManager {
temp.add(feature.getFeatureCode());
}
}
updateDFes.add(feature.getFeatureCode());
}
// Check for the features to delete
for(ProfileFeature feature : existingProfileFeaturesList) {
if(!updateDFes.contains(feature.getFeatureCode())){
feturesToDelete.add(feature);
}
}
// Checks for the new features
@ -180,6 +190,12 @@ public class PolicyManagerImpl implements PolicyManager {
if (!newFeaturesList.isEmpty()) {
featureDAO.addProfileFeatures(newFeaturesList, profileId);
}
if(!feturesToDelete.isEmpty()){
for (ProfileFeature pf : feturesToDelete)
featureDAO.deleteProfileFeatures(pf.getId());
}
policyDAO.deleteCriteriaAndDeviceRelatedConfigs(policy.getId());

@ -207,7 +207,7 @@ public class PolicyManagerUtil {
if (configuration != null && !configuration.isEmpty()) {
for (ConfigurationEntry cEntry : configuration) {
if (cEntry.getName().equalsIgnoreCase(MONITORING_FREQUENCY)) {
monitoringFrequency = (int) cEntry.getValue();
monitoringFrequency = Integer.parseInt((String)cEntry.getValue());
}
}
}

@ -139,7 +139,7 @@ public class WebappAuthenticationValve extends CarbonTomcatValve {
msg = authenticationInfo.getMessage();
response.setHeader("WWW-Authenticate", msg);
}
log.error(msg);
log.error(msg + " , API : " + request.getRequestURI());
AuthenticationFrameworkUtil
.handleResponse(request, response, HttpServletResponse.SC_UNAUTHORIZED,
msg);

@ -112,9 +112,9 @@ public class OAuthAuthenticator implements WebappAuthenticator {
if (oAuth2TokenValidationResponseDTO.isValid()) {
String username = oAuth2TokenValidationResponseDTO.getAuthorizedUser();
//Remove the userstore domain from username
if (username.contains("/")) {
/*if (username.contains("/")) {
username = username.substring(username.indexOf('/') + 1);
}
}*/
authenticationInfo.setUsername(username);
authenticationInfo.setTenantDomain(MultitenantUtils.getTenantDomain(username));
authenticationInfo.setTenantId(Utils.getTenantIdOFUser(username));

@ -20,4 +20,6 @@
<AppManagementConfig>
<Enabled>true</Enabled>
<AppManagerUrl>http:/www.google.com</AppManagerUrl>
<ConsumerKey>http:/www.google.com</ConsumerKey>
<ConsumerSecret>http:/www.google.com</ConsumerSecret>
</AppManagementConfig>

@ -305,7 +305,6 @@ CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
LAST_FAILED_TIME DATETIME2(0) NULL,
ATTEMPTS INT NULL,
PRIMARY KEY (ID),
CONSTRAINT DEVICE_ID_UNIQUE UNIQUE (DEVICE_ID ASC),
CONSTRAINT FK_POLICY_COMPLIANCE_STATUS_POLICY
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)

@ -297,7 +297,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
LAST_FAILED_TIME TIMESTAMP NULL,
ATTEMPTS INT NULL,
PRIMARY KEY (ID),
UNIQUE INDEX DEVICE_ID_UNIQUE (DEVICE_ID ASC),
CONSTRAINT FK_POLICY_COMPLIANCE_STATUS_POLICY
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)

@ -486,7 +486,6 @@ CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
LAST_FAILED_TIME TIMESTAMP(0) NULL,
ATTEMPTS NUMBER(10) NULL,
CONSTRAINT PK_DM_POLICY_COMP_STATUS PRIMARY KEY (ID),
CONSTRAINT DEVICE_ID_UNIQUE UNIQUE (DEVICE_ID),
CONSTRAINT FK_POLICY_COMP_STATUS_POLICY
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)

@ -267,7 +267,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE UNIQUE INDEX DEVICE_ID_UNIQUE ON DM_POLICY_COMPLIANCE_STATUS (DEVICE_ID ASC);
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
ID BIGSERIAL NOT NULL PRIMARY KEY,
@ -316,6 +315,17 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
TENANT_ID INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID BIGSERIAL NOT NULL PRIMARY KEY,
DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES
DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
-- POLICY RELATED TABLES FINISHED --
-- NOTIFICATION TABLE --

@ -2,6 +2,6 @@ instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/cdm-config.xml,target:${installFolder}/../../conf/cdm-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/notification-messages.xml,target:${installFolder}/../../conf/notification-messages.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/license-config.xml,target:${installFolder}/../../conf/etc/license-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/app-management-config.xml,target:${installFolder}/../../conf/etc/app-management-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/remote-appmanager-config.xml,target:${installFolder}/../../conf/etc/remote-appmanager-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/dbscripts/cdm,target:${installFolder}/../../../dbscripts/cdm,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/rxts/license.rxt,target:${installFolder}/../../../repository/resources/rxts/license.rxt,overwrite:true);\

@ -1542,6 +1542,9 @@
<google.gson.version>2.3.1</google.gson.version>
<jsr311.version>1.1.1</jsr311.version>
<commons.logging.version>1.2</commons.logging.version>
<!-- Release plugin ID for github-->
<project.scm.id>github-scm</project.scm.id>
</properties>
</project>

Loading…
Cancel
Save