From 9ccf3a5fa5ca9600dad78c041eb3c4b492d81fbf Mon Sep 17 00:00:00 2001 From: inoshperera Date: Fri, 23 Jun 2023 23:18:30 +0530 Subject: [PATCH 001/112] Add vpp user apis fixes https://roadmap.entgra.net/issues/10162 --- .../mgt/common/dto/ProxyResponse.java | 37 +++ .../mgt/common/dto/VppItuneUserDTO.java | 67 ++++ .../mgt/common/dto/VppUserDTO.java | 76 +++++ .../services/VPPApplicationManager.java | 34 +++ .../wrapper/VppItuneUserRequestWrapper.java | 40 +++ .../core/impl/VppApplicationManagerImpl.java | 107 +++++++ ...ApplicationManagementServiceComponent.java | 8 + .../mgt/core/internal/DataHolder.java | 11 + .../application/mgt/core/util/Constants.java | 12 + .../mgt/core/util/VppHttpUtil.java | 285 ++++++++++++++++++ 10 files changed, 677 insertions(+) create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ProxyResponse.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppItuneUserDTO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppUserDTO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserRequestWrapper.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ProxyResponse.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ProxyResponse.java new file mode 100644 index 0000000000..80d5f94df1 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ProxyResponse.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.dto; + +public class ProxyResponse { + + private int code; + private String data; + private String executorResponse; + + public int getCode() { return code; } + + public void setCode(int code) { this.code = code; } + + public String getData() { return data; } + + public void setData(String data) { this.data = data; } + + public String getExecutorResponse() { return executorResponse; } + + public void setExecutorResponse(String executorResponse) { this.executorResponse = executorResponse; } +} \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppItuneUserDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppItuneUserDTO.java new file mode 100644 index 0000000000..d9ebb4ee59 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppItuneUserDTO.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.dto; + +public class VppItuneUserDTO { + String clientUserId; + String inviteCode; + String status; + String email; + String managedId; + + public String getClientUserId() { + return clientUserId; + } + + public void setClientUserId(String clientUserId) { + this.clientUserId = clientUserId; + } + + public String getInviteCode() { + return inviteCode; + } + + public void setInviteCode(String inviteCode) { + this.inviteCode = inviteCode; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getManagedId() { + return managedId; + } + + public void setManagedId(String managedId) { + this.managedId = managedId; + } + +} \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppUserDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppUserDTO.java new file mode 100644 index 0000000000..e2915fec97 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppUserDTO.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.dto; + +public class VppUserDTO extends VppItuneUserDTO { + int id; + String dmUsername; + int tenantId; + String createdTime; + String lastUpdatedTime; + String tmpPassword; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDmUsername() { + return dmUsername; + } + + public void setDmUsername(String dmUsername) { + this.dmUsername = dmUsername; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } + + public String getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(String createdTime) { + this.createdTime = createdTime; + } + + public String getLastUpdatedTime() { + return lastUpdatedTime; + } + + public void setLastUpdatedTime(String lastUpdatedTime) { + this.lastUpdatedTime = lastUpdatedTime; + } + + public String getTmpPassword() { + return tmpPassword; + } + + public void setTmpPassword(String tmpPassword) { + this.tmpPassword = tmpPassword; + } + +} \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java new file mode 100644 index 0000000000..0fa5164f0b --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.application.mgt.common.services; + +import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; + +import java.io.IOException; + +public interface VPPApplicationManager { + + VppUserDTO getUserByDMUsername() throws ApplicationManagementException; + + VppUserDTO addUser(VppUserDTO userDTO) throws ApplicationManagementException; + + ProxyResponse callVPPBackend(String url, String payload, String accessToken, String method) throws IOException; +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserRequestWrapper.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserRequestWrapper.java new file mode 100644 index 0000000000..726a7dbadd --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserRequestWrapper.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.wrapper; + +import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; + +import java.util.ArrayList; +import java.util.List; + +public class VppItuneUserRequestWrapper { + + List user; + + public VppItuneUserRequestWrapper() { + user = new ArrayList<>(); + } + public List getUser() { + return user; + } + + public void setUser(List user) { + this.user = user; + } + +} \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java new file mode 100644 index 0000000000..c9e27bebbc --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.application.mgt.core.impl; + +import com.google.gson.Gson; +import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserRequestWrapper; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; +import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; +import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; +import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; +import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; +import io.entgra.device.mgt.core.application.mgt.core.util.Constants; +import io.entgra.device.mgt.core.application.mgt.core.util.VppHttpUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpStatus; + +import java.io.IOException; + +public class VppApplicationManagerImpl implements VPPApplicationManager { + private static final String APP_API = "https://vpp.itunes.apple.com/mdm/v2"; + private static final String ASSETS = APP_API + "/assets"; + private static final String USER_CREATE = APP_API + "users/create"; + private static final String TOKEN = ""; + + private static final Log log = LogFactory.getLog(VppApplicationManagerImpl.class); + private ApplicationDAO applicationDAO; + private SPApplicationDAO spApplicationDAO; + private VisibilityDAO visibilityDAO; + private final LifecycleStateManager lifecycleStateManager; + + public VppApplicationManagerImpl() { + initDataAccessObjects(); + lifecycleStateManager = DataHolder.getInstance().getLifecycleStateManager(); + } + + private void initDataAccessObjects() { + this.applicationDAO = ApplicationManagementDAOFactory.getApplicationDAO(); + this.visibilityDAO = ApplicationManagementDAOFactory.getVisibilityDAO(); + this.spApplicationDAO = ApplicationManagementDAOFactory.getSPApplicationDAO(); + } + + + @Override + public VppUserDTO getUserByDMUsername() throws ApplicationManagementException { + // TODO: Return from DAO in a tenanted manner + return null; + } + + @Override + public VppUserDTO addUser(VppUserDTO userDTO) throws ApplicationManagementException { + // Call the API to add + try { + VppItuneUserDTO ituneUserDTO = userDTO; + VppItuneUserRequestWrapper wrapper = new VppItuneUserRequestWrapper(); + wrapper.getUser().add(ituneUserDTO); + + Gson gson = new Gson(); + String userPayload = gson.toJson(wrapper); + + ProxyResponse proxyResponse = callVPPBackend(USER_CREATE, userPayload, TOKEN, Constants.POST); + if (proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == HttpStatus.SC_CREATED) { + // TODO: Save the user in the DAO + + + + } + } catch (IOException e) { + String msg = "Error while callng VPP backend"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + + + return null; + } + + @Override + public ProxyResponse callVPPBackend(String url, + String payload, + String accessToken, + String method) throws IOException { + return VppHttpUtil.execute(url, payload, accessToken, method); + } +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java index d15ae1eb5d..0a373b4282 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java @@ -18,7 +18,9 @@ package io.entgra.device.mgt.core.application.mgt.core.internal; import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; +import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; import io.entgra.device.mgt.core.application.mgt.core.impl.AppmDataHandlerImpl; +import io.entgra.device.mgt.core.application.mgt.core.impl.VppApplicationManagerImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; @@ -116,6 +118,12 @@ public class ApplicationManagementServiceComponent { DataHolder.getInstance().setConfigManager(configManager); bundleContext.registerService(AppmDataHandler.class.getName(), configManager, null); + + // TODO: Get the new instance from extension like others + VppApplicationManagerImpl vppApplicationManager = new VppApplicationManagerImpl(); + DataHolder.getInstance().setVppApplicationManager(vppApplicationManager); + bundleContext.registerService(VPPApplicationManager.class.getName(), vppApplicationManager, null); + ScheduledAppSubscriptionTaskManager taskManager = new ScheduledAppSubscriptionTaskManager(); taskManager.scheduleCleanupTask(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/DataHolder.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/DataHolder.java index 6d5000a986..b8905829ad 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/DataHolder.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/DataHolder.java @@ -23,6 +23,7 @@ import io.entgra.device.mgt.core.application.mgt.common.services.AppmDataHandler import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.ntask.core.service.TaskService; @@ -39,6 +40,8 @@ public class DataHolder { private SPApplicationManager SPApplicationManager; + private VPPApplicationManager vppApplicationManager; + private ApplicationManager applicationManager; private ReviewManager reviewManager; @@ -142,4 +145,12 @@ public class DataHolder { public void setISApplicationManager(SPApplicationManager SPApplicationManager) { this.SPApplicationManager = SPApplicationManager; } + + public VPPApplicationManager getVppApplicationManager() { + return vppApplicationManager; + } + + public void setVppApplicationManager(VPPApplicationManager vppApplicationManager) { + this.vppApplicationManager = vppApplicationManager; + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java index 5864242acf..bd676bf3e8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java @@ -100,6 +100,18 @@ public class Constants { } public static final Map AGENT_FILE_NAMES = Collections.unmodifiableMap(AGENT_DATA); + public static final String BEARER = "Bearer "; + + public static final String EXECUTOR_EXCEPTION_PREFIX = "ExecutorException-"; + public static final String TOKEN_IS_EXPIRED = "ACCESS_TOKEN_IS_EXPIRED"; + + public static final int INTERNAL_ERROR_CODE = 500; + + public static final String GET = "GET"; + public static final String POST = "POST"; + public static final String PUT = "PUT"; + public static final String DELETE = "DELETE"; + /** * Database types supported by Application Management. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java new file mode 100644 index 0000000000..216a8de71f --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.application.mgt.core.util; + +import com.google.gson.Gson; +import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.Consts; +import org.apache.http.HttpEntity; +import org.apache.http.HttpHeaders; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; + +public class VppHttpUtil { + private static final Log log = LogFactory.getLog(VppHttpUtil.class); + + public static ProxyResponse execute(String url, + String payload, + String accessToken, + String method) throws IOException { + + HttpRequestBase endpoint = null; + if (Constants.GET.equalsIgnoreCase(method) || Constants.DELETE.equalsIgnoreCase(method)) { + endpoint = new HttpGet(url); + addHeaders(endpoint, accessToken); + return VppHttpUtil.execute(endpoint); + } else if (Constants.POST.equalsIgnoreCase(method)) { + endpoint = new HttpPost(url); + } else if (Constants.PUT.equalsIgnoreCase(method)) { + endpoint = new HttpPut(url); + } + addHeaders(endpoint, accessToken); + + + if (payload != null) { + HttpEntity forwardRequestBody = new StringEntity(payload, ContentType.APPLICATION_JSON.toString(), "utf-8"); + if (Constants.POST.equalsIgnoreCase(method)) { + ((HttpPost) endpoint).setEntity(forwardRequestBody); + } else if (Constants.PUT.equalsIgnoreCase(method)) { + ((HttpPut) endpoint).setEntity(forwardRequestBody); + } + + } + if (log.isDebugEnabled()) { + log.info("Forwarding request to " + url); + } + return VppHttpUtil.execute(endpoint); + } + + private static void addHeaders(HttpRequestBase endpoint, String accessToken) { + endpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); + endpoint.setHeader(HttpHeaders.ACCEPT, ContentType.APPLICATION_JSON.toString()); + endpoint.setHeader(HttpHeaders.AUTHORIZATION, Constants.BEARER + accessToken); + } + + + /*** + * + * @param httpRequest - httpMethod e.g:- HttpPost, HttpGet + * @return response as string + * @throws IOException IO exception returns if error occurs when executing the httpMethod + */ + private static ProxyResponse execute(HttpRequestBase httpRequest) throws IOException { + try (CloseableHttpClient client = getHttpClient()) { + HttpResponse response = client.execute(httpRequest); + ProxyResponse proxyResponse = new ProxyResponse(); + + if (response == null) { + log.error("Received null response for http request : " + httpRequest.getMethod() + " " + httpRequest + .getURI().toString()); + proxyResponse.setCode(Constants.INTERNAL_ERROR_CODE); + proxyResponse.setExecutorResponse(Constants.EXECUTOR_EXCEPTION_PREFIX + getStatusKey( + Constants.INTERNAL_ERROR_CODE)); + return proxyResponse; + } else { + int statusCode = response.getStatusLine().getStatusCode(); + try (BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()))) { + StringBuilder result = new StringBuilder(); + String line; + while ((line = rd.readLine()) != null) { + result.append(line); + } + + String jsonString = result.toString(); + if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_CREATED) { + proxyResponse.setCode(statusCode); + proxyResponse.setData(jsonString); + proxyResponse.setExecutorResponse("SUCCESS"); + return proxyResponse; + } else if (statusCode == HttpStatus.SC_UNAUTHORIZED) { + if (jsonString.contains("Access token expired") || jsonString + .contains("Invalid input. Access token validation failed")) { + proxyResponse.setCode(statusCode); + proxyResponse.setExecutorResponse(Constants.TOKEN_IS_EXPIRED); + return proxyResponse; + } else { + log.error( + "Received " + statusCode + " response for http request : " + httpRequest.getMethod() + + " " + httpRequest.getURI().toString() + ". Error message: " + jsonString); + proxyResponse.setCode(statusCode); + proxyResponse.setData(jsonString); + proxyResponse.setExecutorResponse( + Constants.EXECUTOR_EXCEPTION_PREFIX + getStatusKey(statusCode)); + return proxyResponse; + } + } + log.error("Received " + statusCode + + " response for http request : " + httpRequest.getMethod() + " " + httpRequest.getURI() + .toString() + ". Error message: " + jsonString); + proxyResponse.setCode(statusCode); + proxyResponse.setData(jsonString); + proxyResponse + .setExecutorResponse(Constants.EXECUTOR_EXCEPTION_PREFIX + getStatusKey(statusCode)); + return proxyResponse; + } + } + } + } + + /*** + * + * @param statusCode Provide status code, e.g:- 400, 401, 500 etc + * @return relative status code key for given status code. + */ + public static String getStatusKey(int statusCode) { + String statusCodeKey; + + switch (statusCode) { + case HttpStatus.SC_INTERNAL_SERVER_ERROR: + statusCodeKey = "internalServerError"; + break; + case HttpStatus.SC_BAD_REQUEST: + statusCodeKey = "badRequest"; + break; + case HttpStatus.SC_UNAUTHORIZED: + statusCodeKey = "unauthorized"; + break; + case HttpStatus.SC_FORBIDDEN: + statusCodeKey = "forbidden"; + break; + case HttpStatus.SC_NOT_FOUND: + statusCodeKey = "notFound"; + break; + case HttpStatus.SC_METHOD_NOT_ALLOWED: + statusCodeKey = "methodNotAllowed"; + break; + case HttpStatus.SC_NOT_ACCEPTABLE: + statusCodeKey = "notAcceptable"; + break; + case HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE: + statusCodeKey = "unsupportedMediaType"; + break; + default: + statusCodeKey = "defaultPage"; + break; + } + return statusCodeKey; + } + + + /*** + * Handle error requests. + * + * @param resp {@link HttpServletResponse} + * @param proxyResponse {@link ProxyResponse} + * @throws IOException If error occurred when trying to send the error response. + */ + public static void handleError(HttpServletResponse resp, ProxyResponse proxyResponse) throws IOException { + Gson gson = new Gson(); + if (proxyResponse == null) { + proxyResponse = new ProxyResponse(); + proxyResponse.setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); + proxyResponse.setExecutorResponse(Constants.EXECUTOR_EXCEPTION_PREFIX + VppHttpUtil + .getStatusKey(Constants.INTERNAL_ERROR_CODE)); + } + resp.setStatus(proxyResponse.getCode()); + resp.setContentType(ContentType.APPLICATION_JSON.getMimeType()); + resp.setCharacterEncoding(Consts.UTF_8.name()); + + proxyResponse.setExecutorResponse(null); + try (PrintWriter writer = resp.getWriter()) { + writer.write(gson.toJson(proxyResponse)); + } + } + + /** + * Handle error requests with custom error codes. + * + * @param resp {@link HttpServletResponse} + * @param errorCode HTTP error status code + * @throws IOException If error occurred when trying to send the error response. + */ + public static void handleError(HttpServletResponse resp, int errorCode) + throws IOException { + ProxyResponse proxyResponse = new ProxyResponse(); + proxyResponse.setCode(errorCode); + proxyResponse.setExecutorResponse( + Constants.EXECUTOR_EXCEPTION_PREFIX + VppHttpUtil.getStatusKey(errorCode)); + VppHttpUtil.handleError(resp, proxyResponse); + } + + /*** + * + * @param resp {@link HttpServletResponse} + * Return Success Response. + */ + public static void handleSuccess(HttpServletResponse resp, ProxyResponse proxyResponse) throws IOException { + if (proxyResponse == null) { + handleError(resp, null); + return; + } + resp.setStatus(proxyResponse.getCode()); + resp.setContentType(ContentType.APPLICATION_JSON.getMimeType()); + resp.setCharacterEncoding(Consts.UTF_8.name()); + JSONObject response = new JSONObject(); + String responseData = proxyResponse.getData(); + + if (!StringUtils.isEmpty(responseData)) { + try { + if (responseData.startsWith("{")) { + JSONObject responseDataJsonObj = new JSONObject(responseData); + response.put("data", responseDataJsonObj); + } else if (responseData.startsWith("[")) { + JSONArray responseDataJsonArr = new JSONArray(responseData); + response.put("data", responseDataJsonArr); + } else { + log.warn("Response data is not valid json string >> " + responseData); + response.put("data", responseData); + } + } catch (JSONException e) { + log.error("Response data is not passable"); + response.put("data", responseData); + } + } + + try (PrintWriter writer = resp.getWriter()) { + writer.write(response.toString()); + } + } + + /** + * Retrieve Http client based on hostname verification. + * + * @return {@link CloseableHttpClient} http client + */ + public static CloseableHttpClient getHttpClient() { + return HttpClients.custom().setMaxConnTotal(1).setMaxConnPerRoute(1).build(); + } + +} From cc8470d3c0970427ca2d31594e026d14b0f49b6c Mon Sep 17 00:00:00 2001 From: inoshperera Date: Mon, 26 Jun 2023 19:10:17 +0530 Subject: [PATCH 002/112] add vpp user services --- .../mgt/common/dto/VppPaginationDTO.java | 76 +++++++++++++++ .../mgt/common/dto/VppUserDTO.java | 16 ++++ .../services/VPPApplicationManager.java | 8 +- .../wrapper/VppItuneUserRequestWrapper.java | 10 +- .../wrapper/VppItuneUserResponseWrapper.java | 40 ++++++++ .../core/impl/VppApplicationManagerImpl.java | 95 ++++++++++++++++--- .../application/mgt/core/util/Constants.java | 26 +++-- .../mgt/core/util/VppHttpUtil.java | 30 +++--- 8 files changed, 255 insertions(+), 46 deletions(-) create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppPaginationDTO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserResponseWrapper.java diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppPaginationDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppPaginationDTO.java new file mode 100644 index 0000000000..32c4f12f9b --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppPaginationDTO.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.dto; + +public class VppPaginationDTO { + + int currentPageIndex; + int size; + String tokenExpirationDate; + int totalPages; + String uId; + String versionId; + + public int getCurrentPageIndex() { + return currentPageIndex; + } + + public void setCurrentPageIndex(int currentPageIndex) { + this.currentPageIndex = currentPageIndex; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public String getTokenExpirationDate() { + return tokenExpirationDate; + } + + public void setTokenExpirationDate(String tokenExpirationDate) { + this.tokenExpirationDate = tokenExpirationDate; + } + + public int getTotalPages() { + return totalPages; + } + + public void setTotalPages(int totalPages) { + this.totalPages = totalPages; + } + + public String getuId() { + return uId; + } + + public void setuId(String uId) { + this.uId = uId; + } + + public String getVersionId() { + return versionId; + } + + public void setVersionId(String versionId) { + this.versionId = versionId; + } +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppUserDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppUserDTO.java index e2915fec97..4ea7929014 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppUserDTO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppUserDTO.java @@ -73,4 +73,20 @@ public class VppUserDTO extends VppItuneUserDTO { this.tmpPassword = tmpPassword; } + @Override + public String toString() { + return "VppUserDTO{" + + "id=" + id + + ", dmUsername='" + dmUsername + '\'' + + ", tenantId=" + tenantId + + ", createdTime='" + createdTime + '\'' + + ", lastUpdatedTime='" + lastUpdatedTime + '\'' + + ", tmpPassword='" + tmpPassword + '\'' + + ", clientUserId='" + clientUserId + '\'' + + ", inviteCode='" + inviteCode + '\'' + + ", status='" + status + '\'' + + ", email='" + email + '\'' + + ", managedId='" + managedId + '\'' + + '}'; + } } \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java index 0fa5164f0b..4b08001e08 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java @@ -26,9 +26,13 @@ import java.io.IOException; public interface VPPApplicationManager { - VppUserDTO getUserByDMUsername() throws ApplicationManagementException; - VppUserDTO addUser(VppUserDTO userDTO) throws ApplicationManagementException; + VppUserDTO getUserByDMUsername(String emmUsername) throws ApplicationManagementException; + + void updateUser(VppUserDTO userDTO) throws ApplicationManagementException; + + void syncUsers(String clientId) throws ApplicationManagementException; + ProxyResponse callVPPBackend(String url, String payload, String accessToken, String method) throws IOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserRequestWrapper.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserRequestWrapper.java index 726a7dbadd..4189fa557a 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserRequestWrapper.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserRequestWrapper.java @@ -24,17 +24,17 @@ import java.util.List; public class VppItuneUserRequestWrapper { - List user; + List users; public VppItuneUserRequestWrapper() { - user = new ArrayList<>(); + users = new ArrayList<>(); } public List getUser() { - return user; + return users; } - public void setUser(List user) { - this.user = user; + public void setUser(List users) { + this.users = users; } } \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserResponseWrapper.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserResponseWrapper.java new file mode 100644 index 0000000000..64ee578241 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneUserResponseWrapper.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.wrapper; + +import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppPaginationDTO; + +import java.util.ArrayList; +import java.util.List; + +public class VppItuneUserResponseWrapper extends VppPaginationDTO { + + List users; + + public VppItuneUserResponseWrapper() { + users = new ArrayList<>(); + } + public List getUser() { + return users; + } + + public void setUser(List users) { + this.users = users; + } +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index c9e27bebbc..6ec3023def 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -18,13 +18,17 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; +import com.google.gson.ExclusionStrategy; +import com.google.gson.FieldAttributes; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserRequestWrapper; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserResponseWrapper; import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; @@ -42,7 +46,9 @@ import java.io.IOException; public class VppApplicationManagerImpl implements VPPApplicationManager { private static final String APP_API = "https://vpp.itunes.apple.com/mdm/v2"; private static final String ASSETS = APP_API + "/assets"; - private static final String USER_CREATE = APP_API + "users/create"; + private static final String USER_CREATE = APP_API + "/users/create"; + private static final String USER_UPDATE = APP_API + "/users/update"; + private static final String USER_GET = APP_API + "/users"; private static final String TOKEN = ""; private static final Log log = LogFactory.getLog(VppApplicationManagerImpl.class); @@ -62,13 +68,6 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { this.spApplicationDAO = ApplicationManagementDAOFactory.getSPApplicationDAO(); } - - @Override - public VppUserDTO getUserByDMUsername() throws ApplicationManagementException { - // TODO: Return from DAO in a tenanted manner - return null; - } - @Override public VppUserDTO addUser(VppUserDTO userDTO) throws ApplicationManagementException { // Call the API to add @@ -78,23 +77,90 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { wrapper.getUser().add(ituneUserDTO); Gson gson = new Gson(); +// Gson gson = new GsonBuilder() +// .setExclusionStrategies(new NullEmptyExclusionStrategy()) +// .create(); String userPayload = gson.toJson(wrapper); - ProxyResponse proxyResponse = callVPPBackend(USER_CREATE, userPayload, TOKEN, Constants.POST); - if (proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == HttpStatus.SC_CREATED) { - // TODO: Save the user in the DAO + ProxyResponse proxyResponse = callVPPBackend(USER_CREATE, userPayload, TOKEN, Constants.VPP.POST); + if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == + HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.EVENT_ID)) { + // Create user does not return any useful data. Its needed to call the backend again + ProxyResponse getUserResponse = callVPPBackend(USER_GET + Constants.VPP.CLIENT_USER_ID_PARAM + + userDTO.getClientUserId(), userPayload, TOKEN, Constants.VPP.GET); + if ((getUserResponse.getCode() == HttpStatus.SC_OK || getUserResponse.getCode() == + HttpStatus.SC_CREATED) && getUserResponse.getData().contains(Constants.VPP.TOTAL_PAGES)) { + VppItuneUserResponseWrapper vppItuneUserResponseWrapper = gson.fromJson + (getUserResponse.getData(), VppItuneUserResponseWrapper.class); + userDTO.setInviteCode(vppItuneUserResponseWrapper.getUser().get(0) + .getInviteCode()); + userDTO.setStatus(vppItuneUserResponseWrapper.getUser().get(0).getStatus()); + log.error("userDTO " + userDTO.toString()); + // TODO: Save the userDTO in the DAO + return userDTO; + } + + } + } catch (IOException e) { + String msg = "Error while calling VPP backend to add user"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + return null; + } + + @Override + public VppUserDTO getUserByDMUsername(String emmUsername) throws ApplicationManagementException { + // TODO: Return from DAO in a tenanted manner + return null; + } + + @Override + public void updateUser(VppUserDTO userDTO) throws ApplicationManagementException { + VppItuneUserDTO ituneUserDTO = userDTO; + VppItuneUserRequestWrapper wrapper = new VppItuneUserRequestWrapper(); + wrapper.getUser().add(ituneUserDTO); + + Gson gson = new Gson(); + String userPayload = gson.toJson(wrapper); + try { + ProxyResponse proxyResponse = callVPPBackend(USER_UPDATE, userPayload, TOKEN, Constants.VPP.POST); + if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == + HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.EVENT_ID)) { + + log.error("userDTO " + userDTO.toString()); + // TODO: Save the userDTO in the DAO + } } catch (IOException e) { - String msg = "Error while callng VPP backend"; + String msg = "Error while callng VPP backend to update"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + } + + @Override + public void syncUsers(String clientId) throws ApplicationManagementException { + ProxyResponse proxyResponse = null; + try { + proxyResponse = callVPPBackend(USER_GET, null, TOKEN, Constants + .VPP.GET); + if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == + HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.TOTAL_PAGES)) { + log.error("proxyResponse " + proxyResponse.getData()); + Gson gson = new Gson(); + VppItuneUserResponseWrapper vppUserResponseWrapper = gson.fromJson + (proxyResponse.getData(), VppItuneUserResponseWrapper.class); + } + } catch (IOException e) { + String msg = "Error while syncing VPP users with backend"; log.error(msg, e); throw new ApplicationManagementException(msg, e); } - - return null; } @Override @@ -104,4 +170,5 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { String method) throws IOException { return VppHttpUtil.execute(url, payload, accessToken, method); } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java index bd676bf3e8..ce61c1a81b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java @@ -100,17 +100,23 @@ public class Constants { } public static final Map AGENT_FILE_NAMES = Collections.unmodifiableMap(AGENT_DATA); - public static final String BEARER = "Bearer "; + public static final class VPP { + public static final String GET = "GET"; + public static final String BEARER = "Bearer "; + public static final String EXECUTOR_EXCEPTION_PREFIX = "ExecutorException-"; + public static final String TOKEN_IS_EXPIRED = "ACCESS_TOKEN_IS_EXPIRED"; + public static final int INTERNAL_ERROR_CODE = 500; + public static final String POST = "POST"; + public static final String PUT = "PUT"; + public static final String DELETE = "DELETE"; + public static final String CLIENT_USER_ID = "clientUserId"; + public static final String EVENT_ID = "eventId"; + public static final String CLIENT_USER_ID_PARAM = "?clientUserId="; + public static final String TOTAL_PAGES = "totalPages"; - public static final String EXECUTOR_EXCEPTION_PREFIX = "ExecutorException-"; - public static final String TOKEN_IS_EXPIRED = "ACCESS_TOKEN_IS_EXPIRED"; - - public static final int INTERNAL_ERROR_CODE = 500; - - public static final String GET = "GET"; - public static final String POST = "POST"; - public static final String PUT = "PUT"; - public static final String DELETE = "DELETE"; + private VPP() { + } + } /** diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java index 216a8de71f..620339a1bf 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java @@ -55,13 +55,13 @@ public class VppHttpUtil { String method) throws IOException { HttpRequestBase endpoint = null; - if (Constants.GET.equalsIgnoreCase(method) || Constants.DELETE.equalsIgnoreCase(method)) { + if (Constants.VPP.GET.equalsIgnoreCase(method) || Constants.VPP.DELETE.equalsIgnoreCase(method)) { endpoint = new HttpGet(url); addHeaders(endpoint, accessToken); return VppHttpUtil.execute(endpoint); - } else if (Constants.POST.equalsIgnoreCase(method)) { + } else if (Constants.VPP.POST.equalsIgnoreCase(method)) { endpoint = new HttpPost(url); - } else if (Constants.PUT.equalsIgnoreCase(method)) { + } else if (Constants.VPP.PUT.equalsIgnoreCase(method)) { endpoint = new HttpPut(url); } addHeaders(endpoint, accessToken); @@ -69,9 +69,9 @@ public class VppHttpUtil { if (payload != null) { HttpEntity forwardRequestBody = new StringEntity(payload, ContentType.APPLICATION_JSON.toString(), "utf-8"); - if (Constants.POST.equalsIgnoreCase(method)) { + if (Constants.VPP.POST.equalsIgnoreCase(method)) { ((HttpPost) endpoint).setEntity(forwardRequestBody); - } else if (Constants.PUT.equalsIgnoreCase(method)) { + } else if (Constants.VPP.PUT.equalsIgnoreCase(method)) { ((HttpPut) endpoint).setEntity(forwardRequestBody); } @@ -85,7 +85,7 @@ public class VppHttpUtil { private static void addHeaders(HttpRequestBase endpoint, String accessToken) { endpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); endpoint.setHeader(HttpHeaders.ACCEPT, ContentType.APPLICATION_JSON.toString()); - endpoint.setHeader(HttpHeaders.AUTHORIZATION, Constants.BEARER + accessToken); + endpoint.setHeader(HttpHeaders.AUTHORIZATION, Constants.VPP.BEARER + accessToken); } @@ -103,9 +103,9 @@ public class VppHttpUtil { if (response == null) { log.error("Received null response for http request : " + httpRequest.getMethod() + " " + httpRequest .getURI().toString()); - proxyResponse.setCode(Constants.INTERNAL_ERROR_CODE); - proxyResponse.setExecutorResponse(Constants.EXECUTOR_EXCEPTION_PREFIX + getStatusKey( - Constants.INTERNAL_ERROR_CODE)); + proxyResponse.setCode(Constants.VPP.INTERNAL_ERROR_CODE); + proxyResponse.setExecutorResponse(Constants.VPP.EXECUTOR_EXCEPTION_PREFIX + getStatusKey( + Constants.VPP.INTERNAL_ERROR_CODE)); return proxyResponse; } else { int statusCode = response.getStatusLine().getStatusCode(); @@ -126,7 +126,7 @@ public class VppHttpUtil { if (jsonString.contains("Access token expired") || jsonString .contains("Invalid input. Access token validation failed")) { proxyResponse.setCode(statusCode); - proxyResponse.setExecutorResponse(Constants.TOKEN_IS_EXPIRED); + proxyResponse.setExecutorResponse(Constants.VPP.TOKEN_IS_EXPIRED); return proxyResponse; } else { log.error( @@ -135,7 +135,7 @@ public class VppHttpUtil { proxyResponse.setCode(statusCode); proxyResponse.setData(jsonString); proxyResponse.setExecutorResponse( - Constants.EXECUTOR_EXCEPTION_PREFIX + getStatusKey(statusCode)); + Constants.VPP.EXECUTOR_EXCEPTION_PREFIX + getStatusKey(statusCode)); return proxyResponse; } } @@ -145,7 +145,7 @@ public class VppHttpUtil { proxyResponse.setCode(statusCode); proxyResponse.setData(jsonString); proxyResponse - .setExecutorResponse(Constants.EXECUTOR_EXCEPTION_PREFIX + getStatusKey(statusCode)); + .setExecutorResponse(Constants.VPP.EXECUTOR_EXCEPTION_PREFIX + getStatusKey(statusCode)); return proxyResponse; } } @@ -205,8 +205,8 @@ public class VppHttpUtil { if (proxyResponse == null) { proxyResponse = new ProxyResponse(); proxyResponse.setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); - proxyResponse.setExecutorResponse(Constants.EXECUTOR_EXCEPTION_PREFIX + VppHttpUtil - .getStatusKey(Constants.INTERNAL_ERROR_CODE)); + proxyResponse.setExecutorResponse(Constants.VPP.EXECUTOR_EXCEPTION_PREFIX + VppHttpUtil + .getStatusKey(Constants.VPP.INTERNAL_ERROR_CODE)); } resp.setStatus(proxyResponse.getCode()); resp.setContentType(ContentType.APPLICATION_JSON.getMimeType()); @@ -230,7 +230,7 @@ public class VppHttpUtil { ProxyResponse proxyResponse = new ProxyResponse(); proxyResponse.setCode(errorCode); proxyResponse.setExecutorResponse( - Constants.EXECUTOR_EXCEPTION_PREFIX + VppHttpUtil.getStatusKey(errorCode)); + Constants.VPP.EXECUTOR_EXCEPTION_PREFIX + VppHttpUtil.getStatusKey(errorCode)); VppHttpUtil.handleError(resp, proxyResponse); } From cd42a2c48fea2b15222c258ada529eccf0562a02 Mon Sep 17 00:00:00 2001 From: osh Date: Wed, 28 Jun 2023 20:03:16 +0530 Subject: [PATCH 003/112] Adding the DAO layer for vpp user management fixes https://roadmap.entgra.net/issues/10169 --- .../mgt/core/dao/VppApplicationDAO.java | 14 ++ .../ApplicationManagementDAOFactory.java | 36 ++++- .../vpp/GenericVppApplicationDAOImpl.java | 152 ++++++++++++++++++ .../impl/vpp/OracleVppApplicationDAOImpl.java | 64 ++++++++ .../impl/vpp/PostgreSQLVppApplicationDAO.java | 63 ++++++++ .../vpp/SQLServerVppApplicationDAOImpl.java | 4 + .../core/impl/VppApplicationManagerImpl.java | 80 +++++++-- .../application/mgt/core/util/DAOUtil.java | 38 +++++ 8 files changed, 435 insertions(+), 16 deletions(-) create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/OracleVppApplicationDAOImpl.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/PostgreSQLVppApplicationDAO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/SQLServerVppApplicationDAOImpl.java diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java new file mode 100644 index 0000000000..ae2b75e515 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java @@ -0,0 +1,14 @@ +package io.entgra.device.mgt.core.application.mgt.core.dao; + +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; + + +public interface VppApplicationDAO { + + int addVppUser(VppUserDTO userDTO) throws ApplicationManagementDAOException; + + VppUserDTO updateVppUser(VppUserDTO userDTO) throws ApplicationManagementDAOException; + + VppUserDTO getUserByDMUsername(String emmUsername) throws ApplicationManagementDAOException; +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java index e7996ee804..1a29b33b2d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java @@ -17,7 +17,7 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao.common; -import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.*; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.GenericSPApplicationDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.OracleSPApplicationDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.PostgreSQLSPApplicationDAOImpl; @@ -26,16 +26,14 @@ import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.Generi import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.OracleVisibilityDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.PostgreSQLVisibilityDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.SQLServerVisibilityDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp.GenericVppApplicationDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp.OracleVppApplicationDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp.PostgreSQLVppApplicationDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp.SQLServerVppApplicationDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.UnsupportedDatabaseEngineException; -import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationReleaseDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.LifecycleStateDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.ReviewDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.SubscriptionDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.PostgreSQLApplicationDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.SQLServerApplicationDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release.OracleApplicationReleaseDAOImpl; @@ -232,4 +230,28 @@ public class ApplicationManagementDAOFactory { } throw new IllegalStateException("Database engine has not initialized properly."); } + + + /** + * To get the instance of VppApplicationImplementation of the particular database engine. + * @return specific VppApplicationImplementation + */ + public static VppApplicationDAO getVppApplicationDAO() { + if (databaseEngine != null) { + switch (databaseEngine) { + case Constants.DataBaseTypes.DB_TYPE_H2: + case Constants.DataBaseTypes.DB_TYPE_MYSQL: + return new GenericVppApplicationDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new PostgreSQLVppApplicationDAO(); + case Constants.DataBaseTypes.DB_TYPE_ORACLE: + return new OracleVppApplicationDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_MSSQL: + return new SQLServerVppApplicationDAOImpl(); + default: + throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); + } + } + throw new IllegalStateException("Database engine has not initialized properly."); + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java new file mode 100644 index 0000000000..3dc356b764 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -0,0 +1,152 @@ +package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; + +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.core.dao.VppApplicationDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; +import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.sql.*; + +public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements VppApplicationDAO { + private static final Log log = LogFactory.getLog(GenericVppApplicationDAOImpl.class); + + @Override + public int addVppUser(VppUserDTO userDTO) + throws ApplicationManagementDAOException { + int vppUserId = -1; + String sql = "INSERT INTO " + + "AP_VPP_USER(" + + "CLIENT_USER_ID, " + + "DM_USERNAME, " + + "TENANT_ID, " + + "EMAIL, " + + "INVITE_CODE, " + + "STATUS," + + "CREATED_TIME," + + "LAST_UPDATED_TIME," + + "MANAGED_ID," + + "TEMP_PASSWORD) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { + long currentTime = System.currentTimeMillis(); + stmt.setString(1, userDTO.getClientUserId()); + stmt.setString(2, userDTO.getDmUsername()); + stmt.setInt(3, userDTO.getTenantId()); + stmt.setString(4, userDTO.getEmail()); + stmt.setString(5, userDTO.getInviteCode()); + stmt.setString(6, userDTO.getStatus()); + stmt.setLong(7, currentTime); + stmt.setLong(8, currentTime); + stmt.setString(9, userDTO.getManagedId()); + stmt.setString(10, userDTO.getTmpPassword()); + stmt.executeUpdate(); + try (ResultSet rs = stmt.getGeneratedKeys()) { + if (rs.next()) { + vppUserId = rs.getInt(1); + } + } + return vppUserId; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when adding the vpp user"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to add the vpp user."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + public VppUserDTO updateVppUser(VppUserDTO userDTO) + throws ApplicationManagementDAOException { + + String sql = "UPDATE " + + "AP_VPP_USER " + + "SET " + + "CLIENT_USER_ID = ?," + + "DM_USERNAME = ?, " + + "TENANT_ID = ?, " + + "EMAIL = ?, " + + "INVITE_CODE = ?, " + + "STATUS = ?, " + + "LAST_UPDATED_TIME = ?, " + + "MANAGED_ID = ?, " + + "TEMP_PASSWORD = ? " + + "WHERE ID = ?"; + try { + Connection conn = this.getDBConnection(); + long updatedTime = System.currentTimeMillis(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setString(1, userDTO.getClientUserId()); + stmt.setString(2, userDTO.getDmUsername()); + stmt.setInt(3, userDTO.getTenantId()); + stmt.setString(4, userDTO.getEmail()); + stmt.setString(5, userDTO.getInviteCode()); + stmt.setString(6, userDTO.getStatus()); + stmt.setLong(7, updatedTime); + stmt.setString(8, userDTO.getManagedId()); + stmt.setString(9, userDTO.getTmpPassword()); + stmt.setInt(10, userDTO.getId()); + stmt.executeUpdate(); + if (stmt.executeUpdate() == 1) { + return userDTO; + } + return null; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when updating the vpp user"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to updating the vpp user."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + public VppUserDTO getUserByDMUsername(String emmUsername) + throws ApplicationManagementDAOException { + String sql = "SELECT " + + "ID, " + + "CLIENT_USER_ID, " + + "TENANT_ID, " + + "EMAIL, " + + "INVITE_CODE, " + + "STATUS, " + + "CREATED_TIME, " + + "LAST_UPDATED_TIME, " + + "MANAGED_ID, " + + "TEMP_PASSWORD " + + "FROM AP_VPP_USER " + + "WHERE DM_USERNAME = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setString(1, emmUsername); + try (ResultSet rs = stmt.executeQuery()) { + return DAOUtil.loadVppUser(rs); + } + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when retrieving vpp user by EMM Username."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to retrieve vpp user by EMM Username."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (UnexpectedServerErrorException e) { + String msg = "Found more than one user for: " + emmUsername; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/OracleVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/OracleVppApplicationDAOImpl.java new file mode 100644 index 0000000000..fd5f5cc9d3 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/OracleVppApplicationDAOImpl.java @@ -0,0 +1,64 @@ +package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; + +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.sql.*; + +public class OracleVppApplicationDAOImpl extends GenericVppApplicationDAOImpl { + + private static final Log log = LogFactory.getLog(GenericVppApplicationDAOImpl.class); + + @Override + public int addVppUser(VppUserDTO userDTO) + throws ApplicationManagementDAOException { + int vppUserId = -1; + String sql = "INSERT INTO " + + "AP_VPP_USER(" + + "CLIENT_USER_ID, " + + "DM_USERNAME, " + + "TENANT_ID, " + + "EMAIL, " + + "INVITE_CODE, " + + "STATUS," + + "CREATED_TIME," + + "LAST_UPDATED_TIME," + + "MANAGED_ID," + + "TEMP_PASSWORD) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql, new String[] {"ID"})) { + long currentTime = System.currentTimeMillis(); + stmt.setString(1, userDTO.getClientUserId()); + stmt.setString(2, userDTO.getDmUsername()); + stmt.setInt(3, userDTO.getTenantId()); + stmt.setString(4, userDTO.getEmail()); + stmt.setString(5, userDTO.getInviteCode()); + stmt.setString(6, userDTO.getStatus()); + stmt.setLong(7, currentTime); + stmt.setLong(8, currentTime); + stmt.setString(9, userDTO.getManagedId()); + stmt.setString(10, userDTO.getTmpPassword()); + stmt.executeUpdate(); + try (ResultSet rs = stmt.getGeneratedKeys()) { + if (rs.next()) { + vppUserId = rs.getInt(1); + } + } + return vppUserId; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when adding the vpp user"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to add the vpp user."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/PostgreSQLVppApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/PostgreSQLVppApplicationDAO.java new file mode 100644 index 0000000000..7dd20ff6f4 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/PostgreSQLVppApplicationDAO.java @@ -0,0 +1,63 @@ +package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; + +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.sql.*; + +public class PostgreSQLVppApplicationDAO extends GenericVppApplicationDAOImpl { + + private static final Log log = LogFactory.getLog(GenericVppApplicationDAOImpl.class); + + public int addVppUser(VppUserDTO userDTO) + throws ApplicationManagementDAOException { + int vppUserId = -1; + String sql = "INSERT INTO " + + "AP_VPP_USER(" + + "CLIENT_USER_ID, " + + "DM_USERNAME, " + + "TENANT_ID, " + + "EMAIL, " + + "INVITE_CODE, " + + "STATUS," + + "CREATED_TIME," + + "LAST_UPDATED_TIME," + + "MANAGED_ID," + + "TEMP_PASSWORD) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql, new String[]{"ID"})) { + long currentTime = System.currentTimeMillis(); + stmt.setString(1, userDTO.getClientUserId()); + stmt.setString(2, userDTO.getDmUsername()); + stmt.setInt(3, userDTO.getTenantId()); + stmt.setString(4, userDTO.getEmail()); + stmt.setString(5, userDTO.getInviteCode()); + stmt.setString(6, userDTO.getStatus()); + stmt.setLong(7, currentTime); + stmt.setLong(8, currentTime); + stmt.setString(9, userDTO.getManagedId()); + stmt.setString(10, userDTO.getTmpPassword()); + stmt.executeUpdate(); + try (ResultSet rs = stmt.getGeneratedKeys()) { + if (rs.next()) { + vppUserId = rs.getInt(1); + } + } + return vppUserId; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when adding the vpp user"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to add the vpp user."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/SQLServerVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/SQLServerVppApplicationDAOImpl.java new file mode 100644 index 0000000000..dc110b03f4 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/SQLServerVppApplicationDAOImpl.java @@ -0,0 +1,4 @@ +package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; + +public class SQLServerVppApplicationDAOImpl extends GenericVppApplicationDAOImpl { +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index 6ec3023def..011a2e3868 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -24,6 +24,8 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.common.exception.TransactionManagementException; import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserRequestWrapper; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; @@ -32,9 +34,12 @@ import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserResp import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.VppApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; +import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.VppHttpUtil; import org.apache.commons.logging.Log; @@ -56,6 +61,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { private SPApplicationDAO spApplicationDAO; private VisibilityDAO visibilityDAO; private final LifecycleStateManager lifecycleStateManager; + private VppApplicationDAO vppApplicationDAO; public VppApplicationManagerImpl() { initDataAccessObjects(); @@ -66,6 +72,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { this.applicationDAO = ApplicationManagementDAOFactory.getApplicationDAO(); this.visibilityDAO = ApplicationManagementDAOFactory.getVisibilityDAO(); this.spApplicationDAO = ApplicationManagementDAOFactory.getSPApplicationDAO(); + this.vppApplicationDAO = ApplicationManagementDAOFactory.getVppApplicationDAO(); } @Override @@ -96,10 +103,30 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { .getInviteCode()); userDTO.setStatus(vppItuneUserResponseWrapper.getUser().get(0).getStatus()); log.error("userDTO " + userDTO.toString()); - // TODO: Save the userDTO in the DAO - - - return userDTO; + try { + ConnectionManagerUtil.beginDBTransaction(); + if (vppApplicationDAO.addVppUser(userDTO) != -1) { + ConnectionManagerUtil.commitDBTransaction(); + return userDTO; + } + ConnectionManagerUtil.rollbackDBTransaction(); + return null; + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while adding the Vpp User."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while executing database transaction for adding Vpp User."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while retrieving the database connection for adding Vpp User."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } } } @@ -113,8 +140,20 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { @Override public VppUserDTO getUserByDMUsername(String emmUsername) throws ApplicationManagementException { - // TODO: Return from DAO in a tenanted manner - return null; + try { + ConnectionManagerUtil.openDBConnection(); + return vppApplicationDAO.getUserByDMUsername(emmUsername); + } catch (DBConnectionException e) { + String msg = "DB Connection error occurs while getting vpp User data related to EMM user " + emmUsername + "."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + String msg = "Error occurred while getting vpp User data related to EMM user " + emmUsername + "."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } } @Override @@ -131,12 +170,35 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.EVENT_ID)) { log.error("userDTO " + userDTO.toString()); - // TODO: Save the userDTO in the DAO - + try { + ConnectionManagerUtil.beginDBTransaction(); + if (vppApplicationDAO.updateVppUser(userDTO) == null) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Unable to update the Vpp user " +userDTO.getId(); + log.error(msg); + throw new ApplicationManagementException(msg); + } + ConnectionManagerUtil.commitDBTransaction(); + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while updating the Vpp User."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while executing database transaction for Vpp User update."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while retrieving the database connection for Vpp User update."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } } } catch (IOException e) { - String msg = "Error while callng VPP backend to update"; + String msg = "Error while calling VPP backend to update"; log.error(msg, e); throw new ApplicationManagementException(msg, e); } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index 1960230759..89b5ac01ca 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -32,6 +32,7 @@ import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDT import io.entgra.device.mgt.core.application.mgt.common.dto.DeviceSubscriptionDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import java.sql.PreparedStatement; @@ -43,6 +44,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Date; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -344,6 +346,42 @@ public class DAOUtil { return subscriptionDTOS; } + public static VppUserDTO loadVppUser(ResultSet rs) throws SQLException, UnexpectedServerErrorException { + List vppUserDTOS = loadVppUsers(rs); + if (vppUserDTOS.isEmpty()) { + return null; + } + if (vppUserDTOS.size() > 1) { + String msg = "Internal server error. Found more than one vpp user for requested emmUsername"; + log.error(msg); + throw new UnexpectedServerErrorException(msg); + } + return vppUserDTOS.get(0); + } + + public static List loadVppUsers (ResultSet rs) throws SQLException { + List vppUserDTOS = new ArrayList<>(); + while (rs.next()) { + VppUserDTO vppUserDTO = new VppUserDTO(); + vppUserDTO.setId(rs.getInt("ID")); + vppUserDTO.setClientUserId(rs.getString("CLIENT_USER_ID")); + vppUserDTO.setTenantId(rs.getInt("TENANT_ID")); + vppUserDTO.setEmail(rs.getString("EMAIL")); + vppUserDTO.setInviteCode(rs.getString("INVITE_CODE")); + vppUserDTO.setStatus(rs.getString("STATUS")); + vppUserDTO.setManagedId(rs.getString("MANAGED_ID")); + vppUserDTO.setTmpPassword(rs.getString("TEMP_PASSWORD")); + if (rs.getLong("CREATED_TIME") != 0) { + vppUserDTO.setCreatedTime(new Date(rs.getLong(("CREATED_TIME")) * 1000).toString()); + } + if (rs.getLong("LAST_UPDATED_TIME") != 0) { + vppUserDTO.setLastUpdatedTime(new Date(rs.getLong(("LAST_UPDATED_TIME")) * 1000).toString()); + } + vppUserDTOS.add(vppUserDTO); + } + return vppUserDTOS; + } + /** * Cleans up the statement and resultset after executing the query * From 665702d50447682288a329532a85fe9caec0ea64 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Wed, 28 Jun 2023 21:08:20 +0530 Subject: [PATCH 004/112] Add asset apis Fixes https://roadmap.entgra.net/issues/10178 --- .../mgt/common/dto/ItuneAppDTO.java | 95 ++++++ .../mgt/common/dto/VppAssetDTO.java | 67 ++++ .../mgt/common/dto/VppItuneAssetDTO.java | 109 +++++++ .../mgt/common/dto/VppPaginationDTO.java | 9 + .../services/VPPApplicationManager.java | 5 + .../wrapper/VppItuneAssetResponseWrapper.java | 39 +++ .../core/impl/VppApplicationManagerImpl.java | 135 +++++++- .../core/util/ApplicationManagementUtil.java | 295 +++++++++++++++++- .../application/mgt/core/util/Constants.java | 28 +- 9 files changed, 766 insertions(+), 16 deletions(-) create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ItuneAppDTO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppAssetDTO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppItuneAssetDTO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneAssetResponseWrapper.java diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ItuneAppDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ItuneAppDTO.java new file mode 100644 index 0000000000..a76a9ec12b --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ItuneAppDTO.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.dto; + +public class ItuneAppDTO { + int id; + String packageName; + String version; + String description; + String title; + String paymentMethod; + String iconURL; + String category; + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getIconURL() { + return iconURL; + } + + public void setIconURL(String iconURL) { + this.iconURL = iconURL; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getPaymentMethod() { + return paymentMethod; + } + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppAssetDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppAssetDTO.java new file mode 100644 index 0000000000..1ce0d3c3cf --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppAssetDTO.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.dto; + +public class VppAssetDTO extends VppItuneAssetDTO { + int id; + int appId; + int tenantId; + String createdTime; + String lastUpdatedTime; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getAppId() { + return appId; + } + + public void setAppId(int appId) { + this.appId = appId; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } + + public String getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(String createdTime) { + this.createdTime = createdTime; + } + + public String getLastUpdatedTime() { + return lastUpdatedTime; + } + + public void setLastUpdatedTime(String lastUpdatedTime) { + this.lastUpdatedTime = lastUpdatedTime; + } + +} \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppItuneAssetDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppItuneAssetDTO.java new file mode 100644 index 0000000000..71e9429c68 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppItuneAssetDTO.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the String LicenseString ); 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 + * String AS ISString 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.dto; + +import java.util.List; + +public class VppItuneAssetDTO { + + + String adamId; + String assignedCount; + String availableCount; + String deviceAssignable; + String pricingParam; + String productType; + String retiredCount; + String revocable; + + List supportedPlatforms; + + public List getSupportedPlatforms() { + return supportedPlatforms; + } + + public void setSupportedPlatforms(List supportedPlatforms) { + this.supportedPlatforms = supportedPlatforms; + } + + public String getAdamId() { + return adamId; + } + + public void setAdamId(String adamId) { + this.adamId = adamId; + } + + public String getAssignedCount() { + return assignedCount; + } + + public void setAssignedCount(String assignedCount) { + this.assignedCount = assignedCount; + } + + public String getAvailableCount() { + return availableCount; + } + + public void setAvailableCount(String availableCount) { + this.availableCount = availableCount; + } + + public String getDeviceAssignable() { + return deviceAssignable; + } + + public void setDeviceAssignable(String deviceAssignable) { + this.deviceAssignable = deviceAssignable; + } + + public String getPricingParam() { + return pricingParam; + } + + public void setPricingParam(String pricingParam) { + this.pricingParam = pricingParam; + } + + public String getProductType() { + return productType; + } + + public void setProductType(String productType) { + this.productType = productType; + } + + public String getRetiredCount() { + return retiredCount; + } + + public void setRetiredCount(String retiredCount) { + this.retiredCount = retiredCount; + } + + public String getRevocable() { + return revocable; + } + + public void setRevocable(String revocable) { + this.revocable = revocable; + } + + +} \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppPaginationDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppPaginationDTO.java index 32c4f12f9b..95cf054f9c 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppPaginationDTO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppPaginationDTO.java @@ -22,6 +22,7 @@ public class VppPaginationDTO { int currentPageIndex; int size; String tokenExpirationDate; + int nextPageIndex; int totalPages; String uId; String versionId; @@ -50,6 +51,14 @@ public class VppPaginationDTO { this.tokenExpirationDate = tokenExpirationDate; } + public int getNextPageIndex() { + return nextPageIndex; + } + + public void setNextPageIndex(int nextPageIndex) { + this.nextPageIndex = nextPageIndex; + } + public int getTotalPages() { return totalPages; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java index 4b08001e08..55a3ee51b8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.application.mgt.common.services; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; @@ -34,5 +35,9 @@ public interface VPPApplicationManager { void syncUsers(String clientId) throws ApplicationManagementException; + void syncAssets(int nextPageIndex) throws ApplicationManagementException; + + VppAssetDTO getAssetByAppId(String appId) throws ApplicationManagementException; + ProxyResponse callVPPBackend(String url, String payload, String accessToken, String method) throws IOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneAssetResponseWrapper.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneAssetResponseWrapper.java new file mode 100644 index 0000000000..26c45207ab --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppItuneAssetResponseWrapper.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.wrapper; + +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppPaginationDTO; + +import java.util.ArrayList; +import java.util.List; + +public class VppItuneAssetResponseWrapper extends VppPaginationDTO { + + List assets; + + public List getAssets() { + return assets; + } + + public void setAssets(List assets) { + this.assets = assets; + } + +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index 6ec3023def..37cf50a394 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -18,16 +18,18 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; -import com.google.gson.ExclusionStrategy; -import com.google.gson.FieldAttributes; import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import io.entgra.device.mgt.core.application.mgt.common.dto.ItuneAppDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserRequestWrapper; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneAssetResponseWrapper; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserRequestWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserResponseWrapper; import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; @@ -35,11 +37,13 @@ import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; +import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.VppHttpUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; @@ -50,8 +54,14 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { private static final String USER_UPDATE = APP_API + "/users/update"; private static final String USER_GET = APP_API + "/users"; private static final String TOKEN = ""; + private static final String LOOKUP_API = "https://uclient-api.itunes.apple" + + ".com/WebObjects/MZStorePlatform.woa/wa/lookup?version=2&id="; + private static final String LOOKUP_API_PREFIX = + "&p=mdm-lockup&caller=MDM&platform=enterprisestore&cc=us&l=en"; + private static final Log log = LogFactory.getLog(VppApplicationManagerImpl.class); + private ApplicationDAO applicationDAO; private SPApplicationDAO spApplicationDAO; private VisibilityDAO visibilityDAO; @@ -154,6 +164,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { Gson gson = new Gson(); VppItuneUserResponseWrapper vppUserResponseWrapper = gson.fromJson (proxyResponse.getData(), VppItuneUserResponseWrapper.class); + // TODO: to implement later } } catch (IOException e) { String msg = "Error while syncing VPP users with backend"; @@ -163,6 +174,122 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { } + @Override + public void syncAssets(int nextPageIndex) throws ApplicationManagementException { + ProxyResponse proxyResponse = null; + try { + String url = ASSETS; + if (nextPageIndex > 0) { // Not the first page + url += "?pageIndex=" + nextPageIndex; + } + proxyResponse = callVPPBackend(url, null, TOKEN, Constants.VPP.GET); + if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == + HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.TOTAL_PAGES)) { + Gson gson = new Gson(); + VppItuneAssetResponseWrapper vppItuneAssetResponse = gson.fromJson + (proxyResponse.getData(), VppItuneAssetResponseWrapper.class); + if (vppItuneAssetResponse.getSize() > 0) { + for (VppAssetDTO vppAssetDTO : vppItuneAssetResponse.getAssets()) { + vppAssetDTO.setTenantId(PrivilegedCarbonContext + .getThreadLocalCarbonContext().getTenantId()); + vppAssetDTO.setCreatedTime(String.valueOf(System.currentTimeMillis())); + vppAssetDTO.setLastUpdatedTime(String.valueOf(System.currentTimeMillis())); + } + + for (VppAssetDTO vppAssetDTO : vppItuneAssetResponse.getAssets()) { + ItuneAppDTO ituneAppDTO = lookupAsset(vppAssetDTO.getAdamId()); + ApplicationManagementUtil.persistApp(ituneAppDTO); + } + + // TODO: Store/update vppItuneAssetResponse.getAssets() in the DB + + // TODO: END of DAO access + + } + + + if (vppItuneAssetResponse.getCurrentPageIndex() == (vppItuneAssetResponse + .getTotalPages() - 1)) { + return; + } else { + syncAssets(vppItuneAssetResponse.getNextPageIndex()); + } + } + } catch (IOException e) { + String msg = "Error while syncing VPP users with backend"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + + + } + + private ItuneAppDTO lookupAsset(String packageName) throws ApplicationManagementException { + String lookupURL = LOOKUP_API + packageName + LOOKUP_API_PREFIX; + try { + ProxyResponse proxyResponse = callVPPBackend(lookupURL, null, TOKEN, Constants.VPP.GET); + if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == + HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.GET_APP_DATA_RESPONSE_START)) { + String responseData = proxyResponse.getData(); + JsonObject responseJson = new JsonParser().parse(responseData) + .getAsJsonObject(); + + JsonObject results = responseJson.getAsJsonObject(Constants.ApplicationProperties.RESULTS); + JsonObject result = results.getAsJsonObject(packageName); + + String iconUrl = result.getAsJsonObject(Constants.ApplicationProperties.ARTWORK) + .get(Constants.ApplicationProperties.URL).getAsString(); + int lastSlashIndex = iconUrl.lastIndexOf("/"); + if (lastSlashIndex != -1) { + iconUrl = iconUrl.substring(0, lastSlashIndex + 1) + Constants.VPP.REMOTE_FILE_NAME; + } + + String descriptionStandard = result.getAsJsonObject(Constants.ApplicationProperties.DESCRIPTION) + .get(Constants.ApplicationProperties.STANDARD).getAsString(); + if (descriptionStandard != null && !descriptionStandard.isEmpty()) { + descriptionStandard = descriptionStandard.substring(0, 199); + } + String name = result.get(Constants.ApplicationProperties.NAME).getAsString(); + double price = result.getAsJsonArray(Constants.ApplicationProperties.OFFERS).get(0) + .getAsJsonObject().get(Constants.ApplicationProperties.PRICE).getAsDouble(); + String version = result.getAsJsonArray(Constants.ApplicationProperties.OFFERS) + .get(0).getAsJsonObject().get(Constants.ApplicationProperties.VERSION) + .getAsJsonObject().get(Constants.ApplicationProperties.DISPLAY).getAsString(); + + String[] genreNames = new Gson().fromJson(result.getAsJsonArray(Constants.ApplicationProperties.GENRE_NAMES), + String[].class); + + ItuneAppDTO ituneAppDTO = new ItuneAppDTO(); + ituneAppDTO.setPackageName(packageName); + ituneAppDTO.setVersion(version); + ituneAppDTO.setDescription(descriptionStandard); + ituneAppDTO.setTitle(name); + + if (Constants.ApplicationProperties.PRICE_ZERO.equalsIgnoreCase(String.valueOf(price))) { + ituneAppDTO.setPaymentMethod(Constants.ApplicationProperties.FREE_SUB_METHOD); + } else { + ituneAppDTO.setPaymentMethod(Constants.ApplicationProperties.PAID_SUB_METHOD); + } + ituneAppDTO.setIconURL(iconUrl); + ituneAppDTO.setCategory(genreNames[0]); + + return ituneAppDTO; + } + } catch (IOException e) { + String msg = "Error while looking up the app details"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + return null; + } + + + public VppAssetDTO getAssetByAppId(String appId) throws ApplicationManagementException { + // App ID is the app id of the App management database + VppAssetDTO assetDTO = null; // TODO: load from the DB + return assetDTO; + } + @Override public ProxyResponse callVPPBackend(String url, String payload, diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index 55bf0b1a72..8ae9a580f4 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -18,15 +18,21 @@ package io.entgra.device.mgt.core.application.mgt.core.util; import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact; -import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; -import io.entgra.device.mgt.core.application.mgt.core.config.Extension; -import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.application.mgt.common.FileDataHolder; +import io.entgra.device.mgt.core.application.mgt.common.LifecycleChanger; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.ItuneAppDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; +import io.entgra.device.mgt.core.application.mgt.common.exception.InvalidConfigurationException; import io.entgra.device.mgt.core.application.mgt.common.exception.RequestValidatingException; +import io.entgra.device.mgt.core.application.mgt.common.response.Application; +import io.entgra.device.mgt.core.application.mgt.common.response.Category; +import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; +import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; +import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; +import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationUpdateWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppReleaseWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppWrapper; @@ -35,18 +41,31 @@ import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppRelease import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppReleaseWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; +import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; +import io.entgra.device.mgt.core.application.mgt.core.config.Extension; +import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; +import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; +import io.entgra.device.mgt.core.device.mgt.common.Base64File; +import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.core.common.util.FileUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.exception.InvalidConfigurationException; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; -import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; -import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; -import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; -import io.entgra.device.mgt.core.device.mgt.core.common.util.FileUtil; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Base64; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -247,4 +266,258 @@ public class ApplicationManagementUtil { throw new InvalidConfigurationException(msg, e); } } + + public static void persistApp(ItuneAppDTO product) throws ApplicationManagementException { + ApplicationManager applicationManager = APIUtil.getApplicationManager(); + List categories = applicationManager.getRegisteredCategories(); + if (product != null && product.getVersion() != null) { + // Generate artifacts + ApplicationArtifact applicationArtifact = generateArtifacts(product); + + List packageNamesOfApps = new ArrayList<>(); + packageNamesOfApps.add(product.getPackageName()); + + List existingApps = applicationManager.getApplications(packageNamesOfApps); + + if (existingApps != null && existingApps.size() > 0) { + Application app = existingApps.get(0); + if (product.getPackageName().equals(app.getPackageName())) { + ApplicationUpdateWrapper applicationUpdateWrapper = generatePubAppUpdateWrapper(product, categories); + applicationManager.updateApplication(app.getId(), applicationUpdateWrapper); + + PublicAppReleaseWrapper publicAppReleaseWrapper = new PublicAppReleaseWrapper(); + if (app.getSubMethod() + .equalsIgnoreCase(Constants.ApplicationProperties.FREE_SUB_METHOD)) { + publicAppReleaseWrapper.setPrice(0.0); + } else { + publicAppReleaseWrapper.setPrice(1.0); + } + + publicAppReleaseWrapper.setDescription(product.getDescription()); + publicAppReleaseWrapper.setReleaseType("ga"); + publicAppReleaseWrapper.setVersion(product.getVersion()); + publicAppReleaseWrapper.setSupportedOsVersions("4.0-12.3"); + applicationManager.updatePubAppRelease(app.getApplicationReleases().get(0).getUuid(), + publicAppReleaseWrapper, applicationArtifact); + return; + } + } else { + + // Generate App wrapper + PublicAppWrapper publicAppWrapper = generatePubAppWrapper(product, categories); + PublicAppReleaseWrapper appReleaseWrapper = new PublicAppReleaseWrapper(); + + if (publicAppWrapper.getSubMethod() + .equalsIgnoreCase(Constants.ApplicationProperties.FREE_SUB_METHOD)) { + appReleaseWrapper.setPrice(0.0); + } else { + appReleaseWrapper.setPrice(1.0); + } + + appReleaseWrapper.setDescription(product.getDescription()); + appReleaseWrapper.setReleaseType("ga"); + appReleaseWrapper.setVersion(product.getVersion()); + appReleaseWrapper.setPackageName(product.getPackageName()); + appReleaseWrapper.setSupportedOsVersions("4.0-12.3"); + + publicAppWrapper.setPublicAppReleaseWrappers( + Arrays.asList(new PublicAppReleaseWrapper[]{appReleaseWrapper})); + + try { + updateImages(appReleaseWrapper, applicationArtifact.getIconName(), + applicationArtifact.getIconStream(), applicationArtifact.getScreenshots()); + + Application application = applicationManager.createApplication(publicAppWrapper, false); + if (application != null && (application.getApplicationReleases().get(0).getCurrentStatus() == null + || application.getApplicationReleases().get(0).getCurrentStatus().equals("CREATED"))) { + String uuid = application.getApplicationReleases().get(0).getUuid(); + LifecycleChanger lifecycleChanger = new LifecycleChanger(); + lifecycleChanger.setAction("IN-REVIEW"); + applicationManager.changeLifecycleState(uuid, lifecycleChanger); + lifecycleChanger.setAction("APPROVED"); + applicationManager.changeLifecycleState(uuid, lifecycleChanger); + lifecycleChanger.setAction("PUBLISHED"); + applicationManager.changeLifecycleState(uuid, lifecycleChanger); + } + } catch (IOException e) { + String msg = "Error while downloading images of release."; + log.error(msg); + throw new ApplicationManagementException(msg, e); + } + } + } + } + + private static PublicAppWrapper generatePubAppWrapper(ItuneAppDTO product, List categories) { + PublicAppWrapper publicAppWrapper = new PublicAppWrapper(); + publicAppWrapper.setName(product.getTitle()); + publicAppWrapper.setDescription(product.getDescription()); + publicAppWrapper.setCategories( + Collections.singletonList(Constants.ApplicationProperties.APPLE_STORE_SYNCED_APP_CATEGORY));//Default category + for (Category category : categories) { + if (product.getCategory() == null) { + List pubAppCategories = new ArrayList<>(); + pubAppCategories.add(Constants.ApplicationProperties.APPLE_STORE_SYNCED_APP_CATEGORY); + publicAppWrapper.setCategories(pubAppCategories); + break; + } else if (product.getCategory().equalsIgnoreCase(category.getCategoryName())) { + List pubAppCategories = new ArrayList<>(); + pubAppCategories.add(category.getCategoryName()); + pubAppCategories.add(Constants.ApplicationProperties.APPLE_STORE_SYNCED_APP_CATEGORY); + publicAppWrapper.setCategories(pubAppCategories); + break; + } + } + if (product.getPaymentMethod().equalsIgnoreCase(Constants.ApplicationProperties.FREE_SUB_METHOD)) { + publicAppWrapper.setSubMethod(Constants.ApplicationProperties.FREE_SUB_METHOD); + } else { + publicAppWrapper.setSubMethod(Constants.ApplicationProperties.PAID_SUB_METHOD); + } + // TODO: purchase an app from app store and see how to capture the real value for price + // field. + publicAppWrapper.setPaymentCurrency("$"); + publicAppWrapper.setDeviceType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); + return publicAppWrapper; + } + + private static ApplicationUpdateWrapper generatePubAppUpdateWrapper(ItuneAppDTO product, List categories) { + ApplicationUpdateWrapper applicationUpdateWrapper = new ApplicationUpdateWrapper(); + applicationUpdateWrapper.setName(product.getTitle()); + applicationUpdateWrapper.setDescription(product.getDescription()); + applicationUpdateWrapper.setCategories( + Collections.singletonList(Constants + .ApplicationProperties.APPLE_STORE_SYNCED_APP_CATEGORY));//Default + // add the default APPLE_STORE_SYNCED_APP_CATEGORY + for (Category category : categories) { + if (product.getCategory() == null) { + List pubAppCategories = new ArrayList<>(); + pubAppCategories.add(Constants.ApplicationProperties.APPLE_STORE_SYNCED_APP_CATEGORY); + applicationUpdateWrapper.setCategories(pubAppCategories); + break; + } else if (product.getCategory().equalsIgnoreCase(category.getCategoryName())) { + List pubAppCategories = new ArrayList<>(); + pubAppCategories.add(category.getCategoryName()); + pubAppCategories.add(Constants.ApplicationProperties.APPLE_STORE_SYNCED_APP_CATEGORY); + applicationUpdateWrapper.setCategories(pubAppCategories); + break; + } + } + if (product.getPaymentMethod().equalsIgnoreCase(Constants.ApplicationProperties.FREE_SUB_METHOD)) { + applicationUpdateWrapper.setSubMethod(Constants.ApplicationProperties.FREE_SUB_METHOD); + } else { + applicationUpdateWrapper.setSubMethod(Constants.ApplicationProperties.PAID_SUB_METHOD); + } + // TODO: purchase an app from Playstore and see how to capture the real value for price field. + applicationUpdateWrapper.setPaymentCurrency("$"); + return applicationUpdateWrapper; + } + + private static ApplicationArtifact generateArtifacts(ItuneAppDTO product) throws ApplicationManagementException { + ApplicationArtifact applicationArtifact = new ApplicationArtifact(); + String prefix = product.getPackageName(); + try { + String iconName = prefix + "_icon"; + applicationArtifact.setIconName(iconName); + InputStream iconInputStream = getInputStream(iconName, product.getIconURL()); + applicationArtifact.setIconStream(iconInputStream); + Map screenshotMap = new HashMap<>(); + // TODO: look for a way to get screenshots + + for (int a = 0; a < 3; a++) { + String screenshotName = product.getPackageName() + a; + InputStream screenshotInputStream = getInputStream(screenshotName, product.getIconURL()); + screenshotMap.put(screenshotName, screenshotInputStream); + } + + applicationArtifact.setScreenshots(screenshotMap); + return applicationArtifact; + } catch (ApplicationManagementException e) { + String msg = "Error occurred while generating Application artifact"; + log.error(msg); + throw new ApplicationManagementException(msg, e); + } + } + + private static InputStream getInputStream(String filename, String url) throws ApplicationManagementException { + URL website; + try { + website = new URL(url); + } catch (MalformedURLException e) { + String msg = "Error occurred while converting the url " + url; + log.error(msg); + throw new ApplicationManagementException(msg, e); + } + ReadableByteChannel rbc = null; + FileOutputStream fos = null; + try { + rbc = Channels.newChannel(website.openStream()); + fos = new FileOutputStream(System.getProperty("java.io.tmpdir") + + File.separator + filename); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + } catch (IOException e) { + String msg = "Error occurred while opening stream for url " + url; + log.error(msg); + throw new ApplicationManagementException(msg, e); + } finally { + try { + fos.close(); + rbc.close(); + } catch (IOException e) { + } + } + + File file = new File(System.getProperty("java.io.tmpdir") + File.separator + filename); + InputStream targetStream; + try { + targetStream = new FileInputStream(file); + } catch (FileNotFoundException e) { + String msg = "Error occurred while reading the tmp file " + System.getProperty("java.io.tmpdir") + + File.separator + filename; + log.error(msg); + throw new ApplicationManagementException(msg, e); + } + file.deleteOnExit(); + return targetStream; + } + + private static void updateImages(PublicAppReleaseWrapper appReleaseWrapper, String iconName, + InputStream iconStream, Map + screenshotsMaps) throws IOException { + List screenshots = new ArrayList<>(); + Base64File iconFile = new Base64File(iconName, + convertStreamToBase64(iconStream)); + appReleaseWrapper.setIcon(iconFile); + if (screenshotsMaps.size() > 0) { + for (Map.Entry screenshotEntry : screenshotsMaps.entrySet()) { + Base64File screenshot = new Base64File(screenshotEntry.getKey(), + convertStreamToBase64(screenshotEntry.getValue())); + screenshots.add(screenshot); + } + appReleaseWrapper.setScreenshots(screenshots); + } + } + + private static String convertStreamToBase64(InputStream inputStream) throws IOException { + final int bufLen = 4 * 0x400; // 4KB + byte[] buf = new byte[bufLen]; + int readLen; + + try { + try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { + while ((readLen = inputStream.read(buf, 0, bufLen)) != -1) + outputStream.write(buf, 0, readLen); + + return Base64.getEncoder().encodeToString(outputStream.toByteArray()); + } + } catch (IOException e) { + String msg = "Error while converting image to base64"; + log.error(msg); + throw e; + } finally { + try { + inputStream.close(); + } catch (IOException e) { + } + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java index ce61c1a81b..7b804e7fa8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java @@ -109,10 +109,11 @@ public class Constants { public static final String POST = "POST"; public static final String PUT = "PUT"; public static final String DELETE = "DELETE"; - public static final String CLIENT_USER_ID = "clientUserId"; public static final String EVENT_ID = "eventId"; public static final String CLIENT_USER_ID_PARAM = "?clientUserId="; public static final String TOTAL_PAGES = "totalPages"; + public static final String GET_APP_DATA_RESPONSE_START = "results"; + public static final String REMOTE_FILE_NAME = "512x512w.png"; private VPP() { } @@ -182,4 +183,29 @@ public class Constants { public static final String AUTHORIZATION = "Authorization"; public static final String AUTHORIZATION_HEADER_VALUE = "Bearer "; } + + public final class ApplicationProperties { + private ApplicationProperties() { + throw new AssertionError(); + } + + public static final String NAME = "name"; + public static final String VERSION = "version"; + public static final String FREE_SUB_METHOD = "FREE"; + public static final String PAID_SUB_METHOD = "PAID"; + public static final String TYPE = "type";; + public static final String PACKAGE_NAME = "packageName"; + public static final String APPLE_STORE_SYNCED_APP_CATEGORY = "APPLE_STORE_SYNCED_APP"; + + public static final String RESULTS = "results"; + public static final String ARTWORK = "artwork"; + public static final String URL = "url"; + public static final String DESCRIPTION = "description"; + public static final String STANDARD = "standard"; + public static final String OFFERS = "offers"; + public static final String PRICE = "price"; + public static final String DISPLAY = "display"; + public static final String GENRE_NAMES = "genreNames"; + public static final String PRICE_ZERO = "0.0"; + } } From 2e799a545feb33dfd4618f38e9d5ed31e53cd615 Mon Sep 17 00:00:00 2001 From: osh Date: Wed, 28 Jun 2023 21:43:06 +0530 Subject: [PATCH 005/112] Resolve comments --- .../mgt/core/dao/VppApplicationDAO.java | 24 ++++++++++++-- .../vpp/GenericVppApplicationDAOImpl.java | 31 +++++++++++++++---- .../impl/vpp/OracleVppApplicationDAOImpl.java | 22 +++++++++++-- .../impl/vpp/PostgreSQLVppApplicationDAO.java | 22 +++++++++++-- .../vpp/SQLServerVppApplicationDAOImpl.java | 18 +++++++++++ .../core/impl/VppApplicationManagerImpl.java | 12 +++++-- 6 files changed, 113 insertions(+), 16 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java index ae2b75e515..6ebec3f0e7 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + package io.entgra.device.mgt.core.application.mgt.core.dao; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; @@ -6,9 +24,9 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManag public interface VppApplicationDAO { - int addVppUser(VppUserDTO userDTO) throws ApplicationManagementDAOException; + int addVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException; - VppUserDTO updateVppUser(VppUserDTO userDTO) throws ApplicationManagementDAOException; + VppUserDTO updateVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException; - VppUserDTO getUserByDMUsername(String emmUsername) throws ApplicationManagementDAOException; + VppUserDTO getUserByDMUsername(String emmUsername, int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index 3dc356b764..2bafc338f3 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; @@ -16,7 +34,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp private static final Log log = LogFactory.getLog(GenericVppApplicationDAOImpl.class); @Override - public int addVppUser(VppUserDTO userDTO) + public int addVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException { int vppUserId = -1; String sql = "INSERT INTO " @@ -38,7 +56,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp long currentTime = System.currentTimeMillis(); stmt.setString(1, userDTO.getClientUserId()); stmt.setString(2, userDTO.getDmUsername()); - stmt.setInt(3, userDTO.getTenantId()); + stmt.setInt(3, tenantId); stmt.setString(4, userDTO.getEmail()); stmt.setString(5, userDTO.getInviteCode()); stmt.setString(6, userDTO.getStatus()); @@ -65,7 +83,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp } } - public VppUserDTO updateVppUser(VppUserDTO userDTO) + public VppUserDTO updateVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException { String sql = "UPDATE " @@ -87,7 +105,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setString(1, userDTO.getClientUserId()); stmt.setString(2, userDTO.getDmUsername()); - stmt.setInt(3, userDTO.getTenantId()); + stmt.setInt(3, tenantId); stmt.setString(4, userDTO.getEmail()); stmt.setString(5, userDTO.getInviteCode()); stmt.setString(6, userDTO.getStatus()); @@ -112,7 +130,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp } } - public VppUserDTO getUserByDMUsername(String emmUsername) + public VppUserDTO getUserByDMUsername(String emmUsername, int tenantId) throws ApplicationManagementDAOException { String sql = "SELECT " + "ID, " @@ -126,11 +144,12 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp + "MANAGED_ID, " + "TEMP_PASSWORD " + "FROM AP_VPP_USER " - + "WHERE DM_USERNAME = ?"; + + "WHERE DM_USERNAME = ? AND TENANT_ID = ?"; try { Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setString(1, emmUsername); + stmt.setInt(2, tenantId); try (ResultSet rs = stmt.executeQuery()) { return DAOUtil.loadVppUser(rs); } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/OracleVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/OracleVppApplicationDAOImpl.java index fd5f5cc9d3..480f18006e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/OracleVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/OracleVppApplicationDAOImpl.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; @@ -13,7 +31,7 @@ public class OracleVppApplicationDAOImpl extends GenericVppApplicationDAOImpl { private static final Log log = LogFactory.getLog(GenericVppApplicationDAOImpl.class); @Override - public int addVppUser(VppUserDTO userDTO) + public int addVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException { int vppUserId = -1; String sql = "INSERT INTO " @@ -35,7 +53,7 @@ public class OracleVppApplicationDAOImpl extends GenericVppApplicationDAOImpl { long currentTime = System.currentTimeMillis(); stmt.setString(1, userDTO.getClientUserId()); stmt.setString(2, userDTO.getDmUsername()); - stmt.setInt(3, userDTO.getTenantId()); + stmt.setInt(3, tenantId); stmt.setString(4, userDTO.getEmail()); stmt.setString(5, userDTO.getInviteCode()); stmt.setString(6, userDTO.getStatus()); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/PostgreSQLVppApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/PostgreSQLVppApplicationDAO.java index 7dd20ff6f4..5d9fe7a8f6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/PostgreSQLVppApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/PostgreSQLVppApplicationDAO.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; @@ -12,7 +30,7 @@ public class PostgreSQLVppApplicationDAO extends GenericVppApplicationDAOImpl { private static final Log log = LogFactory.getLog(GenericVppApplicationDAOImpl.class); - public int addVppUser(VppUserDTO userDTO) + public int addVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException { int vppUserId = -1; String sql = "INSERT INTO " @@ -34,7 +52,7 @@ public class PostgreSQLVppApplicationDAO extends GenericVppApplicationDAOImpl { long currentTime = System.currentTimeMillis(); stmt.setString(1, userDTO.getClientUserId()); stmt.setString(2, userDTO.getDmUsername()); - stmt.setInt(3, userDTO.getTenantId()); + stmt.setInt(3, tenantId); stmt.setString(4, userDTO.getEmail()); stmt.setString(5, userDTO.getInviteCode()); stmt.setString(6, userDTO.getStatus()); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/SQLServerVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/SQLServerVppApplicationDAOImpl.java index dc110b03f4..da4e4828da 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/SQLServerVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/SQLServerVppApplicationDAOImpl.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; public class SQLServerVppApplicationDAOImpl extends GenericVppApplicationDAOImpl { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index 011a2e3868..468fc17304 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -45,6 +45,7 @@ import io.entgra.device.mgt.core.application.mgt.core.util.VppHttpUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; @@ -77,6 +78,9 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { @Override public VppUserDTO addUser(VppUserDTO userDTO) throws ApplicationManagementException { + + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + // Call the API to add try { VppItuneUserDTO ituneUserDTO = userDTO; @@ -105,7 +109,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { log.error("userDTO " + userDTO.toString()); try { ConnectionManagerUtil.beginDBTransaction(); - if (vppApplicationDAO.addVppUser(userDTO) != -1) { + if (vppApplicationDAO.addVppUser(userDTO, tenantId) != -1) { ConnectionManagerUtil.commitDBTransaction(); return userDTO; } @@ -140,9 +144,10 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { @Override public VppUserDTO getUserByDMUsername(String emmUsername) throws ApplicationManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); try { ConnectionManagerUtil.openDBConnection(); - return vppApplicationDAO.getUserByDMUsername(emmUsername); + return vppApplicationDAO.getUserByDMUsername(emmUsername, tenantId); } catch (DBConnectionException e) { String msg = "DB Connection error occurs while getting vpp User data related to EMM user " + emmUsername + "."; log.error(msg, e); @@ -158,6 +163,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { @Override public void updateUser(VppUserDTO userDTO) throws ApplicationManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); VppItuneUserDTO ituneUserDTO = userDTO; VppItuneUserRequestWrapper wrapper = new VppItuneUserRequestWrapper(); wrapper.getUser().add(ituneUserDTO); @@ -173,7 +179,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { try { ConnectionManagerUtil.beginDBTransaction(); - if (vppApplicationDAO.updateVppUser(userDTO) == null) { + if (vppApplicationDAO.updateVppUser(userDTO, tenantId) == null) { ConnectionManagerUtil.rollbackDBTransaction(); String msg = "Unable to update the Vpp user " +userDTO.getId(); log.error(msg); From 54111b4d94da207ae3fe6619aad2917799bdf847 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Fri, 30 Jun 2023 13:32:47 +0530 Subject: [PATCH 006/112] Add association apis fixes https://roadmap.entgra.net/issues/10182 --- .../mgt/common/dto/VppAssociationDTO.java | 113 ++++++++++++++++++ .../mgt/common/response/Application.java | 14 +++ .../services/VPPApplicationManager.java | 4 + .../wrapper/VppAssociateRequestWrapper.java | 47 ++++++++ .../core/impl/SubscriptionManagerImpl.java | 53 ++++++++ .../core/impl/VppApplicationManagerImpl.java | 59 ++++++++- ...ApplicationManagementServiceComponent.java | 19 ++- .../application/mgt/core/util/APIUtil.java | 30 ++++- .../core/util/ApplicationManagementUtil.java | 7 ++ .../application/mgt/core/util/Constants.java | 3 + .../mgt/core/util/VppHttpUtil.java | 20 ++++ 11 files changed, 355 insertions(+), 14 deletions(-) create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppAssociationDTO.java create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppAssociateRequestWrapper.java diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppAssociationDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppAssociationDTO.java new file mode 100644 index 0000000000..b2178febfa --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/VppAssociationDTO.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.dto; + +public class VppAssociationDTO { + int id; + String adamId; + String clientUserId; + String pricingParam; + String associationType; + + int assetId; + int clientId; + int tenantId; + String createdTime; + String lastUpdatedTime; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getAdamId() { + return adamId; + } + + public void setAdamId(String adamId) { + this.adamId = adamId; + } + + public String getClientUserId() { + return clientUserId; + } + + public void setClientUserId(String clientUserId) { + this.clientUserId = clientUserId; + } + + public String getPricingParam() { + return pricingParam; + } + + public void setPricingParam(String pricingParam) { + this.pricingParam = pricingParam; + } + + public String getAssociationType() { + return associationType; + } + + public void setAssociationType(String associationType) { + this.associationType = associationType; + } + + public int getAssetId() { + return assetId; + } + + public void setAssetId(int assetId) { + this.assetId = assetId; + } + + public int getClientId() { + return clientId; + } + + public void setClientId(int clientId) { + this.clientId = clientId; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } + + public String getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(String createdTime) { + this.createdTime = createdTime; + } + + public String getLastUpdatedTime() { + return lastUpdatedTime; + } + + public void setLastUpdatedTime(String lastUpdatedTime) { + this.lastUpdatedTime = lastUpdatedTime; + } + +} \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/response/Application.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/response/Application.java index 025f352e4c..0d62a46a5b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/response/Application.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/response/Application.java @@ -108,6 +108,12 @@ public class Application { value = "if the app is favoured by the user") private boolean isFavourite; + @ApiModelProperty(name = "isExternalAppStoreApp", + value = "Is the app coming from an external application store", + required = true, + example = "true or false") + private boolean isExternalAppStoreApp; + public String getPackageName() { return packageName; } @@ -194,4 +200,12 @@ public class Application { public void setFavourite(boolean favourite) { isFavourite = favourite; } + + public boolean isExternalAppStoreApp() { + return isExternalAppStoreApp; + } + + public void setExternalAppStoreApp(boolean externalAppStoreApp) { + isExternalAppStoreApp = externalAppStoreApp; + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java index 55a3ee51b8..1113a22777 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java @@ -24,6 +24,7 @@ import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import java.io.IOException; +import java.util.List; public interface VPPApplicationManager { @@ -40,4 +41,7 @@ public interface VPPApplicationManager { VppAssetDTO getAssetByAppId(String appId) throws ApplicationManagementException; ProxyResponse callVPPBackend(String url, String payload, String accessToken, String method) throws IOException; + + boolean addAssociation(VppAssetDTO asset, List vppUsers) throws + ApplicationManagementException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppAssociateRequestWrapper.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppAssociateRequestWrapper.java new file mode 100644 index 0000000000..7cea9d52c8 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/wrapper/VppAssociateRequestWrapper.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.application.mgt.common.wrapper; + +import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; + +import java.util.ArrayList; +import java.util.List; + +public class VppAssociateRequestWrapper { + + List assets; + List clientUserIds; + + public List getAssets() { + return assets; + } + + public void setAssets(List assets) { + this.assets = assets; + } + + public List getClientUserIds() { + return clientUserIds; + } + + public void setClientUserIds(List clientUserIds) { + this.clientUserIds = clientUserIds; + } + +} \ No newline at end of file diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java index d89039dee5..bb8dd4f6f8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -19,7 +19,13 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; import com.google.gson.Gson; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; +import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; +import io.entgra.device.mgt.core.application.mgt.core.dao.VppApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; +import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; +import io.entgra.device.mgt.core.application.mgt.core.util.VppHttpUtil; import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; import io.entgra.device.mgt.core.notification.logger.AppInstallLogContext; import io.entgra.device.mgt.core.notification.logger.impl.EntgraAppInstallLoggerImpl; @@ -118,12 +124,14 @@ public class SubscriptionManagerImpl implements SubscriptionManager { private static final EntgraLogger log = new EntgraAppInstallLoggerImpl(SubscriptionManagerImpl.class); private SubscriptionDAO subscriptionDAO; private ApplicationDAO applicationDAO; + private VppApplicationDAO vppApplicationDAO; private LifecycleStateManager lifecycleStateManager; public SubscriptionManagerImpl() { this.lifecycleStateManager = DataHolder.getInstance().getLifecycleStateManager(); this.subscriptionDAO = ApplicationManagementDAOFactory.getSubscriptionDAO(); this.applicationDAO = ApplicationManagementDAOFactory.getApplicationDAO(); + this.vppApplicationDAO = ApplicationManagementDAOFactory.getVppApplicationDAO(); } @Override @@ -148,6 +156,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager { ApplicationDTO applicationDTO = getApplicationDTO(applicationUUID); ApplicationSubscriptionInfo applicationSubscriptionInfo = getAppSubscriptionInfo(applicationDTO, subType, params); + performExternalStoreSubscription(applicationDTO, applicationSubscriptionInfo); ApplicationInstallResponse applicationInstallResponse = performActionOnDevices( applicationSubscriptionInfo.getAppSupportingDeviceTypeName(), applicationSubscriptionInfo.getDevices(), applicationDTO, subType, applicationSubscriptionInfo.getSubscribers(), action, properties, isOperationReExecutingDisabled); @@ -156,6 +165,50 @@ public class SubscriptionManagerImpl implements SubscriptionManager { return applicationInstallResponse; } + private void performExternalStoreSubscription(ApplicationDTO applicationDTO, + ApplicationSubscriptionInfo + applicationSubscriptionInfo) throws ApplicationManagementException { + try { + // Only for iOS devices + if (DeviceTypes.IOS.toString().equalsIgnoreCase(APIUtil.getDeviceTypeData(applicationDTO + .getDeviceTypeId()).getName())) { + // TODO: replace getAssetByAppId with the correct one in DAO + // Check if the app trying to subscribe is a VPP asset. + VppAssetDTO storedAsset = vppApplicationDAO.getAssetByAppId(applicationDTO.getId()); + if (storedAsset != null) { // This is a VPP asset + List users = new ArrayList<>(); + List devices = applicationSubscriptionInfo.getDevices();// get + // subscribed device list, so that we can extract the users of those devices. + for (Device device : devices) { + VppUserDTO user = vppApplicationDAO.getUserByDMUsername(device.getEnrolmentInfo() + .getOwner(), PrivilegedCarbonContext.getThreadLocalCarbonContext() + .getTenantId(true)); + users.add(user); + } + VPPApplicationManager vppManager = APIUtil.getVPPManager(); + vppManager.addAssociation(storedAsset, users); + } + } + } catch (BadRequestException e) { + String msg = "Device Type not found"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (UnexpectedServerErrorException e) { + String msg = "Unexpected error while getting device type"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + String msg = "Error while getting the device user"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementException e) { + String msg = "Error while associating user"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + + } + @Override public void createScheduledSubscription(ScheduledSubscriptionDTO subscriptionDTO) throws SubscriptionManagementException { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index 15ec5e3a15..52f4a30dc2 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -24,13 +24,15 @@ import com.google.gson.JsonParser; import io.entgra.device.mgt.core.application.mgt.common.dto.ItuneAppDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssociationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneAssetDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; -import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; -import io.entgra.device.mgt.core.application.mgt.common.exception.TransactionManagementException; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserRequestWrapper; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; +import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.common.exception.TransactionManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppAssociateRequestWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneAssetResponseWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserRequestWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserResponseWrapper; @@ -52,6 +54,8 @@ import org.apache.http.HttpStatus; import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; public class VppApplicationManagerImpl implements VPPApplicationManager { private static final String APP_API = "https://vpp.itunes.apple.com/mdm/v2"; @@ -59,6 +63,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { private static final String USER_CREATE = APP_API + "/users/create"; private static final String USER_UPDATE = APP_API + "/users/update"; private static final String USER_GET = APP_API + "/users"; + private static final String ASSIGNMENTS_POST = APP_API + "/assets/associate"; private static final String TOKEN = ""; private static final String LOOKUP_API = "https://uclient-api.itunes.apple" + ".com/WebObjects/MZStorePlatform.woa/wa/lookup?version=2&id="; @@ -267,6 +272,8 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { for (VppAssetDTO vppAssetDTO : vppItuneAssetResponse.getAssets()) { ItuneAppDTO ituneAppDTO = lookupAsset(vppAssetDTO.getAdamId()); ApplicationManagementUtil.persistApp(ituneAppDTO); + + } // TODO: Store/update vppItuneAssetResponse.getAssets() in the DB @@ -366,4 +373,50 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { return VppHttpUtil.execute(url, payload, accessToken, method); } + public boolean addAssociation(VppAssetDTO asset, List vppUsers) throws + ApplicationManagementException { + + List associations = new ArrayList<>(); // To save to UEM DBs + List clientUserIds = new ArrayList<>(); // Need this to send to vpp backend. + if (asset != null) { + for (VppUserDTO vppUserDTO : vppUsers) { + VppAssociationDTO associationDTO = VppHttpUtil.getAssociation(vppUserDTO, asset); + associations.add(associationDTO); + clientUserIds.add(vppUserDTO.getClientUserId()); + } + + if (associations.size() > 0) { + //TODO: Add or Update associations + try { + + // Create the VPP backend payload + List assets = new ArrayList<>(); + VppItuneAssetDTO assetDTO = new VppItuneAssetDTO(); + assetDTO.setAdamId(asset.getAdamId()); + assetDTO.setPricingParam(asset.getPricingParam()); + assets.add(assetDTO); + + VppAssociateRequestWrapper vppAssociate = new VppAssociateRequestWrapper(); + vppAssociate.setAssets(assets); + vppAssociate.setClientUserIds(clientUserIds); + + Gson gson = new Gson(); + String payload = gson.toJson(vppAssociate); + + ProxyResponse proxyResponse = callVPPBackend(ASSIGNMENTS_POST, payload, TOKEN, + Constants.VPP.POST); + return true; + + } catch (IOException e) { + String msg = "Error while adding associations"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + } + + } + + return false; + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java index 0a373b4282..267105e5f7 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java @@ -17,26 +17,25 @@ */ package io.entgra.device.mgt.core.application.mgt.core.internal; -import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; -import io.entgra.device.mgt.core.application.mgt.core.impl.AppmDataHandlerImpl; -import io.entgra.device.mgt.core.application.mgt.core.impl.VppApplicationManagerImpl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; import io.entgra.device.mgt.core.application.mgt.common.services.AppmDataHandler; import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; +import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; +import io.entgra.device.mgt.core.application.mgt.core.impl.AppmDataHandlerImpl; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; import io.entgra.device.mgt.core.application.mgt.core.task.ScheduledAppSubscriptionTaskManager; import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.ntask.core.service.TaskService; import org.wso2.carbon.user.core.service.RealmService; @@ -118,9 +117,9 @@ public class ApplicationManagementServiceComponent { DataHolder.getInstance().setConfigManager(configManager); bundleContext.registerService(AppmDataHandler.class.getName(), configManager, null); - // TODO: Get the new instance from extension like others - VppApplicationManagerImpl vppApplicationManager = new VppApplicationManagerImpl(); + VPPApplicationManager vppApplicationManager = ApplicationManagementUtil + .getVPPManagerInstance(); DataHolder.getInstance().setVppApplicationManager(vppApplicationManager); bundleContext.registerService(VPPApplicationManager.class.getName(), vppApplicationManager, null); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java index 407b4ebcac..5a76974288 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java @@ -71,6 +71,7 @@ public class APIUtil { private static volatile SubscriptionManager subscriptionManager; private static volatile ReviewManager reviewManager; private static volatile AppmDataHandler appmDataHandler; + private static volatile VPPApplicationManager vppApplicationManager; public static SPApplicationManager getSPApplicationManager() { if (SPApplicationManager == null) { @@ -200,6 +201,29 @@ public class APIUtil { return reviewManager; } + public static VPPApplicationManager getVPPManager() { + try { + if (vppApplicationManager == null) { + synchronized (APIUtil.class) { + if (vppApplicationManager == null) { + vppApplicationManager = ApplicationManagementUtil.getVPPManagerInstance(); + if (vppApplicationManager == null) { + String msg = "Vpp Manager service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + } + } + } + } catch (Exception e) { + String msg = "Error occurred while getting the vpp manager"; + log.error(msg); + throw new IllegalStateException(msg); + } + return vppApplicationManager; + } + + /** * To get the DataHandler from the osgi context. * @return AppmDataHandler instance in the current osgi context. @@ -424,9 +448,13 @@ public class APIUtil { } List applicationReleases = new ArrayList<>(); if (ApplicationType.PUBLIC.toString().equals(applicationDTO.getType()) && application.getCategories() - .contains("GooglePlaySyncedApp")) { + .contains(Constants.GOOGLE_PLAY_SYNCED_APP)) { application.setAndroidEnterpriseApp(true); } + if (ApplicationType.PUBLIC.toString().equals(applicationDTO.getType()) && application.getCategories() + .contains(Constants.ApplicationProperties.APPLE_STORE_SYNCED_APP_CATEGORY)) { + application.setExternalAppStoreApp(true); + } for (ApplicationReleaseDTO applicationReleaseDTO : applicationDTO.getApplicationReleaseDTOs()) { applicationReleases.add(releaseDtoToRelease(applicationReleaseDTO)); } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index 8ae9a580f4..e32a77448b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -32,6 +32,7 @@ import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStor import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.common.services.VPPApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationUpdateWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppReleaseWrapper; @@ -44,6 +45,7 @@ import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; import io.entgra.device.mgt.core.application.mgt.core.config.Extension; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; +import io.entgra.device.mgt.core.application.mgt.core.impl.VppApplicationManagerImpl; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; @@ -202,6 +204,11 @@ public class ApplicationManagementUtil { return getInstance(extension, LifecycleStateManager.class); } + public static VPPApplicationManager getVPPManagerInstance() { + // TODO: implement as an extension + return new VppApplicationManagerImpl(); + } + /** * This is useful to delete application artifacts if any error occurred while creating release/application * after uploading the artifacts diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java index 7b804e7fa8..f689d56828 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java @@ -73,6 +73,7 @@ public class Constants { public static final String GOOGLE_PLAY_STORE_URL = "https://play.google.com/store/apps/details?id="; public static final String APPLE_STORE_URL = "https://itunes.apple.com/country/app/app-name/id"; + public static final String GOOGLE_PLAY_SYNCED_APP = "GooglePlaySyncedApp"; // Subscription task related constants public static final String SUBSCRIBERS = "SUBSCRIBERS"; @@ -207,5 +208,7 @@ public class Constants { public static final String DISPLAY = "display"; public static final String GENRE_NAMES = "genreNames"; public static final String PRICE_ZERO = "0.0"; + public static final String ASSOCIATION_DEVICE = "ASSOCIATION_DEVICE"; + public static final String ASSOCIATION_USER = "ASSOCIATION_USER"; } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java index 620339a1bf..c915b8407d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/VppHttpUtil.java @@ -20,6 +20,9 @@ package io.entgra.device.mgt.core.application.mgt.core.util; import com.google.gson.Gson; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssociationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -39,6 +42,7 @@ import org.apache.http.impl.client.HttpClients; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.servlet.http.HttpServletResponse; import java.io.BufferedReader; @@ -282,4 +286,20 @@ public class VppHttpUtil { return HttpClients.custom().setMaxConnTotal(1).setMaxConnPerRoute(1).build(); } + public static VppAssociationDTO getAssociation(VppUserDTO user, VppAssetDTO asset) { + VppAssociationDTO associationDTO = new VppAssociationDTO(); + associationDTO.setAdamId(asset.getAdamId()); + associationDTO.setClientUserId(user.getClientUserId()); + associationDTO.setPricingParam(asset.getPricingParam()); + associationDTO.setAssociationType(Constants.ApplicationProperties.ASSOCIATION_USER); + + associationDTO.setAssetId(asset.getId()); + associationDTO.setClientId(user.getId()); + associationDTO.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext() + .getTenantId(true)); + associationDTO.setCreatedTime(String.valueOf(System.currentTimeMillis())); + associationDTO.setLastUpdatedTime(String.valueOf(System.currentTimeMillis())); + return associationDTO; + } + } From 1263c09079374134ab73a3f04a743710159f97f4 Mon Sep 17 00:00:00 2001 From: osh Date: Fri, 30 Jun 2023 19:05:59 +0530 Subject: [PATCH 007/112] Add DAOs for asset management fixes https://roadmap.entgra.net/issues/10179 --- .../application/mgt/common/DepConfig.java | 77 +++++++++ .../services/VPPApplicationManager.java | 2 +- .../mgt/core/dao/VppApplicationDAO.java | 7 + .../vpp/GenericVppApplicationDAOImpl.java | 156 ++++++++++++++++++ .../core/impl/VppApplicationManagerImpl.java | 116 +++++++++++-- .../core/util/ApplicationManagementUtil.java | 7 + .../application/mgt/core/util/DAOUtil.java | 54 +++++- .../mgt/core/DeviceManagementConstants.java | 1 + 8 files changed, 400 insertions(+), 20 deletions(-) create mode 100644 components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DepConfig.java diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DepConfig.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DepConfig.java new file mode 100644 index 0000000000..712ad11df2 --- /dev/null +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DepConfig.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.application.mgt.common; + +public class DepConfig { + + private String agentPackageName; + private String consumerKey; + private String consumerSecret; + private String accessToken; + private String accessSecret; + private String accessTokenExpiry; + + public String getAgentPackageName() { + return agentPackageName; + } + + public void setAgentPackageName(String agentPackageName) { + this.agentPackageName = agentPackageName; + } + + public String getConsumerKey() { + return consumerKey; + } + + public void setConsumerKey(String consumerKey) { + this.consumerKey = consumerKey; + } + + public String getConsumerSecret() { + return consumerSecret; + } + + public void setConsumerSecret(String consumerSecret) { + this.consumerSecret = consumerSecret; + } + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public String getAccessSecret() { + return accessSecret; + } + + public void setAccessSecret(String accessSecret) { + this.accessSecret = accessSecret; + } + + public String getAccessTokenExpiry() { + return accessTokenExpiry; + } + + public void setAccessTokenExpiry(String accessTokenExpiry) { + this.accessTokenExpiry = accessTokenExpiry; + } +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java index 55a3ee51b8..8c28055c6b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java @@ -37,7 +37,7 @@ public interface VPPApplicationManager { void syncAssets(int nextPageIndex) throws ApplicationManagementException; - VppAssetDTO getAssetByAppId(String appId) throws ApplicationManagementException; + VppAssetDTO getAssetByAppId(int appId) throws ApplicationManagementException; ProxyResponse callVPPBackend(String url, String payload, String accessToken, String method) throws IOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java index 6ebec3f0e7..df84ed1e27 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.application.mgt.core.dao; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; @@ -29,4 +30,10 @@ public interface VppApplicationDAO { VppUserDTO updateVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException; VppUserDTO getUserByDMUsername(String emmUsername, int tenantId) throws ApplicationManagementDAOException; + + VppAssetDTO getAssetByAppId(int appId, int tenantId) throws ApplicationManagementDAOException; + + int addAsset(VppAssetDTO vppAssetDTO, int tenantId) throws ApplicationManagementDAOException; + + VppAssetDTO updateAsset(VppAssetDTO vppAssetDTO, int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index 2bafc338f3..13c26d75f6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.VppApplicationDAO; @@ -29,6 +30,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.sql.*; +import java.util.List; public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements VppApplicationDAO { private static final Log log = LogFactory.getLog(GenericVppApplicationDAOImpl.class); @@ -83,6 +85,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp } } + @Override public VppUserDTO updateVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException { @@ -130,6 +133,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp } } + @Override public VppUserDTO getUserByDMUsername(String emmUsername, int tenantId) throws ApplicationManagementDAOException { String sql = "SELECT " @@ -168,4 +172,156 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp throw new ApplicationManagementDAOException(msg, e); } } + + @Override + public VppAssetDTO getAssetByAppId(int appId, int tenantId) + throws ApplicationManagementDAOException { + String sql = "SELECT " + + "ID, " + + "APP_ID, " + + "TENANT_ID, " + + "CREATED_TIME, " + + "LAST_UPDATED_TIME, " + + "ADAM_ID, " + + "ASSIGNED_COUNT, " + + "DEVICE_ASSIGNABLE, " + + "PRICING_PARAMS, " + + "PRODUCT_TYPE, " + + "RETIRED_COUNT, " + + "REVOCABLE " +// + "SUPPORTED_PLATFORMS " + + "FROM AP_ASSETS " + + "WHERE APP_ID = ? AND TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, appId); + stmt.setInt(2, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + return DAOUtil.loadAsset(rs); + } + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when retrieving asset data of app id "+ appId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to retrieve asset by app id."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (UnexpectedServerErrorException e) { + String msg = "Found more than one app for app id: " + appId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public int addAsset(VppAssetDTO vppAssetDTO, int tenantId) + throws ApplicationManagementDAOException { + int assetId = -1; + String sql = "INSERT INTO " + + "AP_ASSETS(" + + "APP_ID, " + + "TENANT_ID, " + + "CREATED_TIME," + + "LAST_UPDATED_TIME," + + "ADAM_ID," + + "ASSIGNED_COUNT," + + "DEVICE_ASSIGNABLE," + + "PRICING_PARAMS," + + "PRODUCT_TYPE," + + "RETIRED_COUNT," + + "REVOCABLE) " +// + "SUPPORTED_PLATFORMS) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { + long currentTime = System.currentTimeMillis(); + stmt.setInt(1, vppAssetDTO.getAppId()); + stmt.setInt(2, tenantId); + stmt.setLong(3, currentTime); + stmt.setLong(4, currentTime); + stmt.setString(5, vppAssetDTO.getAdamId()); + stmt.setString(6, vppAssetDTO.getAssignedCount()); + stmt.setString(7, vppAssetDTO.getDeviceAssignable()); + stmt.setString(8, vppAssetDTO.getPricingParam()); + stmt.setString(9, vppAssetDTO.getProductType()); + stmt.setString(10, vppAssetDTO.getRetiredCount()); + stmt.setString(11, vppAssetDTO.getRevocable()); +// List platformList = vppAssetDTO.getSupportedPlatforms(); +// String platformString = String.join(",", platformList); +// stmt.setString(12, platformString); + stmt.executeUpdate(); + try (ResultSet rs = stmt.getGeneratedKeys()) { + if (rs.next()) { + assetId = rs.getInt(1); + } + } + return assetId; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when adding the asset."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to add the asset."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public VppAssetDTO updateAsset(VppAssetDTO vppAssetDTO, int tenantId) + throws ApplicationManagementDAOException { + + String sql = "UPDATE " + + "AP_ASSETS " + + "SET " + + "APP_ID = ?," + + "LAST_UPDATED_TIME = ?, " + + "ADAM_ID = ?, " + + "ASSIGNED_COUNT = ?, " + + "DEVICE_ASSIGNABLE = ?, " + + "PRICING_PARAMS = ?, " + + "PRODUCT_TYPE = ?, " + + "RETIRED_COUNT = ?, " + + "REVOCABLE = ? " +// + "SUPPORTED_PLATFORMS = ? " + + "WHERE ID = ? AND TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + long updatedTime = System.currentTimeMillis(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, vppAssetDTO.getAppId()); + stmt.setLong(2, updatedTime); + stmt.setString(3, vppAssetDTO.getAdamId()); + stmt.setString(4, vppAssetDTO.getAssignedCount()); + stmt.setString(5, vppAssetDTO.getDeviceAssignable()); + stmt.setString(6, vppAssetDTO.getPricingParam()); + stmt.setString(7, vppAssetDTO.getProductType()); + stmt.setString(8, vppAssetDTO.getRetiredCount()); + stmt.setString(9, vppAssetDTO.getRevocable()); +// List platformList = vppAssetDTO.getSupportedPlatforms(); +// String platformString = String.join(",", platformList); +// stmt.setString(10, platformString); + stmt.setInt(10, vppAssetDTO.getId()); + stmt.setLong(11, tenantId); + stmt.executeUpdate(); + if (stmt.executeUpdate() == 1) { + return vppAssetDTO; + } + return null; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when updating the vpp user"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to updating the vpp user."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index 15ec5e3a15..e99f0eb44b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -21,12 +21,14 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import io.entgra.device.mgt.core.application.mgt.common.DepConfig; import io.entgra.device.mgt.core.application.mgt.common.dto.ItuneAppDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppItuneUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.common.exception.TransactionManagementException; +import io.entgra.device.mgt.core.application.mgt.common.response.Application; import io.entgra.device.mgt.core.application.mgt.common.wrapper.VppItuneUserRequestWrapper; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; @@ -46,12 +48,19 @@ import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagement import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.VppHttpUtil; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; +import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; +import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; +import java.util.List; public class VppApplicationManagerImpl implements VPPApplicationManager { private static final String APP_API = "https://vpp.itunes.apple.com/mdm/v2"; @@ -245,6 +254,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { @Override public void syncAssets(int nextPageIndex) throws ApplicationManagementException { ProxyResponse proxyResponse = null; + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); try { String url = ASSETS; if (nextPageIndex > 0) { // Not the first page @@ -267,15 +277,66 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { for (VppAssetDTO vppAssetDTO : vppItuneAssetResponse.getAssets()) { ItuneAppDTO ituneAppDTO = lookupAsset(vppAssetDTO.getAdamId()); ApplicationManagementUtil.persistApp(ituneAppDTO); + List applications = ApplicationManagementUtil.getAppDetails(vppAssetDTO.getAdamId()); + for (Application application :applications) { + VppAssetDTO vppAssetDTOs = getAssetByAppId(application.getId()); + if (vppAssetDTOs == null) { + vppAssetDTOs = new VppAssetDTO(); + vppAssetDTOs.setAppId(application.getId()); + try { + ConnectionManagerUtil.beginDBTransaction(); + if (vppApplicationDAO.addAsset(vppAssetDTOs, tenantId) != -1) { + ConnectionManagerUtil.commitDBTransaction(); + } + ConnectionManagerUtil.rollbackDBTransaction(); + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while adding the Asset."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while executing database transaction for adding Asset."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while retrieving the database connection for adding Asset."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } else { + vppAssetDTOs.setAppId(application.getId()); + try { + ConnectionManagerUtil.beginDBTransaction(); + if (vppApplicationDAO.updateAsset(vppAssetDTOs, tenantId) == null) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Unable to update the asset: " +vppAssetDTOs.getAdamId(); + log.error(msg); + throw new ApplicationManagementException(msg); + } + ConnectionManagerUtil.commitDBTransaction(); + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while updating the Asset."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while executing database transaction for Asset update."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while retrieving the database connection for Asset update."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + } } - - // TODO: Store/update vppItuneAssetResponse.getAssets() in the DB - - // TODO: END of DAO access - } - if (vppItuneAssetResponse.getCurrentPageIndex() == (vppItuneAssetResponse .getTotalPages() - 1)) { return; @@ -288,8 +349,6 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { log.error(msg, e); throw new ApplicationManagementException(msg, e); } - - } private ItuneAppDTO lookupAsset(String packageName) throws ApplicationManagementException { @@ -352,10 +411,22 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { } - public VppAssetDTO getAssetByAppId(String appId) throws ApplicationManagementException { - // App ID is the app id of the App management database - VppAssetDTO assetDTO = null; // TODO: load from the DB - return assetDTO; + public VppAssetDTO getAssetByAppId(int appId) throws ApplicationManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + try { + ConnectionManagerUtil.openDBConnection(); + return vppApplicationDAO.getAssetByAppId(appId, tenantId); + } catch (DBConnectionException e) { + String msg = "DB Connection error occurs while getting asset related to app with app id " + appId + "."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + String msg = "Error occurred while getting asset data related to app with app id " + appId + "."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } } @Override @@ -366,4 +437,25 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { return VppHttpUtil.execute(url, payload, accessToken, method); } + public String getVppToken() throws ApplicationManagementException { + String token = ""; + MetadataManagementService meta = DeviceManagementDataHolder + .getInstance().getMetadataManagementService(); + Metadata metadata = null; + try { + metadata = meta.retrieveMetadata(DeviceManagementConstants.DEP_META_KEY); + if (metadata != null) { + + Gson g = new Gson(); + DepConfig depConfigs = g.fromJson(metadata.getMetaValue(), DepConfig.class); + token = depConfigs.getAccessToken(); + return token; + } + }catch (MetadataManagementException e) { + String msg = "Error when retrieving metadata of vpp feature"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + return token; + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index 8ae9a580f4..d506bc854d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -520,4 +520,11 @@ public class ApplicationManagementUtil { } } } + + public static List getAppDetails(String adamId) throws ApplicationManagementException { + ApplicationManager applicationManager = APIUtil.getApplicationManager(); + List packageNamesOfApps = new ArrayList<>(); + packageNamesOfApps.add(adamId); + return applicationManager.getApplications(packageNamesOfApps); + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index 89b5ac01ca..f152d27f4f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -19,20 +19,14 @@ package io.entgra.device.mgt.core.application.mgt.core.util; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.*; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.JSONException; import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.DeviceSubscriptionDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import java.sql.PreparedStatement; @@ -382,6 +376,52 @@ public class DAOUtil { return vppUserDTOS; } + public static VppAssetDTO loadAsset(ResultSet rs) throws SQLException, UnexpectedServerErrorException { + List vppAssetDTOS = loadAssets(rs); + if (vppAssetDTOS.isEmpty()) { + return null; + } + if (vppAssetDTOS.size() > 1) { + String msg = "Internal server error. Found more than one asset for given app id."; + log.error(msg); + throw new UnexpectedServerErrorException(msg); + } + return vppAssetDTOS.get(0); + } + + public static List loadAssets (ResultSet rs) throws SQLException { + List vppAssetDTOS = new ArrayList<>(); + while (rs.next()) { + VppAssetDTO vppAssetDTO = new VppAssetDTO(); + vppAssetDTO.setId(rs.getInt("ID")); + vppAssetDTO.setAppId(rs.getInt("APP_ID")); + vppAssetDTO.setTenantId(rs.getInt("TENANT_ID")); + if (rs.getLong("CREATED_TIME") != 0) { + vppAssetDTO.setCreatedTime(new Date(rs.getLong(("CREATED_TIME")) * 1000).toString()); + } + if (rs.getLong("LAST_UPDATED_TIME") != 0) { + vppAssetDTO.setLastUpdatedTime(new Date(rs.getLong(("LAST_UPDATED_TIME")) * 1000).toString()); + } + vppAssetDTO.setAdamId(rs.getString("ADAM_ID")); + vppAssetDTO.setAssignedCount(rs.getString("ASSIGNED_COUNT")); + vppAssetDTO.setDeviceAssignable(rs.getString("DEVICE_ASSIGNABLE")); + vppAssetDTO.setPricingParam(rs.getString("PRICING_PARAMS")); + vppAssetDTO.setProductType(rs.getString("PRODUCT_TYPE")); + vppAssetDTO.setRetiredCount(rs.getString("RETIRED_COUNT")); + vppAssetDTO.setRevocable(rs.getString("REVOCABLE")); +// String jsonString = rs.getString("SUPPORTED_PLATFORMS"); +// ObjectMapper objectMapper = new ObjectMapper(); +// try { +// List platformList = objectMapper.readValue(jsonString, new TypeReference>() {}); +// vppAssetDTO.setSupportedPlatforms(platformList); +// } catch (IOException e) { +// e.printStackTrace(); +// } + vppAssetDTOS.add(vppAssetDTO); + } + return vppAssetDTOS; + } + /** * Cleans up the statement and resultset after executing the query * diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java index 58be3dae82..770c6db022 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java @@ -29,6 +29,7 @@ public final class DeviceManagementConstants { public static final String GEOFENCE_CACHE = "GEOFENCE_CACHE"; public static final String BILLING_CACHE = "BILLING_CACHE"; public static final String META_KEY = "PER_DEVICE_COST"; + public static final String DEP_META_KEY = "DEP_CONFIG"; public static final String ACTIVE_STATUS = "ACTIVE"; public static final String ENROLLMENT_NOTIFICATION_API_ENDPOINT = "/api/device-mgt/enrollment-notification"; public static final String URL_SEPERATOR = "/"; From 026986cd93e1ba3c0fe41be5d18c1d94f2b879f3 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Wed, 5 Jul 2023 17:16:38 +0530 Subject: [PATCH 008/112] Add DAO improvements for user APIs Fixes https://roadmap.entgra.net/issues/10169 --- .../services/VPPApplicationManager.java | 4 + .../vpp/GenericVppApplicationDAOImpl.java | 76 +++++++++++++------ .../core/impl/VppApplicationManagerImpl.java | 16 +++- .../application/mgt/core/util/Constants.java | 2 +- .../application/mgt/core/util/DAOUtil.java | 25 +++++- .../main/resources/conf/application-mgt.xml | 1 + .../repository/conf/application-mgt.xml.j2 | 1 + 7 files changed, 93 insertions(+), 32 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java index f537764c62..443aed228f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.application.mgt.common.services; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssociationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; @@ -44,4 +45,7 @@ public interface VPPApplicationManager { boolean addAssociation(VppAssetDTO asset, List vppUsers) throws ApplicationManagementException; + + VppAssociationDTO getUserAssociation(String adamId, String emmUsername) throws + ApplicationManagementException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index 13c26d75f6..3ec5487261 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -89,34 +89,61 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp public VppUserDTO updateVppUser(VppUserDTO userDTO, int tenantId) throws ApplicationManagementDAOException { - String sql = "UPDATE " - + "AP_VPP_USER " - + "SET " - + "CLIENT_USER_ID = ?," - + "DM_USERNAME = ?, " - + "TENANT_ID = ?, " - + "EMAIL = ?, " - + "INVITE_CODE = ?, " - + "STATUS = ?, " - + "LAST_UPDATED_TIME = ?, " - + "MANAGED_ID = ?, " - + "TEMP_PASSWORD = ? " - + "WHERE ID = ?"; + String sql = "UPDATE AP_VPP_USER SET "; + if (userDTO.getClientUserId() != null && !userDTO.getClientUserId().isEmpty()) { + sql += "CLIENT_USER_ID = ?,"; + } + if (userDTO.getDmUsername() != null && !userDTO.getDmUsername().isEmpty()) { + sql += "DM_USERNAME = ?,"; + } + if (userDTO.getEmail() != null && !userDTO.getEmail().isEmpty()) { + sql += "EMAIL = ?,"; + } + if (userDTO.getInviteCode() != null && !userDTO.getInviteCode().isEmpty()) { + sql += "INVITE_CODE = ?,"; + } + if (userDTO.getStatus() != null && !userDTO.getStatus().isEmpty()) { + sql += "STATUS = ?,"; + } + if (userDTO.getManagedId() != null && !userDTO.getManagedId().isEmpty()) { + sql += "MANAGED_ID = ?,"; + } + if (userDTO.getTmpPassword() != null && !userDTO.getTmpPassword().isEmpty()) { + sql += "TEMP_PASSWORD = ?,"; + } + + sql += " TENANT_ID = ?, LAST_UPDATED_TIME = ? WHERE ID = ?"; + try { Connection conn = this.getDBConnection(); long updatedTime = System.currentTimeMillis(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setString(1, userDTO.getClientUserId()); - stmt.setString(2, userDTO.getDmUsername()); - stmt.setInt(3, tenantId); - stmt.setString(4, userDTO.getEmail()); - stmt.setString(5, userDTO.getInviteCode()); - stmt.setString(6, userDTO.getStatus()); - stmt.setLong(7, updatedTime); - stmt.setString(8, userDTO.getManagedId()); - stmt.setString(9, userDTO.getTmpPassword()); - stmt.setInt(10, userDTO.getId()); - stmt.executeUpdate(); + int x = 0; + + if (userDTO.getClientUserId() != null && !userDTO.getClientUserId().isEmpty()) { + stmt.setString(++x, userDTO.getClientUserId()); + } + if (userDTO.getDmUsername() != null && !userDTO.getDmUsername().isEmpty()) { + stmt.setString(++x, userDTO.getDmUsername()); + } + if (userDTO.getEmail() != null && !userDTO.getEmail().isEmpty()) { + stmt.setString(++x, userDTO.getEmail()); + } + if (userDTO.getInviteCode() != null && !userDTO.getInviteCode().isEmpty()) { + stmt.setString(++x, userDTO.getInviteCode()); + } + if (userDTO.getStatus() != null && !userDTO.getStatus().isEmpty()) { + stmt.setString(++x, userDTO.getStatus()); + } + if (userDTO.getManagedId() != null && !userDTO.getManagedId().isEmpty()) { + stmt.setString(++x, userDTO.getManagedId()); + } + if (userDTO.getTmpPassword() != null && !userDTO.getTmpPassword().isEmpty()) { + stmt.setString(++x, userDTO.getTmpPassword()); + } + stmt.setInt(++x, tenantId); + stmt.setLong(++x, updatedTime); + stmt.setInt(++x, userDTO.getId()); if (stmt.executeUpdate() == 1) { return userDTO; } @@ -147,6 +174,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp + "LAST_UPDATED_TIME, " + "MANAGED_ID, " + "TEMP_PASSWORD " + + "DM_USERNAME " + "FROM AP_VPP_USER " + "WHERE DM_USERNAME = ? AND TENANT_ID = ?"; try { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index b86ef9d2a3..f6ab0d92a8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -110,9 +110,6 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { wrapper.getUser().add(ituneUserDTO); Gson gson = new Gson(); -// Gson gson = new GsonBuilder() -// .setExclusionStrategies(new NullEmptyExclusionStrategy()) -// .create(); String userPayload = gson.toJson(wrapper); ProxyResponse proxyResponse = callVPPBackend(USER_CREATE, userPayload, TOKEN, Constants.VPP.POST); @@ -131,8 +128,12 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { log.error("userDTO " + userDTO.toString()); try { ConnectionManagerUtil.beginDBTransaction(); - if (vppApplicationDAO.addVppUser(userDTO, tenantId) != -1) { + int id = vppApplicationDAO.addVppUser(userDTO, tenantId); + if (id != -1) { ConnectionManagerUtil.commitDBTransaction(); + userDTO.setId(id); + userDTO.setTenantId(PrivilegedCarbonContext + .getThreadLocalCarbonContext().getTenantId()); return userDTO; } ConnectionManagerUtil.rollbackDBTransaction(); @@ -507,4 +508,11 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { return false; } + + @Override + public VppAssociationDTO getUserAssociation(String adamId, String emmUsername) throws ApplicationManagementException { + // Todo: Join the 3 tables and find a matching association + return null; + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java index f689d56828..016fe414fa 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java @@ -196,7 +196,7 @@ public class Constants { public static final String PAID_SUB_METHOD = "PAID"; public static final String TYPE = "type";; public static final String PACKAGE_NAME = "packageName"; - public static final String APPLE_STORE_SYNCED_APP_CATEGORY = "APPLE_STORE_SYNCED_APP"; + public static final String APPLE_STORE_SYNCED_APP_CATEGORY = "AppleStoreSyncedApp"; public static final String RESULTS = "results"; public static final String ARTWORK = "artwork"; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index f152d27f4f..c5d9f259a6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -362,9 +362,18 @@ public class DAOUtil { vppUserDTO.setTenantId(rs.getInt("TENANT_ID")); vppUserDTO.setEmail(rs.getString("EMAIL")); vppUserDTO.setInviteCode(rs.getString("INVITE_CODE")); - vppUserDTO.setStatus(rs.getString("STATUS")); - vppUserDTO.setManagedId(rs.getString("MANAGED_ID")); - vppUserDTO.setTmpPassword(rs.getString("TEMP_PASSWORD")); + if (columnExist(rs,"STATUS")) { + vppUserDTO.setStatus(rs.getString("STATUS")); + } + if (columnExist(rs,"MANAGED_ID")) { + vppUserDTO.setManagedId(rs.getString("MANAGED_ID")); + } + if (columnExist(rs,"TEMP_PASSWORD")) { + vppUserDTO.setTmpPassword(rs.getString("TEMP_PASSWORD")); + } + if (columnExist(rs,"DM_USERNAME")) { + vppUserDTO.setDmUsername(rs.getString("DM_USERNAME")); + } if (rs.getLong("CREATED_TIME") != 0) { vppUserDTO.setCreatedTime(new Date(rs.getLong(("CREATED_TIME")) * 1000).toString()); } @@ -376,6 +385,16 @@ public class DAOUtil { return vppUserDTOS; } + private static boolean columnExist(ResultSet rs, String column){ + try{ + rs.findColumn(column); + return true; + } catch (SQLException sqlex){ + } + + return false; + } + public static VppAssetDTO loadAsset(ResultSet rs) throws SQLException, UnexpectedServerErrorException { List vppAssetDTOS = loadAssets(rs); if (vppAssetDTOS.isEmpty()) { diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml index 8913afa2b9..bb1e6144ac 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml @@ -171,6 +171,7 @@ Video Players & Editors Weather GooglePlaySyncedApp + AppleStoreSyncedApp diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf_templates/templates/repository/conf/application-mgt.xml.j2 b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf_templates/templates/repository/conf/application-mgt.xml.j2 index cbd8c6f0c9..bc4d34b048 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf_templates/templates/repository/conf/application-mgt.xml.j2 +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf_templates/templates/repository/conf/application-mgt.xml.j2 @@ -202,6 +202,7 @@ Video Players & Editors Weather GooglePlaySyncedApp + AppleStoreSyncedApp {% if application_mgt_conf.app_categories is defined %} {%- for app_category in application_mgt_conf.app_categories -%} {{app_category}} From 0e5478fb5e0235c5282aeedfa852f1a78468ccdc Mon Sep 17 00:00:00 2001 From: osh Date: Wed, 5 Jul 2023 20:49:46 +0530 Subject: [PATCH 009/112] Add association DAO and fix meta issue fixes https://roadmap.entgra.net/issues/10186 --- .../services/VPPApplicationManager.java | 4 + .../mgt/core/config/Extension.java | 3 +- .../mgt/core/dao/VppApplicationDAO.java | 7 + .../vpp/GenericVppApplicationDAOImpl.java | 122 ++++++++++++++ .../core/impl/VppApplicationManagerImpl.java | 156 ++++++++++++++---- .../application/mgt/core/util/APIUtil.java | 25 +++ .../core/util/ApplicationManagementUtil.java | 9 + .../application/mgt/core/util/DAOUtil.java | 31 ++++ 8 files changed, 323 insertions(+), 34 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java index f537764c62..05f3090949 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/VPPApplicationManager.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.application.mgt.common.services; import io.entgra.device.mgt.core.application.mgt.common.dto.ProxyResponse; import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssociationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; @@ -44,4 +45,7 @@ public interface VPPApplicationManager { boolean addAssociation(VppAssetDTO asset, List vppUsers) throws ApplicationManagementException; + + VppAssociationDTO getAssociation(int assetId, int userId) throws + ApplicationManagementException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java index 553ee67172..9ded8d3608 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java @@ -88,7 +88,8 @@ public class Extension { SubscriptionManager, VisibilityManager, ApplicationStorageManager, - PlatformStorageManager + PlatformStorageManager, + MetadataManagementService } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java index df84ed1e27..02aec95174 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.application.mgt.core.dao; import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssociationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; @@ -36,4 +37,10 @@ public interface VppApplicationDAO { int addAsset(VppAssetDTO vppAssetDTO, int tenantId) throws ApplicationManagementDAOException; VppAssetDTO updateAsset(VppAssetDTO vppAssetDTO, int tenantId) throws ApplicationManagementDAOException; + + VppAssociationDTO getAssociation(int assetId, int userId, int tenantId) throws ApplicationManagementDAOException; + + int addAssociation(VppAssociationDTO vppAssociationDTO, int tenantId) throws ApplicationManagementDAOException; + + VppAssociationDTO updateAssociation(VppAssociationDTO vppAssociationDTO, int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index 13c26d75f6..212a6d4baf 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.vpp; import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssetDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.VppAssociationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.VppUserDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.VppApplicationDAO; @@ -324,4 +325,125 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp throw new ApplicationManagementDAOException(msg, e); } } + + @Override + public VppAssociationDTO getAssociation(int assetId, int userId, int tenantId) + throws ApplicationManagementDAOException { + String sql = "SELECT " + + "ID, " + + "ASSOCIATION_TYPE, " + + "CREATED_TIME, " + + "LAST_UPDATED_TIME, " + + "PRICING_PARAMS " + + "FROM AP_VPP_ASSOCIATION " + + "WHERE ASSET_ID = ? AND USER_ID = ? AND TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, assetId); + stmt.setInt(2, userId); + stmt.setInt(3, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + return DAOUtil.loadAssignment(rs); + } + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when retrieving assignment data of user with id "+ userId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to retrieve assignment by asset id and user id."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (UnexpectedServerErrorException e) { + String msg = "Found more than one assignment for user id: " + userId + " and asset id: " + assetId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public int addAssociation(VppAssociationDTO vppAssociationDTO, int tenantId) + throws ApplicationManagementDAOException { + int associationId = -1; + String sql = "INSERT INTO " + + "AP_VPP_ASSOCIATION(" + + "ASSET_ID, " + + "USER_ID, " + + "TENANT_ID, " + + "ASSOCIATION_TYPE," + + "CREATED_TIME," + + "LAST_UPDATED_TIME," + + "PRICING_PARAMS) " + + "VALUES (?, ?, ?, ?, ?)"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { + long currentTime = System.currentTimeMillis(); + stmt.setInt(1, vppAssociationDTO.getAssetId()); + stmt.setInt(2, vppAssociationDTO.getClientId()); + stmt.setInt(3, tenantId); + stmt.setString(4, vppAssociationDTO.getAssociationType()); + stmt.setLong(5, currentTime); + stmt.setLong(6, currentTime); + stmt.setString(7, vppAssociationDTO.getPricingParam()); + stmt.executeUpdate(); + try (ResultSet rs = stmt.getGeneratedKeys()) { + if (rs.next()) { + associationId = rs.getInt(1); + } + } + return associationId; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when adding the asset."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to add the asset."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public VppAssociationDTO updateAssociation(VppAssociationDTO vppAssociationDTO, int tenantId) + throws ApplicationManagementDAOException { + + String sql = "UPDATE " + + "AP_VPP_ASSOCIATION " + + "SET " + + "ASSET_ID = ?," + + "USER_ID = ?, " + + "ASSOCIATION_TYPE = ?, " + + "LAST_UPDATED_TIME = ?, " + + "PRICING_PARAMS = ? " + + "WHERE ID = ? AND TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + long updatedTime = System.currentTimeMillis(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, vppAssociationDTO.getAssetId()); + stmt.setInt(2, vppAssociationDTO.getClientId()); + stmt.setString(3, vppAssociationDTO.getAssociationType()); + stmt.setLong(4, updatedTime); + stmt.setString(5, vppAssociationDTO.getPricingParam()); + stmt.setInt(6, vppAssociationDTO.getId()); + stmt.setLong(7, tenantId); + stmt.executeUpdate(); + if (stmt.executeUpdate() == 1) { + return vppAssociationDTO; + } + return null; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining database connection when updating the vpp user"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to updating the vpp user."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index b86ef9d2a3..d1a0af7cf4 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -50,6 +50,7 @@ import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagement import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.VppHttpUtil; +import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; @@ -71,6 +72,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { private static final String USER_UPDATE = APP_API + "/users/update"; private static final String USER_GET = APP_API + "/users"; private static final String ASSIGNMENTS_POST = APP_API + "/assets/associate"; + private static final String ASSIGNMENTS_GET = APP_API + "/assignments"; private static final String TOKEN = ""; private static final String LOOKUP_API = "https://uclient-api.itunes.apple" + ".com/WebObjects/MZStorePlatform.woa/wa/lookup?version=2&id="; @@ -285,10 +287,10 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { VppAssetDTO vppAssetDTOs = getAssetByAppId(application.getId()); if (vppAssetDTOs == null) { vppAssetDTOs = new VppAssetDTO(); - vppAssetDTOs.setAppId(application.getId()); + vppAssetDTO.setAppId(application.getId()); try { ConnectionManagerUtil.beginDBTransaction(); - if (vppApplicationDAO.addAsset(vppAssetDTOs, tenantId) != -1) { + if (vppApplicationDAO.addAsset(vppAssetDTO, tenantId) != -1) { ConnectionManagerUtil.commitDBTransaction(); } ConnectionManagerUtil.rollbackDBTransaction(); @@ -413,7 +415,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { return null; } - + @Override public VppAssetDTO getAssetByAppId(int appId) throws ApplicationManagementException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); try { @@ -433,40 +435,12 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { } @Override - public ProxyResponse callVPPBackend(String url, - String payload, - String accessToken, - String method) throws IOException { - return VppHttpUtil.execute(url, payload, accessToken, method); - } - - public String getVppToken() throws ApplicationManagementException { - String token = ""; - MetadataManagementService meta = DeviceManagementDataHolder - .getInstance().getMetadataManagementService(); - Metadata metadata = null; - try { - metadata = meta.retrieveMetadata("DEP_META_KEY"); - if (metadata != null) { - - Gson g = new Gson(); - DepConfig depConfigs = g.fromJson(metadata.getMetaValue(), DepConfig.class); - token = depConfigs.getAccessToken(); - return token; - } - }catch (MetadataManagementException e) { - String msg = "Error when retrieving metadata of vpp feature"; - log.error(msg, e); - throw new ApplicationManagementException(msg, e); - } - return token; - } - public boolean addAssociation(VppAssetDTO asset, List vppUsers) throws ApplicationManagementException { List associations = new ArrayList<>(); // To save to UEM DBs List clientUserIds = new ArrayList<>(); // Need this to send to vpp backend. + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); if (asset != null) { for (VppUserDTO vppUserDTO : vppUsers) { VppAssociationDTO associationDTO = VppHttpUtil.getAssociation(vppUserDTO, asset); @@ -494,7 +468,75 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { ProxyResponse proxyResponse = callVPPBackend(ASSIGNMENTS_POST, payload, TOKEN, Constants.VPP.POST); - return true; + if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == + HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.EVENT_ID)) { + // Create assignment does not return any useful data. Its needed to call the backend again + ProxyResponse getAssignmentResponse = callVPPBackend(ASSIGNMENTS_GET, null, TOKEN, Constants.VPP.GET); + if ((getAssignmentResponse.getCode() == HttpStatus.SC_OK || getAssignmentResponse.getCode() == + HttpStatus.SC_CREATED) && getAssignmentResponse.getData().contains(Constants.VPP.TOTAL_PAGES)) { +// VppAssociateResponseWrapper vppAssociateResponseWrapper = gson.fromJson +// (getAssignmentResponse.getData(), VppAssociateResponseWrapper.class); + for (VppAssociationDTO association : associations) { + + VppAssociationDTO vppAssociation = getAssociation(association.getAssetId(), association.getClientId()); + + if (vppAssociation == null) { + try { + ConnectionManagerUtil.beginDBTransaction(); + if (vppApplicationDAO.addAssociation(association, tenantId) != -1) { + ConnectionManagerUtil.commitDBTransaction(); + return true; + } + ConnectionManagerUtil.rollbackDBTransaction(); + return false; + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while adding the Assignment."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while executing database transaction for adding Assignment."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while retrieving the database connection for adding Assignment."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } else { + try { + ConnectionManagerUtil.beginDBTransaction(); + if (vppApplicationDAO.updateAssociation(association, tenantId) == null) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Unable to update the assignment: " +association.getAssetId(); + log.error(msg); + throw new ApplicationManagementException(msg); + } + ConnectionManagerUtil.commitDBTransaction(); + return true; + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while updating the Asset."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while executing database transaction for Asset update."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while retrieving the database connection for Asset update."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + } + } + + } } catch (IOException e) { String msg = "Error while adding associations"; @@ -507,4 +549,52 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { return false; } + + @Override + public VppAssociationDTO getAssociation(int assetId, int userId) throws ApplicationManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + try { + ConnectionManagerUtil.openDBConnection(); + return vppApplicationDAO.getAssociation(assetId, userId, tenantId); + } catch (DBConnectionException e) { + String msg = "DB Connection error occurs while getting assignment related to user of id " + userId + "."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + String msg = "Error occurred while getting assignment data related to user of id " + userId + "."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + + @Override + public ProxyResponse callVPPBackend(String url, + String payload, + String accessToken, + String method) throws IOException { + return VppHttpUtil.execute(url, payload, accessToken, method); + } + + public String getVppToken() throws ApplicationManagementException { + String token = ""; + MetadataManagementService meta = APIUtil.getMetadataManager(); + Metadata metadata = null; + try { + metadata = meta.retrieveMetadata("DEP_META_KEY"); + if (metadata != null) { + + Gson g = new Gson(); + DepConfig depConfigs = g.fromJson(metadata.getMetaValue(), DepConfig.class); + token = depConfigs.getAccessToken(); + return token; + } + }catch (MetadataManagementException e) { + String msg = "Error when retrieving metadata of vpp feature"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + return token; + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java index 5a76974288..2e8536feb8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java @@ -26,6 +26,8 @@ import io.entgra.device.mgt.core.application.mgt.core.config.IdentityServiceProv import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceProviderApplicationService; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -72,6 +74,7 @@ public class APIUtil { private static volatile ReviewManager reviewManager; private static volatile AppmDataHandler appmDataHandler; private static volatile VPPApplicationManager vppApplicationManager; + private static volatile MetadataManagementService metadataManagementService; public static SPApplicationManager getSPApplicationManager() { if (SPApplicationManager == null) { @@ -113,6 +116,28 @@ public class APIUtil { return applicationManager; } + public static MetadataManagementService getMetadataManager() { + try { + if (metadataManagementService == null) { + synchronized (APIUtil.class) { + if (metadataManagementService == null) { + metadataManagementService = ApplicationManagementUtil.getDeviceManagerInstance(); + if (metadataManagementService == null) { + String msg = "MetadataManagement Service service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + } + } + } + } catch (Exception e) { + String msg = "Error occurred while getting the vpp manager"; + log.error(msg); + throw new IllegalStateException(msg); + } + return metadataManagementService; + } + /** * To get the ApplicationDTO Storage Manager from the osgi context. * @return ApplicationStoreManager instance in the current osgi context. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index 3ae13bae1f..d739f0f68a 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -49,7 +49,9 @@ import io.entgra.device.mgt.core.application.mgt.core.impl.VppApplicationManager import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; import io.entgra.device.mgt.core.device.mgt.core.common.util.FileUtil; +import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.MetadataManagementServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -209,6 +211,13 @@ public class ApplicationManagementUtil { return new VppApplicationManagerImpl(); } + public static MetadataManagementService getDeviceManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.MetadataManagementService); + return getInstance(extension, MetadataManagementService.class); + } + + /** * This is useful to delete application artifacts if any error occurred while creating release/application * after uploading the artifacts diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index f152d27f4f..73df7fbe53 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -422,6 +422,37 @@ public class DAOUtil { return vppAssetDTOS; } + public static VppAssociationDTO loadAssignment(ResultSet rs) throws SQLException, UnexpectedServerErrorException { + List vppAssociationDTOS = loadAssignments(rs); + if (vppAssociationDTOS.isEmpty()) { + return null; + } + if (vppAssociationDTOS.size() > 1) { + String msg = "Internal server error. Found more than one asset for given app id."; + log.error(msg); + throw new UnexpectedServerErrorException(msg); + } + return vppAssociationDTOS.get(0); + } + + public static List loadAssignments (ResultSet rs) throws SQLException { + List vppAssociationDTOS = new ArrayList<>(); + while (rs.next()) { + VppAssociationDTO vppAssociationDTO = new VppAssociationDTO(); + vppAssociationDTO.setId(rs.getInt("ID")); + vppAssociationDTO.setAssociationType(rs.getString("ASSOCIATION_TYPE")); + if (rs.getLong("CREATED_TIME") != 0) { + vppAssociationDTO.setCreatedTime(new Date(rs.getLong(("CREATED_TIME")) * 1000).toString()); + } + if (rs.getLong("LAST_UPDATED_TIME") != 0) { + vppAssociationDTO.setLastUpdatedTime(new Date(rs.getLong(("LAST_UPDATED_TIME")) * 1000).toString()); + } + vppAssociationDTO.setPricingParam(rs.getString("PRICING_PARAMS")); + vppAssociationDTOS.add(vppAssociationDTO); + } + return vppAssociationDTOS; + } + /** * Cleans up the statement and resultset after executing the query * From dae8c0976155f4069c3e28824092e0dce409a936 Mon Sep 17 00:00:00 2001 From: osh Date: Wed, 5 Jul 2023 22:38:10 +0530 Subject: [PATCH 010/112] Resolve comments --- .../mgt/core/config/Extension.java | 3 +-- .../vpp/GenericVppApplicationDAOImpl.java | 1 - .../application/mgt/core/util/APIUtil.java | 23 ++++++++----------- .../core/util/ApplicationManagementUtil.java | 8 ------- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java index 9ded8d3608..553ee67172 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java @@ -88,8 +88,7 @@ public class Extension { SubscriptionManager, VisibilityManager, ApplicationStorageManager, - PlatformStorageManager, - MetadataManagementService + PlatformStorageManager } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index 1e935d35de..936e8da7e3 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -458,7 +458,6 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp stmt.setString(5, vppAssociationDTO.getPricingParam()); stmt.setInt(6, vppAssociationDTO.getId()); stmt.setLong(7, tenantId); - stmt.executeUpdate(); if (stmt.executeUpdate() == 1) { return vppAssociationDTO; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java index 2e8536feb8..d37a85dee6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java @@ -27,7 +27,6 @@ import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceP import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; -import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -117,23 +116,19 @@ public class APIUtil { } public static MetadataManagementService getMetadataManager() { - try { - if (metadataManagementService == null) { - synchronized (APIUtil.class) { + if (metadataManagementService == null) { + synchronized (APIUtil.class) { + if (metadataManagementService == null) { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + metadataManagementService = + (MetadataManagementService) ctx.getOSGiService(MetadataManagementService.class, null); if (metadataManagementService == null) { - metadataManagementService = ApplicationManagementUtil.getDeviceManagerInstance(); - if (metadataManagementService == null) { - String msg = "MetadataManagement Service service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } + String msg = "MetadataManagement Manager service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); } } } - } catch (Exception e) { - String msg = "Error occurred while getting the vpp manager"; - log.error(msg); - throw new IllegalStateException(msg); } return metadataManagementService; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index d739f0f68a..36920d013c 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -210,14 +210,6 @@ public class ApplicationManagementUtil { // TODO: implement as an extension return new VppApplicationManagerImpl(); } - - public static MetadataManagementService getDeviceManagerInstance() throws InvalidConfigurationException { - ConfigurationManager configurationManager = ConfigurationManager.getInstance(); - Extension extension = configurationManager.getExtension(Extension.Name.MetadataManagementService); - return getInstance(extension, MetadataManagementService.class); - } - - /** * This is useful to delete application artifacts if any error occurred while creating release/application * after uploading the artifacts From 2d3f2b94dad5d4d7f55c90afc191fa9ed415f3d9 Mon Sep 17 00:00:00 2001 From: nishan Date: Fri, 7 Jul 2023 18:53:21 +0530 Subject: [PATCH 011/112] Show device identifier and changeed to delete certificate using Id --- ...CertificateManagementAdminServiceImpl.java | 12 +++---- .../admin/api/util/RequestValidationUtil.java | 8 +++++ .../mgt/core/dao/CertificateDAO.java | 4 +-- .../dao/impl/AbstractCertificateDAOImpl.java | 12 ++++--- .../dao/impl/GenericCertificateDAOImpl.java | 27 +++++++++++++-- .../dao/impl/OracleCertificateDAOImpl.java | 28 +++++++++++++-- .../impl/PostgreSQLCertificateDAOImpl.java | 28 +++++++++++++-- .../dao/impl/SQLServerCertificateDAOImpl.java | 28 +++++++++++++-- .../mgt/core/dto/CertificateResponse.java | 34 +++++++++++++++---- .../mgt/core/impl/CertificateGenerator.java | 2 +- .../service/CertificateManagementService.java | 2 +- .../CertificateManagementServiceImpl.java | 8 ++--- ...CertificateManagementServiceImplTests.java | 2 +- 13 files changed, 161 insertions(+), 34 deletions(-) diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java index 0adb7ee601..c64df487be 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java @@ -151,20 +151,20 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem } @DELETE - public Response removeCertificate(@QueryParam("serialNumber") String serialNumber) { - RequestValidationUtil.validateSerialNumber(serialNumber); + public Response removeCertificate(@QueryParam("certificateId") String certificateId) { + RequestValidationUtil.validateCertificateId(certificateId); CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService(); try { - boolean status = certificateService.removeCertificate(serialNumber); + boolean status = certificateService.removeCertificate(certificateId); if (!status) { return Response.status(Response.Status.NOT_FOUND).entity( "No certificate is found with the given " + - "serial number '" + serialNumber + "'").build(); + "certificate id '" + certificateId + "'").build(); } else { return Response.status(Response.Status.OK).entity( - "Certificate that carries the serial number '" + - serialNumber + "' has been removed").build(); + "Certificate that carries the certificate id '" + + certificateId + "' has been removed").build(); } } catch (CertificateManagementException e) { String msg = "Error occurred while converting PEM file to X509Certificate"; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java index 43f4d1ab48..6263ac9e46 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java @@ -30,6 +30,14 @@ public class RequestValidationUtil { } } + public static void validateCertificateId(String certificateId) { + if (certificateId == null || certificateId.isEmpty()) { + throw new InputValidationException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage( + "Certificate Id cannot be null or empty").build()); + } + } + public static void validatePaginationInfo(int offset, int limit) { if (offset < 0) { throw new InputValidationException( diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateDAO.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateDAO.java index 779251761e..a3200621d1 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateDAO.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateDAO.java @@ -95,10 +95,10 @@ public interface CertificateDAO { /** * Delete a certificate identified by a serial number() * - * @param serialNumber serial number + * @param certificateId number * @return whether the certificate was removed or not. */ - boolean removeCertificate(String serialNumber) throws CertificateManagementDAOException; + boolean removeCertificate(String certificateId) throws CertificateManagementDAOException; List searchCertificate(String serialNumber) throws CertificateManagementDAOException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java index d2b5be4062..8e87ffff38 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java @@ -237,7 +237,7 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, TENANT_ID, USERNAME" + String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME" + " FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); @@ -247,6 +247,8 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{ certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); @@ -263,7 +265,7 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{ } @Override - public boolean removeCertificate(String serialNumber) throws CertificateManagementDAOException { + public boolean removeCertificate(String certificateId) throws CertificateManagementDAOException { Connection conn; PreparedStatement stmt = null; ResultSet resultSet = null; @@ -271,15 +273,15 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{ try { conn = this.getConnection(); String query = - "DELETE FROM DM_DEVICE_CERTIFICATE WHERE SERIAL_NUMBER = ?" + + "DELETE FROM DM_DEVICE_CERTIFICATE WHERE ID = ?" + " AND TENANT_ID = ? "; stmt = conn.prepareStatement(query); - stmt.setString(1, serialNumber); + stmt.setString(1, certificateId); stmt.setInt(2, tenantId); return stmt.executeUpdate() > 0; } catch (SQLException e) { - String msg = "Unable to get the read the certificate with serial" + serialNumber; + String msg = "Unable to get the read the certificate with certificate id" + certificateId; log.error(msg, e); throw new CertificateManagementDAOException(msg, e); } finally { diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java index 99bf38c73f..f3cba82857 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java @@ -47,6 +47,27 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { private Connection getConnection() throws SQLException { return CertificateManagementDAOFactory.getConnection(); } + private int getCertificateCount(int tenantId) throws CertificateManagementDAOException, SQLException { + int certificateCount = 0; + try { + Connection conn = this.getConnection(); + String sql = + "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + } + } + } + } catch (SQLException e) { + String errorMsg = "SQL error occurred while retrieving the certificates."; + log.error(errorMsg, e); + throw new CertificateManagementDAOException(errorMsg, e); + } + return certificateCount; + } @Override public PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementDAOException { @@ -58,7 +79,7 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, TENANT_ID, USERNAME FROM " + String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME FROM " + "DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC LIMIT ?,?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); @@ -71,6 +92,8 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); @@ -79,7 +102,7 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { } paginationResult = new PaginationResult(); paginationResult.setData(certificates); - paginationResult.setRecordsTotal(resultCount); + paginationResult.setRecordsTotal(this.getCertificateCount(tenantId)); } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java index 2b2e934570..f326f9cf97 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java @@ -53,7 +53,7 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, TENANT_ID, USERNAME FROM " + String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME FROM " + "DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); @@ -66,6 +66,8 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); @@ -74,7 +76,7 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { } paginationResult = new PaginationResult(); paginationResult.setData(certificates); - paginationResult.setRecordsTotal(resultCount); + paginationResult.setRecordsTotal(this.getCertificateCount(tenantId)); } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); @@ -88,4 +90,26 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { private Connection getConnection() throws SQLException { return CertificateManagementDAOFactory.getConnection(); } + + private int getCertificateCount(int tenantId) throws CertificateManagementDAOException, SQLException { + int certificateCount = 0; + try { + Connection conn = this.getConnection(); + String sql = + "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + } + } + } + } catch (SQLException e) { + String errorMsg = "SQL error occurred while retrieving the certificates."; + log.error(errorMsg, e); + throw new CertificateManagementDAOException(errorMsg, e); + } + return certificateCount; + } } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java index 6e8ea00703..7d187cfa3d 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java @@ -53,7 +53,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, TENANT_ID, USERNAME FROM " + String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME FROM " + "DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC LIMIT ? OFFSET ?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); @@ -66,6 +66,8 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); @@ -74,7 +76,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { } paginationResult = new PaginationResult(); paginationResult.setData(certificates); - paginationResult.setRecordsTotal(resultCount); + paginationResult.setRecordsTotal(this.getCertificateCount(tenantId)); } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); @@ -88,4 +90,26 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { private Connection getConnection() throws SQLException { return CertificateManagementDAOFactory.getConnection(); } + + private int getCertificateCount(int tenantId) throws CertificateManagementDAOException, SQLException { + int certificateCount = 0; + try { + Connection conn = this.getConnection(); + String sql = + "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + } + } + } + } catch (SQLException e) { + String errorMsg = "SQL error occurred while retrieving the certificates."; + log.error(errorMsg, e); + throw new CertificateManagementDAOException(errorMsg, e); + } + return certificateCount; + } } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java index de8d911c29..6615ab4c12 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java @@ -53,7 +53,7 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, TENANT_ID, USERNAME FROM " + String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME FROM " + "DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); @@ -66,6 +66,8 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); @@ -74,7 +76,7 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { } paginationResult = new PaginationResult(); paginationResult.setData(certificates); - paginationResult.setRecordsTotal(resultCount); + paginationResult.setRecordsTotal(this.getCertificateCount(tenantId)); } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); @@ -88,4 +90,26 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { private Connection getConnection() throws SQLException { return CertificateManagementDAOFactory.getConnection(); } + + private int getCertificateCount(int tenantId) throws CertificateManagementDAOException, SQLException { + int certificateCount = 0; + try { + Connection conn = this.getConnection(); + String sql = + "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + } + } + } + } catch (SQLException e) { + String errorMsg = "SQL error occurred while retrieving the certificates."; + log.error(errorMsg, e); + throw new CertificateManagementDAOException(errorMsg, e); + } + return certificateCount; + } } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dto/CertificateResponse.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dto/CertificateResponse.java index 44b0df5193..23f37a0efa 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dto/CertificateResponse.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dto/CertificateResponse.java @@ -32,6 +32,12 @@ public class CertificateResponse { @ApiModelProperty(name = "serialNumber", value = "It is the unique ID that is used to identify a certificate", required = true) String serialNumber; + @ApiModelProperty(name = "deviceIdentifier", value = "It is use to identify a certificate list", required = true) + String deviceIdentifier; + + @ApiModelProperty(name = "certificateId", value = "It is the unique ID that is used to identify a certificate", required = true) + String certificateId; + @ApiModelProperty(name = "tenantId", value = "The ID of the tenant who adds the certificate", required = true) int tenantId; @@ -44,8 +50,8 @@ public class CertificateResponse { @ApiModelProperty(name = "notBefore", value = "The date from when the certificate is valid", required = true) long notBefore; - @ApiModelProperty(name = "certificateserial", value = "The serial number of the certificate", required = true) - BigInteger certificateserial; + @ApiModelProperty(name = "certificateSerial", value = "The serial number of the certificate", required = true) + BigInteger certificateSerial; @ApiModelProperty(name = "issuer", value = "The identity of the authority that signs the SSL certificate", required = true) String issuer; @@ -83,12 +89,12 @@ public class CertificateResponse { this.notBefore = notBefore; } - public BigInteger getCertificateserial() { - return certificateserial; + public BigInteger getCertificateSerial() { + return certificateSerial; } - public void setCertificateserial(BigInteger certificateserial) { - this.certificateserial = certificateserial; + public void setCertificateSerial(BigInteger certificateSerial) { + this.certificateSerial = certificateSerial; } public String getIssuer() { @@ -146,4 +152,20 @@ public class CertificateResponse { public void setTenantId(int tenantId) { this.tenantId = tenantId; } + + public String getDeviceIdentifier() { + return deviceIdentifier; + } + + public void setDeviceIdentifier(String deviceIdentifier) { + this.deviceIdentifier = deviceIdentifier; + } + + public String getCertificateId() { + return certificateId; + } + + public void setCertificateId(String certificateId) { + this.certificateId = certificateId; + } } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java index 328c2fcbfb..f90762897d 100755 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java @@ -130,7 +130,7 @@ public class CertificateGenerator { X509Certificate certificate = (X509Certificate) x509Certificate; certificateResponse.setNotAfter(certificate.getNotAfter().getTime()); certificateResponse.setNotBefore(certificate.getNotBefore().getTime()); - certificateResponse.setCertificateserial(certificate.getSerialNumber()); + certificateResponse.setCertificateSerial(certificate.getSerialNumber()); certificateResponse.setIssuer(certificate.getIssuerDN().getName()); certificateResponse.setSubject(certificate.getSubjectDN().getName()); certificateResponse.setCertificateVersion(certificate.getVersion()); diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementService.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementService.java index 3eb94d21f1..61d333413e 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementService.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementService.java @@ -73,7 +73,7 @@ public interface CertificateManagementService { PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementException; - boolean removeCertificate(String serialNumber) throws CertificateManagementException; + boolean removeCertificate(String certificateId) throws CertificateManagementException; List getCertificates() throws CertificateManagementException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java index 95ec72a111..bcd696f21e 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java @@ -174,20 +174,20 @@ public class CertificateManagementServiceImpl implements CertificateManagementSe } @Override - public boolean removeCertificate(String serialNumber) throws CertificateManagementException { + public boolean removeCertificate(String certificateId) throws CertificateManagementException { try { CertificateManagementDAOFactory.beginTransaction(); CertificateDAO certificateDAO = CertificateManagementDAOFactory.getCertificateDAO(); - boolean status = certificateDAO.removeCertificate(serialNumber); + boolean status = certificateDAO.removeCertificate(certificateId); CertificateManagementDAOFactory.commitTransaction(); return status; } catch (TransactionManagementException e) { - String msg = "Error occurred while removing certificate carrying serial number '" + serialNumber + "'"; + String msg = "Error occurred while removing certificate carrying certificate id '" + certificateId + "'"; log.error(msg, e); throw new CertificateManagementException(msg, e); } catch (CertificateManagementDAOException e) { CertificateManagementDAOFactory.rollbackTransaction(); - String msg = "Error occurred while removing the certificate carrying serial number '" + serialNumber + + String msg = "Error occurred while removing the certificate carrying certificate id '" + certificateId + "' from the certificate repository"; log.error(msg, e); throw new CertificateManagementException(msg, e); diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java index 81ff3db86f..ff6ad09e88 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java @@ -210,7 +210,7 @@ public class CertificateManagementServiceImplTests extends BaseDeviceManagementC X509Certificate x509Certificate = managementService.generateX509Certificate(); CertificateResponse certificateResponse = managementService.retrieveCertificate(x509Certificate.getSerialNumber().toString()); Assert.assertNotNull(certificateResponse); - Assert.assertEquals(x509Certificate.getSerialNumber(), certificateResponse.getCertificateserial()); + Assert.assertEquals(x509Certificate.getSerialNumber(), certificateResponse.getCertificateSerial()); } @Test(description = "This test case tests the retrieval of Certificates from keystore in desired pagination") From 81fd5687ef74fedfc9b6b1e88678d82b7ce23283 Mon Sep 17 00:00:00 2001 From: osh Date: Sun, 9 Jul 2023 00:50:57 +0530 Subject: [PATCH 012/112] Update user service and token retrieval --- .../core/impl/VppApplicationManagerImpl.java | 72 ++++++++++--------- .../application/mgt/core/util/DAOUtil.java | 31 ++++++-- 2 files changed, 62 insertions(+), 41 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index 9ecc31ee46..f250af7a6b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -114,12 +114,12 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { Gson gson = new Gson(); String userPayload = gson.toJson(wrapper); - ProxyResponse proxyResponse = callVPPBackend(USER_CREATE, userPayload, TOKEN, Constants.VPP.POST); + ProxyResponse proxyResponse = callVPPBackend(USER_CREATE, userPayload, getVppToken(), Constants.VPP.POST); if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.EVENT_ID)) { // Create user does not return any useful data. Its needed to call the backend again ProxyResponse getUserResponse = callVPPBackend(USER_GET + Constants.VPP.CLIENT_USER_ID_PARAM + - userDTO.getClientUserId(), userPayload, TOKEN, Constants.VPP.GET); + userDTO.getClientUserId(), userPayload, getVppToken(), Constants.VPP.GET); if ((getUserResponse.getCode() == HttpStatus.SC_OK || getUserResponse.getCode() == HttpStatus.SC_CREATED) && getUserResponse.getData().contains(Constants.VPP.TOTAL_PAGES)) { VppItuneUserResponseWrapper vppItuneUserResponseWrapper = gson.fromJson @@ -196,38 +196,40 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { Gson gson = new Gson(); String userPayload = gson.toJson(wrapper); try { - ProxyResponse proxyResponse = callVPPBackend(USER_UPDATE, userPayload, TOKEN, Constants.VPP.POST); + ProxyResponse proxyResponse = callVPPBackend(USER_UPDATE, userPayload, getVppToken(), Constants.VPP.POST); if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.EVENT_ID)) { - - log.error("userDTO " + userDTO.toString()); - - try { - ConnectionManagerUtil.beginDBTransaction(); - if (vppApplicationDAO.updateVppUser(userDTO, tenantId) == null) { - ConnectionManagerUtil.rollbackDBTransaction(); - String msg = "Unable to update the Vpp user " +userDTO.getId(); - log.error(msg); - throw new ApplicationManagementException(msg); + VppUserDTO currentUserDTO = getUserByDMUsername(userDTO.getDmUsername()); + if (currentUserDTO != null) { + userDTO.setId(currentUserDTO.getId()); + } + try { + ConnectionManagerUtil.beginDBTransaction(); + if (vppApplicationDAO.updateVppUser(userDTO, tenantId) == null) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Unable to update the Vpp user " +userDTO.getId(); + log.error(msg); + throw new ApplicationManagementException(msg); + } + ConnectionManagerUtil.commitDBTransaction(); + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while updating the Vpp User."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while executing database transaction for Vpp User update."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while retrieving the database connection for Vpp User update."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); } - ConnectionManagerUtil.commitDBTransaction(); - } catch (ApplicationManagementDAOException e) { - ConnectionManagerUtil.rollbackDBTransaction(); - String msg = "Error occurred while updating the Vpp User."; - log.error(msg, e); - throw new ApplicationManagementException(msg, e); - } catch (TransactionManagementException e) { - String msg = "Error occurred while executing database transaction for Vpp User update."; - log.error(msg, e); - throw new ApplicationManagementException(msg, e); - } catch (DBConnectionException e) { - String msg = "Error occurred while retrieving the database connection for Vpp User update."; - log.error(msg, e); - throw new ApplicationManagementException(msg, e); - } finally { - ConnectionManagerUtil.closeDBConnection(); } - } + } catch (IOException e) { String msg = "Error while calling VPP backend to update"; log.error(msg, e); @@ -239,7 +241,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { public void syncUsers(String clientId) throws ApplicationManagementException { ProxyResponse proxyResponse = null; try { - proxyResponse = callVPPBackend(USER_GET, null, TOKEN, Constants + proxyResponse = callVPPBackend(USER_GET, null, getVppToken(), Constants .VPP.GET); if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.TOTAL_PAGES)) { @@ -266,7 +268,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { if (nextPageIndex > 0) { // Not the first page url += "?pageIndex=" + nextPageIndex; } - proxyResponse = callVPPBackend(url, null, TOKEN, Constants.VPP.GET); + proxyResponse = callVPPBackend(url, null, getVppToken(), Constants.VPP.GET); if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.TOTAL_PAGES)) { Gson gson = new Gson(); @@ -360,7 +362,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { private ItuneAppDTO lookupAsset(String packageName) throws ApplicationManagementException { String lookupURL = LOOKUP_API + packageName + LOOKUP_API_PREFIX; try { - ProxyResponse proxyResponse = callVPPBackend(lookupURL, null, TOKEN, Constants.VPP.GET); + ProxyResponse proxyResponse = callVPPBackend(lookupURL, null, getVppToken(), Constants.VPP.GET); if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.GET_APP_DATA_RESPONSE_START)) { String responseData = proxyResponse.getData(); @@ -467,12 +469,12 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { Gson gson = new Gson(); String payload = gson.toJson(vppAssociate); - ProxyResponse proxyResponse = callVPPBackend(ASSIGNMENTS_POST, payload, TOKEN, + ProxyResponse proxyResponse = callVPPBackend(ASSIGNMENTS_POST, payload, getVppToken(), Constants.VPP.POST); if ((proxyResponse.getCode() == HttpStatus.SC_OK || proxyResponse.getCode() == HttpStatus.SC_CREATED) && proxyResponse.getData().contains(Constants.VPP.EVENT_ID)) { // Create assignment does not return any useful data. Its needed to call the backend again - ProxyResponse getAssignmentResponse = callVPPBackend(ASSIGNMENTS_GET, null, TOKEN, Constants.VPP.GET); + ProxyResponse getAssignmentResponse = callVPPBackend(ASSIGNMENTS_GET, null, getVppToken(), Constants.VPP.GET); if ((getAssignmentResponse.getCode() == HttpStatus.SC_OK || getAssignmentResponse.getCode() == HttpStatus.SC_CREATED) && getAssignmentResponse.getData().contains(Constants.VPP.TOTAL_PAGES)) { // VppAssociateResponseWrapper vppAssociateResponseWrapper = gson.fromJson diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index 256a76bb0c..1f497ea5ec 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -33,6 +33,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; @@ -375,10 +376,16 @@ public class DAOUtil { vppUserDTO.setDmUsername(rs.getString("DM_USERNAME")); } if (rs.getLong("CREATED_TIME") != 0) { - vppUserDTO.setCreatedTime(new Date(rs.getLong(("CREATED_TIME")) * 1000).toString()); + Date date = new Date(rs.getLong("CREATED_TIME")); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = dateFormat.format(date); + vppUserDTO.setCreatedTime(dateString); } if (rs.getLong("LAST_UPDATED_TIME") != 0) { - vppUserDTO.setLastUpdatedTime(new Date(rs.getLong(("LAST_UPDATED_TIME")) * 1000).toString()); + Date date = new Date(rs.getLong("LAST_UPDATED_TIME")); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = dateFormat.format(date); + vppUserDTO.setLastUpdatedTime(dateString); } vppUserDTOS.add(vppUserDTO); } @@ -416,10 +423,16 @@ public class DAOUtil { vppAssetDTO.setAppId(rs.getInt("APP_ID")); vppAssetDTO.setTenantId(rs.getInt("TENANT_ID")); if (rs.getLong("CREATED_TIME") != 0) { - vppAssetDTO.setCreatedTime(new Date(rs.getLong(("CREATED_TIME")) * 1000).toString()); + Date date = new Date(rs.getLong("CREATED_TIME")); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = dateFormat.format(date); + vppAssetDTO.setCreatedTime(dateString); } if (rs.getLong("LAST_UPDATED_TIME") != 0) { - vppAssetDTO.setLastUpdatedTime(new Date(rs.getLong(("LAST_UPDATED_TIME")) * 1000).toString()); + Date date = new Date(rs.getLong("LAST_UPDATED_TIME")); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = dateFormat.format(date); + vppAssetDTO.setLastUpdatedTime(dateString); } vppAssetDTO.setAdamId(rs.getString("ADAM_ID")); vppAssetDTO.setAssignedCount(rs.getString("ASSIGNED_COUNT")); @@ -461,10 +474,16 @@ public class DAOUtil { vppAssociationDTO.setId(rs.getInt("ID")); vppAssociationDTO.setAssociationType(rs.getString("ASSOCIATION_TYPE")); if (rs.getLong("CREATED_TIME") != 0) { - vppAssociationDTO.setCreatedTime(new Date(rs.getLong(("CREATED_TIME")) * 1000).toString()); + Date date = new Date(rs.getLong("CREATED_TIME")); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = dateFormat.format(date); + vppAssociationDTO.setCreatedTime(dateString); } if (rs.getLong("LAST_UPDATED_TIME") != 0) { - vppAssociationDTO.setLastUpdatedTime(new Date(rs.getLong(("LAST_UPDATED_TIME")) * 1000).toString()); + Date date = new Date(rs.getLong("LAST_UPDATED_TIME")); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = dateFormat.format(date); + vppAssociationDTO.setLastUpdatedTime(dateString); } vppAssociationDTO.setPricingParam(rs.getString("PRICING_PARAMS")); vppAssociationDTOS.add(vppAssociationDTO); From eb740773aa32c94c9356e579d249cfb404022b0d Mon Sep 17 00:00:00 2001 From: osh Date: Tue, 11 Jul 2023 15:59:42 +0530 Subject: [PATCH 013/112] Improve update asset DAO fixes https://roadmap.entgra.net/issues/10179 --- .../vpp/GenericVppApplicationDAOImpl.java | 102 ++++++++++++------ .../core/impl/VppApplicationManagerImpl.java | 1 + 2 files changed, 68 insertions(+), 35 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index 936e8da7e3..df29a3f4b7 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -261,9 +261,9 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp + "PRICING_PARAMS," + "PRODUCT_TYPE," + "RETIRED_COUNT," - + "REVOCABLE) " -// + "SUPPORTED_PLATFORMS) " - + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + + "REVOCABLE, " + + "SUPPORTED_PLATFORMS) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; try { Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { @@ -279,9 +279,9 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp stmt.setString(9, vppAssetDTO.getProductType()); stmt.setString(10, vppAssetDTO.getRetiredCount()); stmt.setString(11, vppAssetDTO.getRevocable()); -// List platformList = vppAssetDTO.getSupportedPlatforms(); -// String platformString = String.join(",", platformList); -// stmt.setString(12, platformString); + List platformList = vppAssetDTO.getSupportedPlatforms(); + String platformString = String.join(",", platformList); + stmt.setString(12, platformString); stmt.executeUpdate(); try (ResultSet rs = stmt.getGeneratedKeys()) { if (rs.next()) { @@ -305,39 +305,71 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp public VppAssetDTO updateAsset(VppAssetDTO vppAssetDTO, int tenantId) throws ApplicationManagementDAOException { - String sql = "UPDATE " - + "AP_ASSETS " - + "SET " - + "APP_ID = ?," - + "LAST_UPDATED_TIME = ?, " - + "ADAM_ID = ?, " - + "ASSIGNED_COUNT = ?, " - + "DEVICE_ASSIGNABLE = ?, " - + "PRICING_PARAMS = ?, " - + "PRODUCT_TYPE = ?, " - + "RETIRED_COUNT = ?, " - + "REVOCABLE = ? " -// + "SUPPORTED_PLATFORMS = ? " - + "WHERE ID = ? AND TENANT_ID = ?"; + String sql = "UPDATE AP_ASSETS SET "; + + if (vppAssetDTO.getAdamId() != null && !vppAssetDTO.getAdamId().isEmpty()) { + sql += "ADAM_ID = ?, "; + } + if (vppAssetDTO.getAssignedCount() != null && !vppAssetDTO.getAssignedCount().isEmpty()) { + sql += "ASSIGNED_COUNT = ?, "; + } + if (vppAssetDTO.getDeviceAssignable() != null && !vppAssetDTO.getDeviceAssignable().isEmpty()) { + sql += "DEVICE_ASSIGNABLE = ?, "; + } + if (vppAssetDTO.getPricingParam() != null && !vppAssetDTO.getPricingParam().isEmpty()) { + sql += "PRICING_PARAMS = ?, "; + } + if (vppAssetDTO.getProductType() != null && !vppAssetDTO.getProductType().isEmpty()) { + sql += "PRODUCT_TYPE = ?, "; + } + if (vppAssetDTO.getRetiredCount() != null && !vppAssetDTO.getRetiredCount().isEmpty()) { + sql += "RETIRED_COUNT = ?, "; + } + if (vppAssetDTO.getRevocable() != null && !vppAssetDTO.getRevocable().isEmpty()) { + sql += "REVOCABLE = ?, "; + } + if (vppAssetDTO.getSupportedPlatforms() != null && !vppAssetDTO.getSupportedPlatforms().isEmpty()) { + sql += "SUPPORTED_PLATFORMS = ?,"; + } + sql += "APP_ID = ?, LAST_UPDATED_TIME = ? WHERE ID = ? AND TENANT_ID = ?"; + try { Connection conn = this.getDBConnection(); long updatedTime = System.currentTimeMillis(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, vppAssetDTO.getAppId()); - stmt.setLong(2, updatedTime); - stmt.setString(3, vppAssetDTO.getAdamId()); - stmt.setString(4, vppAssetDTO.getAssignedCount()); - stmt.setString(5, vppAssetDTO.getDeviceAssignable()); - stmt.setString(6, vppAssetDTO.getPricingParam()); - stmt.setString(7, vppAssetDTO.getProductType()); - stmt.setString(8, vppAssetDTO.getRetiredCount()); - stmt.setString(9, vppAssetDTO.getRevocable()); -// List platformList = vppAssetDTO.getSupportedPlatforms(); -// String platformString = String.join(",", platformList); -// stmt.setString(10, platformString); - stmt.setInt(10, vppAssetDTO.getId()); - stmt.setLong(11, tenantId); - stmt.executeUpdate(); + int x = 0; + + if (vppAssetDTO.getAdamId() != null && !vppAssetDTO.getAdamId().isEmpty()) { + stmt.setString(++x, vppAssetDTO.getAdamId()); + } + if (vppAssetDTO.getAssignedCount() != null && !vppAssetDTO.getAssignedCount().isEmpty()) { + stmt.setString(++x, vppAssetDTO.getAssignedCount()); + } + if (vppAssetDTO.getDeviceAssignable() != null && !vppAssetDTO.getDeviceAssignable().isEmpty()) { + stmt.setString(++x, vppAssetDTO.getDeviceAssignable()); + } + if (vppAssetDTO.getPricingParam() != null && !vppAssetDTO.getPricingParam().isEmpty()) { + stmt.setString(++x, vppAssetDTO.getPricingParam()); + } + if (vppAssetDTO.getProductType() != null && !vppAssetDTO.getProductType().isEmpty()) { + stmt.setString(++x, vppAssetDTO.getProductType()); + } + if (vppAssetDTO.getRetiredCount() != null && !vppAssetDTO.getRetiredCount().isEmpty()) { + stmt.setString(++x, vppAssetDTO.getRetiredCount()); + } + if (vppAssetDTO.getRevocable() != null && !vppAssetDTO.getRevocable().isEmpty()) { + stmt.setString(++x, vppAssetDTO.getRevocable()); + } + if (vppAssetDTO.getSupportedPlatforms() != null && !vppAssetDTO.getSupportedPlatforms().isEmpty()) { + List platformList = vppAssetDTO.getSupportedPlatforms(); + String platformString = String.join(",", platformList); + stmt.setString(++x, platformString); + } + + stmt.setInt(++x, vppAssetDTO.getAppId()); + stmt.setLong(++x, updatedTime); + stmt.setInt(++x, vppAssetDTO.getId()); + stmt.setLong(++x, tenantId); if (stmt.executeUpdate() == 1) { return vppAssetDTO; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index f250af7a6b..8ab98ad5a5 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -315,6 +315,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { } } else { vppAssetDTOs.setAppId(application.getId()); + vppAssetDTOs.setSupportedPlatforms(vppAssetDTO.getSupportedPlatforms()); try { ConnectionManagerUtil.beginDBTransaction(); if (vppApplicationDAO.updateAsset(vppAssetDTOs, tenantId) == null) { From 01df3700322964fdb407d992597c49191f10ba6d Mon Sep 17 00:00:00 2001 From: osh Date: Thu, 13 Jul 2023 14:40:15 +0530 Subject: [PATCH 014/112] Add db scripts --- .../dbscripts/cdm/application-mgt/h2.sql | 54 ++++++++++++++++++ .../dbscripts/cdm/application-mgt/mssql.sql | 56 +++++++++++++++++++ .../dbscripts/cdm/application-mgt/mysql.sql | 54 ++++++++++++++++++ .../dbscripts/cdm/application-mgt/oracle.sql | 47 ++++++++++++++++ .../cdm/application-mgt/postgresql.sql | 53 ++++++++++++++++++ 5 files changed, 264 insertions(+) diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql index f9c5861831..e129d6f68e 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql @@ -325,3 +325,57 @@ CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( FOREIGN KEY (AP_APP_ID) REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); + +-- ----------------------------------------------------- +-- Table AP_VPP_USER +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_VPP_USER ( + ID INT NOT NULL AUTO_INCREMENT, + CLIENT_USER_ID VARCHAR(255) NULL, + DM_USERNAME VARCHAR(255) NOT NULL, + TENANT_ID INT NOT NULL, + EMAIL VARCHAR(255) NULL, + INVITE_CODE VARCHAR(255) NULL, + STATUS VARCHAR(255) NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, + MANAGED_ID VARCHAR(255) NULL, + TEMP_PASSWORD VARCHAR(255) NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table AP_ASSETS +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_ASSETS ( + ID INT NOT NULL AUTO_INCREMENT, + APP_ID INT NULL, + TENANT_ID INT NOT NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, + ADAM_ID VARCHAR(255) NULL, + ASSIGNED_COUNT VARCHAR(255) NULL, + DEVICE_ASSIGNABLE VARCHAR(255) NULL, + PRICING_PARAMS VARCHAR(255) NULL, + PRODUCT_TYPE VARCHAR(255) NULL, + RETIRED_COUNT VARCHAR(255) NULL, + REVOCABLE VARCHAR(255) NULL, + SUPPORTED_PLATFORMS VARCHAR(255) NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table AP_VPP_ASSOCIATION +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION ( + ID INT NOT NULL AUTO_INCREMENT, + ASSET_ID INT, + USER_ID INT, + TENANT_ID INT NOT NULL, + ASSOCIATION_TYPE VARCHAR(255) NOT NULL, + PRICING_PARAMS VARCHAR(255) NULL, + PRIMARY KEY (ID), + CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE +); diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql index 9b2e89b3f7..143d2f2103 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql @@ -342,3 +342,59 @@ CREATE TABLE AP_APP_FAVOURITES( FOREIGN KEY (AP_APP_ID) REFERENCES AP_APP (ID) ); + +-- ----------------------------------------------------- +-- Table AP_VPP_USER +-- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'AP_VPP_USER') AND type in (N'U')) +CREATE TABLE AP_VPP_USER ( + ID INT NOT NULL IDENTITY(1,1), + CLIENT_USER_ID VARCHAR(255) NULL, + DM_USERNAME VARCHAR(255) NOT NULL, + TENANT_ID INT NOT NULL, + EMAIL VARCHAR(255) NULL, + INVITE_CODE VARCHAR(255) NULL, + STATUS VARCHAR(255) NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, + MANAGED_ID VARCHAR(255) NULL, + TEMP_PASSWORD VARCHAR(255) NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table AP_ASSETS +-- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'AP_ASSETS') AND type in (N'U')) +CREATE TABLE AP_ASSETS ( + ID INT NOT NULL IDENTITY(1,1), + APP_ID INT NULL, + TENANT_ID INT NOT NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, + ADAM_ID VARCHAR(255) NULL, + ASSIGNED_COUNT VARCHAR(255) NULL, + DEVICE_ASSIGNABLE VARCHAR(255) NULL, + PRICING_PARAMS VARCHAR(255) NULL, + PRODUCT_TYPE VARCHAR(255) NULL, + RETIRED_COUNT VARCHAR(255) NULL, + REVOCABLE VARCHAR(255) NULL, + SUPPORTED_PLATFORMS VARCHAR(255) NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table AP_VPP_ASSOCIATION +-- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'AP_VPP_ASSOCIATION') AND type in (N'U')) +CREATE TABLE AP_VPP_ASSOCIATION ( + ID INT NOT NULL IDENTITY(1,1), + ASSET_ID INT, + USER_ID INT, + TENANT_ID INT NOT NULL, + ASSOCIATION_TYPE VARCHAR(255) NOT NULL, + PRICING_PARAMS VARCHAR(255) NULL, + PRIMARY KEY (ID), + CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE +); diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql index 54ba58a9fe..d1ae759084 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql @@ -272,4 +272,58 @@ CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( TENANT_ID INTEGER NOT NULL, PRIMARY KEY(ID), CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk FOREIGN KEY (AP_APP_ID) REFERENCES AP_APP (ID) +); + +-- ----------------------------------------------------- +-- Table AP_VPP_USER +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_VPP_USER ( + ID INT NOT NULL AUTO_INCREMENT, + CLIENT_USER_ID VARCHAR(255) NULL, + DM_USERNAME VARCHAR(255) NOT NULL, + TENANT_ID INT NOT NULL, + EMAIL VARCHAR(255) NULL, + INVITE_CODE VARCHAR(255) NULL, + STATUS VARCHAR(255) NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, + MANAGED_ID VARCHAR(255) NULL, + TEMP_PASSWORD VARCHAR(255) NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table AP_ASSETS +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_ASSETS ( + ID INT NOT NULL AUTO_INCREMENT, + APP_ID INT NULL, + TENANT_ID INT NOT NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, + ADAM_ID VARCHAR(255) NULL, + ASSIGNED_COUNT VARCHAR(255) NULL, + DEVICE_ASSIGNABLE VARCHAR(255) NULL, + PRICING_PARAMS VARCHAR(255) NULL, + PRODUCT_TYPE VARCHAR(255) NULL, + RETIRED_COUNT VARCHAR(255) NULL, + REVOCABLE VARCHAR(255) NULL, + SUPPORTED_PLATFORMS VARCHAR(255) NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table AP_VPP_ASSOCIATION +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION ( + ID INT NOT NULL AUTO_INCREMENT, + ASSET_ID INT, + USER_ID INT, + TENANT_ID INT NOT NULL, + ASSOCIATION_TYPE VARCHAR(255) NOT NULL, + PRICING_PARAMS VARCHAR(255) NULL, + PRIMARY KEY (ID), + CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE ); \ No newline at end of file diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql index 79c5b1345f..c2f82d7e39 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql @@ -420,3 +420,50 @@ CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( REFERENCES AP_APP (ID) ) / + +CREATE TABLE AP_VPP_USER ( + ID number GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL, + CLIENT_USER_ID VARCHAR2(255) NULL, + DM_USERNAME VARCHAR2(255) NOT NULL, + TENANT_ID INT NOT NULL, + EMAIL VARCHAR2(255) NULL, + INVITE_CODE VARCHAR2(255) NULL, + STATUS VARCHAR2(255) NULL, + CREATED_TIME NUMBER(19) NULL, + LAST_UPDATED_TIME NUMBER(19) NULL, + MANAGED_ID VARCHAR2(255) NULL, + TEMP_PASSWORD VARCHAR2(255) NULL, + PRIMARY KEY (ID) +) +/ + +CREATE TABLE AP_ASSETS ( + ID number GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL, + APP_ID INT NULL, + TENANT_ID INT NOT NULL, + CREATED_TIME NUMBER(19) NULL, + LAST_UPDATED_TIME NUMBER(19) NULL, + ADAM_ID VARCHAR2(255) NULL, + ASSIGNED_COUNT VARCHAR2(255) NULL, + DEVICE_ASSIGNABLE VARCHAR2(255) NULL, + PRICING_PARAMS VARCHAR2(255) NULL, + PRODUCT_TYPE VARCHAR2(255) NULL, + RETIRED_COUNT VARCHAR2(255) NULL, + REVOCABLE VARCHAR2(255) NULL, + SUPPORTED_PLATFORMS VARCHAR2(255) NULL, + PRIMARY KEY (ID) +) +/ + +CREATE TABLE AP_VPP_ASSOCIATION ( + ID number GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL, + ASSET_ID INT, + USER_ID INT, + TENANT_ID INT NOT NULL, + ASSOCIATION_TYPE VARCHAR2(255) NOT NULL, + PRICING_PARAMS VARCHAR2(255) NULL, + PRIMARY KEY (ID), + CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE, + CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE +) +/ diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql index e8e1dbb225..f1645de58b 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql @@ -352,3 +352,56 @@ CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( FOREIGN KEY (AP_APP_ID) REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); + +-- ----------------------------------------------------- +-- Table AP_VPP_USER +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_VPP_USER ( + ID INTEGER NOT NULL DEFAULT NEXTVAL('AP_VPP_USER_seq'), + CLIENT_USER_ID VARCHAR(255) NULL, + DM_USERNAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EMAIL VARCHAR(255) NULL, + INVITE_CODE VARCHAR(255) NULL, + STATUS VARCHAR(255) NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, + MANAGED_ID VARCHAR(255) NULL, + TEMP_PASSWORD VARCHAR(255) NULL, + PRIMARY KEY (ID) + ); + +-- ----------------------------------------------------- +-- Table AP_ASSETS +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_ASSETS ( + ID INTEGER NOT NULL DEFAULT NEXTVAL('AP_ASSETS_seq'), + APP_ID INTEGER NULL, + TENANT_ID INTEGER NOT NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, + ADAM_ID VARCHAR(255) NULL, + ASSIGNED_COUNT VARCHAR(255) NULL, + DEVICE_ASSIGNABLE VARCHAR(255) NULL, + PRICING_PARAMS VARCHAR(255) NULL, + PRODUCT_TYPE VARCHAR(255) NULL, + RETIRED_COUNT VARCHAR(255) NULL, + REVOCABLE VARCHAR(255) NULL, + SUPPORTED_PLATFORMS VARCHAR(255) NULL, + PRIMARY KEY (ID) + ); + +-- ----------------------------------------------------- +-- Table AP_VPP_ASSOCIATION +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION ( + ID INTEGER NOT NULL DEFAULT NEXTVAL('AP_VPP_ASSOCIATION_seq'), + ASSET_ID INTEGER, + USER_ID INTEGER, + TENANT_ID INTEGER NOT NULL, + ASSOCIATION_TYPE VARCHAR(255) NOT NULL, + PRICING_PARAMS VARCHAR(255) NULL, + PRIMARY KEY (ID), + CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE + ); From dd7910268e685611498eb2def19083383686bfc3 Mon Sep 17 00:00:00 2001 From: osh Date: Mon, 17 Jul 2023 13:36:39 +0530 Subject: [PATCH 015/112] Add vpp token field --- .../mgt/core/application/mgt/common/DepConfig.java | 9 +++++++++ .../core/dao/impl/vpp/GenericVppApplicationDAOImpl.java | 2 +- .../mgt/core/impl/VppApplicationManagerImpl.java | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DepConfig.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DepConfig.java index 712ad11df2..244f88fb08 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DepConfig.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DepConfig.java @@ -26,6 +26,7 @@ public class DepConfig { private String accessToken; private String accessSecret; private String accessTokenExpiry; + private String vppToken; public String getAgentPackageName() { return agentPackageName; @@ -59,6 +60,14 @@ public class DepConfig { this.accessToken = accessToken; } + public String getVppToken() { + return vppToken; + } + + public void setVppToken(String vppToken) { + this.vppToken = vppToken; + } + public String getAccessSecret() { return accessSecret; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index df29a3f4b7..38fa090f94 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -174,7 +174,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp + "CREATED_TIME, " + "LAST_UPDATED_TIME, " + "MANAGED_ID, " - + "TEMP_PASSWORD " + + "TEMP_PASSWORD, " + "DM_USERNAME " + "FROM AP_VPP_USER " + "WHERE DM_USERNAME = ? AND TENANT_ID = ?"; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java index 8ab98ad5a5..dc9b34e40d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/VppApplicationManagerImpl.java @@ -591,7 +591,7 @@ public class VppApplicationManagerImpl implements VPPApplicationManager { Gson g = new Gson(); DepConfig depConfigs = g.fromJson(metadata.getMetaValue(), DepConfig.class); - token = depConfigs.getAccessToken(); + token = depConfigs.getVppToken(); return token; } }catch (MetadataManagementException e) { From 4b9cad1c755543053234cb01e7955982a9c9d0b5 Mon Sep 17 00:00:00 2001 From: osh Date: Mon, 17 Jul 2023 16:13:07 +0530 Subject: [PATCH 016/112] Update db queries --- .../src/main/resources/dbscripts/cdm/application-mgt/h2.sql | 2 ++ .../src/main/resources/dbscripts/cdm/application-mgt/mssql.sql | 2 ++ .../src/main/resources/dbscripts/cdm/application-mgt/mysql.sql | 2 ++ .../src/main/resources/dbscripts/cdm/application-mgt/oracle.sql | 2 ++ .../main/resources/dbscripts/cdm/application-mgt/postgresql.sql | 2 ++ 5 files changed, 10 insertions(+) diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql index e129d6f68e..27c7669289 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql @@ -375,6 +375,8 @@ CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION ( TENANT_ID INT NOT NULL, ASSOCIATION_TYPE VARCHAR(255) NOT NULL, PRICING_PARAMS VARCHAR(255) NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, PRIMARY KEY (ID), CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql index 143d2f2103..0c95c74ddd 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql @@ -393,6 +393,8 @@ CREATE TABLE AP_VPP_ASSOCIATION ( USER_ID INT, TENANT_ID INT NOT NULL, ASSOCIATION_TYPE VARCHAR(255) NOT NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, PRICING_PARAMS VARCHAR(255) NULL, PRIMARY KEY (ID), CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql index d1ae759084..448c249b85 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql @@ -323,6 +323,8 @@ CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION ( TENANT_ID INT NOT NULL, ASSOCIATION_TYPE VARCHAR(255) NOT NULL, PRICING_PARAMS VARCHAR(255) NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, PRIMARY KEY (ID), CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql index c2f82d7e39..66e518a59e 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql @@ -462,6 +462,8 @@ CREATE TABLE AP_VPP_ASSOCIATION ( TENANT_ID INT NOT NULL, ASSOCIATION_TYPE VARCHAR2(255) NOT NULL, PRICING_PARAMS VARCHAR2(255) NULL, + CREATED_TIME NUMBER(19) NULL, + LAST_UPDATED_TIME NUMBER(19) NULL, PRIMARY KEY (ID), CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE, CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql index f1645de58b..7f51f6e935 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql @@ -401,6 +401,8 @@ CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION ( TENANT_ID INTEGER NOT NULL, ASSOCIATION_TYPE VARCHAR(255) NOT NULL, PRICING_PARAMS VARCHAR(255) NULL, + CREATED_TIME BIGINT NULL, + LAST_UPDATED_TIME BIGINT NULL, PRIMARY KEY (ID), CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE From e7b0255a957d3542708a876b20ce668ee9c2ab31 Mon Sep 17 00:00:00 2001 From: osh Date: Tue, 18 Jul 2023 19:34:11 +0530 Subject: [PATCH 017/112] Add get device apps by id service --- .../common/services/ApplicationManager.java | 11 +++ .../mgt/core/dao/ApplicationDAO.java | 10 +++ .../GenericApplicationDAOImpl.java | 70 +++++++++++++++++++ .../mgt/core/impl/ApplicationManagerImpl.java | 29 ++++++++ .../application/mgt/core/util/DAOUtil.java | 20 ++++++ 5 files changed, 140 insertions(+) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java index 0c75b3b284..7451b8469f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java @@ -273,6 +273,17 @@ public interface ApplicationManager { */ ApplicationDTO getApplication(int applicationId) throws ApplicationManagementException; + /** + * This method is responsible to provide application data for given deviceId. + * + * @param deviceId id of the device + * @return {@link ApplicationDTO} + * @throws ApplicationManagementException + * if an error occurred while getting subscribed app details for relevant device id, + */ + ApplicationList getSubscribedAppsOfDevice(int deviceId) + throws ApplicationManagementException; + /** * To get the Application for given Id. * diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java index 6886e824f2..d46ed6336b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java @@ -150,6 +150,16 @@ public interface ApplicationDAO { */ ApplicationDTO getApplication(int applicationId, int tenantId) throws ApplicationManagementDAOException; + /** + * To get the application with the given id + * + * @param deviceId ID of the device which the apps are installed on. + * @param tenantId ID of the tenant. + * @return the application + * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception. + */ + List getSubscribedAppsOfDevice(int deviceId, int tenantId) throws ApplicationManagementDAOException; + /** * To get the application with the given uuid * diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index a6abaef4cb..361746f623 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -656,6 +656,76 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } } + @Override + public List getSubscribedAppsOfDevice(int deviceId, int tenantId) throws + ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Getting all installed apps of device " + deviceId + + " from the database"); + } + List appList = null; + + String sql = "SELECT " + + "AP_APP.ID AS APP_ID, " + + "AP_APP.NAME AS APP_NAME, " + + "AP_APP.DESCRIPTION AS APP_DESCRIPTION, " + + "AP_APP.TYPE AS APP_TYPE, " + + "AP_APP.STATUS AS APP_STATUS, " + + "AP_APP.SUB_TYPE AS APP_SUB_TYPE, " + + "AP_APP.CURRENCY AS APP_CURRENCY, " + + "AP_APP.RATING AS APP_RATING, " + + "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, " + + "AP_APP_RELEASE.ID AS RELEASE_ID, " + + "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, " + + "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, " + + "AP_APP_RELEASE.UUID AS RELEASE_UUID, " + + "AP_APP_RELEASE.RELEASE_TYPE AS RELEASE_TYPE, " + + "AP_APP_RELEASE.INSTALLER_LOCATION AS AP_RELEASE_STORED_LOC, " + + "AP_APP_RELEASE.ICON_LOCATION AS AP_RELEASE_ICON_LOC, " + + "AP_APP_RELEASE.BANNER_LOCATION AS AP_RELEASE_BANNER_LOC, " + + "AP_APP_RELEASE.SC_1_LOCATION AS AP_RELEASE_SC1, " + + "AP_APP_RELEASE.SC_2_LOCATION AS AP_RELEASE_SC2, " + + "AP_APP_RELEASE.SC_3_LOCATION AS AP_RELEASE_SC3, " + + "AP_APP_RELEASE.APP_HASH_VALUE AS RELEASE_HASH_VALUE, " + + "AP_APP_RELEASE.APP_PRICE AS RELEASE_PRICE, " + + "AP_APP_RELEASE.APP_META_INFO AS RELEASE_META_INFO, " + + "AP_APP_RELEASE.PACKAGE_NAME AS PACKAGE_NAME, " + + "AP_APP_RELEASE.SUPPORTED_OS_VERSIONS AS RELEASE_SUP_OS_VERSIONS, " + + "AP_APP_RELEASE.RATING AS RELEASE_RATING, " + + "AP_APP_RELEASE.CURRENT_STATE AS RELEASE_CURRENT_STATE, " + + "AP_APP_RELEASE.RATED_USERS AS RATED_USER_COUNT " + + "FROM AP_APP " + + "JOIN AP_APP_RELEASE ON AP_APP.ID = AP_APP_RELEASE.AP_APP_ID " + + "JOIN AP_DEVICE_SUBSCRIPTION ON AP_APP_RELEASE.ID = AP_DEVICE_SUBSCRIPTION.AP_APP_RELEASE_ID " + + "WHERE AP_DEVICE_SUBSCRIPTION.DM_DEVICE_ID = ? AND AP_DEVICE_SUBSCRIPTION.TENANT_ID= ? " + +"AND AP_DEVICE_SUBSCRIPTION.STATUS= 'COMPLETED'"; + + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, deviceId); + stmt.setInt(2, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + appList = new ArrayList<>(); + while (rs.next()) { + ApplicationDTO app = DAOUtil.loadDeviceApp(rs); + appList.add(app); + } + return appList; + } + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection for getting all apps installed on the device of " + + "device Id: " + deviceId + "."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while while running SQL to get all installed apps of device with device Id: " + deviceId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + @Override public boolean updateApplication(ApplicationDTO applicationDTO, int tenantId) throws ApplicationManagementDAOException { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index 3bb8ba8260..257994d0a9 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -1444,6 +1444,35 @@ public class ApplicationManagerImpl implements ApplicationManager { } } + @Override + public ApplicationList getSubscribedAppsOfDevice(int deviceId) throws ApplicationManagementException { + ApplicationList applicationList = new ApplicationList(); + List applications = new ArrayList<>(); + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + try { + ConnectionManagerUtil.openDBConnection(); + List applicationDTOS = this.applicationDAO.getSubscribedAppsOfDevice(deviceId, tenantId); + for (ApplicationDTO applicationDTO: applicationDTOS) { + applicationDTO.setTags(this.applicationDAO.getAppTags(applicationDTO.getId(), tenantId)); + applicationDTO.setAppCategories(this.applicationDAO.getAppCategories(applicationDTO.getId(), tenantId)); + applications.add(APIUtil.appDtoToAppResponse(applicationDTO)); + } + applicationList.setApplications(applications); + return applicationList; + } catch (ApplicationManagementDAOException e) { + String msg = "Error occurred when getting installed apps of device with device id: " + + deviceId; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "DB Connection error occurred while getting installed apps of device with device id: " + deviceId; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + /** * Check whether given OS range is valid or invalid * diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index 1960230759..5538cbfa05 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -241,6 +241,26 @@ public class DAOUtil { return applicationDTOs.get(0); } + public static ApplicationDTO loadDeviceApp(ResultSet rs) throws SQLException { + ApplicationDTO application = new ApplicationDTO(); + application.setId( rs.getInt("APP_ID")); + application.setName(rs.getString("APP_NAME")); + application.setDescription(rs.getString("APP_DESCRIPTION")); + application.setType(rs.getString("APP_TYPE")); + application.setSubType(rs.getString("APP_SUB_TYPE")); + application.setPaymentCurrency(rs.getString("APP_CURRENCY")); + application.setStatus(rs.getString("APP_STATUS")); + application.setAppRating(rs.getDouble("APP_RATING")); + application.setDeviceTypeId(rs.getInt("APP_DEVICE_TYPE_ID")); + ApplicationReleaseDTO releaseDTO = constructAppReleaseDTO(rs); + List releaseDtoList = new ArrayList<>(); + if (releaseDTO != null) { + releaseDtoList.add(constructAppReleaseDTO(rs)); + application.setApplicationReleaseDTOs(releaseDtoList); + } + return application; + } + /** * Populates {@link ApplicationReleaseDTO} object with the result obtained from the database. * From 77b68af5d0a80d194fdd4a4f5061efe734f21b44 Mon Sep 17 00:00:00 2001 From: osh Date: Tue, 18 Jul 2023 23:10:23 +0530 Subject: [PATCH 018/112] Add pagination --- .../mgt/common/services/ApplicationManager.java | 3 ++- .../application/mgt/core/dao/ApplicationDAO.java | 3 ++- .../impl/application/GenericApplicationDAOImpl.java | 11 ++++++++++- .../mgt/core/impl/ApplicationManagerImpl.java | 13 +++++++++++-- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java index 7451b8469f..57890f53eb 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java @@ -27,6 +27,7 @@ import io.entgra.device.mgt.core.application.mgt.common.response.Category; import io.entgra.device.mgt.core.application.mgt.common.response.Tag; import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import org.apache.cxf.jaxrs.ext.multipart.Attachment; import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact; @@ -281,7 +282,7 @@ public interface ApplicationManager { * @throws ApplicationManagementException * if an error occurred while getting subscribed app details for relevant device id, */ - ApplicationList getSubscribedAppsOfDevice(int deviceId) + ApplicationList getSubscribedAppsOfDevice(int deviceId, PaginationRequest request) throws ApplicationManagementException; /** diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java index d46ed6336b..ffa85b260d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java @@ -22,6 +22,7 @@ import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.CategoryDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.TagDTO; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import java.util.List; @@ -158,7 +159,7 @@ public interface ApplicationDAO { * @return the application * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception. */ - List getSubscribedAppsOfDevice(int deviceId, int tenantId) throws ApplicationManagementDAOException; + List getSubscribedAppsOfDevice(int deviceId, int tenantId, PaginationRequest request) throws ApplicationManagementDAOException; /** * To get the application with the given uuid diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 361746f623..1e403e5848 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -22,6 +22,7 @@ import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -657,7 +658,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } @Override - public List getSubscribedAppsOfDevice(int deviceId, int tenantId) throws + public List getSubscribedAppsOfDevice(int deviceId, int tenantId, PaginationRequest request) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { log.debug("Getting all installed apps of device " + deviceId @@ -700,11 +701,19 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic + "WHERE AP_DEVICE_SUBSCRIPTION.DM_DEVICE_ID = ? AND AP_DEVICE_SUBSCRIPTION.TENANT_ID= ? " +"AND AP_DEVICE_SUBSCRIPTION.STATUS= 'COMPLETED'"; + if (request != null) { + sql = sql + " LIMIT ?,?"; + } + try { Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, deviceId); stmt.setInt(2, tenantId); + if (request != null) { + stmt.setInt(3, request.getStartIndex()); + stmt.setInt(4, request.getRowCount()); + } try (ResultSet rs = stmt.executeQuery()) { appList = new ArrayList<>(); while (rs.next()) { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index 257994d0a9..22f5688b07 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -22,6 +22,7 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestExcept import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import org.apache.commons.codec.digest.DigestUtils; @@ -1445,19 +1446,27 @@ public class ApplicationManagerImpl implements ApplicationManager { } @Override - public ApplicationList getSubscribedAppsOfDevice(int deviceId) throws ApplicationManagementException { + public ApplicationList getSubscribedAppsOfDevice(int deviceId, PaginationRequest request) throws ApplicationManagementException { ApplicationList applicationList = new ApplicationList(); List applications = new ArrayList<>(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); try { ConnectionManagerUtil.openDBConnection(); - List applicationDTOS = this.applicationDAO.getSubscribedAppsOfDevice(deviceId, tenantId); + List applicationDTOS = this.applicationDAO.getSubscribedAppsOfDevice(deviceId, tenantId, request); for (ApplicationDTO applicationDTO: applicationDTOS) { applicationDTO.setTags(this.applicationDAO.getAppTags(applicationDTO.getId(), tenantId)); applicationDTO.setAppCategories(this.applicationDAO.getAppCategories(applicationDTO.getId(), tenantId)); applications.add(APIUtil.appDtoToAppResponse(applicationDTO)); } + + List totalApplications = this.applicationDAO.getSubscribedAppsOfDevice(deviceId, tenantId, null); + Pagination pagination = new Pagination(); + pagination.setCount(totalApplications.size()); + pagination.setSize(applications.size()); + pagination.setOffset(request.getStartIndex()); + pagination.setLimit(request.getRowCount()); applicationList.setApplications(applications); + applicationList.setPagination(pagination); return applicationList; } catch (ApplicationManagementDAOException e) { String msg = "Error occurred when getting installed apps of device with device id: " From 615da6303fb4d6d783ce81e462a95dafdfcb46c0 Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Mon, 24 Jul 2023 11:52:23 +0530 Subject: [PATCH 019/112] notify cluster formation changed implementation --- .../core/TestHeartBeatManagementService.java | 5 ++ .../beacon/config/HeartBeatBeaconConfig.java | 13 ++++ .../internal/HeartBeatBeaconComponent.java | 14 ++++ .../internal/HeartBeatBeaconDataHolder.java | 10 +++ .../beacon/internal/HeartBeatExecutor.java | 4 ++ .../ClusterFormationChangedNotifier.java | 25 ++++++++ ...terFormationChangedNotifierRepository.java | 64 +++++++++++++++++++ .../service/HeartBeatManagementService.java | 1 + .../HeartBeatManagementServiceImpl.java | 43 +++++++++++++ .../mock/TestHeartBeatManagementService.java | 5 ++ .../main/resources/conf/heart-beat-config.xml | 3 + .../repository/conf/heart-beat-config.xml.j2 | 10 +++ 12 files changed, 197 insertions(+) create mode 100644 components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifier.java create mode 100644 components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java index 0e5f71243c..8d5924709c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java @@ -66,4 +66,9 @@ public class TestHeartBeatManagementService implements HeartBeatManagementServic @Override public Map getActiveServers() throws HeartBeatManagementException { return null; } + + @Override + public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException { + + } } diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java index e7df3d8468..ca3cc09610 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java @@ -22,6 +22,7 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.HeartBeatBeaconC import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.HeartBeatBeaconUtils; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.InvalidConfigurationStateException; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.ClusterFormationChangedNotifier; import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; @@ -29,8 +30,10 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import java.io.File; +import java.util.List; @XmlRootElement(name = "HeartBeatBeaconConfig") public class HeartBeatBeaconConfig { @@ -50,6 +53,7 @@ public class HeartBeatBeaconConfig { private static final String SERVER_UUID_FILE_LOCATION = CarbonUtils.getCarbonConfigDirPath() + File.separator + "server-credentials.properties"; + private List notifiers; private HeartBeatBeaconConfig() { } @@ -135,4 +139,13 @@ public class HeartBeatBeaconConfig { } } + @XmlElementWrapper(name = "ClusterFormationChangedNotifiers", required = true) + @XmlElement(name = "Notifier", required = true) + public List getNotifiers() { + return notifiers; + } + + public void setNotifiers(List notifiers) { + this.notifiers = notifiers; + } } diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java index c7e874c3f5..5f07342a41 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java @@ -22,6 +22,7 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.HeartBeatBeaconU import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.HeartBeatBeaconConfig; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.HeartBeatBeaconDAOFactory; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.ClusterFormationChangedNotifierRepository; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementServiceImpl; import org.apache.commons.logging.Log; @@ -29,6 +30,8 @@ import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; import org.wso2.carbon.ndatasource.core.DataSourceService; +import java.util.List; + /** * @scr.component name="io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.heartbeatBeaconComponent" * immediate="true" @@ -62,6 +65,17 @@ public class HeartBeatBeaconComponent { HeartBeatExecutor.setUpNotifiers(HeartBeatBeaconUtils.getServerDetails()); } + ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository + = new ClusterFormationChangedNotifierRepository(); + List notifiers = HeartBeatBeaconConfig.getInstance().getNotifiers(); + if (notifiers != null && notifiers.size() > 0) { + for (String notifier : notifiers) { + clusterFormationChangedNotifierRepository.addNotifier(notifier); + } + } + HeartBeatBeaconDataHolder.getInstance().setClusterFormationChangedNotifierRepository( + clusterFormationChangedNotifierRepository); + if (log.isDebugEnabled()) { log.debug("Heart Beat Notifier bundle has been successfully initialized"); } diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconDataHolder.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconDataHolder.java index bde95e33c4..a3119d6064 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconDataHolder.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconDataHolder.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.ClusterFormationChangedNotifierRepository; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; public class HeartBeatBeaconDataHolder { @@ -27,6 +28,7 @@ public class HeartBeatBeaconDataHolder { private static HeartBeatBeaconDataHolder thisInstance = new HeartBeatBeaconDataHolder(); + private ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository; private HeartBeatBeaconDataHolder() {} public static HeartBeatBeaconDataHolder getInstance() { @@ -48,4 +50,12 @@ public class HeartBeatBeaconDataHolder { public void setLocalServerUUID(String localServerUUID) { this.localServerUUID = localServerUUID; } + + public ClusterFormationChangedNotifierRepository getClusterFormationChangedNotifierRepository() { + return clusterFormationChangedNotifierRepository; + } + + public void setClusterFormationChangedNotifierRepository(ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository) { + this.clusterFormationChangedNotifierRepository = clusterFormationChangedNotifierRepository; + } } diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java index 81be3a999f..bd19a185a8 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java @@ -69,6 +69,7 @@ public class HeartBeatExecutor { try { recordHeartBeat(designatedUUID); electDynamicTaskExecutionCandidate(cumilativeTimeOut); + notifyClusterFormationChanged(cumilativeTimeOut); } catch (Exception e) { log.error("Error while executing record heart beat task. This will result in schedule operation malfunction.", e); } @@ -98,5 +99,8 @@ public class HeartBeatExecutor { HeartBeatBeaconDataHolder.getInstance().getHeartBeatManagementService().electCandidate(cumilativeTimeOut); } + static void notifyClusterFormationChanged(int cumilativeTimeOut) throws HeartBeatManagementException { + HeartBeatBeaconDataHolder.getInstance().getHeartBeatManagementService().notifyClusterFormationChanged(cumilativeTimeOut); + } } diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifier.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifier.java new file mode 100644 index 0000000000..ecd53d98ef --- /dev/null +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifier.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service; + +public interface ClusterFormationChangedNotifier { + + String getType(); + + void notifyClusterFormationChanged(int hashIndex, int activeServerCount); +} diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java new file mode 100644 index 0000000000..bb0c7726de --- /dev/null +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class ClusterFormationChangedNotifierRepository { + + private Map notifiers; + private static final Log log = LogFactory.getLog(ClusterFormationChangedNotifierRepository.class); + + public ClusterFormationChangedNotifierRepository() { + this.notifiers = new ConcurrentHashMap<>(); + } + + public void addNotifier(ClusterFormationChangedNotifier notifier) { + notifiers.put(notifier.getType(), notifier); + } + + public void addNotifier(String className) { + try { + if (!StringUtils.isEmpty(className)) { + Class clz = Class.forName(className); + ClusterFormationChangedNotifier notifier = (ClusterFormationChangedNotifier) clz.newInstance(); + notifiers.put(notifier.getType(), notifier); + } + } catch (ClassNotFoundException e) { + log.error("Provided ClusterFormationChangedNotifier implementation '" + className + "' cannot be found", e); + } catch (InstantiationException e) { + log.error("Error occurred while instantiating ClusterFormationChangedNotifier implementation '" + + className + "'", e); + } catch (IllegalAccessException e) { + log.error("Error occurred while adding ClusterFormationChangedNotifier implementation '" + className + "'", e); + } + } + + public ClusterFormationChangedNotifier getNotifier(String type) { + return notifiers.get(type); + } + + public Map getNotifiers() { + return notifiers; + } +} diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java index 50a42d5d59..f8c6afcc56 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java @@ -36,6 +36,7 @@ public interface HeartBeatManagementService { boolean recordHeartBeat(HeartBeatEvent event) throws HeartBeatManagementException; void electCandidate(int elapsedTimeInSeconds) throws HeartBeatManagementException; + void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException; boolean updateTaskExecutionAcknowledgement(String newTask) throws HeartBeatManagementException; diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java index f39eda3c78..7aa362376a 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java @@ -48,6 +48,9 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic private final HeartBeatDAO heartBeatDAO; + private static int lastActiveCount = -1; + private static int lastHashIndex = -1; + public HeartBeatManagementServiceImpl() { this.heartBeatDAO = HeartBeatBeaconDAOFactory.getHeartBeatDAO(); } @@ -254,6 +257,46 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic throw new HeartBeatManagementException(msg); } } + @Override + public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException { + if (HeartBeatBeaconConfig.getInstance().isEnabled()) { + try { + Map servers = heartBeatDAO.getActiveServerDetails(elapsedTimeInSeconds); + if (servers != null && !servers.isEmpty()) { + String serverUUID = HeartBeatBeaconDataHolder.getInstance().getLocalServerUUID(); + ServerContext serverContext = servers.get(serverUUID); + + // cluster change can be identified, either by changing hash index or changing active server count + if ((lastHashIndex != serverContext.getIndex()) || (lastActiveCount != servers.size())) { + lastHashIndex = serverContext.getIndex(); + lastActiveCount = servers.size(); + + ClusterFormationChangedNotifierRepository repository = HeartBeatBeaconDataHolder.getInstance().getClusterFormationChangedNotifierRepository(); + Map notifiers = repository.getNotifiers(); + for (String type : notifiers.keySet()) { + ClusterFormationChangedNotifier notifier = notifiers.get(type); + Runnable r = new Runnable() { + @Override + public void run() { + notifier.notifyClusterFormationChanged(lastHashIndex, lastActiveCount); + } + }; + new Thread(r).start(); + } + } + } + } catch (HeartBeatDAOException e) { + String msg = "Error occurred while notifyClusterFormationChanged."; + log.error(msg, e); + throw new HeartBeatManagementException(msg, e); + } + } else { + String msg = "Heart Beat Configuration Disabled. Error while notifyClusterFormationChanged."; + log.error(msg); + throw new HeartBeatManagementException(msg); + } + } + private void electCandidate(Map servers) throws HeartBeatDAOException { String electedCandidate = getRandomElement(servers.keySet()); diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java index 3272091675..2254ea57ee 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java @@ -66,4 +66,9 @@ public class TestHeartBeatManagementService implements HeartBeatManagementServic @Override public Map getActiveServers() throws HeartBeatManagementException { return null; } + + @Override + public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException { + + } } diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml index a434001e72..afdc9b3971 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml @@ -49,4 +49,7 @@ 300 5 600 + + + diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf_templates/templates/repository/conf/heart-beat-config.xml.j2 b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf_templates/templates/repository/conf/heart-beat-config.xml.j2 index f128b56c19..a294c876e3 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf_templates/templates/repository/conf/heart-beat-config.xml.j2 +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf_templates/templates/repository/conf/heart-beat-config.xml.j2 @@ -51,11 +51,21 @@ {{heart_beat_beacon_conf.notifier_frequency_in_seconds}} {{heart_beat_beacon_conf.time_skew_in_seconds}} {{heart_beat_beacon_conf.sever_timeout_interval_in_seconds}} + {% if heart_beat_beacon_conf.cluster_formation_changed_configs.cluster_formation_changed_notifiers is defined %} + + {%- for cluster_formation_changed_notifier in heart_beat_beacon_conf.cluster_formation_changed_configs.cluster_formation_changed_notifiers -%} + {{cluster_formation_changed_notifier}} + {% endfor %} + + {% endif %} {% else %} false 30 300 5 600 + + + {% endif %} From 66f33f484569a199f3b522292fa8a19dfa0aec7e Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Mon, 24 Jul 2023 13:17:46 +0530 Subject: [PATCH 020/112] notify cluster formation changed nug fixes --- .../internal/HeartBeatBeaconComponent.java | 22 ++++++++++--------- .../HeartBeatManagementServiceImpl.java | 9 ++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java index 5f07342a41..a526e216fb 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java @@ -61,20 +61,22 @@ public class HeartBeatBeaconComponent { DataSourceConfig dsConfig = HeartBeatBeaconConfig.getInstance().getDataSourceConfig(); HeartBeatBeaconDAOFactory.init(dsConfig); + ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository + = new ClusterFormationChangedNotifierRepository(); + List notifiers = HeartBeatBeaconConfig.getInstance().getNotifiers(); + if (notifiers != null && notifiers.size() > 0) { + for (String notifier : notifiers) { + clusterFormationChangedNotifierRepository.addNotifier(notifier); + } + } + HeartBeatBeaconDataHolder.getInstance().setClusterFormationChangedNotifierRepository( + clusterFormationChangedNotifierRepository); + //Setting up executors to notify heart beat status */ HeartBeatExecutor.setUpNotifiers(HeartBeatBeaconUtils.getServerDetails()); } - ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository - = new ClusterFormationChangedNotifierRepository(); - List notifiers = HeartBeatBeaconConfig.getInstance().getNotifiers(); - if (notifiers != null && notifiers.size() > 0) { - for (String notifier : notifiers) { - clusterFormationChangedNotifierRepository.addNotifier(notifier); - } - } - HeartBeatBeaconDataHolder.getInstance().setClusterFormationChangedNotifierRepository( - clusterFormationChangedNotifierRepository); + if (log.isDebugEnabled()) { log.debug("Heart Beat Notifier bundle has been successfully initialized"); diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java index 7aa362376a..7a31a6ebcc 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java @@ -261,7 +261,9 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException { if (HeartBeatBeaconConfig.getInstance().isEnabled()) { try { + HeartBeatBeaconDAOFactory.beginTransaction(); Map servers = heartBeatDAO.getActiveServerDetails(elapsedTimeInSeconds); + HeartBeatBeaconDAOFactory.commitTransaction(); if (servers != null && !servers.isEmpty()) { String serverUUID = HeartBeatBeaconDataHolder.getInstance().getLocalServerUUID(); ServerContext serverContext = servers.get(serverUUID); @@ -289,6 +291,13 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic String msg = "Error occurred while notifyClusterFormationChanged."; log.error(msg, e); throw new HeartBeatManagementException(msg, e); + } catch (TransactionManagementException e) { + HeartBeatBeaconDAOFactory.rollbackTransaction(); + String msg = "Error occurred while electing candidate for dynamic task execution. Issue in opening a connection to the underlying data source"; + log.error(msg, e); + throw new HeartBeatManagementException(msg, e); + } finally { + HeartBeatBeaconDAOFactory.closeConnection(); } } else { String msg = "Heart Beat Configuration Disabled. Error while notifyClusterFormationChanged."; From c6c2ef9a01e2c4f8b1fcc46d62a114c211b35c72 Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Mon, 31 Jul 2023 14:20:55 +0530 Subject: [PATCH 021/112] fixed ws api publishing and dynamic endpoint configurations --- .../rest/api/PublisherRESTAPIServices.java | 23 +- .../api/PublisherRESTAPIServicesImpl.java | 105 +++-- .../rest/api/dto/APIInfo/APIInfo.java | 67 +-- .../rest/api/dto/APIInfo/APIRevision.java | 90 ++++ .../dto/APIInfo/APIRevisionDeployment.java | 79 ++++ .../rest/api/dto/APIInfo/AdvertiseInfo.java | 5 +- .../api/dto/APIInfo/BusinessInformation.java | 4 +- .../api/dto/APIInfo/CORSConfiguration.java | 82 ++++ .../rest/api/dto/APIInfo/Documentation.java | 192 ++++++++ .../rest/api/dto/APIInfo/Mediation.java | 54 +++ .../rest/api/dto/APIInfo/Operations.java | 4 +- .../extension/rest/api/dto/APIInfo/Scope.java | 100 ++++ .../rest/api/dto/APIInfo/URITemplate.java | 440 ++++++++++++++++++ .../publisher/APIPublisherServiceImpl.java | 234 ++++------ 14 files changed, 1250 insertions(+), 229 deletions(-) create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/CORSConfiguration.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Mediation.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/URITemplate.java diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java index f5b766b119..4e7d79403a 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java @@ -24,13 +24,12 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIService import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment; import org.json.JSONObject; -import org.wso2.carbon.apimgt.api.model.APIIdentifier; -import org.wso2.carbon.apimgt.api.model.Scope; -import org.wso2.carbon.apimgt.api.model.Mediation; -import org.wso2.carbon.apimgt.api.model.APIRevision; -import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; -import org.wso2.carbon.apimgt.api.model.Documentation; import java.util.List; @@ -48,7 +47,7 @@ public interface PublisherRESTAPIServices { boolean updateSharedScope(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, Scope scope) throws APIServicesException, BadRequestException, UnexpectedResponseException; - JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIIdentifier apiIdentifier) + JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; JSONObject getApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) @@ -65,15 +64,15 @@ public interface PublisherRESTAPIServices { throws APIServicesException, BadRequestException, UnexpectedResponseException; JSONObject getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - APIIdentifier apiIdentifier) + String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean addApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, Mediation mediation) throws APIServicesException, BadRequestException, UnexpectedResponseException; - boolean updateApiSpecificMediationPolicyContent(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - String uuid, Mediation mediation) + boolean deleteApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + String uuid, Mediation mediation) throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean changeLifeCycleStatus(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, @@ -108,11 +107,11 @@ public interface PublisherRESTAPIServices { String uuid, String documentID) throws APIServicesException, BadRequestException, UnexpectedResponseException; - Documentation addDocumentation(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation addDocumentation(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, Documentation documentation) throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean addDocumentationContent(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - APIInfo api, String docId, String docContent) + String apiUuid, String docId, String docContent) throws APIServicesException, BadRequestException, UnexpectedResponseException; } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java index b3ae5c8f92..40a8e92c61 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java @@ -21,30 +21,26 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api; import com.google.gson.Gson; import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.HttpsTrustManagerUtils; import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.ScopeUtils; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.RequestBody; +import okhttp3.*; +import okhttp3.Request.Builder; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.ssl.Base64; import org.json.JSONArray; import org.json.JSONObject; -import org.wso2.carbon.apimgt.api.model.APIIdentifier; -import org.wso2.carbon.apimgt.api.model.Scope; -import org.wso2.carbon.apimgt.api.model.Mediation; -import org.wso2.carbon.apimgt.api.model.APIRevision; -import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; -import org.wso2.carbon.apimgt.api.model.Documentation; import java.io.IOException; import java.util.List; @@ -237,10 +233,10 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } @Override - public JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIIdentifier apiIdentifier) + public JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException { - String getAllApi = endPointPrefix + Constants.API_ENDPOINT + apiIdentifier.getUUID(); + String getAllApi = endPointPrefix + Constants.API_ENDPOINT + apiUuid; Request request = new Request.Builder() .url(getAllApi) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER @@ -259,7 +255,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); //TODO: max attempt count - return getApi(apiApplicationKey, refreshedAccessToken, apiIdentifier); + return getApi(apiApplicationKey, refreshedAccessToken, apiUuid); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -344,6 +340,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { " \"apiThrottlingPolicy\": " + api.getApiThrottlingPolicy() + ",\n" + " \"authorizationHeader\": \"" + api.getAuthorizationHeader() + "\",\n" + " \"visibility\": \"" + api.getVisibility() + "\",\n" + + " \"mediationPolicies\": " + (api.getInSequence() != null ? "[{\"name\": \"" + api.getInSequence() + "\",\"type\": \"in\"}]" : null) + ",\n" + " \"subscriptionAvailability\": \"" + api.getSubscriptionAvailability() + "\",\n" + " \"subscriptionAvailableTenants\": [],\n" + " \"additionalProperties\": [],\n" + @@ -359,7 +356,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { " \"endpointConfig\": " + api.getEndpointConfig().toString() + ",\n" + " \"endpointImplementationType\": \"ENDPOINT\",\n" + " \"scopes\": " + api.getScopes().toString() + ",\n" + - " \"operations\": " + api.getOperations().toString() + ",\n" + + " \"operations\": " + (api.getOperations() != null ? api.getOperations().toString() : null) + ",\n" + " \"threatProtectionPolicies\": null,\n" + " \"categories\": [],\n" + " \"keyManagers\": " + gson.toJson(api.getKeyManagers()) + ",\n" + @@ -431,6 +428,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { " \"apiThrottlingPolicy\": " + api.getApiThrottlingPolicy() + ",\n" + " \"authorizationHeader\": \"" + api.getAuthorizationHeader() + "\",\n" + " \"visibility\": \"" + api.getVisibility() + "\",\n" + + " \"mediationPolicies\": " + (api.getInSequence() != null ? "[{\"name\": \"" + api.getInSequence() + "\",\"type\": \"in\"}]" : null) + ",\n" + " \"subscriptionAvailability\": \"" + api.getSubscriptionAvailability() + "\",\n" + " \"subscriptionAvailableTenants\": [],\n" + " \"additionalProperties\": [],\n" + @@ -446,7 +444,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { " \"endpointConfig\": " + api.getEndpointConfig().toString() + ",\n" + " \"endpointImplementationType\": \"ENDPOINT\",\n" + " \"scopes\": " + api.getScopes().toString() + ",\n" + - " \"operations\": " + api.getOperations().toString() + ",\n" + + " \"operations\": " + (api.getOperations() != null? api.getOperations().toString() : null) + ",\n" + " \"threatProtectionPolicies\": null,\n" + " \"categories\": [],\n" + " \"keyManagers\": " + gson.toJson(api.getKeyManagers()) + ",\n" + @@ -493,11 +491,16 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String uuid, String asyncApiDefinition) throws APIServicesException, BadRequestException, UnexpectedResponseException { - String addNewScope = endPointPrefix + Constants.API_ENDPOINT + uuid; + String saveAsyncAPI = endPointPrefix + Constants.API_ENDPOINT + uuid + "/asyncapi"; + + RequestBody requestBody = new MultipartBody.Builder() + .setType(MultipartBody.FORM) + .addFormDataPart("apiDefinition", asyncApiDefinition) + .build(); - RequestBody requestBody = RequestBody.create(JSON, asyncApiDefinition); Request request = new Request.Builder() - .url(addNewScope) + .url(saveAsyncAPI) + .addHeader(Constants.HEADER_CONTENT_TYPE, "multipart/form-data") .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + accessTokenInfo.getAccess_token()) .put(requestBody) @@ -532,10 +535,10 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { @Override public JSONObject getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - APIIdentifier apiIdentifier) + String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException { - String getAPIMediationEndPoint = endPointPrefix + Constants.API_ENDPOINT + apiIdentifier.getUUID() + "/mediation-policies"; + String getAPIMediationEndPoint = endPointPrefix + Constants.API_ENDPOINT + apiUuid + "/mediation-policies"; Request request = new Request.Builder() .url(getAPIMediationEndPoint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER @@ -554,7 +557,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); //TODO: max attempt count - return getAllApiSpecificMediationPolicies(apiApplicationKey, refreshedAccessToken, apiIdentifier); + return getAllApiSpecificMediationPolicies(apiApplicationKey, refreshedAccessToken, apiUuid); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -575,12 +578,17 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String uuid, Mediation mediation) throws APIServicesException, BadRequestException, UnexpectedResponseException { - String addAPIMediation = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies/" + mediation.getUuid() - + "/content"; + String addAPIMediation = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies"; - RequestBody requestBody = RequestBody.create(JSON, String.valueOf(mediation)); - Request request = new Request.Builder() + RequestBody requestBody = new MultipartBody.Builder() + .setType(MultipartBody.FORM) + .addFormDataPart("inlineContent", mediation.getConfig()) + .addFormDataPart("type", mediation.getType()) + .build(); + + Request request = new Builder() .url(addAPIMediation) + .addHeader(Constants.HEADER_CONTENT_TYPE, "multipart/form-data") .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + accessTokenInfo.getAccess_token()) .post(requestBody) @@ -613,26 +621,23 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } - @Override - public boolean updateApiSpecificMediationPolicyContent(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + public boolean deleteApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, Mediation mediation) throws APIServicesException, BadRequestException, UnexpectedResponseException { - String updateApiMediationEndPOint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies/" + mediation.getUuid() - + "/content"; + String deleteApiMediationEndPOint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies/" + mediation.getUuid(); - RequestBody requestBody = RequestBody.create(JSON, String.valueOf(mediation)); Request request = new Request.Builder() - .url(updateApiMediationEndPOint) + .url(deleteApiMediationEndPOint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + accessTokenInfo.getAccess_token()) - .put(requestBody) + .delete() .build(); try { Response response = client.newCall(request).execute(); - if (HttpStatus.SC_CREATED == response.code()) { // Check response status + if (HttpStatus.SC_NO_CONTENT == response.code()) { // Check response status return true; } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); @@ -640,7 +645,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); //TODO: max attempt count - return updateApiSpecificMediationPolicyContent(apiApplicationKey, refreshedAccessToken, uuid, mediation); + return deleteApiSpecificMediationPolicy(apiApplicationKey, refreshedAccessToken, uuid, mediation); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid mediation policy"; log.error(msg); @@ -1018,18 +1023,19 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String addNewScope = endPointPrefix + Constants.API_ENDPOINT + uuid + "/documents"; String document = "{\n" + - " \"name\": \" " + documentation.getName() + " \",\n" + - " \"type\": \" " + documentation.getType() + " \",\n" + - " \"summary\": \" " + documentation.getSummary() + " \",\n" + - " \"sourceType\": \" " + documentation.getSourceType() + " \",\n" + - " \"inlineContent\": \" " + documentation.getSourceType() + " \",\n" + - " \"visibility\": \" " + documentation.getVisibility() + " \",\n" + - " \"createdBy\": \" admin \"\n" + + " \"name\": \"" + documentation.getName() + "\",\n" + + " \"type\": \"" + documentation.getType() + "\",\n" + + " \"summary\": \"" + documentation.getSummary() + "\",\n" + + " \"sourceType\": \"" + documentation.getSourceType() + "\",\n" + + " \"inlineContent\": \"" + documentation.getSourceType() + "\",\n" + + " \"visibility\": \"" + documentation.getVisibility() + "\",\n" + + " \"createdBy\": \"admin\"\n" + "}"; RequestBody requestBody = RequestBody.create(JSON, document); Request request = new Request.Builder() .url(addNewScope) + .addHeader(Constants.HEADER_CONTENT_TYPE, Constants.APPLICATION_JSON) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + accessTokenInfo.getAccess_token()) .post(requestBody) @@ -1063,14 +1069,19 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { @Override public boolean addDocumentationContent(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - APIInfo api, String docId, String docContent) + String apiUuid, String docId, String docContent) throws APIServicesException, BadRequestException, UnexpectedResponseException { - String addDocumentationContentEndPoint = endPointPrefix + Constants.API_ENDPOINT + api.getId() + "/documents/" + docId; + String addDocumentationContentEndPoint = endPointPrefix + Constants.API_ENDPOINT + apiUuid + "/documents/" + docId + "/content"; + + RequestBody requestBody = new MultipartBody.Builder() + .setType(MultipartBody.FORM) + .addFormDataPart("inlineContent", docContent) + .build(); - RequestBody requestBody = RequestBody.create(JSON, docContent); Request request = new Request.Builder() .url(addDocumentationContentEndPoint) + .addHeader(Constants.HEADER_CONTENT_TYPE, "multipart/form-data") .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + accessTokenInfo.getAccess_token()) .post(requestBody) @@ -1086,7 +1097,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); //TODO: max attempt count - return addDocumentationContent(apiApplicationKey, refreshedAccessToken, api, docId, docContent); + return addDocumentationContent(apiApplicationKey, refreshedAccessToken, apiUuid, docId, docContent); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid documentation request body"; log.error(msg); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java index a6f76116d9..b7443b0f53 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java @@ -1,12 +1,12 @@ /* - * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. * * Entgra (Pvt) Ltd. 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 + * 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 @@ -19,13 +19,8 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; import org.json.JSONObject; -import org.wso2.carbon.apimgt.api.model.APICategory; -import org.wso2.carbon.apimgt.api.model.CORSConfiguration; -import org.wso2.carbon.apimgt.api.model.WebsubSubscriptionConfiguration; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; +import java.util.*; /** * This class represents the API response. @@ -70,7 +65,6 @@ public class APIInfo { private String accessControlRoles; private BusinessInformation businessInformation; private CORSConfiguration corsConfiguration; - private WebsubSubscriptionConfiguration websubSubscriptionConfiguration; private String workflowStatus; private String createdTime; private String lastUpdatedTime; @@ -79,11 +73,16 @@ public class APIInfo { private List scopes = new ArrayList(); private List operations; private String threatProtectionPolicies; - private List apiCategories; private List keyManagers = new ArrayList(); private JSONObject serviceInfo = new JSONObject(); private AdvertiseInfo advertiseInfo; + private String asyncApiDefinition; + + private Set uriTemplates = new LinkedHashSet(); + private String inSequence; + + private Map wsUriMapping; public String getId() { return id; } @@ -372,14 +371,6 @@ public class APIInfo { this.corsConfiguration = corsConfiguration; } - public WebsubSubscriptionConfiguration getWebsubSubscriptionConfiguration() { - return websubSubscriptionConfiguration; - } - - public void setWebsubSubscriptionConfiguration(WebsubSubscriptionConfiguration websubSubscriptionConfiguration) { - this.websubSubscriptionConfiguration = websubSubscriptionConfiguration; - } - public String getWorkflowStatus() { return workflowStatus; } @@ -444,14 +435,6 @@ public class APIInfo { this.threatProtectionPolicies = threatProtectionPolicies; } - public List getApiCategories() { - return apiCategories; - } - - public void setApiCategories(List apiCategories) { - this.apiCategories = apiCategories; - } - public List getKeyManagers() { return keyManagers; } @@ -475,4 +458,36 @@ public class APIInfo { public void setAdvertiseInfo(AdvertiseInfo advertiseInfo) { this.advertiseInfo = advertiseInfo; } + + public String getInSequence() { + return inSequence; + } + + public void setInSequence(String inSequence) { + this.inSequence = inSequence; + } + + public String getAsyncApiDefinition() { + return asyncApiDefinition; + } + + public void setAsyncApiDefinition(String asyncApiDefinition) { + this.asyncApiDefinition = asyncApiDefinition; + } + + public Set getUriTemplates() { + return uriTemplates; + } + + public void setUriTemplates(Set uriTemplates) { + this.uriTemplates = uriTemplates; + } + + public Map getWsUriMapping() { + return wsUriMapping; + } + + public void setWsUriMapping(Map wsUriMapping) { + this.wsUriMapping = wsUriMapping; + } } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java new file mode 100644 index 0000000000..581fbb1792 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; + +import java.io.Serializable; +import java.util.List; + +public class APIRevision implements Serializable { + private static final long serialVersionUID = 1L; + private int id; + private String apiUUID; + private String revisionUUID; + private String description; + private String createdBy; + private String createdTime; + private List apiRevisionDeploymentList; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getApiUUID() { + return apiUUID; + } + + public void setApiUUID(String apiUUID) { + this.apiUUID = apiUUID; + } + + public String getRevisionUUID() { + return revisionUUID; + } + + public void setRevisionUUID(String revisionUUID) { + this.revisionUUID = revisionUUID; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(String createdTime) { + this.createdTime = createdTime; + } + + public List getApiRevisionDeploymentList() { + return apiRevisionDeploymentList; + } + + public void setApiRevisionDeploymentList(List apiRevisionDeploymentList) { + this.apiRevisionDeploymentList = apiRevisionDeploymentList; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java new file mode 100644 index 0000000000..20c84232cc --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +import java.io.Serializable; + +public class APIRevisionDeployment implements Serializable { + private static final long serialVersionUID = 1L; + private int id; + private String revisionUUID; + private String deployment; + private String vhost; + private boolean isDisplayOnDevportal; + private String deployedTime; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getRevisionUUID() { + return revisionUUID; + } + + public void setRevisionUUID(String revisionUUID) { + this.revisionUUID = revisionUUID; + } + + public String getDeployment() { + return deployment; + } + + public void setDeployment(String deployment) { + this.deployment = deployment; + } + + public String getVhost() { + return vhost; + } + + public void setVhost(String vhost) { + this.vhost = vhost; + } + + public boolean isDisplayOnDevportal() { + return isDisplayOnDevportal; + } + + public void setDisplayOnDevportal(boolean displayOnDevportal) { + isDisplayOnDevportal = displayOnDevportal; + } + + public String getDeployedTime() { + return deployedTime; + } + + public void setDeployedTime(String deployedTime) { + this.deployedTime = deployedTime; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdvertiseInfo.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdvertiseInfo.java index 93511526aa..9ed465bc72 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdvertiseInfo.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdvertiseInfo.java @@ -1,12 +1,12 @@ /* - * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. * * Entgra (Pvt) Ltd. 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 + * 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 @@ -15,7 +15,6 @@ * specific language governing permissions and limitations * under the License. */ - package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; /** diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/BusinessInformation.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/BusinessInformation.java index ad32e51f15..4310d50cbf 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/BusinessInformation.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/BusinessInformation.java @@ -1,12 +1,12 @@ /* - * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. * * Entgra (Pvt) Ltd. 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 + * 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 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/CORSConfiguration.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/CORSConfiguration.java new file mode 100644 index 0000000000..1bee613429 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/CORSConfiguration.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +import java.util.List; + +/** + * API CORS Configuration + */ +public class CORSConfiguration { + + private boolean corsConfigurationEnabled; + private List accessControlAllowOrigins; + private boolean accessControlAllowCredentials; + private List accessControlAllowHeaders; + private List accessControlAllowMethods; + + public CORSConfiguration(boolean corsConfigurationEnabled, List accessControlAllowOrigins, + boolean accessControlAllowCredentials, + List accessControlAllowHeaders, List accessControlAllowMethods) { + this.corsConfigurationEnabled = corsConfigurationEnabled; + this.accessControlAllowOrigins = accessControlAllowOrigins; + this.accessControlAllowCredentials = accessControlAllowCredentials; + this.accessControlAllowHeaders = accessControlAllowHeaders; + this.accessControlAllowMethods = accessControlAllowMethods; + } + + public boolean isCorsConfigurationEnabled() { + return corsConfigurationEnabled; + } + + public void setCorsConfigurationEnabled(boolean corsConfigurationEnabled) { + this.corsConfigurationEnabled = corsConfigurationEnabled; + } + + public List getAccessControlAllowOrigins() { + return accessControlAllowOrigins; + } + + public void setAccessControlAllowOrigins(List accessControlAllowOrigins) { + this.accessControlAllowOrigins = accessControlAllowOrigins; + } + + public boolean isAccessControlAllowCredentials() { + return accessControlAllowCredentials; + } + + public void setAccessControlAllowCredentials(boolean accessControlAllowCredentials) { + this.accessControlAllowCredentials = accessControlAllowCredentials; + } + + public List getAccessControlAllowHeaders() { + return accessControlAllowHeaders; + } + + public void setAccessControlAllowHeaders(List accessControlAllowHeaders) { + this.accessControlAllowHeaders = accessControlAllowHeaders; + } + + public List getAccessControlAllowMethods() { + return accessControlAllowMethods; + } + + public void setAccessControlAllowMethods(List accessControlAllowMethods) { + this.accessControlAllowMethods = accessControlAllowMethods; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java new file mode 100644 index 0000000000..5d54bc7567 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +import java.util.Date; + +public class Documentation { + + private static final long serialVersionUID = 1L; + private String id; + private String documentId; + private DocumentationType type; + private String name; + private String summary; + private DocumentSourceType sourceType; + private String sourceUrl; + private DocumentVisibility visibility; + private Date lastUpdated; + private String filePath; + private Date createdDate; + private String otherTypeName; + + public String getOtherTypeName() { + return this.otherTypeName; + } + + public void setOtherTypeName(String otherTypeName) { + this.otherTypeName = otherTypeName; + } + + public String getFilePath() { + return this.filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getSourceUrl() { + return this.sourceUrl; + } + + public void setSourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + } + + public Documentation(DocumentationType type, String name) { + this.type = type; + this.name = name; + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } else if (o != null && this.getClass() == o.getClass()) { + Documentation that = (Documentation)o; + return this.name.equals(that.name) && this.type == that.type; + } else { + return false; + } + } + + public DocumentationType getType() { + return this.type; + } + + public String getName() { + return this.name; + } + + public String getSummary() { + return this.summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public DocumentVisibility getVisibility() { + return this.visibility; + } + + public void setVisibility(DocumentVisibility visibility) { + this.visibility = visibility; + } + + public DocumentSourceType getSourceType() { + return this.sourceType; + } + + public void setSourceType(DocumentSourceType sourceType) { + this.sourceType = sourceType; + } + + public int hashCode() { + int result = this.type.hashCode(); + result = 31 * result + this.name.hashCode(); + return result; + } + + public Date getLastUpdated() { + return this.lastUpdated; + } + + public void setLastUpdated(Date lastUpdated) { + this.lastUpdated = lastUpdated; + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDocumentId() { + return documentId; + } + + public void setDocumentId(String documentId) { + this.documentId = documentId; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public static enum DocumentVisibility { + OWNER_ONLY("owner_only"), + PRIVATE("private"), + API_LEVEL("api_level"); + + private String visibility; + + private DocumentVisibility(String visibility) { + this.visibility = visibility; + } + } + + public static enum DocumentSourceType { + INLINE("In line"), + MARKDOWN("Markdown"), + URL("URL"), + FILE("File"); + + private String type; + + private DocumentSourceType(String type) { + this.type = type; + } + } + + public static enum DocumentationType { + HOWTO("How To"), + SAMPLES("Samples"), + PUBLIC_FORUM("Public Forum"), + SUPPORT_FORUM("Support Forum"), + API_MESSAGE_FORMAT("API Message Format"), + SWAGGER_DOC("Swagger API Definition"), + OTHER("Other"); + + private String type; + + private DocumentationType(String type) { + this.type = type; + } + + public String getType() { + return type; + } + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Mediation.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Mediation.java new file mode 100644 index 0000000000..5e5125006c --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Mediation.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +public class Mediation { + + private String uuid; + private String name; + private String type; + private String config; + private boolean isGlobal; + + public Mediation(){} + + public void setUuid(String id){ + this.uuid=id; + } + public String getUuid(){return uuid;} + + public void setName(String name){this.name=name;} + + public String getName(){return name;} + + public void setType(String mType){this.type=mType;} + + public String getType(){return type;} + + public void setConfig(String mConfig){this.config=mConfig;} + + public String getConfig(){return config;} + + public boolean isGlobal() { + return isGlobal; + } + + public void setGlobal(boolean isGlobal) { + this.isGlobal = isGlobal; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java index 51f2c1ee4c..2dd00c4482 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java @@ -1,12 +1,12 @@ /* - * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. * * Entgra (Pvt) Ltd. 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 + * 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 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java new file mode 100644 index 0000000000..01d3f53d36 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +import java.io.Serializable; +import java.util.Objects; + +public class Scope implements Serializable{ + + private static final long serialVersionUID = 1L; + + String key; + String name; + String roles; + String description; + String id; + int usageCount; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getRoles() { + return roles; + } + + public void setRoles(String roles) { + this.roles = roles; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getUsageCount() { + return usageCount; + } + + public void setUsageCount(int usageCount) { + this.usageCount = usageCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Scope scope = (Scope) o; + + if (id != null ? !id.equals(scope.id) : scope.id != null) return false; + if (!key.equals(scope.key)) return false; + if (!name.equals(scope.name)) return false; + if (roles != null ? !roles.equals(scope.roles) : scope.roles != null) return false; + return description != null ? description.equals(scope.description) : scope.description == null; + } + + @Override + public int hashCode() { + return Objects.hash(key, name, roles, description, id); + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/URITemplate.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/URITemplate.java new file mode 100644 index 0000000000..9cd69a9f11 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/URITemplate.java @@ -0,0 +1,440 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +import org.json.simple.JSONValue; +import org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO; +import org.wso2.carbon.apimgt.api.model.APIProductIdentifier; +import org.wso2.carbon.apimgt.api.model.Scope; +import org.wso2.carbon.apimgt.api.model.policy.PolicyConstants; + +import java.io.Serializable; +import java.util.*; + +public class URITemplate implements Serializable{ + + private static final long serialVersionUID = 1L; + + private String uriTemplate; + private String resourceURI; + private String resourceSandboxURI; + private String httpVerb; + private String authType; + private LinkedHashSet httpVerbs = new LinkedHashSet(); + private List authTypes = new ArrayList(); + private List throttlingConditions = new ArrayList(); + private String applicableLevel; + private String throttlingTier; + private List throttlingTiers = new ArrayList(); + private org.wso2.carbon.apimgt.api.model.Scope scope; + private String mediationScript; + private List scopes = new ArrayList(); + private Map mediationScripts = new HashMap(); + private ConditionGroupDTO[] conditionGroups; + private int id; + private Set usedByProducts = new HashSet<>(); + private String amznResourceName; + private int amznResourceTimeout; + + public ConditionGroupDTO[] getConditionGroups() { + return conditionGroups; + } + + public void setConditionGroups(ConditionGroupDTO[] conditionGroups) { + this.conditionGroups = conditionGroups; + } + + public String getMediationScript() { + return mediationScript; + } + + + public List getThrottlingConditions() { + return throttlingConditions; + } + + public void setThrottlingConditions(List throttlingConditions) { + this.throttlingConditions = throttlingConditions; + } + + public void setMediationScript(String mediationScript) { + this.mediationScript = mediationScript; + } + /** + * Set mediation script for a given http method + * @param method http method name + * @param mediationScript mediation script content + */ + public void setMediationScripts(String method, String mediationScript){ + if (mediationScript != null && !mediationScript.trim().equals("") && !mediationScript.trim().equals("null")){ + mediationScripts.put(method, mediationScript); + } + + } + + /** + * Generating the script by aggregating scripts of each http method to form a single script in to be + * used when generating synapse configuration file. + * + * @return aggregated script in the following format, + * if (http-method = 'GET'){ + * //script for GET + * } + * .... + * .... + * if (http-method = 'POST'){ + * //script for POST + * } + */ + public String getAggregatedMediationScript(){ + if (mediationScripts.isEmpty()){ + return "null"; + }else if (mediationScripts.size() == 1 && httpVerbs.size() == 1){ + return mediationScript; + }else{ + StringBuilder aggregatedScript = new StringBuilder(); + + for (Map.Entry entry : mediationScripts.entrySet()){ + String httpMethod = entry.getKey(); + String mediationScript = entry.getValue(); + + aggregatedScript.append("if (mc.getProperty('REST_METHOD') == '").append(httpMethod).append("'){"); + aggregatedScript.append(mediationScript); + aggregatedScript.append("}"); + + } + + return aggregatedScript.toString(); + } + } + + public String getThrottlingTier() { + return throttlingTier; + } + + public void setThrottlingTier(String throttlingTier) { + this.throttlingTier = throttlingTier; + } + + public List getThrottlingTiers(){ + return throttlingTiers; + } + + public void setThrottlingTiers(List throttlingTiers) { + this.throttlingTiers = throttlingTiers; + } + + public String getHTTPVerb() { + return httpVerb; + } + + public void setHTTPVerb(String httpVerb) { + this.httpVerb = httpVerb; + } + + public String getAuthType() { + return authType; + } + + public void setAuthType(String authType) { + this.authType = authType; + + } + + public String getResourceURI() { + return resourceURI; + } + + public void setResourceURI(String resourceURI) { + this.resourceURI = resourceURI; + } + + public boolean isResourceURIExist(){ + return this.resourceURI != null; + } + + public String getResourceSandboxURI() { + return resourceSandboxURI; + } + + public void setResourceSandboxURI(String resourceSandboxURI) { + this.resourceSandboxURI = resourceSandboxURI; + } + + public boolean isResourceSandboxURIExist(){ + return this.resourceSandboxURI != null; + } + + public String getUriTemplate() { + return uriTemplate; + } + + public void setUriTemplate(String template) { + this.uriTemplate = template; + } + + public void setHttpVerbs(String httpVerb) { + + httpVerbs.add(httpVerb); + } + + public LinkedHashSet getHttpVerbs() { + + return httpVerbs; + } + + + + public void setAuthTypes(String authType) { + + authTypes.add(authType); + } + + public String getAuthTypes() { + + return authType; + } + + + public String getMethodsAsString() { + StringBuilder stringBuilder = new StringBuilder(); + for (String method : httpVerbs) { + stringBuilder.append(method).append(" "); + } + return stringBuilder.toString().trim(); + } + + public String getAuthTypeAsString() { + StringBuilder stringBuilder = new StringBuilder(); + for (String authType : authTypes) { + stringBuilder.append(authType).append(" "); + } + return stringBuilder.toString().trim(); + } + + public String getThrottlingConditionsAsString() { + StringBuilder stringBuilder = new StringBuilder(); + for (String authType : throttlingConditions) { + stringBuilder.append(authType).append(" "); + } + return stringBuilder.toString().trim(); + } + + public void setThrottlingTiers(String tier) { + throttlingTiers.add(tier); + } + + public String getThrottlingTiersAsString() { + StringBuilder stringBuilder = new StringBuilder(); + for (String tier : throttlingTiers) { + if (tier.contains(PolicyConstants.THROTTLING_TIER_CONTENT_AWARE_SEPERATOR)) { + stringBuilder.append(tier.substring(0, + tier.indexOf(PolicyConstants.THROTTLING_TIER_CONTENT_AWARE_SEPERATOR)).trim()).append(" "); + } else { + stringBuilder.append(tier.trim()).append(" "); + } + } + return stringBuilder.toString().trim(); + } + + public boolean checkContentAwareFromThrottlingTiers() { + // use the content aware property appended to throttling tiers + if (!throttlingTiers.isEmpty()) { + String throttlingTierWithContentAware = throttlingTiers.get(0); + if (throttlingTierWithContentAware != null && + throttlingTierWithContentAware.contains(PolicyConstants.THROTTLING_TIER_CONTENT_AWARE_SEPERATOR)) { + String[] splitThrottlingTiers = + throttlingTierWithContentAware.split(PolicyConstants.THROTTLING_TIER_CONTENT_AWARE_SEPERATOR); + return Boolean.valueOf(splitThrottlingTiers[splitThrottlingTiers.length - 1]); + } + } + return false; + } + + public org.wso2.carbon.apimgt.api.model.Scope getScope() { + return scope; + } + public List getScopes() { + return scopes; + } + + public void setScope(org.wso2.carbon.apimgt.api.model.Scope scope) { + this.scope = scope; + } + + public void setScopes(org.wso2.carbon.apimgt.api.model.Scope scope){ + this.scopes.add(scope); + } + + public String getResourceMap(){ + Map verbs = new LinkedHashMap(); + int i = 0; + for (String method : httpVerbs) { + Map verb = new LinkedHashMap(); + verb.put("auth_type",authTypes.get(i)); + verb.put("throttling_tier",throttlingTiers.get(i)); + //Following parameter is not required as it not need to reflect UI level. If need please enable it. + // /verb.put("throttling_conditions", throttlingConditions.get(i)); + try{ + org.wso2.carbon.apimgt.api.model.Scope tmpScope = scopes.get(i); + if(tmpScope != null){ + verb.put("scope",tmpScope.getKey()); + } + }catch(IndexOutOfBoundsException e){ + //todo need to rewrite to prevent this type of exceptions + } + verbs.put(method,verb); + i++; + } + //todo this is a hack to make key validation service stub from braking need to rewrite. + return JSONValue.toJSONString(verbs); + } + + public String getApplicableLevel() { + return applicableLevel; + } + + public void setApplicableLevel(String applicableLevel) { + this.applicableLevel = applicableLevel; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + URITemplate that = (URITemplate) o; + + if (!uriTemplate.equals(that.uriTemplate)) { + return false; + } + if (resourceURI != null ? !resourceURI.equals(that.resourceURI) : that.resourceURI != null) { + return false; + } + if (resourceSandboxURI != null ? !resourceSandboxURI.equals(that.resourceSandboxURI) : that + .resourceSandboxURI != null) { + return false; + } + if (!httpVerb.equals(that.httpVerb)) { + return false; + } + if (!authType.equals(that.authType)) { + return false; + } + if (!httpVerbs.equals(that.httpVerbs)) { + return false; + } + if (!authTypes.equals(that.authTypes)) { + return false; + } + if (throttlingConditions != null ? !throttlingConditions.equals(that.throttlingConditions) : that + .throttlingConditions != null) { + return false; + } + if (applicableLevel != null ? !applicableLevel.equals(that.applicableLevel) : that.applicableLevel != null) { + return false; + } + if (!throttlingTier.equals(that.throttlingTier)) { + return false; + } + if (!throttlingTiers.equals(that.throttlingTiers)) { + return false; + } + if (scope != null ? !scope.equals(that.scope) : that.scope != null) { + return false; + } + if (mediationScript != null ? !mediationScript.equals(that.mediationScript) : that.mediationScript != null) { + return false; + } + if (scopes != null ? !scopes.equals(that.scopes) : that.scopes != null) { + return false; + } + if (mediationScripts != null ? !mediationScripts.equals(that.mediationScripts) : that.mediationScripts != + null) { + return false; + } + // Probably incorrect - comparing Object[] arrays with Arrays.equals + return Arrays.equals(conditionGroups, that.conditionGroups); + } + + @Override + public int hashCode() { + int result = uriTemplate.hashCode(); + result = 31 * result + (resourceURI != null ? resourceURI.hashCode() : 0); + result = 31 * result + (resourceSandboxURI != null ? resourceSandboxURI.hashCode() : 0); + result = 31 * result + (httpVerb != null ? httpVerb.hashCode() : 0); + result = 31 * result + (authType != null ? authType.hashCode() : 0); + result = 31 * result + (httpVerbs != null ? httpVerbs.hashCode() : 0); + result = 31 * result + (authTypes != null ? authTypes.hashCode() : 0); + result = 31 * result + (throttlingConditions != null ? throttlingConditions.hashCode() : 0); + result = 31 * result + (applicableLevel != null ? applicableLevel.hashCode() : 0); + result = 31 * result + (throttlingTier != null ? throttlingTier.hashCode() : 0); + result = 31 * result + (throttlingTiers != null ? throttlingTiers.hashCode() : 0); + result = 31 * result + (scope != null ? scope.hashCode() : 0); + result = 31 * result + (mediationScript != null ? mediationScript.hashCode() : 0); + result = 31 * result + (scopes != null ? scopes.hashCode() : 0); + result = 31 * result + (mediationScripts != null ? mediationScripts.hashCode() : 0); + result = 31 * result + Arrays.hashCode(conditionGroups); + return result; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public List retrieveAllScopes() { + return this.scopes; + } + + public void addAllScopes(List scopes) { + + this.scopes = scopes; + } + + public Set retrieveUsedByProducts() { + return usedByProducts; + } + + public void addUsedByProduct(APIProductIdentifier usedByProduct) { + usedByProducts.add(usedByProduct); + } + + public void setAmznResourceName(String amznResourceName) { + this.amznResourceName = amznResourceName; + } + + public String getAmznResourceName() { + return amznResourceName; + } + + public void setAmznResourceTimeout(int amznResourceTimeout) { + this.amznResourceTimeout = amznResourceTimeout; + } + + public int getAmznResourceTimeout() { + return amznResourceTimeout; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 0c3b336f0b..779a48ad63 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -23,33 +23,32 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServi import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServicesImpl; import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.CORSConfiguration; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.model.Documentation; -import org.wso2.carbon.apimgt.api.model.DocumentationType; import org.json.JSONArray; import org.json.JSONObject; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.api.model.APIIdentifier; -import org.wso2.carbon.apimgt.api.model.APIRevision; -import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; -import org.wso2.carbon.apimgt.api.model.CORSConfiguration; -import org.wso2.carbon.apimgt.api.model.Mediation; -import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.utils.APIUtil; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; @@ -65,16 +64,7 @@ import java.io.IOException; import java.nio.file.DirectoryIteratorException; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Date; +import java.util.*; /** * This class represents the concrete implementation of the APIPublisherService that corresponds to providing all @@ -167,6 +157,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { break; } } + String apiUuid = apiIdentifier.getUUID(); if (!apiFound) { // add new scopes as shared scopes for (ApiScope apiScope : apiConfig.getScopes()) { @@ -182,9 +173,10 @@ public class APIPublisherServiceImpl implements APIPublisherService { } APIInfo api = getAPI(apiConfig, true); JSONObject createdAPI = publisherRESTAPIServices.addAPI(apiApplicationKey, accessTokenInfo, api); + apiUuid = createdAPI.getString("id"); if (apiConfig.getEndpointType() != null && "WS".equals(apiConfig.getEndpointType())) { publisherRESTAPIServices.saveAsyncApiDefinition(apiApplicationKey, accessTokenInfo, - createdAPI.getString("id"), apiConfig.getAsyncApiDefinition()); + apiUuid, apiConfig.getAsyncApiDefinition()); } if (CREATED_STATUS.equals(createdAPI.getString("lifeCycleStatus"))) { // if endpoint type "dynamic" and then add in sequence @@ -195,13 +187,13 @@ public class APIPublisherServiceImpl implements APIPublisherService { mediation.setType("in"); mediation.setGlobal(false); publisherRESTAPIServices.addApiSpecificMediationPolicy(apiApplicationKey, - accessTokenInfo, createdAPI.getString("id"), mediation); + accessTokenInfo, apiUuid, mediation); } publisherRESTAPIServices.changeLifeCycleStatus(apiApplicationKey, accessTokenInfo, - createdAPI.getString("id"), PUBLISH_ACTION); + apiUuid, PUBLISH_ACTION); APIRevision apiRevision = new APIRevision(); - apiRevision.setApiUUID(createdAPI.getString("id")); + apiRevision.setApiUUID(apiUuid); apiRevision.setDescription("Initial Revision"); String apiRevisionId = publisherRESTAPIServices.addAPIRevision(apiApplicationKey, accessTokenInfo, apiRevision).getString("id"); @@ -214,7 +206,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { List apiRevisionDeploymentList = new ArrayList<>(); apiRevisionDeploymentList.add(apiRevisionDeployment); publisherRESTAPIServices.deployAPIRevision(apiApplicationKey, accessTokenInfo, - createdAPI.getString("id"), apiRevisionId, apiRevisionDeploymentList); + apiUuid, apiRevisionId, apiRevisionDeploymentList); } } else { if (WebappPublisherConfig.getInstance().isEnabledUpdateApi()) { @@ -257,7 +249,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { // Get existing API JSONObject existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo, - apiIdentifier); + apiUuid); if (scopesToMoveAsSharedScopes.size() > 0) { // update API to remove local scopes APIInfo api = getAPI(apiConfig, false); @@ -274,15 +266,15 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } - existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo, apiIdentifier); + existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo, apiUuid); APIInfo api = getAPI(apiConfig, true); api.setLastUpdatedTime(existingAPI.getString("lifeCycleStatus")); - api.setId(existingAPI.getString("id")); + api.setId(apiUuid); publisherRESTAPIServices.updateApi(apiApplicationKey, accessTokenInfo, api); if (apiConfig.getEndpointType() != null && "WS".equals(apiConfig.getEndpointType())) { publisherRESTAPIServices.saveAsyncApiDefinition(apiApplicationKey, accessTokenInfo, - existingAPI.getString("id"), apiConfig.getAsyncApiDefinition()); + apiUuid, apiConfig.getAsyncApiDefinition()); } // if endpoint type "dynamic" and then add /update in sequence @@ -293,48 +285,50 @@ public class APIPublisherServiceImpl implements APIPublisherService { mediation.setType("in"); mediation.setGlobal(false); - List mediationList = (List) publisherRESTAPIServices + JSONArray mediationList = (JSONArray) publisherRESTAPIServices .getAllApiSpecificMediationPolicies(apiApplicationKey, accessTokenInfo, - apiIdentifier).get("list"); + apiUuid).get("list"); boolean isMediationPolicyFound = false; - for (Mediation m : mediationList) { - if (apiConfig.getInSequenceName().equals(m.getName())) { - m.setConfig(apiConfig.getInSequenceConfig()); - publisherRESTAPIServices. - updateApiSpecificMediationPolicyContent(apiApplicationKey, - accessTokenInfo, existingAPI.getString("id"), m); + for (int i = 0; i < mediationList.length(); i++) { + JSONObject mediationObj = mediationList.getJSONObject(i); + if (apiConfig.getInSequenceName().equals(mediationObj.getString("name"))) { + mediation.setUuid(mediationObj.getString("id")); + publisherRESTAPIServices.deleteApiSpecificMediationPolicy(apiApplicationKey, + accessTokenInfo, apiUuid, mediation); + publisherRESTAPIServices.addApiSpecificMediationPolicy(apiApplicationKey, + accessTokenInfo, apiUuid, mediation); isMediationPolicyFound = true; break; } } if (!isMediationPolicyFound) { publisherRESTAPIServices.addApiSpecificMediationPolicy(apiApplicationKey, - accessTokenInfo, existingAPI.getString("id"), mediation); + accessTokenInfo, apiUuid, mediation); } } // This will retrieve the deployed revision JSONArray revisionDeploymentList = (JSONArray) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, - accessTokenInfo, existingAPI.getString("id"), true).get("list"); + accessTokenInfo, apiUuid, true).get("list"); // This will retrieve the un deployed revision list JSONArray undeployedRevisionList = (JSONArray) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, - accessTokenInfo, existingAPI.getString("id"), false).get("list"); + accessTokenInfo, apiUuid, false).get("list"); int apiRevisionCount = (int) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, - accessTokenInfo, existingAPI.getString("id"), null).get("count"); + accessTokenInfo, apiUuid, null).get("count"); if (apiRevisionCount >= 5) { JSONObject latestRevisionDeployment = revisionDeploymentList.getJSONObject(0); JSONObject earliestUndeployRevision = undeployedRevisionList.getJSONObject(0); publisherRESTAPIServices.undeployAPIRevisionDeployment(apiApplicationKey, - accessTokenInfo, latestRevisionDeployment, existingAPI.getString("id")); + accessTokenInfo, latestRevisionDeployment, apiUuid); publisherRESTAPIServices.deleteAPIRevision(apiApplicationKey, accessTokenInfo, - earliestUndeployRevision, existingAPI.getString("id")); + earliestUndeployRevision, apiUuid); } // create new revision APIRevision apiRevision = new APIRevision(); - apiRevision.setApiUUID(existingAPI.getString("id")); + apiRevision.setApiUUID(apiUuid); apiRevision.setDescription("Updated Revision"); String apiRevisionId = publisherRESTAPIServices.addAPIRevision(apiApplicationKey, accessTokenInfo, apiRevision).getString("id"); @@ -348,17 +342,15 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiRevisionDeploymentList.add(apiRevisionDeployment); publisherRESTAPIServices.deployAPIRevision(apiApplicationKey, accessTokenInfo, - existingAPI.getString("id"), apiRevisionId, apiRevisionDeploymentList); + apiUuid, apiRevisionId, apiRevisionDeploymentList); if (CREATED_STATUS.equals(existingAPI.getString("lifeCycleStatus"))) { publisherRESTAPIServices.changeLifeCycleStatus(apiApplicationKey,accessTokenInfo, - existingAPI.getString("id"), PUBLISH_ACTION); + apiUuid, PUBLISH_ACTION); } } } - if (apiConfig.getApiDocumentationSourceFile() != null) { - APIInfo api = getAPI(apiConfig, true); - + if (apiUuid != null && apiConfig.getApiDocumentationSourceFile() != null) { String fileName = CarbonUtils.getCarbonHome() + File.separator + "repository" + File.separator + "resources" + File.separator + "api-docs" + File.separator + @@ -376,7 +368,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { br.close(); String docContent = stringBuilder.toString(); - Documentation apiDocumentation = new Documentation(DocumentationType.HOWTO, apiConfig.getApiDocumentationName()); + Documentation apiDocumentation = new Documentation(Documentation.DocumentationType.HOWTO, apiConfig.getApiDocumentationName()); apiDocumentation.setVisibility(Documentation.DocumentVisibility.API_LEVEL); apiDocumentation.setSourceType(Documentation.DocumentSourceType.MARKDOWN); apiDocumentation.setCreatedDate(new Date()); @@ -385,25 +377,27 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiDocumentation.setOtherTypeName(null); JSONArray documentList = (JSONArray) publisherRESTAPIServices.getDocumentations(apiApplicationKey, - accessTokenInfo, api.getId()).get("list"); + accessTokenInfo, apiUuid).get("list"); if (documentList.length() > 0) { for (int i = 0; i < documentList.length(); i++) { JSONObject existingDoc = documentList.getJSONObject(i); if (existingDoc.getString("name").equals(apiConfig.getApiDocumentationName()) - && existingDoc.getString("type").equals(DocumentationType.HOWTO)) { + && existingDoc.getString("type").equals(Documentation.DocumentationType.HOWTO.name())) { publisherRESTAPIServices.deleteDocumentations(apiApplicationKey, accessTokenInfo, - api.getId(), existingDoc.getString("documentId")); + apiUuid, existingDoc.getString("documentId")); } } } else { log.info("There is no any existing api documentation."); } - Documentation createdDoc = publisherRESTAPIServices.addDocumentation(apiApplicationKey, accessTokenInfo, - api.getId(), apiDocumentation); - publisherRESTAPIServices.addDocumentationContent(apiApplicationKey, accessTokenInfo, api, - createdDoc.getId(), docContent); + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation createdDoc = publisherRESTAPIServices.addDocumentation(apiApplicationKey, accessTokenInfo, + apiUuid, apiDocumentation); + + publisherRESTAPIServices.addDocumentationContent(apiApplicationKey, accessTokenInfo, apiUuid, + createdDoc.getDocumentId(), docContent); + } } catch (APIManagementException | IOException | APIServicesException | BadRequestException | UnexpectedResponseException e) { @@ -572,46 +566,50 @@ public class APIPublisherServiceImpl implements APIPublisherService { } apiInfo.setPolicies(availableTiers); - if (config.getEndpointType() == null) { - List operations = new ArrayList(); - List scopeSet = new ArrayList(); - Iterator iterator; - for (iterator = config.getUriTemplates().iterator(); iterator.hasNext(); ) { - ApiUriTemplate apiUriTemplate = iterator.next(); - JSONObject operation = new JSONObject(); - operation.put("target", apiUriTemplate.getUriTemplate()); - operation.put("verb", apiUriTemplate.getHttpVerb()); - operation.put("authType", apiUriTemplate.getAuthType()); - operation.put("throttlingPolicy", UNLIMITED_TIER); - if (includeScopes) { - if (apiUriTemplate.getScope() != null) { - String scopeString = "{\n" + - " \"scope\": {\n" + - " \"id\": null,\n" + - " \"name\": \"" + apiUriTemplate.getScope().getKey() + "\",\n" + - " \"displayName\": \"" + apiUriTemplate.getScope().getName() + "\",\n" + - " \"description\": \"" + apiUriTemplate.getScope().getDescription() + "\",\n" + - " \"bindings\": [\n" + - " \"" + apiUriTemplate.getScope().getRoles() + "\"\n" + - " ],\n" + - " \"usageCount\": null\n" + - " },\n" + - " \"shared\": true\n" + - " }"; - JSONObject scope = new JSONObject(scopeString); - scopeSet.add(scope); - - Set scopes = new HashSet<>(); - scopes.add(apiUriTemplate.getScope().getKey()); - operation.put("scopes", scopes); - } - } - operations.add(operation); - } - apiInfo.setScopes(scopeSet); - apiInfo.setOperations(operations); + if (config.getEndpointType() != null && "WS".equals(config.getEndpointType())) { + apiInfo.setAsyncApiDefinition(config.getAsyncApiDefinition()); } + //set operations and scopes + List operations = new ArrayList(); + List scopeSet = new ArrayList(); + Iterator iterator; + for (iterator = config.getUriTemplates().iterator(); iterator.hasNext(); ) { + ApiUriTemplate apiUriTemplate = iterator.next(); + JSONObject operation = new JSONObject(); + operation.put("target", apiUriTemplate.getUriTemplate()); + operation.put("verb", apiUriTemplate.getHttpVerb()); + operation.put("authType", apiUriTemplate.getAuthType()); + operation.put("throttlingPolicy", UNLIMITED_TIER); + operation.put("uriMapping", apiUriTemplate.getUriMapping()); + if (includeScopes) { + if (apiUriTemplate.getScope() != null) { + String scopeString = "{\n" + + " \"scope\": {\n" + + " \"id\": null,\n" + + " \"name\": \"" + apiUriTemplate.getScope().getKey() + "\",\n" + + " \"displayName\": \"" + apiUriTemplate.getScope().getName() + "\",\n" + + " \"description\": \"" + apiUriTemplate.getScope().getDescription() + "\",\n" + + " \"bindings\": [\n" + + " \"" + apiUriTemplate.getScope().getRoles() + "\"\n" + + " ],\n" + + " \"usageCount\": null\n" + + " },\n" + + " \"shared\": true\n" + + " }"; + JSONObject scope = new JSONObject(scopeString); + scopeSet.add(scope); + + Set scopes = new HashSet<>(); + scopes.add(apiUriTemplate.getScope().getKey()); + operation.put("scopes", scopes); + } + } + operations.add(operation); + } + apiInfo.setScopes(scopeSet); + apiInfo.setOperations(operations); + if (config.isSharedWithAllTenants()) { apiInfo.setSubscriptionAvailability(SUBSCRIPTION_TO_ALL_TENANTS); apiInfo.setVisibility(API_GLOBAL_VISIBILITY); @@ -640,7 +638,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { if (config.getEndpointType() != null && "dynamic".equals(config.getEndpointType())) { endpointConfig = "{\n" + - " \"endpoint_type\": \"http\",\n" + + " \"endpoint_type\": \"default\",\n" + " \"sandbox_endpoints\": {\n" + " \"url\": \" default \"\n" + " },\n" + @@ -649,8 +647,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { " }\n" + " }"; endPointConfig = new JSONObject(endpointConfig); - //TODO: Will be used in dynamic endpoints -// apiInfo.setInSequence(config.getInSequenceName()); + apiInfo.setInSequence(config.getInSequenceName()); } // if ws endpoint @@ -702,42 +699,5 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiInfo.setServiceInfo(null); return apiInfo; - - //TODO: Will be used in WS or dynamic endpoints -// if (config.getEndpointType() != null && "WS".equals(config.getEndpointType())) { -// api.setAsyncApiDefinition(config.getAsyncApiDefinition()); -// AsyncApiParser asyncApiParser = new AsyncApiParser(); -// try { -// api.setUriTemplates(asyncApiParser.getURITemplates(config.getAsyncApiDefinition(), true)); -// } catch (APIManagementException e) { -// -// } -// api.setWsUriMapping(asyncApiParser.buildWSUriMapping(config.getAsyncApiDefinition())); -// } else { -// api.setSwaggerDefinition(APIPublisherUtil.getSwaggerDefinition(config)); -// -// Set uriTemplates = new HashSet<>(); -// Iterator iterator; -// for (iterator = config.getUriTemplates().iterator(); iterator.hasNext(); ) { -// ApiUriTemplate apiUriTemplate = iterator.next(); -// URITemplate uriTemplate = new URITemplate(); -// uriTemplate.setAuthType(apiUriTemplate.getAuthType()); -// uriTemplate.setHTTPVerb(apiUriTemplate.getHttpVerb()); -// uriTemplate.setResourceURI(apiUriTemplate.getResourceURI()); -// uriTemplate.setUriTemplate(apiUriTemplate.getUriTemplate()); -// if (includeScopes) { -// Scope scope = new Scope(); -// if (apiUriTemplate.getScope() != null) { -// scope.setName(apiUriTemplate.getScope().getName()); -// scope.setDescription(apiUriTemplate.getScope().getDescription()); -// scope.setKey(apiUriTemplate.getScope().getKey()); -// scope.setRoles(apiUriTemplate.getScope().getRoles()); -// uriTemplate.setScopes(scope); -// } -// } -// uriTemplates.add(uriTemplate); -// } -// api.setUriTemplates(uriTemplates); -// } } } From 7d859a317c269cbd8265caf102ed81051f9e6f6b Mon Sep 17 00:00:00 2001 From: pasindu Date: Wed, 2 Aug 2023 13:20:27 +0530 Subject: [PATCH 022/112] Improve check revision deployment list length logic --- .../publisher/APIPublisherServiceImpl.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 0c3b336f0b..c13cadc855 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -314,22 +314,27 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } - // This will retrieve the deployed revision - JSONArray revisionDeploymentList = (JSONArray) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, - accessTokenInfo, existingAPI.getString("id"), true).get("list"); - // This will retrieve the un deployed revision list - JSONArray undeployedRevisionList = (JSONArray) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, - accessTokenInfo, existingAPI.getString("id"), false).get("list"); int apiRevisionCount = (int) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, accessTokenInfo, existingAPI.getString("id"), null).get("count"); - if (apiRevisionCount >= 5) { - JSONObject latestRevisionDeployment = revisionDeploymentList.getJSONObject(0); - JSONObject earliestUndeployRevision = undeployedRevisionList.getJSONObject(0); - publisherRESTAPIServices.undeployAPIRevisionDeployment(apiApplicationKey, - accessTokenInfo, latestRevisionDeployment, existingAPI.getString("id")); - publisherRESTAPIServices.deleteAPIRevision(apiApplicationKey, accessTokenInfo, - earliestUndeployRevision, existingAPI.getString("id")); + // This will retrieve the deployed revision + JSONArray revisionDeploymentList = (JSONArray) publisherRESTAPIServices.getAPIRevisions( + apiApplicationKey, accessTokenInfo, existingAPI.getString("id"), + true).get("list"); + if (revisionDeploymentList.length() > 0) { + JSONObject latestRevisionDeployment = revisionDeploymentList.getJSONObject(0); + publisherRESTAPIServices.undeployAPIRevisionDeployment(apiApplicationKey, + accessTokenInfo, latestRevisionDeployment, existingAPI.getString("id")); + } + // This will retrieve the un deployed revision list + JSONArray undeployedRevisionList = (JSONArray) publisherRESTAPIServices.getAPIRevisions( + apiApplicationKey, accessTokenInfo, existingAPI.getString("id"), + false).get("list"); + if (undeployedRevisionList.length() > 0) { + JSONObject earliestUndeployRevision = undeployedRevisionList.getJSONObject(0); + publisherRESTAPIServices.deleteAPIRevision(apiApplicationKey, accessTokenInfo, + earliestUndeployRevision, existingAPI.getString("id")); + } } // create new revision From 35f11a0d94c6e3769e2cf094f3cd04850c1a575a Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Wed, 2 Aug 2023 16:00:43 +0530 Subject: [PATCH 023/112] ws token generator --- .../request/interceptor/WsTokenHandler.java | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/WsTokenHandler.java diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/WsTokenHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/WsTokenHandler.java new file mode 100644 index 0000000000..3a6c56f75f --- /dev/null +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/WsTokenHandler.java @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.ui.request.interceptor; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData; +import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants; +import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpHeaders; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.ContentType; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; + +import javax.servlet.annotation.MultipartConfig; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +@MultipartConfig +@WebServlet("/ws-credentials") +public class WsTokenHandler extends HttpServlet { + private static final Log log = LogFactory.getLog(DefaultTokenHandler.class); + + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) { + try { + HttpSession httpSession = req.getSession(false); + + if (httpSession != null) { + AuthData authData = (AuthData) httpSession.getAttribute(HandlerConstants.SESSION_AUTH_DATA_KEY); + if (authData == null) { + HandlerUtil.sendUnAuthorizeResponse(resp); + return; + } + + AuthData defaultAuthData = (AuthData) httpSession + .getAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY); + if (defaultAuthData != null) { + HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultAuthData.getAccessToken())); + return; + } + + String clientId = authData.getClientId(); + String clientSecret = authData.getClientSecret(); + + String queryString = req.getQueryString(); + String scopeString = ""; + if (StringUtils.isNotEmpty(queryString)) { + scopeString = req.getParameter("scopes"); + if (scopeString != null) { + scopeString = "?scopes=" + scopeString; + } + } + + String iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + + System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR) + + HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme()); + String tokenUrl = iotsCoreUrl + "/api/device-mgt/v1.0/devices/" + clientId + + "/" + clientSecret + "/default-token" + scopeString; + + HttpGet defaultTokenRequest = new HttpGet(tokenUrl); + defaultTokenRequest + .setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BEARER + authData.getAccessToken()); + defaultTokenRequest + .setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString()); + ProxyResponse tokenResultResponse = HandlerUtil.execute(defaultTokenRequest); + + if (tokenResultResponse.getExecutorResponse().contains(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX)) { + log.error("Error occurred while invoking the API to get default token data."); + HandlerUtil.handleError(resp, tokenResultResponse); + return; + } + String tokenResult = tokenResultResponse.getData(); + if (tokenResult == null) { + log.error("Invalid default token response is received."); + HandlerUtil.handleError(resp, tokenResultResponse); + return; + } + + JsonParser jsonParser = new JsonParser(); + JsonElement jTokenResult = jsonParser.parse(tokenResult); + if (jTokenResult.isJsonObject()) { + JsonObject jTokenResultAsJsonObject = jTokenResult.getAsJsonObject(); + AuthData newDefaultAuthData = new AuthData(); + newDefaultAuthData.setClientId(clientId); + newDefaultAuthData.setClientSecret(clientSecret); + + String defaultToken = jTokenResultAsJsonObject.get("accessToken").getAsString(); + newDefaultAuthData.setAccessToken(defaultToken); + newDefaultAuthData.setRefreshToken(jTokenResultAsJsonObject.get("refreshToken").getAsString()); + newDefaultAuthData.setScope(jTokenResultAsJsonObject.get("scopes").getAsString()); + httpSession.setAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY, newDefaultAuthData); + + HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultToken)); + } + } else { + HandlerUtil.sendUnAuthorizeResponse(resp); + } + } catch (IOException e) { + log.error("Error occurred when processing GET request to get default token.", e); + } + } + + /** + * Get Success Proxy Response + * @param defaultAccessToken Access token which has default scope + * @return {@link ProxyResponse} + */ + private ProxyResponse constructSuccessProxyResponse (String defaultAccessToken) { + + URIBuilder ub = new URIBuilder(); + ub.setScheme(HandlerConstants.WSS_PROTOCOL); + ub.setHost(System.getProperty(HandlerConstants.IOT_REMOTE_SESSION_HOST_ENV_VAR)); + ub.setPort(Integer.parseInt(System.getProperty(HandlerConstants.IOT_REMOTE_SESSION_HTTPS_PORT_ENV_VAR))); + ub.setPath(HandlerConstants.REMOTE_SESSION_CONTEXT); + + URIBuilder ub2 = new URIBuilder(); + ub2.setScheme(HandlerConstants.WSS_PROTOCOL); + ub2.setHost(System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR)); + ub2.setPort(Integer.parseInt(System.getProperty(HandlerConstants.IOT_GATEWAY_WEBSOCKET_WSS_PORT_ENV_VAR))); + + URIBuilder ub3 = new URIBuilder(); + ub3.setScheme(HandlerConstants.WS_PROTOCOL); + ub3.setHost(System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR)); + ub3.setPort(Integer.parseInt(System.getProperty(HandlerConstants.IOT_GATEWAY_WEBSOCKET_WS_PORT_ENV_VAR))); + + JsonObject responseJsonObj = new JsonObject(); + responseJsonObj.addProperty("default-access-token", defaultAccessToken); + responseJsonObj.addProperty("remote-session-base-url", ub.toString()); + responseJsonObj.addProperty("secured-websocket-gateway-url", ub2.toString()); + responseJsonObj.addProperty("unsecured-websocket-gateway-url", ub3.toString()); + + Gson gson = new Gson(); + String payload = gson.toJson(responseJsonObj); + + ProxyResponse proxyResponse = new ProxyResponse(); + proxyResponse.setCode(HttpStatus.SC_OK); + proxyResponse.setStatus(ProxyResponse.Status.SUCCESS); + proxyResponse.setData(payload); + return proxyResponse; + } +} From f33e10475599fb3cfeb3eaedd852c4dc70e8deea Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Wed, 2 Aug 2023 16:05:50 +0530 Subject: [PATCH 024/112] refactor oauth2 token generator --- .../{WsTokenHandler.java => DefaultOauth2TokenHandler.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/{WsTokenHandler.java => DefaultOauth2TokenHandler.java} (98%) diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/WsTokenHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultOauth2TokenHandler.java similarity index 98% rename from components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/WsTokenHandler.java rename to components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultOauth2TokenHandler.java index 3a6c56f75f..343a9c620d 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/WsTokenHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultOauth2TokenHandler.java @@ -44,8 +44,8 @@ import javax.servlet.http.HttpSession; import java.io.IOException; @MultipartConfig -@WebServlet("/ws-credentials") -public class WsTokenHandler extends HttpServlet { +@WebServlet("/default-oauth2-credentials") +public class DefaultOauth2TokenHandler extends HttpServlet { private static final Log log = LogFactory.getLog(DefaultTokenHandler.class); From 0375eab75555cb8dfecd77d774da6d374f28f2c5 Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Thu, 3 Aug 2023 11:11:46 +0530 Subject: [PATCH 025/112] fixed build break --- .../apimgt/webapp/publisher/APIPublisherServiceImpl.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 4932242bd2..871450c824 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -41,18 +41,11 @@ import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPub import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.model.Documentation; -import org.wso2.carbon.apimgt.api.model.DocumentationType; import org.json.JSONArray; import org.json.JSONObject; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.api.model.APIIdentifier; -import org.wso2.carbon.apimgt.api.model.APIRevision; -import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; -import org.wso2.carbon.apimgt.api.model.CORSConfiguration; -import org.wso2.carbon.apimgt.api.model.Mediation; -import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.utils.APIUtil; From 453034c0e2980ff6b37e8bc9356e8cd02e876ef8 Mon Sep 17 00:00:00 2001 From: navodzoysa Date: Fri, 4 Aug 2023 00:32:56 +0530 Subject: [PATCH 026/112] Revert Windows permission temp fix --- .../framework/authorizer/PermissionAuthorizer.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java index 3cddf49e29..0d509200e4 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java @@ -79,11 +79,6 @@ public class PermissionAuthorizer { matchingResources.add(new MatchingResource(permission.getUrlPattern().replace(context, ""), permission.getPath())); } } - //TODO :: Temporary fix for windows bst api url mismatch error - else if ("/api/device-mgt/windows/v1.0/bst/authentication".equals(permission.getUrl())) { - requiredPermission = "/permission/admin/device-mgt/devices/enroll/windows"; - break; - } } if (requiredPermission == null) { From 607b11a224e7bba8f84bc3b8778c34e68fc7bccf Mon Sep 17 00:00:00 2001 From: navodzoysa Date: Tue, 8 Aug 2023 23:41:06 +0530 Subject: [PATCH 027/112] Add missing Windows enroll scope --- .../src/main/resources/conf/mdm-ui-config.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index b16935562d..4e7b97fc6e 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -215,6 +215,7 @@ perm:android:google-account perm:android:info perm:windows:lock-devices + perm:windows:enroll perm:windows:disenroll perm:windows:wipe perm:windows:ring @@ -227,7 +228,7 @@ perm:android:clear-application perm:android:suspend-package perm:android:alternate-install - perm:ios:lock + perm:ios:lock perm:ios:location perm:ios:ring perm:ios:clear-passcode From e6ee539239ed9d625120d3fe8af358b72896758b Mon Sep 17 00:00:00 2001 From: osh Date: Wed, 9 Aug 2023 00:27:33 +0530 Subject: [PATCH 028/112] Add api changes for getting app details of operation --- .../common/services/SubscriptionManager.java | 10 ++++ .../mgt/core/dao/SubscriptionDAO.java | 12 +++++ .../GenericSubscriptionDAOImpl.java | 46 +++++++++++++++++++ .../core/impl/SubscriptionManagerImpl.java | 26 +++++++++++ .../api/ActivityInfoProviderService.java | 12 ++++- .../impl/ActivityProviderServiceImpl.java | 29 ++++++++++-- .../impl/ActivityProviderServiceImplTest.java | 2 +- .../mgt/common/operation/mgt/Activity.java | 46 +++++++++++++++++++ 8 files changed, 178 insertions(+), 5 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java index f2bd759fd7..e06a17cb9b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java @@ -27,6 +27,7 @@ import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import java.util.List; import java.util.Properties; @@ -207,4 +208,13 @@ public interface SubscriptionManager { */ PaginationResult getAppInstalledSubscribeDevices(PaginationRequest request, String appUUID, String subType, String subTypeName) throws ApplicationManagementException; + + + /*** + * This method is responsible for retrieving application details of the passed operation id. + * @param id ID of the related operation + * @return {@link Activity} Activity result of the app information. + * @throws {@link SubscriptionManagementException} Exception of the subscription management + */ + Activity getOperationAppDetails(String id) throws SubscriptionManagementException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java index 8b5caec6ac..804a4a29e2 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java @@ -23,6 +23,7 @@ import io.entgra.device.mgt.core.application.mgt.common.dto.DeviceSubscriptionDT import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import java.util.List; import java.util.Map; @@ -252,4 +253,15 @@ public interface SubscriptionDAO { * @throws {@link ApplicationManagementDAOException} if connections establishment fails. */ Map getCurrentInstalledAppVersion(int appId, List deviceIdList, String installedVersion) throws ApplicationManagementDAOException; + + + /** + * Retrieves app details by operation id. + * + * @param operationId ID of the operation which app details needs to be retrieved + * @param tenantId ID of tenant + * @return {@link Activity} + * @throws ApplicationManagementDAOException if error occurred while retrieving the app details + */ + Activity getOperationAppDetails(int operationId, int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index 353340e3d3..373ade8595 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -21,6 +21,7 @@ import io.entgra.device.mgt.core.application.mgt.core.dao.SubscriptionDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; @@ -1435,4 +1436,49 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc throw new ApplicationManagementDAOException(msg, e); } } + + public Activity getOperationAppDetails(int operationId, int tenantId) throws ApplicationManagementDAOException { + Activity activity = null; + try { + String sql = "SELECT " + + "AP.NAME, " + + "AR.PACKAGE_NAME, " + + "DS.SUBSCRIBED_BY, " + + "DS.STATUS " + + "FROM AP_APP_SUB_OP_MAPPING SOP " + + "JOIN AP_DEVICE_SUBSCRIPTION DS ON SOP.AP_DEVICE_SUBSCRIPTION_ID = DS.ID " + + "JOIN AP_APP_RELEASE AR ON DS.AP_APP_RELEASE_ID = AR.ID " + + "JOIN AP_APP AP ON AP.ID = AR.AP_APP_ID " + + " WHERE SOP.OPERATION_ID = ? AND SOP.TENANT_ID = ?"; + + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, operationId); + stmt.setInt(2,tenantId); + try (ResultSet rs = stmt.executeQuery()) { + if (log.isDebugEnabled()) { + log.debug("Successfully retrieved app details for operation " + + operationId); + } + while (rs.next()) { + activity = new Activity(); + activity.setAppName(rs.getString("NAME")); + activity.setUsername(rs.getString("SUBSCRIBED_BY")); + activity.setPackageName(rs.getString("PACKAGE_NAME")); + activity.setStatus(rs.getString("STATUS")); + } + return activity; + } + } + } catch (DBConnectionException e) { + String msg = + "Error occurred while getting the app details from the database related to operation " + operationId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to retrieve app details of operation" + operationId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java index d89039dee5..0829906682 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; import com.google.gson.Gson; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; +import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; import io.entgra.device.mgt.core.notification.logger.AppInstallLogContext; import io.entgra.device.mgt.core.notification.logger.impl.EntgraAppInstallLoggerImpl; @@ -1568,4 +1569,29 @@ public class SubscriptionManagerImpl implements SubscriptionManager { ConnectionManagerUtil.closeDBConnection(); } } + + @Override + public Activity getOperationAppDetails(String id) throws SubscriptionManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + int operationId = Integer.parseInt( + id.replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, "")); + if (operationId == 0) { + throw new IllegalArgumentException("Operation ID cannot be null or zero (0)."); + } + try { + ConnectionManagerUtil.openDBConnection(); + return subscriptionDAO.getOperationAppDetails(operationId, tenantId); + } catch (ApplicationManagementDAOException e) { + String msg = "Error occurred while retrieving app details of operation: " + operationId; + log.error(msg, e); + throw new SubscriptionManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while retrieving the database connection"; + log.error(msg, e); + throw new SubscriptionManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java index 99b56d9fbe..23076328e4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java @@ -308,7 +308,17 @@ public interface ActivityInfoProviderService { "Provide the value in the Java Date Format: EEE, d MMM yyyy HH:mm:ss Z\n." + "Example: Mon, 05 Jan 2014 15:10:00 +0200", required = false) - @HeaderParam("If-Modified-Since") String ifModifiedSince); + @HeaderParam("If-Modified-Since") String ifModifiedSince, + @ApiParam( + name = "response", + value = "The starting pagination index for the complete list of qualified items.", + required = false) + @QueryParam("response") Boolean response, + @ApiParam( + name = "appInstall", + value = "The starting pagination index for the complete list of qualified items.", + required = false) + @QueryParam("appInstall") Boolean appInstall); @GET @Path("/type/{operationCode}") diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java index db2a8eab31..d4860d3dc3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -18,6 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import com.google.gson.Gson; +import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; +import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest; @@ -146,8 +148,11 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService @Size(max = 45) String devicetype, @PathParam("deviceid") @Size(max = 45) String deviceid, - @HeaderParam("If-Modified-Since") String ifModifiedSince) { - Activity activity; + @HeaderParam("If-Modified-Since") String ifModifiedSince, + @QueryParam("response") Boolean response, + @QueryParam("appInstall") Boolean appInstall) { + Activity activity = new Activity(); + Activity appActivity = null; DeviceManagementProviderService dmService; try { RequestValidationUtil.validateActivityId(id); @@ -157,7 +162,20 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService deviceIdentifier.setType(devicetype); dmService = DeviceMgtAPIUtils.getDeviceManagementService(); - activity = dmService.getOperationByActivityIdAndDevice(id, deviceIdentifier); + + if (appInstall != null && appInstall) { + if (response != null && response) { + activity = dmService.getOperationByActivityIdAndDevice(id, deviceIdentifier); + } + SubscriptionManager subscriptionManager = DeviceMgtAPIUtils.getSubscriptionManager(); + appActivity = subscriptionManager.getOperationAppDetails(id); + activity.setUsername(appActivity.getUsername()); + activity.setPackageName(appActivity.getPackageName()); + activity.setAppName(appActivity.getAppName()); + activity.setStatus(appActivity.getStatus()); + } else { + activity = dmService.getOperationByActivityIdAndDevice(id, deviceIdentifier); + } if (activity == null) { String msg = "No activity can be " + "found upon the provided activity id '" + id + "'"; @@ -169,6 +187,11 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService log.error(msg, e); return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (SubscriptionManagementException e) { + String msg = "ErrorResponse occurred while fetching the app details for the supplied id."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java index f56c673495..0e3d23d705 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java @@ -206,7 +206,7 @@ public class ActivityProviderServiceImplTest { Mockito.when(this.deviceManagementProviderService .getOperationByActivityIdAndDevice(TEST_ACTIVITY_ID, deviceIdentifier)).thenReturn(activity); Response response = this.activityInfoProviderService.getActivityByDevice(TEST_ACTIVITY_ID, - DEVICE_TYPE, DEVICE_ID, IF_MODIFIED_SINCE); + DEVICE_TYPE, DEVICE_ID, IF_MODIFIED_SINCE, false, false); Assert.assertNotNull(response); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); Mockito.reset(this.deviceManagementProviderService); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java index 5a04185e0a..e9874778d9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java @@ -80,6 +80,20 @@ public class Activity { @JsonProperty("initiatedBy") private String initiatedBy; + @ApiModelProperty(name = "appName", value = "App Name.") + private String appName; + + @ApiModelProperty(name = "packageName", + value = "package name of the application") + private String packageName; + @ApiModelProperty(name = "username", + value = "username of subscribed person") + private String username; + @ApiModelProperty(name = "status", + value = "Status of app install") + private String status; + + public String getActivityId() { return activityId; } @@ -127,5 +141,37 @@ public class Activity { public void setInitiatedBy(String initiatedBy) { this.initiatedBy = initiatedBy; } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } } From e2a467bc455c7b960a7f244bdffc0529b9628d1d Mon Sep 17 00:00:00 2001 From: osh Date: Wed, 9 Aug 2023 15:03:29 +0530 Subject: [PATCH 029/112] Update activity loading --- .../GenericSubscriptionDAOImpl.java | 18 ++++--------- .../application/mgt/core/util/DAOUtil.java | 27 +++++++++++++++++++ .../impl/ActivityProviderServiceImpl.java | 14 +++++++--- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index 373ade8595..429ecc1e35 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -1438,7 +1438,6 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } public Activity getOperationAppDetails(int operationId, int tenantId) throws ApplicationManagementDAOException { - Activity activity = null; try { String sql = "SELECT " + "AP.NAME, " @@ -1456,18 +1455,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc stmt.setInt(1, operationId); stmt.setInt(2,tenantId); try (ResultSet rs = stmt.executeQuery()) { - if (log.isDebugEnabled()) { - log.debug("Successfully retrieved app details for operation " - + operationId); - } - while (rs.next()) { - activity = new Activity(); - activity.setAppName(rs.getString("NAME")); - activity.setUsername(rs.getString("SUBSCRIBED_BY")); - activity.setPackageName(rs.getString("PACKAGE_NAME")); - activity.setStatus(rs.getString("STATUS")); - } - return activity; + return DAOUtil.loadOperationActivity(rs); } } } catch (DBConnectionException e) { @@ -1479,6 +1467,10 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc String msg = "Error occurred when processing SQL to retrieve app details of operation" + operationId; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); + } catch (UnexpectedServerErrorException e) { + String msg = "More than one app for operation " + operationId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); } } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index 08ebe3b60d..ede8d7ff6d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -21,6 +21,7 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import io.entgra.device.mgt.core.application.mgt.common.dto.*; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.JSONException; @@ -361,6 +362,32 @@ public class DAOUtil { return subscriptionDTOS; } + public static Activity loadOperationActivity(ResultSet rs) throws SQLException, UnexpectedServerErrorException { + List activity = loadOperationActivities(rs); + if (activity.isEmpty()) { + return null; + } + if (activity.size() > 1) { + String msg = "Internal server error. Found more than one app for operation"; + log.error(msg); + throw new UnexpectedServerErrorException(msg); + } + return activity.get(0); + } + + public static List loadOperationActivities (ResultSet rs) throws SQLException { + List activities = new ArrayList<>(); + while (rs.next()) { + Activity activity = new Activity(); + activity.setAppName(rs.getString("NAME")); + activity.setUsername(rs.getString("SUBSCRIBED_BY")); + activity.setPackageName(rs.getString("PACKAGE_NAME")); + activity.setStatus(rs.getString("STATUS")); + activities.add(activity); + } + return activities; + } + public static VppUserDTO loadVppUser(ResultSet rs) throws SQLException, UnexpectedServerErrorException { List vppUserDTOS = loadVppUsers(rs); if (vppUserDTOS.isEmpty()) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java index d4860d3dc3..60272d589f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -169,10 +169,16 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService } SubscriptionManager subscriptionManager = DeviceMgtAPIUtils.getSubscriptionManager(); appActivity = subscriptionManager.getOperationAppDetails(id); - activity.setUsername(appActivity.getUsername()); - activity.setPackageName(appActivity.getPackageName()); - activity.setAppName(appActivity.getAppName()); - activity.setStatus(appActivity.getStatus()); + if (appActivity != null) { + activity.setUsername(appActivity.getUsername()); + activity.setPackageName(appActivity.getPackageName()); + activity.setAppName(appActivity.getAppName()); + activity.setStatus(appActivity.getStatus()); + } else { + String msg = "Cannot find the app details related to the operation "; + log.error(msg); + Response.status(404).entity(msg).build(); + } } else { activity = dmService.getOperationByActivityIdAndDevice(id, deviceIdentifier); } From 81e57ce78fd26d3fc83ec755c1850cb176353cd4 Mon Sep 17 00:00:00 2001 From: osh Date: Thu, 10 Aug 2023 13:01:41 +0530 Subject: [PATCH 030/112] Retrieve extra details --- .../GenericSubscriptionDAOImpl.java | 5 ++- .../application/mgt/core/util/DAOUtil.java | 3 ++ .../impl/ActivityProviderServiceImpl.java | 3 ++ .../mgt/common/operation/mgt/Activity.java | 36 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index 429ecc1e35..457de13bee 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -1441,9 +1441,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc try { String sql = "SELECT " + "AP.NAME, " + + "AP.TYPE, " + "AR.PACKAGE_NAME, " + + "AR.VERSION, " + "DS.SUBSCRIBED_BY, " - + "DS.STATUS " + + "DS.STATUS, " + + "DS.ACTION_TRIGGERED_FROM " + "FROM AP_APP_SUB_OP_MAPPING SOP " + "JOIN AP_DEVICE_SUBSCRIPTION DS ON SOP.AP_DEVICE_SUBSCRIPTION_ID = DS.ID " + "JOIN AP_APP_RELEASE AR ON DS.AP_APP_RELEASE_ID = AR.ID " diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index ede8d7ff6d..a41f48e1e9 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -380,9 +380,12 @@ public class DAOUtil { while (rs.next()) { Activity activity = new Activity(); activity.setAppName(rs.getString("NAME")); + activity.setAppType(rs.getString("TYPE")); activity.setUsername(rs.getString("SUBSCRIBED_BY")); activity.setPackageName(rs.getString("PACKAGE_NAME")); activity.setStatus(rs.getString("STATUS")); + activity.setVersion(rs.getString("VERSION")); + activity.setTriggeredBy(rs.getString("ACTION_TRIGGERED_FROM")); activities.add(activity); } return activities; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java index 60272d589f..d9fec4b91b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -174,6 +174,9 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService activity.setPackageName(appActivity.getPackageName()); activity.setAppName(appActivity.getAppName()); activity.setStatus(appActivity.getStatus()); + activity.setAppType(appActivity.getAppType()); + activity.setVersion(appActivity.getVersion()); + activity.setTriggeredBy(appActivity.getTriggeredBy()); } else { String msg = "Cannot find the app details related to the operation "; log.error(msg); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java index e9874778d9..e001d72929 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java @@ -93,6 +93,18 @@ public class Activity { value = "Status of app install") private String status; + @ApiModelProperty(name = "version", + value = "Version of app") + private String version; + + @ApiModelProperty(name = "triggeredBy", + value = "Operation triggered by what") + private String triggeredBy; + + @ApiModelProperty(name = "appType", + value = "Type of application") + private String appType; + public String getActivityId() { return activityId; @@ -173,5 +185,29 @@ public class Activity { public void setStatus(String status) { this.status = status; } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getTriggeredBy() { + return triggeredBy; + } + + public void setTriggeredBy(String triggeredBy) { + this.triggeredBy = triggeredBy; + } + + public String getAppType() { + return appType; + } + + public void setAppType(String appType) { + this.appType = appType; + } } From 74d4e2dded9aee97ef5179a3320f30a26cd57d0b Mon Sep 17 00:00:00 2001 From: osh Date: Thu, 10 Aug 2023 13:12:19 +0530 Subject: [PATCH 031/112] Add vpp scopes --- .../src/main/resources/conf/mdm-ui-config.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index 4e7b97fc6e..30c9e55f57 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -241,6 +241,10 @@ perm:ios:app-configurations perm:mac-os:restart perm:mac-os:shut-down + perm:app:vpp:user:modify + perm:app:vpp:user:view + perm:app:vpp:asset:modify + perm:app:vpp:asset:view device-mgt From 67864cb76212aca213ee7e22a721395175a25b7f Mon Sep 17 00:00:00 2001 From: shamalka Date: Tue, 15 Aug 2023 12:48:58 +0530 Subject: [PATCH 032/112] Add deviceinfo config beans --- .../config/ui/DeviceInfoConfigurations.java | 36 ++++++++++ .../mgt/core/config/ui/DeviceInfoItem.java | 56 +++++++++++++++ .../mgt/core/config/ui/UIConfiguration.java | 11 +++ .../src/main/resources/conf/mdm-ui-config.xml | 70 +++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/DeviceInfoConfigurations.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/DeviceInfoItem.java diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/DeviceInfoConfigurations.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/DeviceInfoConfigurations.java new file mode 100644 index 0000000000..0e37753018 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/DeviceInfoConfigurations.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.device.mgt.core.config.ui; + +import javax.xml.bind.annotation.XmlElement; +import java.util.List; + +class DeviceInfoConfigurations { + + private List deviceInfoItems; + + @XmlElement(name = "DeviceInfoItem") + public List getDeviceInfoItems() { + return deviceInfoItems; + } + + public void setDeviceInfoItems(List deviceInfoItems) { + this.deviceInfoItems = deviceInfoItems; + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/DeviceInfoItem.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/DeviceInfoItem.java new file mode 100644 index 0000000000..0f02669a49 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/DeviceInfoItem.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.device.mgt.core.config.ui; + +import javax.xml.bind.annotation.XmlElement; + +class DeviceInfoItem { + + private String definedValue; + private String displayValue; + + private String type; + + @XmlElement(name = "DefinedValue") + public String getDefinedValue() { + return definedValue; + } + + public void setDefinedValue(String definedValue) { + this.definedValue = definedValue; + } + + @XmlElement(name = "DisplayValue") + public String getDisplayValue() { + return displayValue; + } + + public void setDisplayValue(String displayValue) { + this.displayValue = displayValue; + } + + @XmlElement(name = "Type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/UIConfiguration.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/UIConfiguration.java index 844c4039d2..6e71d17072 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/UIConfiguration.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/UIConfiguration.java @@ -36,6 +36,8 @@ public class UIConfiguration { private Billing billing; private HubspotChat hubspotChat; + private DeviceInfoConfigurations deviceInfoConfigurations; + @XmlElement(name = "AppRegistration", required=true) public AppRegistration getAppRegistration() { return appRegistration; @@ -98,4 +100,13 @@ public class UIConfiguration { public void setLoginCacheCapacity(int loginCacheCapacity) { this.loginCacheCapacity = loginCacheCapacity; } + + @XmlElement(name = "DeviceInfoConfigurations", required = true) + public DeviceInfoConfigurations getDeviceInfoConfigurations() { + return deviceInfoConfigurations; + } + + public void setDeviceInfoConfigurations(DeviceInfoConfigurations deviceInfoConfigurations) { + this.deviceInfoConfigurations = deviceInfoConfigurations; + } } diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index 30c9e55f57..d289c60da6 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -40,6 +40,76 @@ false true + + + FIRMWARE_VERSION + Firmware version + + + FIRMWARE_APP_VERSION + App version + + + name + Device + default + + + type + Type + default + + + owner + Owner + default + + + serial + Serial Number + default + + + ownership + Ownership + default + + + status + Status + default + + + dateOfLastUpdate + Last Updated + default + + + actions + Actions + default + + + batteryLevel + Battery Level + deviceInfo + + + deviceModel + Device Model + deviceInfo + + + osVersion + OS Version + deviceInfo + + + vendor + Vendor + deviceInfo + + analytics_management From d8691596257f3fd9cfb8ba50eeb28761d1a03406 Mon Sep 17 00:00:00 2001 From: shamalka Date: Tue, 15 Aug 2023 15:17:27 +0530 Subject: [PATCH 033/112] Add missing type params to device info xml --- .../src/main/resources/conf/mdm-ui-config.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index d289c60da6..4407fbd5e4 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -44,10 +44,12 @@ FIRMWARE_VERSION Firmware version + deviceInfo FIRMWARE_APP_VERSION App version + deviceInfo name From f9ae594326b165ade7c45cf69014d2290665200e Mon Sep 17 00:00:00 2001 From: tcdlpds Date: Wed, 16 Aug 2023 08:34:28 +0530 Subject: [PATCH 034/112] Fix APPs getting issue in APPM DAO --- .../mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java index 8aa49c92e0..4f46d5b4f6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java @@ -293,11 +293,11 @@ public class ApplicationDAOImpl implements ApplicationDAO { "WHERE A.NAME = DM_APPLICATION.NAME " + "AND A.ID < DM_APPLICATION.ID) " + "AND PLATFORM = ? " + - "AND TENANT_ID = ?"; + "AND TENANT_ID = ? "; try { String filter = request.getFilter(); if (filter != null) { - sql = sql + "AND NAME LIKE ?"; + sql = sql + "AND NAME LIKE ? "; } sql = sql + "LIMIT ? OFFSET ?"; Connection conn = this.getConnection(); From 4ab0c77e8e484647af8aa0c893261720c35a44b9 Mon Sep 17 00:00:00 2001 From: shamalka Date: Thu, 17 Aug 2023 01:20:40 +0530 Subject: [PATCH 035/112] Add i8n support --- .../src/main/resources/conf/mdm-ui-config.xml | 88 ++++++++++++++++--- 1 file changed, 74 insertions(+), 14 deletions(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index 4407fbd5e4..f60b9cca6a 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -43,72 +43,132 @@ FIRMWARE_VERSION - Firmware version + label_firmware_version deviceInfo FIRMWARE_APP_VERSION - App version + label_app_version deviceInfo name - Device + label_device default type - Type + label_type default owner - Owner + label_owner default serial - Serial Number + label_serialNumber default ownership - Ownership + label_ownership default status - Status + label_status default dateOfLastUpdate - Last Updated + label_last_updated default actions - Actions + label_actions default batteryLevel - Battery Level + label_battery_leve deviceInfo deviceModel - Device Model + label_deviceModel deviceInfo osVersion - OS Version + label_os_version deviceInfo vendor - Vendor + label_vendor + deviceInfo + + + availableRAMMemory + label_available_ram_memory + deviceInfo + + + connectionType + label_connection_type + deviceInfo + + + cpuUsage + label_cpu_usage + deviceInfo + + + externalAvailableMemory + label_external_available_memory + deviceInfo + + + externalTotalMemory + label_external_tot_memory + deviceInfo + + + internalAvailableMemory + label_internal_available_memory + deviceInfo + + + internalTotalMemory + label_internal_tot_memory + deviceInfo + + + osBuildDate + label_os_build_date + deviceInfo + + + pluggedIn + label_plugged_in + deviceInfo + + + ssid + label_ssid + deviceInfo + + + totalRAMMemory + label_tot_ram_memory + deviceInfo + + + updatedTime + label_updated_time deviceInfo From 6d6d3f4f406397b8f2bc89156b72348dae48507d Mon Sep 17 00:00:00 2001 From: shamalka Date: Fri, 18 Aug 2023 10:28:04 +0530 Subject: [PATCH 036/112] Add firmware system version column --- .../src/main/resources/conf/mdm-ui-config.xml | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index f60b9cca6a..a5dad642b7 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -41,16 +41,6 @@ true - - FIRMWARE_VERSION - label_firmware_version - deviceInfo - - - FIRMWARE_APP_VERSION - label_app_version - deviceInfo - name label_device @@ -91,6 +81,21 @@ label_actions default + + FIRMWARE_VERSION + label_firmware_version + deviceDetailsMap + + + FIRMWARE_APP_VERSION + label_app_version + deviceDetailsMap + + + FIRMWARE_SYSTEM_VERSION + label_firmware_system_version + deviceDetailsMap + batteryLevel label_battery_leve From 388f34e3b8afd2945245eddbff5c3f78a97bc57a Mon Sep 17 00:00:00 2001 From: pramilaniroshan Date: Mon, 21 Aug 2023 12:44:42 +0530 Subject: [PATCH 037/112] Fix try-it meta-info getting issue --- .../mgt/core/otp/mgt/service/OTPManagementServiceImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java index d8872be921..bc9204eecb 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java @@ -276,9 +276,7 @@ public class OTPManagementServiceImpl implements OTPManagementService { public OneTimePinDTO generateOneTimePin(OneTimePinDTO oneTimePinDTO, boolean persistPin) throws OTPManagementException { String otpValue = UUID.randomUUID().toString(); - - Gson gson = new Gson(); - String metaInfo = gson.toJson(oneTimePinDTO.getMetaInfo()); + String metaInfo = oneTimePinDTO.getMetaInfo(); oneTimePinDTO.setMetaInfo(metaInfo); oneTimePinDTO.setOtpToken(otpValue); From 1fed47e8fd694445a505cc7abfccc026aa71cd4c Mon Sep 17 00:00:00 2001 From: osh Date: Mon, 21 Aug 2023 23:27:58 +0530 Subject: [PATCH 038/112] Add app details for UNMANAGED_APP_UNINSTALL --- .../beans/ApplicationUninstallation.java | 49 +++++++++++++++++++ .../service/api/DeviceManagementService.java | 26 +++++++++- .../impl/DeviceManagementServiceImpl.java | 8 ++- .../mgt/dao/impl/GenericOperationDAOImpl.java | 34 +++++++++++++ 4 files changed, 114 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationUninstallation.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationUninstallation.java index a38ae2982d..f78d15966e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationUninstallation.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationUninstallation.java @@ -41,6 +41,14 @@ public class ApplicationUninstallation { @Pattern(regexp = "^[A-Za-z]*$") String type; + String name; + + String platform; + + String version; + + String user; + public ApplicationUninstallation() { } @@ -49,6 +57,47 @@ public class ApplicationUninstallation { this.type = type; } + public ApplicationUninstallation(String appIdentifier, String type, String name, String platform, String version, String user) { + this.appIdentifier = appIdentifier; + this.type = type; + this.name = name; + this.platform = platform; + this.version = version; + this.user = user; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPlatform() { + return platform; + } + + public void setPlatform(String platform) { + this.platform = platform; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + public String getAppIdentifier() { return appIdentifier; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java index 53f7fd9360..bb5349da68 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java @@ -1657,7 +1657,31 @@ public interface DeviceManagementService { value = "The package name of the app user want to uninstall", required = true) @QueryParam("packageName") - String packageName); + String packageName, + @ApiParam( + name = "platform", + value = "The platform of the app user want to uninstall", + required = false) + @QueryParam("platform") + String platform, + @ApiParam( + name = "name", + value = "The name of the app user want to uninstall", + required = false) + @QueryParam("name") + String name, + @ApiParam( + name = "version", + value = "The version of the app user want to uninstall", + required = false) + @QueryParam("version") + String version, + @ApiParam( + name = "user", + value = "The user who triggered the app uninstall", + required = false) + @QueryParam("user") + String user); @GET @Produces(MediaType.APPLICATION_JSON) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java index b5851dff0c..2eaa0a5595 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -981,7 +981,11 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { public Response uninstallation( @PathParam("type") @Size(max = 45) String type, @PathParam("id") @Size(max = 45) String id, - @QueryParam("packageName") String packageName) { + @QueryParam("packageName") String packageName, + @QueryParam("platform") String platform, + @QueryParam("name") String name, + @QueryParam("version") String version, + @QueryParam("user") String user) { List deviceIdentifiers = new ArrayList<>(); Operation operation = new Operation(); try { @@ -1004,7 +1008,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { //if the applications not installed via entgra store } else { if (Constants.ANDROID.equals(type)) { - ApplicationUninstallation applicationUninstallation = new ApplicationUninstallation(packageName, "PUBLIC"); + ApplicationUninstallation applicationUninstallation = new ApplicationUninstallation(packageName, "PUBLIC", name, platform, version, user); Gson gson = new Gson(); operation.setCode(MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL); operation.setType(Operation.Type.PROFILE); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index 046556459a..7411f93c5a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -17,6 +17,8 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; +import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants; +import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ProfileOperation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -41,6 +43,8 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util.Operatio import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; +import java.io.ObjectInputStream; +import java.io.ByteArrayInputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -1353,6 +1357,9 @@ public class GenericOperationDAOImpl implements OperationDAO { List operations = new ArrayList<>(); String createdTo = null; String createdFrom = null; + ByteArrayInputStream bais; + ObjectInputStream ois; + ProfileOperation profileOperation = null; DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); boolean isCreatedDayProvided = false; boolean isUpdatedDayProvided = false; //updated day = received day @@ -1375,6 +1382,7 @@ public class GenericOperationDAOImpl implements OperationDAO { "o.RECEIVED_TIMESTAMP, " + "o.OPERATION_CODE, " + "o.INITIATED_BY, " + + "o.OPERATION_DETAILS, " + "om.STATUS, " + "om.ID AS OM_MAPPING_ID, " + "om.UPDATED_TIMESTAMP " + @@ -1473,10 +1481,21 @@ public class GenericOperationDAOImpl implements OperationDAO { } operation.setCode(rs.getString("OPERATION_CODE")); operation.setInitiatedBy(rs.getString("INITIATED_BY")); + if (MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL.equals(operation.getCode())) { + byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); + bais = new ByteArrayInputStream(operationDetails); + ois = new ObjectInputStream(bais); + profileOperation = (ProfileOperation) ois.readObject(); + operation.setPayLoad(profileOperation.getPayLoad()); + } operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); operations.add(operation); } + } catch (IOException e) { + throw new OperationManagementDAOException("IO Error occurred while retrieving app data of operation ", e); + } catch (ClassNotFoundException e) { + throw new OperationManagementDAOException("Class not found error occurred while retrieving app data of operation ", e); } } } catch (SQLException e) { @@ -1493,6 +1512,9 @@ public class GenericOperationDAOImpl implements OperationDAO { List operations = new ArrayList<>(); String createdTo = null; String createdFrom = null; + ByteArrayInputStream bais; + ObjectInputStream ois; + ProfileOperation profileOperation = null; DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); boolean isCreatedDayProvided = false; boolean isUpdatedDayProvided = false; //updated day = received day @@ -1515,6 +1537,7 @@ public class GenericOperationDAOImpl implements OperationDAO { "o.RECEIVED_TIMESTAMP, " + "o.OPERATION_CODE, " + "o.INITIATED_BY, " + + "o.OPERATION_DETAILS, " + "om.STATUS, " + "om.ID AS OM_MAPPING_ID, " + "om.UPDATED_TIMESTAMP " + @@ -1613,10 +1636,21 @@ public class GenericOperationDAOImpl implements OperationDAO { } operation.setCode(rs.getString("OPERATION_CODE")); operation.setInitiatedBy(rs.getString("INITIATED_BY")); + if (MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL.equals(operation.getCode())) { + byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); + bais = new ByteArrayInputStream(operationDetails); + ois = new ObjectInputStream(bais); + profileOperation = (ProfileOperation) ois.readObject(); + operation.setPayLoad(profileOperation.getPayLoad()); + } operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); operations.add(operation); } + } catch (IOException e) { + throw new OperationManagementDAOException("IO Error occurred while retrieving app data of operation " , e); + } catch (ClassNotFoundException e) { + throw new OperationManagementDAOException("Class not found error occurred while retrieving app data of operation ", e); } } } catch (SQLException e) { From 127b554ef7456aad526647eec8f2cc1a83e8153b Mon Sep 17 00:00:00 2001 From: rajitha Date: Tue, 22 Aug 2023 08:20:59 +0530 Subject: [PATCH 039/112] Remove not null constraints from metainfo field --- .../src/main/resources/dbscripts/cdm/h2.sql | 2 +- .../src/main/resources/dbscripts/cdm/mssql.sql | 2 +- .../src/main/resources/dbscripts/cdm/mysql.sql | 2 +- .../src/main/resources/dbscripts/cdm/oracle.sql | 2 +- .../src/main/resources/dbscripts/cdm/postgresql.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index b3bc1c36ea..a0be9fd704 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -608,7 +608,7 @@ CREATE TABLE IF NOT EXISTS DM_OTP_DATA ( USERNAME VARCHAR(500) DEFAULT NOT NULL, EMAIL VARCHAR(100) NOT NULL, EMAIL_TYPE VARCHAR(20) NOT NULL, - META_INFO VARCHAR(20000) NOT NULL, + META_INFO VARCHAR(20000) NULL, CREATED_AT TIMESTAMP NOT NULL, EXPIRY_TIME INT NOT NULL DEFAULT 3600, IS_EXPIRED BOOLEAN DEFAULT false, diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 34ff7ef1a7..16af46d997 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -669,7 +669,7 @@ CREATE TABLE DM_OTP_DATA ( USERNAME VARCHAR(500) NOT NULL, EMAIL VARCHAR(100) NOT NULL, EMAIL_TYPE VARCHAR(20) NOT NULL, - META_INFO VARCHAR(8000) NOT NULL, + META_INFO VARCHAR(8000) NULL, CREATED_AT DATETIME2(0) NOT NULL, EXPIRY_TIME INT NOT NULL DEFAULT 3600, IS_EXPIRED BIT DEFAULT 0, diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index e55274e49f..d184237d44 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -665,7 +665,7 @@ CREATE TABLE IF NOT EXISTS DM_OTP_DATA ( USERNAME VARCHAR(500) NOT NULL, EMAIL VARCHAR(100) NOT NULL, EMAIL_TYPE VARCHAR(20) NOT NULL, - META_INFO VARCHAR(20000) NOT NULL, + META_INFO VARCHAR(20000) NULL, CREATED_AT TIMESTAMP NOT NULL, EXPIRY_TIME INT NOT NULL DEFAULT 3600, IS_EXPIRED BOOLEAN DEFAULT false, diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index 708f135b78..60c7aaf89e 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -1026,7 +1026,7 @@ CREATE TABLE DM_OTP_DATA ( USERNAME VARCHAR(500) NOT NULL, EMAIL VARCHAR2(100) NOT NULL, EMAIL_TYPE VARCHAR2(20) NOT NULL, - META_INFO VARCHAR2(20000) NOT NULL, + META_INFO VARCHAR2(20000) NULL, CREATED_AT TIMESTAMP(0) NOT NULL, EXPIRY_TIME NUMBER(10) DEFAULT 3600 NOT NULL, IS_EXPIRED CHAR(1) DEFAULT false, diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 3ff77c0242..f9f6879338 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -672,7 +672,7 @@ CREATE TABLE IF NOT EXISTS DM_OTP_DATA ( USERNAME VARCHAR(500) NOT NULL, EMAIL VARCHAR(100) NOT NULL, EMAIL_TYPE VARCHAR(20) NOT NULL, - META_INFO VARCHAR(20000) NOT NULL, + META_INFO VARCHAR(20000) NULL, CREATED_AT TIMESTAMP(0) NOT NULL, EXPIRY_TIME INT NOT NULL DEFAULT 3600, IS_EXPIRED BOOLEAN DEFAULT false, From 195bb64beafe347c6280d8715f074b4f29291949 Mon Sep 17 00:00:00 2001 From: osh Date: Wed, 23 Aug 2023 12:42:57 +0530 Subject: [PATCH 040/112] Resolve comments --- .../mgt/dao/impl/GenericOperationDAOImpl.java | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index 7411f93c5a..164e50a8ec 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -1357,8 +1357,6 @@ public class GenericOperationDAOImpl implements OperationDAO { List operations = new ArrayList<>(); String createdTo = null; String createdFrom = null; - ByteArrayInputStream bais; - ObjectInputStream ois; ProfileOperation profileOperation = null; DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); boolean isCreatedDayProvided = false; @@ -1483,19 +1481,24 @@ public class GenericOperationDAOImpl implements OperationDAO { operation.setInitiatedBy(rs.getString("INITIATED_BY")); if (MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL.equals(operation.getCode())) { byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); - bais = new ByteArrayInputStream(operationDetails); - ois = new ObjectInputStream(bais); - profileOperation = (ProfileOperation) ois.readObject(); - operation.setPayLoad(profileOperation.getPayLoad()); + try (ByteArrayInputStream bais = new ByteArrayInputStream(operationDetails); + ObjectInputStream ois = new ObjectInputStream(bais)) { + profileOperation = (ProfileOperation) ois.readObject(); + operation.setPayLoad(profileOperation.getPayLoad()); + } catch (IOException e) { + String msg = "IO Error occurred while retrieving app data of operation "; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } catch (ClassNotFoundException e) { + String msg = "Class not found error occurred while retrieving app data of operation "; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } } operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); operations.add(operation); } - } catch (IOException e) { - throw new OperationManagementDAOException("IO Error occurred while retrieving app data of operation ", e); - } catch (ClassNotFoundException e) { - throw new OperationManagementDAOException("Class not found error occurred while retrieving app data of operation ", e); } } } catch (SQLException e) { @@ -1512,8 +1515,6 @@ public class GenericOperationDAOImpl implements OperationDAO { List operations = new ArrayList<>(); String createdTo = null; String createdFrom = null; - ByteArrayInputStream bais; - ObjectInputStream ois; ProfileOperation profileOperation = null; DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); boolean isCreatedDayProvided = false; @@ -1638,19 +1639,24 @@ public class GenericOperationDAOImpl implements OperationDAO { operation.setInitiatedBy(rs.getString("INITIATED_BY")); if (MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL.equals(operation.getCode())) { byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); - bais = new ByteArrayInputStream(operationDetails); - ois = new ObjectInputStream(bais); - profileOperation = (ProfileOperation) ois.readObject(); - operation.setPayLoad(profileOperation.getPayLoad()); + try (ByteArrayInputStream bais = new ByteArrayInputStream(operationDetails); + ObjectInputStream ois = new ObjectInputStream(bais)) { + profileOperation = (ProfileOperation) ois.readObject(); + operation.setPayLoad(profileOperation.getPayLoad()); + } catch (IOException e) { + String msg = "IO Error occurred while retrieving app data of operation "; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } catch (ClassNotFoundException e) { + String msg = "Class not found error occurred while retrieving app data of operation "; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } } operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); operations.add(operation); } - } catch (IOException e) { - throw new OperationManagementDAOException("IO Error occurred while retrieving app data of operation " , e); - } catch (ClassNotFoundException e) { - throw new OperationManagementDAOException("Class not found error occurred while retrieving app data of operation ", e); } } } catch (SQLException e) { From 70c27b647b2940dff5dac6a98ac529c320d73f92 Mon Sep 17 00:00:00 2001 From: Thameera Date: Wed, 23 Aug 2023 13:47:30 +0530 Subject: [PATCH 041/112] Operation Template releated changes --- .../io.entgra.device.mgt.core.operation.template/pom.xml | 5 ++++- .../internal/OperationTemplateMgtServiceComponent.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index 9edcd52f95..78e8220884 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -79,7 +79,8 @@ io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.registry, javax.net.ssl, org.wso2.carbon.core.util, - okhttp3 + okhttp3, + com.google.common.cache.* !io.entgra.device.mgt.core.operation.template.internal, @@ -300,6 +301,8 @@ com.google.guava guava + ${guava.version} + provided io.github.openfeign diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtServiceComponent.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtServiceComponent.java index 1bff30c260..0eae3ad301 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtServiceComponent.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtServiceComponent.java @@ -31,7 +31,7 @@ import org.osgi.service.component.ComponentContext; import org.wso2.carbon.ndatasource.core.DataSourceService; /** - * @scr.component name="io.entgra.device.mgt.operation.template.internal.OperationTemplateMgtServiceComponent" immediate="true" + * @scr.component name="io.entgra.device.mgt.core.operation.template.internal.OperationTemplateMgtServiceComponent" immediate="true" * immediate="true" * @scr.reference name="org.wso2.carbon.ndatasource" * interface="org.wso2.carbon.ndatasource.core.DataSourceService" From 7a7974eb36e3d9c953d0a2b4c82a8227627d05df Mon Sep 17 00:00:00 2001 From: ThilinaPremachandra Date: Tue, 22 Aug 2023 14:57:42 +0530 Subject: [PATCH 042/112] Add: hierarchical group count API --- .../service/api/GroupManagementService.java | 46 +++++++++++++ .../admin/GroupManagementAdminService.java | 52 ++++++++++++++ .../impl/GroupManagementServiceImpl.java | 13 ++++ .../GroupManagementAdminServiceImpl.java | 17 +++++ .../GroupManagementProviderService.java | 18 +++++ .../GroupManagementProviderServiceImpl.java | 69 +++++++++++++++++++ 6 files changed, 215 insertions(+) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java index c447c48a5b..94cf447f92 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java @@ -355,6 +355,52 @@ public interface GroupManagementService { @QueryParam("limit") int limit); + @Path("/hierarchy/count") + @GET + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HTTPConstants.HEADER_GET, + value = "Getting the Number of Hirarchical Device Groups", + notes = "Get the number of hierarchical device groups in the server that the current signed in user can access.", + tags = "Device Group Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:count") + }) + }, + nickname = "getGroupCountNonAdmin" + + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK. \n Successfully fetched the hierarchical device group count.", + response = DeviceGroupList.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 304, + message = "Not Modified. \n Empty body because the client has already the latest version of " + + "the requested resource."), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching the group count.", + response = ErrorResponse.class) + }) + Response getHierarchicalGroupCount(); + @Path("/count") @GET @ApiOperation( diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java index 373afe9272..93bc0fabc6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -256,6 +256,58 @@ public interface GroupManagementAdminService { @QueryParam("limit") int limit); + @Path("/hierarchy/count") + @GET + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HTTPConstants.HEADER_GET, + value = "Get the count of all hierarchical groups belongs to current admin user.", + notes = "Returns count of all permitted hierarchical groups enrolled with the system.", + tags = "Device Group Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-groups:count") + }) + } + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK. \n Successfully fetched the hierarchical device group count.", + response = Integer.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 304, + message = "Not Modified. \n Empty body because the client has already the latest version of " + + "the requested resource."), + @ApiResponse( + code = 404, + message = "No groups found.", + response = ErrorResponse.class), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching the group count.", + response = ErrorResponse.class) + }) + Response getHierarchicalGroupCount(@ApiParam( + name = "status", + value = "status of hierarchical groups of which count should be retrieved") + @QueryParam("status") + String status); + @Path("/count") @GET @ApiOperation( diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java index 4c43698395..f825a59c0b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java @@ -140,6 +140,19 @@ public class GroupManagementServiceImpl implements GroupManagementService { } } + @Override + public Response getHierarchicalGroupCount() { + try { + String currentUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + int count = DeviceMgtAPIUtils.getGroupManagementProviderService().getHierarchicalGroupCount(currentUser, null); + return Response.status(Response.Status.OK).entity(count).build(); + } catch (GroupManagementException e) { + String msg = "Error occurred while retrieving hierarchical group count."; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } + @Override public Response getGroupCount() { try { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java index 00d2e1cbaf..fe2b5edd78 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java @@ -133,6 +133,23 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ } } + @Override + public Response getHierarchicalGroupCount(String status) { + try { + int count; + if (status == null || status.isEmpty()) { + count = DeviceMgtAPIUtils.getGroupManagementProviderService().getHierarchicalGroupCount(); + } else { + count = DeviceMgtAPIUtils.getGroupManagementProviderService().getGroupCountByStatus(status); + } + return Response.status(Response.Status.OK).entity(count).build(); + } catch (GroupManagementException e) { + String msg = "ErrorResponse occurred while retrieving hierarchical group count."; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } + @Override public Response getGroupCount(String status) { try { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java index 9447f6a9ea..2c741730bd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java @@ -189,6 +189,14 @@ public interface GroupManagementProviderService { PaginationResult getGroupsWithHierarchy(String username, GroupPaginationRequest request, boolean requireGroupProps) throws GroupManagementException; + /** + * Get all hierarchical device groups count in tenant + * + * @return hierarchical group count + * @throws GroupManagementException + */ + int getHierarchicalGroupCount() throws GroupManagementException; + /** * Get all device group count in tenant * @@ -215,6 +223,16 @@ public interface GroupManagementProviderService { */ int getGroupCount(String username, String parentPath) throws GroupManagementException; + /** + * Get hierarchical device groups count of user + * + * @param username of the user + * @param parentPath of the group + * @return hierarchical group count + * @throws GroupManagementException + */ + int getHierarchicalGroupCount(String username, String parentPath) throws GroupManagementException; + /** * Manage device group sharing with user with list of roles. * diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java index c63810fb1f..3ed40cdc57 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -854,6 +854,28 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid return groupResult; } + @Override + public int getHierarchicalGroupCount() throws GroupManagementException { + if (log.isDebugEnabled()) { + log.debug("Get groups count"); + } + try { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + GroupManagementDAOFactory.openConnection(); + return groupDAO.getGroupCount(tenantId, null); + } catch (GroupManagementDAOException | SQLException e) { + String msg = "Error occurred while retrieving all groups in tenant"; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } catch (Exception e) { + String msg = "Error occurred"; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } finally { + GroupManagementDAOFactory.closeConnection(); + } + } + @Override public int getGroupCount() throws GroupManagementException { if (log.isDebugEnabled()) { @@ -962,6 +984,53 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid } } + /** + * {@inheritDoc} + */ + @Override + public int getHierarchicalGroupCount(String username, String parentPath) throws GroupManagementException { + if (username == null || username.isEmpty()) { + String msg = "Received empty user name for getHierarchicalGroupCount"; + log.error(msg); + throw new GroupManagementException(msg); + } + if (log.isDebugEnabled()) { + log.debug("Get groups count of '" + username + "'"); + } + UserStoreManager userStoreManager; + int count; + try { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + userStoreManager = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId) + .getUserStoreManager(); + if (isAdminUser(username, userStoreManager)) { + GroupManagementDAOFactory.openConnection(); + count = groupDAO.getGroupCount(tenantId, null); + return count; + }else { + String[] roleList = userStoreManager.getRoleListOfUser(username); + GroupManagementDAOFactory.openConnection(); + count = groupDAO.getOwnGroupsCount(username, tenantId, parentPath); + count += groupDAO.getGroupsCount(roleList, tenantId, parentPath); + return count; + } + } catch (UserStoreException e) { + String msg = "Error occurred while retrieving role list of user '" + username + "'"; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while opening db connection to get group count."; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } catch (GroupManagementDAOException e) { + String msg = "Error occurred while retrieving group count of user '" + username + "'"; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } finally { + GroupManagementDAOFactory.closeConnection(); + } + } + /** * {@inheritDoc} */ From 017c70fa084676003dd086ea2f7c75430528b3eb Mon Sep 17 00:00:00 2001 From: nishan Date: Fri, 14 Jul 2023 00:08:27 +0530 Subject: [PATCH 043/112] Fix Certificate test case and delete and search option --- .../CertificateManagementAdminService.java | 41 ++++-- ...CertificateManagementAdminServiceImpl.java | 64 ++++++--- .../admin/api/util/RequestValidationUtil.java | 8 -- .../pom.xml | 7 +- .../mgt/core/dao/CertificateDAO.java | 11 +- .../dao/impl/AbstractCertificateDAOImpl.java | 12 +- .../dao/impl/GenericCertificateDAOImpl.java | 122 ++++++++++++++---- .../dao/impl/OracleCertificateDAOImpl.java | 117 +++++++++++++---- .../impl/PostgreSQLCertificateDAOImpl.java | 118 +++++++++++++---- .../dao/impl/SQLServerCertificateDAOImpl.java | 118 +++++++++++++---- .../service/CertificateManagementService.java | 7 +- .../CertificateManagementServiceImpl.java | 54 ++++++-- .../util/CertificateManagementConstants.java | 6 + .../mgt/core/util/CertificateManagerUtil.java | 25 ++++ ...ateManagementServiceImplNegativeTests.java | 7 +- ...CertificateManagementServiceImplTests.java | 4 +- .../src/test/resources/sql/h2.sql | 1 + .../common/CertificatePaginationRequest.java | 77 +++++++++++ 18 files changed, 643 insertions(+), 156 deletions(-) create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/CertificatePaginationRequest.java diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java index 18207be106..cd2be07ac9 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java @@ -247,14 +247,15 @@ public interface CertificateManagementAdminService { * * @return paginated result of certificate. */ + @GET @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "GET", - value = "Getting Details of Certificates", - notes = "Get all the details of the certificates you have used for mutual SSL. In a situation where you wish to " - + "view all the certificate details, it is not feasible to show all the details on one " + value = "Getting Details of search Certificates", + notes = "Get all the details of the search certificates you have used for mutual SSL. In a situation where you wish to " + + "view all the search certificate details, it is not feasible to show all the details on one " + "page. Therefore, the details are paginated.", tags = "Certificate Management", extensions = { @@ -307,6 +308,31 @@ public interface CertificateManagementAdminService { response = ErrorResponse.class) }) Response getAllCertificates( + @ApiParam( + name = "serialNumber", + value = "The serial number of the certificates", + required = false, + defaultValue = "0") + @QueryParam("serialNumber") String serialNumber, + @ApiParam( + name = "deviceIdentifier", + value = "The device identifier of the certificates", + required = false, + defaultValue = "0") + @QueryParam("deviceIdentifier") String deviceIdentifier, + @ApiParam( + name = "username", + value = "User name of the certificate added user" , + required = false, + defaultValue = "0") + @QueryParam("username") String username, + @ApiParam( + name = "If-Modified-Since", + value = "Checks if the requested variant was modified, since the specified date-time. \n" + + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + + "Example: Mon, 05 Jan 2014 15:10:00 +0200", + required = false) + @HeaderParam("If-Modified-Since") String ifModifiedSince, @ApiParam( name = "offset", value = "The starting pagination index for the complete list of qualified items.", @@ -318,14 +344,7 @@ public interface CertificateManagementAdminService { value = "Provide how many certificate details you require from the starting pagination index/offset.", required = false, defaultValue = "5") - @QueryParam("limit") int limit, - @ApiParam( - name = "If-Modified-Since", - value = "Checks if the requested variant was modified, since the specified date-time. \n" + - "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200", - required = false) - @HeaderParam("If-Modified-Since") String ifModifiedSince); + @QueryParam("limit") int limit); @DELETE @ApiOperation( diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java index c64df487be..3f124a8946 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.impl; -import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; @@ -26,7 +25,8 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; + +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.CertificateManagementAdminService; @@ -84,6 +84,13 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); certificate.setSerial(enrollmentCertificate.getSerial()); certificate.setCertificate(certificateService.pemToX509Certificate(enrollmentCertificate.getPem())); + CertificateResponse existingCertificate = certificateService.getCertificateBySerial(enrollmentCertificate.getSerial()); + if (existingCertificate != null) { + return Response.status(Response.Status.BAD_REQUEST) + .entity("Certificate with serial number " + enrollmentCertificate.getSerial() + " already exists.") + .build(); + } + certificates.add(certificate); } certificateService.saveCertificate(certificates); @@ -131,13 +138,24 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem */ @GET public Response getAllCertificates( - @QueryParam("offset") int offset, - @QueryParam("limit") int limit, - @HeaderParam("If-Modified-Since") String ifModifiedSince) { + @QueryParam("serialNumber") String serialNumber, @QueryParam("deviceIdentifier") String deviceIdentifier, + @QueryParam("username") String username, @HeaderParam("If-Modified-Since") String ifModifiedSince, @QueryParam("offset") int offset, + @QueryParam("limit") int limit) { RequestValidationUtil.validatePaginationInfo(offset, limit); CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService(); + CertificatePaginationRequest request = new CertificatePaginationRequest(offset, limit); + + if (serialNumber != null && !serialNumber.isEmpty()) { + request.setSerialNumber(serialNumber); + } + if (deviceIdentifier != null){ + request.setDeviceIdentifier(deviceIdentifier); + } + if (username != null){ + request.setUsername(username); + } try { - PaginationResult result = certificateService.getAllCertificates(offset, limit); + PaginationResult result = certificateService.getAllCertificates(request); CertificateList certificates = new CertificateList(); certificates.setCount(result.getRecordsTotal()); certificates.setList((List) result.getData()); @@ -151,20 +169,34 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem } @DELETE - public Response removeCertificate(@QueryParam("certificateId") String certificateId) { - RequestValidationUtil.validateCertificateId(certificateId); + public Response removeCertificate(@QueryParam("serialNumber") String serialNumber) { + RequestValidationUtil.validateSerialNumber(serialNumber); CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService(); try { - boolean status = certificateService.removeCertificate(certificateId); - if (!status) { - return Response.status(Response.Status.NOT_FOUND).entity( - "No certificate is found with the given " + - "certificate id '" + certificateId + "'").build(); + boolean decision = certificateService.getValidateMetaValue(); + if (decision) { + try { + boolean status = certificateService.removeCertificate(serialNumber); + if (!status) { + return Response.status(Response.Status.NOT_FOUND).entity( + "No certificate is found with the given " + + "serial number '" + serialNumber + "'").build(); + } else { + return Response.status(Response.Status.OK).entity( + "Certificate that carries the serial number '" + + serialNumber + "' has been removed").build(); + } + } catch (CertificateManagementException e) { + String msg = "Error occurred while converting PEM file to X509Certificate"; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } } else { - return Response.status(Response.Status.OK).entity( - "Certificate that carries the certificate id '" + - certificateId + "' has been removed").build(); + return Response.status(Response.Status.NOT_FOUND).entity( + "User not have to access delete certificate " + + "serial number '" + serialNumber + "'").build(); } } catch (CertificateManagementException e) { String msg = "Error occurred while converting PEM file to X509Certificate"; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java index 6263ac9e46..43f4d1ab48 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java @@ -30,14 +30,6 @@ public class RequestValidationUtil { } } - public static void validateCertificateId(String certificateId) { - if (certificateId == null || certificateId.isEmpty()) { - throw new InputValidationException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage( - "Certificate Id cannot be null or empty").build()); - } - } - public static void validatePaginationInfo(int offset, int limit) { if (offset < 0) { throw new InputValidationException( diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index 84d4790af8..cb44ff8045 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -95,7 +95,8 @@ io.entgra.device.mgt.core.device.mgt.core.*, org.wso2.carbon.registry.indexing.*, javax.cache.*, - javax.naming.ldap + javax.naming.ldap, + com.google.gson.* @@ -253,6 +254,10 @@ slf4j-simple test + + com.googlecode.json-simple.wso2 + json-simple + diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateDAO.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateDAO.java index a3200621d1..068766f3b9 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateDAO.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateDAO.java @@ -18,8 +18,10 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; import java.util.List; @@ -75,13 +77,12 @@ public interface CertificateDAO { /** * Get all the certificates in a paginated manner. * - * @param rowNum Stating index of the paginated result. - * @param limit Number of records to return. + * @param request index of the paginated result. * @return Pagination result with data and the count of results. * @throws CertificateManagementDAOException * */ - PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementDAOException; + PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException; /** * Get all the certificates. @@ -95,10 +96,10 @@ public interface CertificateDAO { /** * Delete a certificate identified by a serial number() * - * @param certificateId number + * @param serialNumber number * @return whether the certificate was removed or not. */ - boolean removeCertificate(String certificateId) throws CertificateManagementDAOException; + boolean removeCertificate(String serialNumber) throws CertificateManagementDAOException; List searchCertificate(String serialNumber) throws CertificateManagementDAOException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java index 8e87ffff38..78ea14c99f 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java @@ -237,7 +237,7 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME" + String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, TENANT_ID, USERNAME" + " FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); @@ -247,8 +247,6 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{ certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); - certificateResponse.setCertificateId(resultSet.getString("ID")); - certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); @@ -265,7 +263,7 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{ } @Override - public boolean removeCertificate(String certificateId) throws CertificateManagementDAOException { + public boolean removeCertificate(String serialNumber) throws CertificateManagementDAOException { Connection conn; PreparedStatement stmt = null; ResultSet resultSet = null; @@ -273,15 +271,15 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{ try { conn = this.getConnection(); String query = - "DELETE FROM DM_DEVICE_CERTIFICATE WHERE ID = ?" + + "DELETE FROM DM_DEVICE_CERTIFICATE WHERE SERIAL_NUMBER = ?" + " AND TENANT_ID = ? "; stmt = conn.prepareStatement(query); - stmt.setString(1, certificateId); + stmt.setString(1, serialNumber); stmt.setInt(2, tenantId); return stmt.executeUpdate() > 0; } catch (SQLException e) { - String msg = "Unable to get the read the certificate with certificate id" + certificateId; + String msg = "Unable to get the read the certificate with serialNumber" + serialNumber; log.error(msg, e); throw new CertificateManagementDAOException(msg, e); } finally { diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java index f3cba82857..b24cc7625e 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import org.apache.commons.logging.Log; @@ -47,47 +48,120 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { private Connection getConnection() throws SQLException { return CertificateManagementDAOFactory.getConnection(); } - private int getCertificateCount(int tenantId) throws CertificateManagementDAOException, SQLException { + + private int getCertificateCount(CertificatePaginationRequest request) throws CertificateManagementDAOException { int certificateCount = 0; + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String serialNumber = request.getSerialNumber(); + String deviceIdentifier = request.getDeviceIdentifier(); + String username = request.getUsername(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { Connection conn = this.getConnection(); - String sql = - "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; - try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, tenantId); - try (ResultSet rs = stmt.executeQuery()) { - if (rs.next()) { - certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); - } - } + StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"); + + if (serialNumber != null && !serialNumber.isEmpty()) { + queryBuilder.append(" AND SERIAL_NUMBER = ?"); + } + + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + queryBuilder.append(" AND DEVICE_IDENTIFIER = ?"); + } + + if (username != null && !username.isEmpty()) { + queryBuilder.append(" AND USERNAME LIKE ?"); + } + + String sql = queryBuilder.toString(); + + stmt = conn.prepareStatement(sql); + stmt.setInt(1, tenantId); + + int paramIdx = 2; + if (serialNumber != null && !serialNumber.isEmpty()) { + stmt.setString(paramIdx++, serialNumber); + } + + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + stmt.setString(paramIdx++, deviceIdentifier); + } + + if (username != null && !username.isEmpty()) { + stmt.setString(paramIdx, "%" + username + "%"); + } + + rs = stmt.executeQuery(); + + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); } } catch (SQLException e) { - String errorMsg = "SQL error occurred while retrieving the certificates."; + String errorMsg = "SQL error occurred while retrieving the certificate count."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); + } finally { + CertificateManagementDAOUtil.cleanupResources(stmt, rs); } + return certificateCount; } + + @Override - public PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementDAOException { + public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); PreparedStatement stmt = null; ResultSet resultSet = null; CertificateResponse certificateResponse; List certificates = new ArrayList<>(); PaginationResult paginationResult; - int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String serialNumber = request.getSerialNumber(); + String deviceIdentifier = request.getDeviceIdentifier(); + String username = request.getUsername(); + boolean isCertificateSerialNumberProvided = false; + boolean isCertificateDeviceIdentifierProvided = false; + boolean isCertificateUsernameProvided = false; + try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME FROM " - + "DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC LIMIT ?,?"; - stmt = conn.prepareStatement(sql); - stmt.setInt(1, tenantId); - stmt.setInt(2, rowNum); - stmt.setInt(3, limit); - resultSet = stmt.executeQuery(); + String query = "SELECT * " + + "FROM DM_DEVICE_CERTIFICATE " + + "WHERE TENANT_ID = ? "; + if (serialNumber != null && !serialNumber.isEmpty()) { + query += "AND SERIAL_NUMBER = ? "; + isCertificateSerialNumberProvided = true; + } - int resultCount = 0; + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + query += "AND DEVICE_IDENTIFIER = ? "; + isCertificateDeviceIdentifierProvided = true; + } + + if (username != null && !username.isEmpty()) { + query += "AND USERNAME LIKE ? "; + isCertificateUsernameProvided = true; + } + + query += "ORDER BY ID LIMIT ?,?"; + + stmt = conn.prepareStatement(query); + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + if (isCertificateSerialNumberProvided) { + stmt.setString(paramIdx++, serialNumber); + } + if (isCertificateDeviceIdentifierProvided) { + stmt.setString(paramIdx++, deviceIdentifier); + } + if (isCertificateUsernameProvided) { + stmt.setString(paramIdx++, "%" + username + "%"); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx++, request.getRowCount()); + resultSet = stmt.executeQuery(); while (resultSet.next()) { certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); @@ -98,11 +172,11 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); certificates.add(certificateResponse); - resultCount++; } paginationResult = new PaginationResult(); paginationResult.setData(certificates); - paginationResult.setRecordsTotal(this.getCertificateCount(tenantId)); + paginationResult.setRecordsTotal(this.getCertificateCount(request)); + } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); @@ -112,4 +186,4 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { } return paginationResult; } -} +} \ No newline at end of file diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java index f326f9cf97..7941cb60b7 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import org.apache.commons.logging.Log; @@ -44,24 +45,57 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { private static final Log log = LogFactory.getLog(OracleCertificateDAOImpl.class); @Override - public PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementDAOException { + public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); PreparedStatement stmt = null; ResultSet resultSet = null; CertificateResponse certificateResponse; List certificates = new ArrayList<>(); PaginationResult paginationResult; - int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String serialNumber = request.getSerialNumber(); + String deviceIdentifier = request.getDeviceIdentifier(); + String username = request.getUsername(); + boolean isCertificateSerialNumberProvided = false; + boolean isCertificateDeviceIdentifierProvided = false; + boolean isCertificateUsernameProvided = false; + try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME FROM " - + "DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; - stmt = conn.prepareStatement(sql); - stmt.setInt(1, tenantId); - stmt.setInt(2, rowNum); - stmt.setInt(3, limit); - resultSet = stmt.executeQuery(); + String query = "SELECT * " + + "FROM DM_DEVICE_CERTIFICATE " + + "WHERE TENANT_ID = ? "; + if (serialNumber != null && !serialNumber.isEmpty()) { + query += "AND SERIAL_NUMBER = ? "; + isCertificateSerialNumberProvided = true; + } - int resultCount = 0; + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + query += "AND DEVICE_IDENTIFIER = ? "; + isCertificateDeviceIdentifierProvided = true; + } + + if (username != null && !username.isEmpty()) { + query += "AND USERNAME LIKE ? "; + isCertificateUsernameProvided = true; + } + + query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + stmt = conn.prepareStatement(query); + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + if (isCertificateSerialNumberProvided) { + stmt.setString(paramIdx++, serialNumber); + } + if (isCertificateDeviceIdentifierProvided) { + stmt.setString(paramIdx++, deviceIdentifier); + } + if (isCertificateUsernameProvided) { + stmt.setString(paramIdx++, "%" + username + "%"); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx++, request.getRowCount()); + resultSet = stmt.executeQuery(); while (resultSet.next()) { certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); @@ -72,11 +106,10 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); certificates.add(certificateResponse); - resultCount++; } paginationResult = new PaginationResult(); paginationResult.setData(certificates); - paginationResult.setRecordsTotal(this.getCertificateCount(tenantId)); + paginationResult.setRecordsTotal(this.getCertificateCount(request)); } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); @@ -91,25 +124,63 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { return CertificateManagementDAOFactory.getConnection(); } - private int getCertificateCount(int tenantId) throws CertificateManagementDAOException, SQLException { + private int getCertificateCount(CertificatePaginationRequest request) throws CertificateManagementDAOException { int certificateCount = 0; + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String serialNumber = request.getSerialNumber(); + String deviceIdentifier = request.getDeviceIdentifier(); + String username = request.getUsername(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { Connection conn = this.getConnection(); - String sql = - "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; - try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, tenantId); - try (ResultSet rs = stmt.executeQuery()) { - if (rs.next()) { - certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); - } - } + StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"); + + if (serialNumber != null && !serialNumber.isEmpty()) { + queryBuilder.append(" AND SERIAL_NUMBER = ?"); + } + + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + queryBuilder.append(" AND DEVICE_IDENTIFIER = ?"); + } + + if (username != null && !username.isEmpty()) { + queryBuilder.append(" AND USERNAME LIKE ?"); + } + + String sql = queryBuilder.toString(); + + stmt = conn.prepareStatement(sql); + stmt.setInt(1, tenantId); + + int paramIdx = 2; + if (serialNumber != null && !serialNumber.isEmpty()) { + stmt.setString(paramIdx++, serialNumber); + } + + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + stmt.setString(paramIdx++, deviceIdentifier); + } + + if (username != null && !username.isEmpty()) { + stmt.setString(paramIdx, "%" + username + "%"); + } + + rs = stmt.executeQuery(); + + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); } } catch (SQLException e) { - String errorMsg = "SQL error occurred while retrieving the certificates."; + String errorMsg = "SQL error occurred while retrieving the certificate count."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); + } finally { + CertificateManagementDAOUtil.cleanupResources(stmt, rs); } + return certificateCount; } + } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java index 7d187cfa3d..1c84fccbe0 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import org.apache.commons.logging.Log; @@ -44,24 +45,57 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { private static final Log log = LogFactory.getLog(PostgreSQLCertificateDAOImpl.class); @Override - public PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementDAOException { + public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); PreparedStatement stmt = null; ResultSet resultSet = null; CertificateResponse certificateResponse; List certificates = new ArrayList<>(); PaginationResult paginationResult; - int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String serialNumber = request.getSerialNumber(); + String deviceIdentifier = request.getDeviceIdentifier(); + String username = request.getUsername(); + boolean isCertificateSerialNumberProvided = false; + boolean isCertificateDeviceIdentifierProvided = false; + boolean isCertificateUsernameProvided = false; + try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME FROM " - + "DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC LIMIT ? OFFSET ?"; - stmt = conn.prepareStatement(sql); - stmt.setInt(1, tenantId); - stmt.setInt(2, limit); - stmt.setInt(3, rowNum); - resultSet = stmt.executeQuery(); + String query = "SELECT * " + + "FROM DM_DEVICE_CERTIFICATE " + + "WHERE TENANT_ID = ? "; + if (serialNumber != null && !serialNumber.isEmpty()) { + query += "AND SERIAL_NUMBER = ? "; + isCertificateSerialNumberProvided = true; + } - int resultCount = 0; + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + query += "AND DEVICE_IDENTIFIER = ? "; + isCertificateDeviceIdentifierProvided = true; + } + + if (username != null && !username.isEmpty()) { + query += "AND USERNAME LIKE ? "; + isCertificateUsernameProvided = true; + } + + query += "ORDER BY ID LIMIT ? OFFSET ?"; + + stmt = conn.prepareStatement(query); + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + if (isCertificateSerialNumberProvided) { + stmt.setString(paramIdx++, serialNumber); + } + if (isCertificateDeviceIdentifierProvided) { + stmt.setString(paramIdx++, deviceIdentifier); + } + if (isCertificateUsernameProvided) { + stmt.setString(paramIdx++, "%" + username + "%"); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx++, request.getRowCount()); + resultSet = stmt.executeQuery(); while (resultSet.next()) { certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); @@ -72,11 +106,11 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); certificates.add(certificateResponse); - resultCount++; } paginationResult = new PaginationResult(); paginationResult.setData(certificates); - paginationResult.setRecordsTotal(this.getCertificateCount(tenantId)); + paginationResult.setRecordsTotal(this.getCertificateCount(request)); + } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); @@ -91,25 +125,63 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { return CertificateManagementDAOFactory.getConnection(); } - private int getCertificateCount(int tenantId) throws CertificateManagementDAOException, SQLException { + private int getCertificateCount(CertificatePaginationRequest request) throws CertificateManagementDAOException { int certificateCount = 0; + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String serialNumber = request.getSerialNumber(); + String deviceIdentifier = request.getDeviceIdentifier(); + String username = request.getUsername(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { Connection conn = this.getConnection(); - String sql = - "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; - try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, tenantId); - try (ResultSet rs = stmt.executeQuery()) { - if (rs.next()) { - certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); - } - } + StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"); + + if (serialNumber != null && !serialNumber.isEmpty()) { + queryBuilder.append(" AND SERIAL_NUMBER = ?"); + } + + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + queryBuilder.append(" AND DEVICE_IDENTIFIER = ?"); + } + + if (username != null && !username.isEmpty()) { + queryBuilder.append(" AND USERNAME ILIKE ?"); + } + + String sql = queryBuilder.toString(); + + stmt = conn.prepareStatement(sql); + stmt.setInt(1, tenantId); + + int paramIdx = 2; + if (serialNumber != null && !serialNumber.isEmpty()) { + stmt.setString(paramIdx++, serialNumber); + } + + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + stmt.setString(paramIdx++, deviceIdentifier); + } + + if (username != null && !username.isEmpty()) { + stmt.setString(paramIdx, "%" + username + "%"); + } + + rs = stmt.executeQuery(); + + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); } } catch (SQLException e) { - String errorMsg = "SQL error occurred while retrieving the certificates."; + String errorMsg = "SQL error occurred while retrieving the certificate count."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); + } finally { + CertificateManagementDAOUtil.cleanupResources(stmt, rs); } + return certificateCount; } + } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java index 6615ab4c12..9fe8733264 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import org.apache.commons.logging.Log; @@ -44,24 +45,57 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { private static final Log log = LogFactory.getLog(SQLServerCertificateDAOImpl.class); @Override - public PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementDAOException { + public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); PreparedStatement stmt = null; ResultSet resultSet = null; CertificateResponse certificateResponse; List certificates = new ArrayList<>(); PaginationResult paginationResult; - int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String serialNumber = request.getSerialNumber(); + String deviceIdentifier = request.getDeviceIdentifier(); + String username = request.getUsername(); + boolean isCertificateSerialNumberProvided = false; + boolean isCertificateDeviceIdentifierProvided = false; + boolean isCertificateUsernameProvided = false; + try { Connection conn = this.getConnection(); - String sql = "SELECT CERTIFICATE, SERIAL_NUMBER, ID, DEVICE_IDENTIFIER, TENANT_ID, USERNAME FROM " - + "DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ? ORDER BY ID DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; - stmt = conn.prepareStatement(sql); - stmt.setInt(1, tenantId); - stmt.setInt(2, rowNum); - stmt.setInt(3, limit); - resultSet = stmt.executeQuery(); + String query = "SELECT * " + + "FROM DM_DEVICE_CERTIFICATE " + + "WHERE TENANT_ID = ? "; + if (serialNumber != null && !serialNumber.isEmpty()) { + query += "AND SERIAL_NUMBER = ? "; + isCertificateSerialNumberProvided = true; + } - int resultCount = 0; + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + query += "AND DEVICE_IDENTIFIER = ? "; + isCertificateDeviceIdentifierProvided = true; + } + + if (username != null && !username.isEmpty()) { + query += "AND USERNAME LIKE ? "; + isCertificateUsernameProvided = true; + } + + query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + stmt = conn.prepareStatement(query); + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + if (isCertificateSerialNumberProvided) { + stmt.setString(paramIdx++, serialNumber); + } + if (isCertificateDeviceIdentifierProvided) { + stmt.setString(paramIdx++, deviceIdentifier); + } + if (isCertificateUsernameProvided) { + stmt.setString(paramIdx++, "%" + username + "%"); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx++, request.getRowCount()); + resultSet = stmt.executeQuery(); while (resultSet.next()) { certificateResponse = new CertificateResponse(); byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); @@ -72,11 +106,11 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { certificateResponse.setUsername(resultSet.getString("USERNAME")); CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); certificates.add(certificateResponse); - resultCount++; } paginationResult = new PaginationResult(); paginationResult.setData(certificates); - paginationResult.setRecordsTotal(this.getCertificateCount(tenantId)); + paginationResult.setRecordsTotal(this.getCertificateCount(request)); + } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); @@ -91,25 +125,63 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { return CertificateManagementDAOFactory.getConnection(); } - private int getCertificateCount(int tenantId) throws CertificateManagementDAOException, SQLException { + private int getCertificateCount(CertificatePaginationRequest request) throws CertificateManagementDAOException { int certificateCount = 0; + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String serialNumber = request.getSerialNumber(); + String deviceIdentifier = request.getDeviceIdentifier(); + String username = request.getUsername(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { Connection conn = this.getConnection(); - String sql = - "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; - try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, tenantId); - try (ResultSet rs = stmt.executeQuery()) { - if (rs.next()) { - certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); - } - } + StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"); + + if (serialNumber != null && !serialNumber.isEmpty()) { + queryBuilder.append(" AND SERIAL_NUMBER = ?"); + } + + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + queryBuilder.append(" AND DEVICE_IDENTIFIER = ?"); + } + + if (username != null && !username.isEmpty()) { + queryBuilder.append(" AND USERNAME LIKE ?"); + } + + String sql = queryBuilder.toString(); + + stmt = conn.prepareStatement(sql); + stmt.setInt(1, tenantId); + + int paramIdx = 2; + if (serialNumber != null && !serialNumber.isEmpty()) { + stmt.setString(paramIdx++, serialNumber); + } + + if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + stmt.setString(paramIdx++, deviceIdentifier); + } + + if (username != null && !username.isEmpty()) { + stmt.setString(paramIdx, "%" + username + "%"); + } + + rs = stmt.executeQuery(); + + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); } } catch (SQLException e) { - String errorMsg = "SQL error occurred while retrieving the certificates."; + String errorMsg = "SQL error occurred while retrieving the certificate count."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); + } finally { + CertificateManagementDAOUtil.cleanupResources(stmt, rs); } + return certificateCount; } + } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementService.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementService.java index 61d333413e..611295ba3f 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementService.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementService.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.certificate.mgt.core.service; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.dto.SCEPResponse; import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; @@ -71,9 +72,11 @@ public interface CertificateManagementService { CertificateResponse retrieveCertificate(String serialNumber) throws CertificateManagementException; - PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementException; + PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementException; - boolean removeCertificate(String certificateId) throws CertificateManagementException; + boolean removeCertificate(String serialNumber) throws CertificateManagementException; + + boolean getValidateMetaValue() throws CertificateManagementException; List getCertificates() throws CertificateManagementException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java index bcd696f21e..047c532197 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java @@ -17,6 +17,14 @@ */ package io.entgra.device.mgt.core.certificate.mgt.core.service; + + +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; +import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagerUtil; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateDAO; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; @@ -27,12 +35,14 @@ import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreExceptio import io.entgra.device.mgt.core.certificate.mgt.core.exception.TransactionManagementException; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import io.entgra.device.mgt.core.certificate.mgt.core.impl.KeyStoreReader; -import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; -import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagerUtil; + +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.bouncycastle.pkcs.PKCS10CertificationRequest; + import java.io.InputStream; import java.security.PrivateKey; import java.security.cert.Certificate; @@ -154,46 +164,70 @@ public class CertificateManagementServiceImpl implements CertificateManagementSe } @Override - public PaginationResult getAllCertificates(int rowNum, int limit) throws CertificateManagementException { + public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementException { try { CertificateManagementDAOFactory.openConnection(); CertificateDAO certificateDAO = CertificateManagementDAOFactory.getCertificateDAO(); - return certificateDAO.getAllCertificates(rowNum, CertificateManagerUtil.validateCertificateListPageSize(limit)); + return certificateDAO.getAllCertificates(request); } catch (SQLException e) { String msg = "Error occurred while opening a connection to the underlying data source"; log.error(msg, e); throw new CertificateManagementException(msg, e); } catch (CertificateManagementDAOException e) { String msg = "Error occurred while looking up for the list of certificates managed in the underlying " + - "certificate repository"; + "certificate repository"; log.error(msg, e); throw new CertificateManagementException(msg, e); } finally { CertificateManagementDAOFactory.closeConnection(); } } - @Override - public boolean removeCertificate(String certificateId) throws CertificateManagementException { + public boolean removeCertificate(String serialNumber) throws CertificateManagementException { try { CertificateManagementDAOFactory.beginTransaction(); CertificateDAO certificateDAO = CertificateManagementDAOFactory.getCertificateDAO(); - boolean status = certificateDAO.removeCertificate(certificateId); + boolean status = certificateDAO.removeCertificate(serialNumber); CertificateManagementDAOFactory.commitTransaction(); return status; } catch (TransactionManagementException e) { - String msg = "Error occurred while removing certificate carrying certificate id '" + certificateId + "'"; + String msg = "Error occurred while removing certificate carrying serialNumber '" + serialNumber + "'"; log.error(msg, e); throw new CertificateManagementException(msg, e); } catch (CertificateManagementDAOException e) { CertificateManagementDAOFactory.rollbackTransaction(); - String msg = "Error occurred while removing the certificate carrying certificate id '" + certificateId + + String msg = "Error occurred while removing the certificate carrying serialNumber '" + serialNumber + "' from the certificate repository"; log.error(msg, e); throw new CertificateManagementException(msg, e); } } + @Override + public boolean getValidateMetaValue() throws CertificateManagementException { + Metadata metadata; + try { + metadata = CertificateManagerUtil.getMetadataManagementService().retrieveMetadata(CertificateManagementConstants.CERTIFICATE_DELETE); + if (metadata != null) { + String metaValue = metadata.getMetaValue(); + if (metaValue != null && !metaValue.isEmpty()) { + JsonParser parser = new JsonParser(); + JsonObject jsonObject = parser.parse(metaValue).getAsJsonObject(); + return jsonObject.get(CertificateManagementConstants.IS_CERTIFICATE_DELETE_ENABLE).getAsBoolean(); + } + } + return false; + } catch (MetadataManagementException e) { + String msg = "Error occurred while getting the metadata entry for metaKey: " + CertificateManagementConstants.CERTIFICATE_DELETE; + log.error(msg, e); + throw new CertificateManagementException(msg, e); + } catch (JsonParseException e) { + String msg = "Error occurred while parsing the JSON metadata value for metaKey: " + CertificateManagementConstants.CERTIFICATE_DELETE; + log.error(msg, e); + throw new CertificateManagementException(msg, e); + } + } + @Override public List getCertificates() throws CertificateManagementException { try { diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagementConstants.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagementConstants.java index 8235b3ee77..f851bd05f0 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagementConstants.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagementConstants.java @@ -41,6 +41,12 @@ public final class CertificateManagementConstants { public static final int RSA_KEY_LENGTH = 2048; public static final String SIGNING_ALGORITHM = "SHA256withRSA"; + public static final int DEFAULT_PAGE_LIMIT = 50; + + public static final String CERTIFICATE_DELETE = "CERTIFICATE_DELETE"; + public static final String IS_CERTIFICATE_DELETE_ENABLE = "isCertificateDelete"; + + public static final class DataBaseTypes { private DataBaseTypes() { throw new AssertionError(); diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagerUtil.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagerUtil.java index cfa613ba5a..2da3d4d414 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagerUtil.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagerUtil.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.certificate.mgt.core.util; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; @@ -28,6 +29,7 @@ import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.DataSour import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; +import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.sql.DataSource; import javax.xml.XMLConstants; @@ -41,6 +43,7 @@ public class CertificateManagerUtil { public static final String GENERAL_CONFIG_RESOURCE_PATH = "general"; public static final String MONITORING_FREQUENCY = "notifierFrequency"; + private static MetadataManagementService metadataManagementService; private static final Log log = LogFactory.getLog(CertificateManagerUtil.class); public static Document convertToDocument(File file) throws CertificateManagementException { @@ -105,4 +108,26 @@ public class CertificateManagerUtil { return limit; } + /** + * Initializing and accessing method for MetadataManagementService. + * + * @return MetadataManagementService instance + * @throws IllegalStateException if metadataManagementService cannot be initialized + */ + public static MetadataManagementService getMetadataManagementService() { + if (metadataManagementService == null) { + synchronized (CertificateManagerUtil.class) { + if (metadataManagementService == null) { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + metadataManagementService = (MetadataManagementService) ctx.getOSGiService( + MetadataManagementService.class, null); + if (metadataManagementService == null) { + throw new IllegalStateException("Metadata Management service not initialized."); + } + } + } + } + return metadataManagementService; + } + } \ No newline at end of file diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplNegativeTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplNegativeTests.java index b1ce7cb8b6..7aff1cd586 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplNegativeTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplNegativeTests.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.certificate.mgt.core.impl; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; @@ -110,7 +111,8 @@ public class CertificateManagementServiceImplNegativeTests extends PowerMockTest public void negativeTestGetAllCertificates() throws Exception { PowerMockito.mockStatic(CertificateManagementDAOFactory.class); PowerMockito.doThrow(new SQLException()).when(CertificateManagementDAOFactory.class, "openConnection"); - instance.getAllCertificates(1, 2); + CertificatePaginationRequest request = new CertificatePaginationRequest(0, 2); + instance.getAllCertificates(request); } @Test(description = "This test case tests behaviour when an error occurs getting the list of certificates from repository" @@ -118,7 +120,8 @@ public class CertificateManagementServiceImplNegativeTests extends PowerMockTest public void negativeTestGetAllCertificates2() throws Exception { CertificateManagementDAOFactory.init(daoExceptionDatasource); CertificateManagementServiceImpl instance1 = CertificateManagementServiceImpl.getInstance(); - instance1.getAllCertificates(1, 2); + CertificatePaginationRequest request = new CertificatePaginationRequest(0, 2); + instance.getAllCertificates(request); } @Test(description = "This test case tests behaviour when data source transaction error occurs when removing the certificate" diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java index ff6ad09e88..a57bfbb4d0 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.certificate.mgt.core.impl; import io.entgra.device.mgt.core.certificate.mgt.core.util.CSRGenerator; import io.entgra.device.mgt.core.certificate.mgt.core.util.DummyCertificate; +import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -217,7 +218,8 @@ public class CertificateManagementServiceImplTests extends BaseDeviceManagementC public void testGetAllCertificatesPaginated() throws CertificateManagementException, KeystoreException { managementService.generateX509Certificate(); managementService.generateX509Certificate(); - PaginationResult allCertificates = managementService.getAllCertificates(0, 2); + CertificatePaginationRequest request = new CertificatePaginationRequest(0,2); + PaginationResult allCertificates = managementService.getAllCertificates(request); Assert.assertEquals(allCertificates.getData().size(), 2); log.info("GetAllCertificatesPaginated Test Successful"); } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/sql/h2.sql b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/sql/h2.sql index 46582aa390..0fb769e406 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/sql/h2.sql +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/sql/h2.sql @@ -37,6 +37,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, CERTIFICATE BLOB DEFAULT NULL, TENANT_ID INTEGER DEFAULT 0, + DEVICE_IDENTIFIER VARCHAR(300), USERNAME VARCHAR(500) DEFAULT NULL, PRIMARY KEY (ID) ); \ No newline at end of file diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/CertificatePaginationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/CertificatePaginationRequest.java new file mode 100644 index 0000000000..fdfcf5d30c --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/CertificatePaginationRequest.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.device.mgt.common; + +public class CertificatePaginationRequest { + private int startIndex; + private int rowCount; + private String serialNumber; + private String deviceIdentifier; + private String username; + + public CertificatePaginationRequest(int start, int rowCount) { + this.startIndex = start; + this.rowCount = rowCount; + } + + public int getStartIndex() { + return startIndex; + } + + public void setStartIndex(int startIndex) { + this.startIndex = startIndex; + } + + public int getRowCount() { + return rowCount; + } + + public void setRowCount(int rowCount) { + this.rowCount = rowCount; + } + + public String getSerialNumber() { + return serialNumber; + } + + public void setSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + } + + public String getDeviceIdentifier() { + return deviceIdentifier; + } + + public void setDeviceIdentifier(String deviceIdentifier) { + this.deviceIdentifier = deviceIdentifier; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + @Override + public String toString() { + return "Certificate serial number '" + this.serialNumber + "' num of rows: " + this.rowCount + " start index: " + this.startIndex; + } +} From dbc73d18ede97983f30b5e7480332f9e62902a9b Mon Sep 17 00:00:00 2001 From: navodzoysa Date: Thu, 24 Aug 2023 16:05:14 +0530 Subject: [PATCH 044/112] Add improvements to certificate component --- .../CertificateManagementAdminService.java | 11 +- ...CertificateManagementAdminServiceImpl.java | 23 ++-- .../pom.xml | 1 + .../dao/impl/GenericCertificateDAOImpl.java | 130 ++++++++---------- .../dao/impl/OracleCertificateDAOImpl.java | 126 ++++++++--------- .../impl/PostgreSQLCertificateDAOImpl.java | 127 ++++++++--------- .../dao/impl/SQLServerCertificateDAOImpl.java | 127 ++++++++--------- .../CertificateManagementServiceImpl.java | 5 +- 8 files changed, 262 insertions(+), 288 deletions(-) diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java index cd2be07ac9..af77d74719 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java @@ -311,20 +311,17 @@ public interface CertificateManagementAdminService { @ApiParam( name = "serialNumber", value = "The serial number of the certificates", - required = false, - defaultValue = "0") + required = false) @QueryParam("serialNumber") String serialNumber, @ApiParam( name = "deviceIdentifier", value = "The device identifier of the certificates", - required = false, - defaultValue = "0") + required = false) @QueryParam("deviceIdentifier") String deviceIdentifier, @ApiParam( name = "username", - value = "User name of the certificate added user" , - required = false, - defaultValue = "0") + value = "User name of the certificate added user", + required = false) @QueryParam("username") String username, @ApiParam( name = "If-Modified-Since", diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java index 3f124a8946..815e141f38 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java @@ -27,6 +27,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.CertificateManagementAdminService; @@ -138,20 +139,23 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem */ @GET public Response getAllCertificates( - @QueryParam("serialNumber") String serialNumber, @QueryParam("deviceIdentifier") String deviceIdentifier, - @QueryParam("username") String username, @HeaderParam("If-Modified-Since") String ifModifiedSince, @QueryParam("offset") int offset, + @QueryParam("serialNumber") String serialNumber, + @QueryParam("deviceIdentifier") String deviceIdentifier, + @QueryParam("username") String username, + @HeaderParam("If-Modified-Since") String ifModifiedSince, + @QueryParam("offset") int offset, @QueryParam("limit") int limit) { RequestValidationUtil.validatePaginationInfo(offset, limit); CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService(); CertificatePaginationRequest request = new CertificatePaginationRequest(offset, limit); - if (serialNumber != null && !serialNumber.isEmpty()) { + if (StringUtils.isNotEmpty(serialNumber)) { request.setSerialNumber(serialNumber); } - if (deviceIdentifier != null){ + if (StringUtils.isNotEmpty(deviceIdentifier)){ request.setDeviceIdentifier(deviceIdentifier); } - if (username != null){ + if (StringUtils.isNotEmpty(username)){ request.setUsername(username); } try { @@ -188,18 +192,19 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem serialNumber + "' has been removed").build(); } } catch (CertificateManagementException e) { - String msg = "Error occurred while converting PEM file to X509Certificate"; + String msg = "Error occurred while removing certificate with the given " + + "serial number '" + serialNumber + "'"; log.error(msg, e); return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } } else { - return Response.status(Response.Status.NOT_FOUND).entity( - "User not have to access delete certificate " + + return Response.status(Response.Status.UNAUTHORIZED).entity( + "User unauthorized to delete certificate with " + "serial number '" + serialNumber + "'").build(); } } catch (CertificateManagementException e) { - String msg = "Error occurred while converting PEM file to X509Certificate"; + String msg = "Error occurred while getting the metadata entry for certificate deletion."; log.error(msg, e); return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index cb44ff8045..ef8abbba07 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -56,6 +56,7 @@ org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.apache.commons.lang, org.apache.commons.logging, org.apache.commons.collections.map, javax.security.auth.x500, diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java index b24cc7625e..7655e46005 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java @@ -21,11 +21,11 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -55,66 +55,58 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { String serialNumber = request.getSerialNumber(); String deviceIdentifier = request.getDeviceIdentifier(); String username = request.getUsername(); - PreparedStatement stmt = null; - ResultSet rs = null; try { Connection conn = this.getConnection(); - StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"); + String sql = "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT " + + "FROM DM_DEVICE_CERTIFICATE " + + "WHERE TENANT_ID = ?"; - if (serialNumber != null && !serialNumber.isEmpty()) { - queryBuilder.append(" AND SERIAL_NUMBER = ?"); + if (StringUtils.isNotEmpty(serialNumber)) { + sql += " AND SERIAL_NUMBER = ?"; } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { - queryBuilder.append(" AND DEVICE_IDENTIFIER = ?"); + if (StringUtils.isNotEmpty(deviceIdentifier)) { + sql += " AND DEVICE_IDENTIFIER = ?"; } - if (username != null && !username.isEmpty()) { - queryBuilder.append(" AND USERNAME LIKE ?"); + if (StringUtils.isNotEmpty(username)) { + sql += " AND USERNAME LIKE ?"; } - String sql = queryBuilder.toString(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); - stmt = conn.prepareStatement(sql); - stmt.setInt(1, tenantId); + int paramIdx = 2; + if (StringUtils.isNotEmpty(serialNumber)) { + stmt.setString(paramIdx++, serialNumber); + } - int paramIdx = 2; - if (serialNumber != null && !serialNumber.isEmpty()) { - stmt.setString(paramIdx++, serialNumber); - } + if (StringUtils.isNotEmpty(deviceIdentifier)) { + stmt.setString(paramIdx++, deviceIdentifier); + } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { - stmt.setString(paramIdx++, deviceIdentifier); - } - - if (username != null && !username.isEmpty()) { - stmt.setString(paramIdx, "%" + username + "%"); - } - - rs = stmt.executeQuery(); - - if (rs.next()) { - certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + if (StringUtils.isNotEmpty(username)) { + stmt.setString(paramIdx, "%" + username + "%"); + } + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + } + } } } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificate count."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); - } finally { - CertificateManagementDAOUtil.cleanupResources(stmt, rs); } - return certificateCount; } - @Override public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - PreparedStatement stmt = null; - ResultSet resultSet = null; CertificateResponse certificateResponse; List certificates = new ArrayList<>(); PaginationResult paginationResult; @@ -130,59 +122,59 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { String query = "SELECT * " + "FROM DM_DEVICE_CERTIFICATE " + "WHERE TENANT_ID = ? "; - if (serialNumber != null && !serialNumber.isEmpty()) { + + if (StringUtils.isNotEmpty(serialNumber)) { query += "AND SERIAL_NUMBER = ? "; isCertificateSerialNumberProvided = true; } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + if (StringUtils.isNotEmpty(deviceIdentifier)) { query += "AND DEVICE_IDENTIFIER = ? "; isCertificateDeviceIdentifierProvided = true; } - if (username != null && !username.isEmpty()) { + if (StringUtils.isNotEmpty(username)) { query += "AND USERNAME LIKE ? "; isCertificateUsernameProvided = true; } query += "ORDER BY ID LIMIT ?,?"; - stmt = conn.prepareStatement(query); - int paramIdx = 1; - stmt.setInt(paramIdx++, tenantId); - if (isCertificateSerialNumberProvided) { - stmt.setString(paramIdx++, serialNumber); + try (PreparedStatement stmt = conn.prepareStatement(query)) { + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + if (isCertificateSerialNumberProvided) { + stmt.setString(paramIdx++, serialNumber); + } + if (isCertificateDeviceIdentifierProvided) { + stmt.setString(paramIdx++, deviceIdentifier); + } + if (isCertificateUsernameProvided) { + stmt.setString(paramIdx++, "%" + username + "%"); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx++, request.getRowCount()); + try (ResultSet resultSet = stmt.executeQuery()) { + while (resultSet.next()) { + certificateResponse = new CertificateResponse(); + byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); + certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); + certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); + certificateResponse.setUsername(resultSet.getString("USERNAME")); + CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); + certificates.add(certificateResponse); + } + paginationResult = new PaginationResult(); + paginationResult.setData(certificates); + paginationResult.setRecordsTotal(this.getCertificateCount(request)); + } } - if (isCertificateDeviceIdentifierProvided) { - stmt.setString(paramIdx++, deviceIdentifier); - } - if (isCertificateUsernameProvided) { - stmt.setString(paramIdx++, "%" + username + "%"); - } - stmt.setInt(paramIdx++, request.getStartIndex()); - stmt.setInt(paramIdx++, request.getRowCount()); - resultSet = stmt.executeQuery(); - while (resultSet.next()) { - certificateResponse = new CertificateResponse(); - byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); - certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); - certificateResponse.setCertificateId(resultSet.getString("ID")); - certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); - certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); - certificateResponse.setUsername(resultSet.getString("USERNAME")); - CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); - certificates.add(certificateResponse); - } - paginationResult = new PaginationResult(); - paginationResult.setData(certificates); - paginationResult.setRecordsTotal(this.getCertificateCount(request)); - } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); - } finally { - CertificateManagementDAOUtil.cleanupResources(stmt, resultSet); } return paginationResult; } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java index 7941cb60b7..9231a0d746 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java @@ -21,11 +21,11 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -47,8 +47,6 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { @Override public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - PreparedStatement stmt = null; - ResultSet resultSet = null; CertificateResponse certificateResponse; List certificates = new ArrayList<>(); PaginationResult paginationResult; @@ -64,58 +62,58 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { String query = "SELECT * " + "FROM DM_DEVICE_CERTIFICATE " + "WHERE TENANT_ID = ? "; - if (serialNumber != null && !serialNumber.isEmpty()) { + if (StringUtils.isNotEmpty(serialNumber)) { query += "AND SERIAL_NUMBER = ? "; isCertificateSerialNumberProvided = true; } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + if (StringUtils.isNotEmpty(deviceIdentifier)) { query += "AND DEVICE_IDENTIFIER = ? "; isCertificateDeviceIdentifierProvided = true; } - if (username != null && !username.isEmpty()) { + if (StringUtils.isNotEmpty(username)) { query += "AND USERNAME LIKE ? "; isCertificateUsernameProvided = true; } query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; - stmt = conn.prepareStatement(query); - int paramIdx = 1; - stmt.setInt(paramIdx++, tenantId); - if (isCertificateSerialNumberProvided) { - stmt.setString(paramIdx++, serialNumber); + try (PreparedStatement stmt = conn.prepareStatement(query)) { + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + if (isCertificateSerialNumberProvided) { + stmt.setString(paramIdx++, serialNumber); + } + if (isCertificateDeviceIdentifierProvided) { + stmt.setString(paramIdx++, deviceIdentifier); + } + if (isCertificateUsernameProvided) { + stmt.setString(paramIdx++, "%" + username + "%"); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx++, request.getRowCount()); + try (ResultSet resultSet = stmt.executeQuery()) { + while (resultSet.next()) { + certificateResponse = new CertificateResponse(); + byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); + certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); + certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); + certificateResponse.setUsername(resultSet.getString("USERNAME")); + CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); + certificates.add(certificateResponse); + } + paginationResult = new PaginationResult(); + paginationResult.setData(certificates); + paginationResult.setRecordsTotal(this.getCertificateCount(request)); + } } - if (isCertificateDeviceIdentifierProvided) { - stmt.setString(paramIdx++, deviceIdentifier); - } - if (isCertificateUsernameProvided) { - stmt.setString(paramIdx++, "%" + username + "%"); - } - stmt.setInt(paramIdx++, request.getStartIndex()); - stmt.setInt(paramIdx++, request.getRowCount()); - resultSet = stmt.executeQuery(); - while (resultSet.next()) { - certificateResponse = new CertificateResponse(); - byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); - certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); - certificateResponse.setCertificateId(resultSet.getString("ID")); - certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); - certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); - certificateResponse.setUsername(resultSet.getString("USERNAME")); - CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); - certificates.add(certificateResponse); - } - paginationResult = new PaginationResult(); - paginationResult.setData(certificates); - paginationResult.setRecordsTotal(this.getCertificateCount(request)); } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); - } finally { - CertificateManagementDAOUtil.cleanupResources(stmt, resultSet); } return paginationResult; } @@ -130,56 +128,52 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { String serialNumber = request.getSerialNumber(); String deviceIdentifier = request.getDeviceIdentifier(); String username = request.getUsername(); - PreparedStatement stmt = null; - ResultSet rs = null; try { Connection conn = this.getConnection(); - StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"); + String sql = "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT " + + "FROM DM_DEVICE_CERTIFICATE " + + "WHERE TENANT_ID = ?"; - if (serialNumber != null && !serialNumber.isEmpty()) { - queryBuilder.append(" AND SERIAL_NUMBER = ?"); + if (StringUtils.isNotEmpty(serialNumber)) { + sql += " AND SERIAL_NUMBER = ?"; } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { - queryBuilder.append(" AND DEVICE_IDENTIFIER = ?"); + if (StringUtils.isNotEmpty(deviceIdentifier)) { + sql += " AND DEVICE_IDENTIFIER = ?"; } - if (username != null && !username.isEmpty()) { - queryBuilder.append(" AND USERNAME LIKE ?"); + if (StringUtils.isNotEmpty(username)) { + sql += " AND USERNAME LIKE ?"; } - String sql = queryBuilder.toString(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); - stmt = conn.prepareStatement(sql); - stmt.setInt(1, tenantId); + int paramIdx = 2; + if (StringUtils.isNotEmpty(serialNumber)) { + stmt.setString(paramIdx++, serialNumber); + } - int paramIdx = 2; - if (serialNumber != null && !serialNumber.isEmpty()) { - stmt.setString(paramIdx++, serialNumber); - } + if (StringUtils.isNotEmpty(deviceIdentifier)) { + stmt.setString(paramIdx++, deviceIdentifier); + } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { - stmt.setString(paramIdx++, deviceIdentifier); - } + if (StringUtils.isNotEmpty(username)) { + stmt.setString(paramIdx, "%" + username + "%"); + } - if (username != null && !username.isEmpty()) { - stmt.setString(paramIdx, "%" + username + "%"); - } - - rs = stmt.executeQuery(); - - if (rs.next()) { - certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + } + } } } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificate count."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); - } finally { - CertificateManagementDAOUtil.cleanupResources(stmt, rs); } - return certificateCount; } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java index 1c84fccbe0..e31e005f0b 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java @@ -21,11 +21,11 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -47,8 +47,6 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { @Override public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - PreparedStatement stmt = null; - ResultSet resultSet = null; CertificateResponse certificateResponse; List certificates = new ArrayList<>(); PaginationResult paginationResult; @@ -64,59 +62,58 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { String query = "SELECT * " + "FROM DM_DEVICE_CERTIFICATE " + "WHERE TENANT_ID = ? "; - if (serialNumber != null && !serialNumber.isEmpty()) { + if (StringUtils.isNotEmpty(serialNumber)) { query += "AND SERIAL_NUMBER = ? "; isCertificateSerialNumberProvided = true; } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + if (StringUtils.isNotEmpty(deviceIdentifier)) { query += "AND DEVICE_IDENTIFIER = ? "; isCertificateDeviceIdentifierProvided = true; } - if (username != null && !username.isEmpty()) { + if (StringUtils.isNotEmpty(username)) { query += "AND USERNAME LIKE ? "; isCertificateUsernameProvided = true; } query += "ORDER BY ID LIMIT ? OFFSET ?"; - stmt = conn.prepareStatement(query); - int paramIdx = 1; - stmt.setInt(paramIdx++, tenantId); - if (isCertificateSerialNumberProvided) { - stmt.setString(paramIdx++, serialNumber); + try (PreparedStatement stmt = conn.prepareStatement(query)) { + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + if (isCertificateSerialNumberProvided) { + stmt.setString(paramIdx++, serialNumber); + } + if (isCertificateDeviceIdentifierProvided) { + stmt.setString(paramIdx++, deviceIdentifier); + } + if (isCertificateUsernameProvided) { + stmt.setString(paramIdx++, "%" + username + "%"); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx++, request.getRowCount()); + try (ResultSet resultSet = stmt.executeQuery()) { + while (resultSet.next()) { + certificateResponse = new CertificateResponse(); + byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); + certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); + certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); + certificateResponse.setUsername(resultSet.getString("USERNAME")); + CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); + certificates.add(certificateResponse); + } + paginationResult = new PaginationResult(); + paginationResult.setData(certificates); + paginationResult.setRecordsTotal(this.getCertificateCount(request)); + } } - if (isCertificateDeviceIdentifierProvided) { - stmt.setString(paramIdx++, deviceIdentifier); - } - if (isCertificateUsernameProvided) { - stmt.setString(paramIdx++, "%" + username + "%"); - } - stmt.setInt(paramIdx++, request.getStartIndex()); - stmt.setInt(paramIdx++, request.getRowCount()); - resultSet = stmt.executeQuery(); - while (resultSet.next()) { - certificateResponse = new CertificateResponse(); - byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); - certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); - certificateResponse.setCertificateId(resultSet.getString("ID")); - certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); - certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); - certificateResponse.setUsername(resultSet.getString("USERNAME")); - CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); - certificates.add(certificateResponse); - } - paginationResult = new PaginationResult(); - paginationResult.setData(certificates); - paginationResult.setRecordsTotal(this.getCertificateCount(request)); - } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); - } finally { - CertificateManagementDAOUtil.cleanupResources(stmt, resultSet); } return paginationResult; } @@ -131,56 +128,52 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { String serialNumber = request.getSerialNumber(); String deviceIdentifier = request.getDeviceIdentifier(); String username = request.getUsername(); - PreparedStatement stmt = null; - ResultSet rs = null; try { Connection conn = this.getConnection(); - StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"); + String sql = "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT " + + "FROM DM_DEVICE_CERTIFICATE " + + "WHERE TENANT_ID = ?"; - if (serialNumber != null && !serialNumber.isEmpty()) { - queryBuilder.append(" AND SERIAL_NUMBER = ?"); + if (StringUtils.isNotEmpty(serialNumber)) { + sql += " AND SERIAL_NUMBER = ?"; } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { - queryBuilder.append(" AND DEVICE_IDENTIFIER = ?"); + if (StringUtils.isNotEmpty(deviceIdentifier)) { + sql += " AND DEVICE_IDENTIFIER = ?"; } - if (username != null && !username.isEmpty()) { - queryBuilder.append(" AND USERNAME ILIKE ?"); + if (StringUtils.isNotEmpty(username)) { + sql += " AND USERNAME ILIKE ?"; } - String sql = queryBuilder.toString(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); - stmt = conn.prepareStatement(sql); - stmt.setInt(1, tenantId); + int paramIdx = 2; + if (StringUtils.isNotEmpty(serialNumber)) { + stmt.setString(paramIdx++, serialNumber); + } - int paramIdx = 2; - if (serialNumber != null && !serialNumber.isEmpty()) { - stmt.setString(paramIdx++, serialNumber); - } + if (StringUtils.isNotEmpty(deviceIdentifier)) { + stmt.setString(paramIdx++, deviceIdentifier); + } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { - stmt.setString(paramIdx++, deviceIdentifier); - } + if (StringUtils.isNotEmpty(username)) { + stmt.setString(paramIdx, "%" + username + "%"); + } - if (username != null && !username.isEmpty()) { - stmt.setString(paramIdx, "%" + username + "%"); - } - - rs = stmt.executeQuery(); - - if (rs.next()) { - certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + } + } } } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificate count."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); - } finally { - CertificateManagementDAOUtil.cleanupResources(stmt, rs); } - return certificateCount; } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java index 9fe8733264..6e0908a286 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java @@ -21,11 +21,11 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; import io.entgra.device.mgt.core.device.mgt.common.CertificatePaginationRequest; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -47,8 +47,6 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { @Override public PaginationResult getAllCertificates(CertificatePaginationRequest request) throws CertificateManagementDAOException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - PreparedStatement stmt = null; - ResultSet resultSet = null; CertificateResponse certificateResponse; List certificates = new ArrayList<>(); PaginationResult paginationResult; @@ -64,59 +62,58 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { String query = "SELECT * " + "FROM DM_DEVICE_CERTIFICATE " + "WHERE TENANT_ID = ? "; - if (serialNumber != null && !serialNumber.isEmpty()) { + if (StringUtils.isNotEmpty(serialNumber)) { query += "AND SERIAL_NUMBER = ? "; isCertificateSerialNumberProvided = true; } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { + if (StringUtils.isNotEmpty(deviceIdentifier)) { query += "AND DEVICE_IDENTIFIER = ? "; isCertificateDeviceIdentifierProvided = true; } - if (username != null && !username.isEmpty()) { + if (StringUtils.isNotEmpty(username)) { query += "AND USERNAME LIKE ? "; isCertificateUsernameProvided = true; } query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; - stmt = conn.prepareStatement(query); - int paramIdx = 1; - stmt.setInt(paramIdx++, tenantId); - if (isCertificateSerialNumberProvided) { - stmt.setString(paramIdx++, serialNumber); + try (PreparedStatement stmt = conn.prepareStatement(query)) { + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + if (isCertificateSerialNumberProvided) { + stmt.setString(paramIdx++, serialNumber); + } + if (isCertificateDeviceIdentifierProvided) { + stmt.setString(paramIdx++, deviceIdentifier); + } + if (isCertificateUsernameProvided) { + stmt.setString(paramIdx++, "%" + username + "%"); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx++, request.getRowCount()); + try (ResultSet resultSet = stmt.executeQuery()) { + while (resultSet.next()) { + certificateResponse = new CertificateResponse(); + byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); + certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); + certificateResponse.setCertificateId(resultSet.getString("ID")); + certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); + certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); + certificateResponse.setUsername(resultSet.getString("USERNAME")); + CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); + certificates.add(certificateResponse); + } + paginationResult = new PaginationResult(); + paginationResult.setData(certificates); + paginationResult.setRecordsTotal(this.getCertificateCount(request)); + } } - if (isCertificateDeviceIdentifierProvided) { - stmt.setString(paramIdx++, deviceIdentifier); - } - if (isCertificateUsernameProvided) { - stmt.setString(paramIdx++, "%" + username + "%"); - } - stmt.setInt(paramIdx++, request.getStartIndex()); - stmt.setInt(paramIdx++, request.getRowCount()); - resultSet = stmt.executeQuery(); - while (resultSet.next()) { - certificateResponse = new CertificateResponse(); - byte[] certificateBytes = resultSet.getBytes("CERTIFICATE"); - certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER")); - certificateResponse.setCertificateId(resultSet.getString("ID")); - certificateResponse.setDeviceIdentifier(resultSet.getString("DEVICE_IDENTIFIER")); - certificateResponse.setTenantId(resultSet.getInt("TENANT_ID")); - certificateResponse.setUsername(resultSet.getString("USERNAME")); - CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse); - certificates.add(certificateResponse); - } - paginationResult = new PaginationResult(); - paginationResult.setData(certificates); - paginationResult.setRecordsTotal(this.getCertificateCount(request)); - } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificates."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); - } finally { - CertificateManagementDAOUtil.cleanupResources(stmt, resultSet); } return paginationResult; } @@ -131,56 +128,52 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { String serialNumber = request.getSerialNumber(); String deviceIdentifier = request.getDeviceIdentifier(); String username = request.getUsername(); - PreparedStatement stmt = null; - ResultSet rs = null; try { Connection conn = this.getConnection(); - StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"); + String sql = "SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT " + + "FROM DM_DEVICE_CERTIFICATE " + + "WHERE TENANT_ID = ?"; - if (serialNumber != null && !serialNumber.isEmpty()) { - queryBuilder.append(" AND SERIAL_NUMBER = ?"); + if (StringUtils.isNotEmpty(serialNumber)) { + sql += " AND SERIAL_NUMBER = ?"; } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { - queryBuilder.append(" AND DEVICE_IDENTIFIER = ?"); + if (StringUtils.isNotEmpty(deviceIdentifier)) { + sql += " AND DEVICE_IDENTIFIER = ?"; } - if (username != null && !username.isEmpty()) { - queryBuilder.append(" AND USERNAME LIKE ?"); + if (StringUtils.isNotEmpty(username)) { + sql += " AND USERNAME LIKE ?"; } - String sql = queryBuilder.toString(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); - stmt = conn.prepareStatement(sql); - stmt.setInt(1, tenantId); + int paramIdx = 2; + if (StringUtils.isNotEmpty(serialNumber)) { + stmt.setString(paramIdx++, serialNumber); + } - int paramIdx = 2; - if (serialNumber != null && !serialNumber.isEmpty()) { - stmt.setString(paramIdx++, serialNumber); - } + if (StringUtils.isNotEmpty(deviceIdentifier)) { + stmt.setString(paramIdx++, deviceIdentifier); + } - if (deviceIdentifier != null && !deviceIdentifier.isEmpty()) { - stmt.setString(paramIdx++, deviceIdentifier); - } + if (StringUtils.isNotEmpty(username)) { + stmt.setString(paramIdx, "%" + username + "%"); + } - if (username != null && !username.isEmpty()) { - stmt.setString(paramIdx, "%" + username + "%"); - } - - rs = stmt.executeQuery(); - - if (rs.next()) { - certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT"); + } + } } } catch (SQLException e) { String errorMsg = "SQL error occurred while retrieving the certificate count."; log.error(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e); - } finally { - CertificateManagementDAOUtil.cleanupResources(stmt, rs); } - return certificateCount; } diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java index 047c532197..06cbedfb4d 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java @@ -17,8 +17,6 @@ */ package io.entgra.device.mgt.core.certificate.mgt.core.service; - - import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.google.gson.JsonParser; @@ -38,6 +36,7 @@ import io.entgra.device.mgt.core.certificate.mgt.core.impl.KeyStoreReader; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.bouncycastle.pkcs.PKCS10CertificationRequest; @@ -210,7 +209,7 @@ public class CertificateManagementServiceImpl implements CertificateManagementSe metadata = CertificateManagerUtil.getMetadataManagementService().retrieveMetadata(CertificateManagementConstants.CERTIFICATE_DELETE); if (metadata != null) { String metaValue = metadata.getMetaValue(); - if (metaValue != null && !metaValue.isEmpty()) { + if (StringUtils.isNotEmpty(metaValue)) { JsonParser parser = new JsonParser(); JsonObject jsonObject = parser.parse(metaValue).getAsJsonObject(); return jsonObject.get(CertificateManagementConstants.IS_CERTIFICATE_DELETE_ENABLE).getAsBoolean(); From cf3d50edf92879143fe185a0facd9c4782fb289f Mon Sep 17 00:00:00 2001 From: "amalka.subasinghe" Date: Thu, 24 Aug 2023 16:28:28 +0530 Subject: [PATCH 045/112] added new method getAllocatedOperationMappingsByStatus --- .../core/operation/mgt/dao/OperationDAO.java | 4 ++ .../mgt/dao/impl/GenericOperationDAOImpl.java | 48 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java index 9d3de1494e..2b5658d85f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java @@ -105,6 +105,10 @@ public interface OperationDAO { Map> getOperationMappingsByStatus(Operation.Status opStatus, Operation.PushNotificationStatus pushNotificationStatus, int limit) throws OperationManagementDAOException; + Map> getAllocatedOperationMappingsByStatus(Operation.Status opStatus, + Operation.PushNotificationStatus pushNotificationStatus, int limit, int activeServerCount, int serverIndex) + throws OperationManagementDAOException; + List getActivities(List deviceTypes, String operationCode, long updatedSince, String operationStatus) throws OperationManagementDAOException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index 046556459a..a864da7b45 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -1970,6 +1970,54 @@ public class GenericOperationDAOImpl implements OperationDAO { return operationMappingsTenantMap; } + @Override + public Map> getAllocatedOperationMappingsByStatus(Operation.Status opStatus, + Operation.PushNotificationStatus pushNotificationStatus, int limit, int activeServerCount, int serverIndex) + throws OperationManagementDAOException { + PreparedStatement stmt = null; + ResultSet rs = null; + Connection conn; + OperationMapping operationMapping; + Map> operationMappingsTenantMap = new HashMap<>(); + try { + conn = OperationManagementDAOFactory.getConnection(); + String sql = "SELECT op.ENROLMENT_ID, op.OPERATION_ID, d.DEVICE_IDENTIFICATION, dt.NAME as DEVICE_TYPE, " + + "d.TENANT_ID FROM DM_DEVICE d, DM_ENROLMENT_OP_MAPPING op, DM_DEVICE_TYPE dt WHERE op.STATUS = ?" + + " AND op.PUSH_NOTIFICATION_STATUS = ? AND d.DEVICE_TYPE_ID = dt.ID AND d.ID=op.ENROLMENT_ID AND MOD(d.ID, ?) = ? ORDER" + + " BY op.OPERATION_ID LIMIT ?"; + stmt = conn.prepareStatement(sql); + stmt.setString(1, opStatus.toString()); + stmt.setString(2, pushNotificationStatus.toString()); + stmt.setInt(3, activeServerCount); + stmt.setInt(4, serverIndex); + stmt.setInt(5, limit); + rs = stmt.executeQuery(); + while (rs.next()) { + int tenantID = rs.getInt("TENANT_ID"); + List operationMappings = operationMappingsTenantMap.get(tenantID); + if (operationMappings == null) { + operationMappings = new LinkedList<>(); + operationMappingsTenantMap.put(tenantID, operationMappings); + } + operationMapping = new OperationMapping(); + operationMapping.setOperationId(rs.getInt("OPERATION_ID")); + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); + deviceIdentifier.setType(rs.getString("DEVICE_TYPE")); + operationMapping.setDeviceIdentifier(deviceIdentifier); + operationMapping.setEnrollmentId(rs.getInt("ENROLMENT_ID")); + operationMapping.setTenantId(tenantID); + operationMappings.add(operationMapping); + } + } catch (SQLException e) { + throw new OperationManagementDAOException("SQL error while getting operation mappings from database. " + + e.getMessage(), e); + } finally { + OperationManagementDAOUtil.cleanupResources(stmt, rs); + } + return operationMappingsTenantMap; + } + public List getActivities(List deviceTypes, String operationCode, long updatedSince, String operationStatus) throws OperationManagementDAOException { From 349fce4e6321c2651456e87a11d1c8c4e3bc1fe6 Mon Sep 17 00:00:00 2001 From: "amalka.subasinghe" Date: Thu, 24 Aug 2023 16:29:22 +0530 Subject: [PATCH 046/112] improved push notofication task to get allocated operations when heart beat enabled --- .../task/PushNotificationSchedulerTask.java | 27 ++++++++++++++++--- .../PushNotificationSchedulerTaskTest.java | 20 +++++++++----- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java index 2e859bcead..c4c9df0e56 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java @@ -17,6 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.core.push.notification.mgt.task; +import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -63,9 +66,27 @@ public class PushNotificationSchedulerTask implements Runnable { try { //Get next available operation list per device batch OperationManagementDAOFactory.openConnection(); - operationMappingsTenantMap = operationDAO.getOperationMappingsByStatus(Operation.Status - .PENDING, Operation.PushNotificationStatus.SCHEDULED, DeviceConfigurationManager.getInstance() - .getDeviceManagementConfig().getPushNotificationConfiguration().getSchedulerBatchSize()); + try { + if (DeviceManagementDataHolder.getInstance().getHeartBeatService().isTaskPartitioningEnabled()) { + ServerCtxInfo serverCtxInfo = DeviceManagementDataHolder.getInstance().getHeartBeatService().getServerCtxInfo(); + if (serverCtxInfo != null) { + operationMappingsTenantMap = operationDAO.getAllocatedOperationMappingsByStatus(Operation.Status + .PENDING, Operation.PushNotificationStatus.SCHEDULED, DeviceConfigurationManager.getInstance() + .getDeviceManagementConfig().getPushNotificationConfiguration().getSchedulerBatchSize(), + serverCtxInfo.getActiveServerCount(), serverCtxInfo.getLocalServerHashIdx()); + } else { + if (log.isDebugEnabled()) { + log.debug("Active server information not recorded yet."); + } + } + } else { + operationMappingsTenantMap = operationDAO.getOperationMappingsByStatus(Operation.Status + .PENDING, Operation.PushNotificationStatus.SCHEDULED, DeviceConfigurationManager.getInstance() + .getDeviceManagementConfig().getPushNotificationConfiguration().getSchedulerBatchSize()); + } + } catch (HeartBeatManagementException e) { + throw new RuntimeException(e); + } } catch (OperationManagementDAOException e) { log.error("Unable to retrieve scheduled pending operations for task.", e); } finally { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTaskTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTaskTest.java index 7d92b9faa1..df04c2fb88 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTaskTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTaskTest.java @@ -17,12 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.push.notification.mgt.task; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; @@ -37,6 +31,14 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.registry.core.exceptions.RegistryException; import java.sql.SQLException; @@ -52,13 +54,16 @@ public class PushNotificationSchedulerTaskTest extends BaseDeviceManagementTest private PushNotificationSchedulerTask pushNotificationSchedulerTask; private OperationDAO operationDAO; + private HeartBeatManagementService heartBeatManagementService; @BeforeClass public void init() throws DeviceManagementException, RegistryException { DeviceConfigurationManager.getInstance().initConfig(); log.info("Initializing Push Notification Scheduler Test Class"); DeviceManagementServiceComponent.notifyStartupListeners(); this.deviceMgtProviderService = Mockito.mock(DeviceManagementProviderServiceImpl.class, Mockito.CALLS_REAL_METHODS); + this.heartBeatManagementService = Mockito.mock(HeartBeatManagementService.class, Mockito.CALLS_REAL_METHODS); DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(this.deviceMgtProviderService); + DeviceManagementDataHolder.getInstance().setHeartBeatService(this.heartBeatManagementService); this.operationDAO = OperationManagementDAOFactory.getOperationDAO(); this.pushNotificationSchedulerTask = new PushNotificationSchedulerTask(); } @@ -69,6 +74,7 @@ public class PushNotificationSchedulerTaskTest extends BaseDeviceManagementTest OperationManagementDAOException { try { log.info("Attempting to execute push notification task scheduler"); + Mockito.when(this.heartBeatManagementService.isTaskPartitioningEnabled()).thenReturn(false); Mockito.doReturn(new TestNotificationStrategy()).when(this.deviceMgtProviderService) .getNotificationStrategyByDeviceType(Mockito.anyString()); Mockito.doReturn(new io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation()) @@ -81,6 +87,8 @@ public class PushNotificationSchedulerTaskTest extends BaseDeviceManagementTest .getPushNotificationConfiguration().getSchedulerBatchSize()); Assert.assertEquals(operationMappingsTenantMap.size(), 0); log.info("Push notification task execution complete."); + } catch (HeartBeatManagementException e) { + throw new RuntimeException(e); } finally { OperationManagementDAOFactory.closeConnection(); } From 21606bc5cd0468d60b1358d0832f3d39ec0cb95d Mon Sep 17 00:00:00 2001 From: "amalka.subasinghe" Date: Thu, 24 Aug 2023 16:30:24 +0530 Subject: [PATCH 047/112] operation timeout task updated to execute only in elected node --- .../task/impl/OperationTimeoutTask.java | 85 +++++++++++-------- ...perationTimeoutTaskManagerServiceImpl.java | 6 +- .../repository/conf/cdm-config.xml.j2 | 2 +- 3 files changed, 54 insertions(+), 39 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java index 3d336140e3..157795aa5a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.timeout.task.impl; import com.google.gson.Gson; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -36,7 +37,6 @@ import java.util.List; public class OperationTimeoutTask extends DynamicPartitionedScheduleTask { private static final Log log = LogFactory.getLog(OperationTimeoutTask.class); - @Override protected void setup() { @@ -44,45 +44,60 @@ public class OperationTimeoutTask extends DynamicPartitionedScheduleTask { @Override protected void executeDynamicTask() { - String operationTimeoutTaskConfigStr = getProperty( - OperationTimeoutTaskManagerServiceImpl.OPERATION_TIMEOUT_TASK_CONFIG); - Gson gson = new Gson(); - OperationTimeout operationTimeoutConfig = gson.fromJson(operationTimeoutTaskConfigStr, OperationTimeout.class); - try { - long timeMillis = System.currentTimeMillis() - operationTimeoutConfig.getTimeout() * 60 * 1000; - List deviceTypes = new ArrayList<>(); - if (operationTimeoutConfig.getDeviceTypes().size() == 1 && - "ALL".equals(operationTimeoutConfig.getDeviceTypes().get(0))) { - try { - List deviceTypeList = DeviceManagementDataHolder.getInstance() - .getDeviceManagementProvider().getDeviceTypes(); - for (DeviceType deviceType : deviceTypeList) { - deviceTypes.add(deviceType.getName()); + if (isQualifiedToExecuteTask()) { // this task will run only in one node when the deployment has multiple nodes + String operationTimeoutTaskConfigStr = getProperty( + OperationTimeoutTaskManagerServiceImpl.OPERATION_TIMEOUT_TASK_CONFIG); + Gson gson = new Gson(); + OperationTimeout operationTimeoutConfig = gson.fromJson(operationTimeoutTaskConfigStr, OperationTimeout.class); + try { + long timeMillis = System.currentTimeMillis() - (long) operationTimeoutConfig.getTimeout(); + List deviceTypes = new ArrayList<>(); + if (operationTimeoutConfig.getDeviceTypes().size() == 1 && + "ALL".equals(operationTimeoutConfig.getDeviceTypes().get(0))) { + try { + List deviceTypeList = DeviceManagementDataHolder.getInstance() + .getDeviceManagementProvider().getDeviceTypes(); + for (DeviceType deviceType : deviceTypeList) { + deviceTypes.add(deviceType.getName()); + } + } catch (DeviceManagementException e) { + log.error("Error occurred while reading device types", e); } - } catch (DeviceManagementException e) { - log.error("Error occurred while reading device types", e); + } else { + deviceTypes = operationTimeoutConfig.getDeviceTypes(); } - } else { - deviceTypes = operationTimeoutConfig.getDeviceTypes(); - } - List activities = DeviceManagementDataHolder.getInstance().getOperationManager() - .getActivities(deviceTypes, operationTimeoutConfig.getCode(), timeMillis, - operationTimeoutConfig.getInitialStatus()); - for (Activity activity : activities) { - for (ActivityStatus activityStatus : activity.getActivityStatus()) { - String operationId = activity.getActivityId().replace("ACTIVITY_", ""); - Operation operation = DeviceManagementDataHolder.getInstance().getOperationManager() - .getOperation(Integer.parseInt(operationId)); - operation.setStatus(Operation.Status.valueOf(operationTimeoutConfig.getNextStatus())); - DeviceManagementDataHolder.getInstance().getOperationManager() - .updateOperation(activityStatus.getDeviceIdentifier(), operation); + List activities = DeviceManagementDataHolder.getInstance().getOperationManager() + .getActivities(deviceTypes, operationTimeoutConfig.getCode(), timeMillis, + operationTimeoutConfig.getInitialStatus()); + for (Activity activity : activities) { + for (ActivityStatus activityStatus : activity.getActivityStatus()) { + String operationId = activity.getActivityId().replace("ACTIVITY_", ""); + Operation operation = DeviceManagementDataHolder.getInstance().getOperationManager() + .getOperation(Integer.parseInt(operationId)); + operation.setStatus(Operation.Status.valueOf(operationTimeoutConfig.getNextStatus())); + DeviceManagementDataHolder.getInstance().getOperationManager() + .updateOperation(activityStatus.getDeviceIdentifier(), operation); + } } - } - } catch (OperationManagementException e) { - String msg = "Error occurred while retrieving operations."; - log.error(msg, e); + } catch (OperationManagementException e) { + String msg = "Error occurred while retrieving operations."; + log.error(msg, e); + } } + } + private boolean isQualifiedToExecuteTask() { + if (isDynamicTaskEligible()) { + try { + return DeviceManagementDataHolder.getInstance().getHeartBeatService().isQualifiedToExecuteTask(); + } catch (HeartBeatManagementException e) { + log.error("Error while checking is qualified to execute task", e); + } + } else { + return true; + } + return false; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTaskManagerServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTaskManagerServiceImpl.java index cffc4937b3..e18507df3e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTaskManagerServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTaskManagerServiceImpl.java @@ -57,14 +57,14 @@ public class OperationTimeoutTaskManagerServiceImpl implements OperationTimeoutT log.debug("Operation timeout task is started for the device type(s) : " + config.getDeviceTypes() + ", operation code : " + config.getInitialStatus()); log.debug( - "Operation timeout task is at frequency of : " + config.getTimeout() + " minutes"); + "Operation timeout task is at frequency of : " + config.getTimeout() + " milliseconds"); } TaskManager taskManager = taskService.getTaskManager(OPERATION_TIMEOUT_TASK); TaskInfo.TriggerInfo triggerInfo = new TaskInfo.TriggerInfo(); //Convert to milli seconds - triggerInfo.setIntervalMillis(config.getTimeout() * 60 * 1000); + triggerInfo.setIntervalMillis(config.getTimeout()); triggerInfo.setRepeatCount(-1); Gson gson = new Gson(); @@ -125,7 +125,7 @@ public class OperationTimeoutTaskManagerServiceImpl implements OperationTimeoutT if (taskManager.isTaskScheduled(taskName)) { taskManager.deleteTask(taskName); TaskInfo.TriggerInfo triggerInfo = new TaskInfo.TriggerInfo(); - triggerInfo.setIntervalMillis(config.getTimeout() * 60 * 1000); + triggerInfo.setIntervalMillis(config.getTimeout()); triggerInfo.setRepeatCount(-1); Map properties = new HashMap<>(); diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 index 2152b1814f..2fe1494e09 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 @@ -353,7 +353,7 @@ - + {% if device_mgt_conf.operation_timeout_conf is defined %} From 1d7700ab5c8dd0bd318e6ac7afa16a12f728a7a0 Mon Sep 17 00:00:00 2001 From: "amalka.subasinghe" Date: Thu, 24 Aug 2023 16:31:17 +0530 Subject: [PATCH 048/112] imrpoved heart beat to handle cluster formation changed --- .../service/ClusterFormationChangedNotifierRepository.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java index bb0c7726de..9c711366ae 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java @@ -15,8 +15,9 @@ * specific language governing permissions and limitations * under the License. */ -package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service; +package io.entgra.device.mgt.core.device.mgt.core.push.notification.mgt; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.ClusterFormationChangedNotifier; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -40,7 +41,7 @@ public class ClusterFormationChangedNotifierRepository { public void addNotifier(String className) { try { if (!StringUtils.isEmpty(className)) { - Class clz = Class.forName(className); + Class clz = ClassLoader.getSystemClassLoader()forName(className); ClusterFormationChangedNotifier notifier = (ClusterFormationChangedNotifier) clz.newInstance(); notifiers.put(notifier.getType(), notifier); } From 9ecdd486f860ea154f664e6e159bb6e3ac7b490b Mon Sep 17 00:00:00 2001 From: "amalka.subasinghe" Date: Thu, 24 Aug 2023 16:31:42 +0530 Subject: [PATCH 049/112] imrpoved heart beat to handle cluster formation changed --- .../pom.xml | 1 + .../internal/HeartBeatBeaconComponent.java | 5 ++++- .../beacon/internal/HeartBeatExecutor.java | 19 ++++++++++++++++++- ...terFormationChangedNotifierRepository.java | 5 ++--- .../HeartBeatManagementServiceImpl.java | 8 ++++++++ 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index 83e9788b9d..6cdcf4027f 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -70,6 +70,7 @@ !io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal, io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.* + * diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java index a526e216fb..356f5d4996 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java @@ -28,6 +28,7 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBea import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.core.ServerStartupObserver; import org.wso2.carbon.ndatasource.core.DataSourceService; import java.util.List; @@ -73,7 +74,9 @@ public class HeartBeatBeaconComponent { clusterFormationChangedNotifierRepository); //Setting up executors to notify heart beat status */ - HeartBeatExecutor.setUpNotifiers(HeartBeatBeaconUtils.getServerDetails()); + HeartBeatExecutor heartBeatExecutor = new HeartBeatExecutor(); + componentContext.getBundleContext().registerService( + ServerStartupObserver.class.getName(), heartBeatExecutor, null); } diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java index bd19a185a8..bcadf4afe7 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java @@ -26,13 +26,16 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto.ServerContex import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.core.ServerStartupObserver; import java.io.IOException; +import java.net.SocketException; +import java.net.UnknownHostException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -public class HeartBeatExecutor { +public class HeartBeatExecutor implements ServerStartupObserver { private static Log log = LogFactory.getLog(HeartBeatExecutor.class); private static final int DEFAULT__NOTIFIER_INTERVAL = 5; @@ -43,6 +46,20 @@ public class HeartBeatExecutor { CONFIG = HeartBeatBeaconConfig.getInstance(); } + @Override + public void completingServerStartup() { + + } + + @Override + public void completedServerStartup() { + try { + setUpNotifiers(HeartBeatBeaconUtils.getServerDetails()); + } catch (HeartBeatBeaconConfigurationException | UnknownHostException | SocketException e) { + throw new RuntimeException(e); + } + } + static void setUpNotifiers(ServerContext ctx) throws HeartBeatBeaconConfigurationException { ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java index 9c711366ae..bb0c7726de 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java @@ -15,9 +15,8 @@ * specific language governing permissions and limitations * under the License. */ -package io.entgra.device.mgt.core.device.mgt.core.push.notification.mgt; +package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service; -import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.ClusterFormationChangedNotifier; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -41,7 +40,7 @@ public class ClusterFormationChangedNotifierRepository { public void addNotifier(String className) { try { if (!StringUtils.isEmpty(className)) { - Class clz = ClassLoader.getSystemClassLoader()forName(className); + Class clz = Class.forName(className); ClusterFormationChangedNotifier notifier = (ClusterFormationChangedNotifier) clz.newInstance(); notifiers.put(notifier.getType(), notifier); } diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java index 7a31a6ebcc..6c737c0b2f 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java @@ -235,6 +235,7 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic } } else { //first time execution, elect if not present + heartBeatDAO.purgeCandidates(); electCandidate(servers); } HeartBeatBeaconDAOFactory.commitTransaction(); @@ -268,6 +269,10 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic String serverUUID = HeartBeatBeaconDataHolder.getInstance().getLocalServerUUID(); ServerContext serverContext = servers.get(serverUUID); + if (log.isDebugEnabled()) { + log.debug("HashIndex (previous, current) : " + lastHashIndex + ", " + serverContext.getIndex()); + log.debug("ActiveServerCount (previous, current) : " + lastActiveCount + ", " + servers.size()); + } // cluster change can be identified, either by changing hash index or changing active server count if ((lastHashIndex != serverContext.getIndex()) || (lastActiveCount != servers.size())) { lastHashIndex = serverContext.getIndex(); @@ -280,6 +285,9 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic Runnable r = new Runnable() { @Override public void run() { + if (log.isDebugEnabled()) { + log.debug("notify cluster formation changed : " + notifier.getType()); + } notifier.notifyClusterFormationChanged(lastHashIndex, lastActiveCount); } }; From f7c3e129c41b67cc924b5baeb060eeaf3c3357f3 Mon Sep 17 00:00:00 2001 From: builder Date: Thu, 24 Aug 2023 21:17:31 +0530 Subject: [PATCH 050/112] [maven-release-plugin] prepare release v5.0.29 --- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/analytics-mgt/grafana-mgt/pom.xml | 2 +- components/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.apimgt.annotations/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.application.mgt.core/pom.xml | 2 +- components/application-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.core/pom.xml | 2 +- components/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.config.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/identity-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.notification.logger/pom.xml | 2 +- components/logger/pom.xml | 2 +- .../io.entgra.device.mgt.core.operation.template/pom.xml | 2 +- components/operation-template-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.decision.point/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.core/pom.xml | 2 +- components/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt/pom.xml | 2 +- components/subtype-mgt/pom.xml | 2 +- components/task-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.core/pom.xml | 2 +- components/task-mgt/task-manager/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.watcher/pom.xml | 2 +- components/task-mgt/task-watcher/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.core/pom.xml | 2 +- components/tenant-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/email-sender/pom.xml | 2 +- components/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- components/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- components/webapp-authenticator-framework/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/analytics-mgt/grafana-mgt/pom.xml | 2 +- features/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- features/application-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.feature/pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- features/jwt-client/pom.xml | 2 +- .../pom.xml | 2 +- features/logger/pom.xml | 2 +- .../pom.xml | 2 +- features/operation-template-mgt-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- features/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml | 2 +- features/subtype-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.feature/pom.xml | 2 +- features/task-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/tenant-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.email.sender.feature/pom.xml | 2 +- features/transport-mgt/email-sender/pom.xml | 2 +- features/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- features/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- features/webapp-authenticator-framework/pom.xml | 2 +- pom.xml | 6 +++--- 132 files changed, 134 insertions(+), 134 deletions(-) diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml index d3c6b6474f..1df7d642f3 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml index 6e76873544..9c7d7e06fd 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index 411df90000..695560e3a7 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml index 8d10307c7e..257a1de501 100644 --- a/components/analytics-mgt/grafana-mgt/pom.xml +++ b/components/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml index 2bacce641b..ee08e5c10c 100644 --- a/components/analytics-mgt/pom.xml +++ b/components/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml index 135b883d73..7abdc0e6c6 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml @@ -20,7 +20,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml index 40482d0575..e1a30c8096 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index 124d0b1ca9..f38e387c6e 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index 99184211a6..d575421bfb 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index c754bea431..08dab148b0 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml index 7f9c6e3f59..d9668cc40a 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml index 28dfb387b7..f635007086 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index d93e9c2838..99f065b4c6 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 869a18e9ad..00ce87c47c 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml index e14d3e5998..9ed7e0f5a6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index c2eef70be0..e147501260 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 42d9d984f9..13889e3108 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml index acf86abad7..0bba9befdb 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml index 892f10fefd..9a5ae62560 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index ef8abbba07..4cd94b5914 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core certificate-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 4d2a1bf77a..cb2d571b4b 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml index 23f5841e76..a01c2ced29 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index 795c737521..3503a159ae 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml index 67308af45c..5523e780b7 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml @@ -21,7 +21,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml index a0e00c6203..2b14cef903 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index 67dcdf12e8..b46a88f3f5 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 7bcbbaaebe..16a61bf16f 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 5e47d43171..71c48d9712 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 454afea709..c47f8f7749 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml index 35d9c423a9..84388f81bd 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 9332ab0d0c..b72d7f697a 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index 23dd513ac9..e7bc481cd5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml index dd6b701335..c597a6b32a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml index 0b1d2d2b25..2867d603a5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index fe00cd6d35..f5a4248ee4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index 5bc3abbd03..9d2eba9d1a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml index 1988b3acbd..fc8867fff8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index a004f7fdae..536a86ac6c 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index 83e9788b9d..a8193be17d 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heartbeat-management - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml index bc020852a5..4853b3780d 100644 --- a/components/heartbeat-management/pom.xml +++ b/components/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml index 1b9eeb5968..3bd4d2e159 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index e1fd294cc1..3d69954a19 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 31026334f9..577fe520cb 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml index 5579244e98..d930a921df 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger - 5.0.29-SNAPSHOT + 5.0.29 io.entgra.device.mgt.core.notification.logger diff --git a/components/logger/pom.xml b/components/logger/pom.xml index 2b81c9b1bc..2767f7ba93 100644 --- a/components/logger/pom.xml +++ b/components/logger/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index 78e8220884..269c7e6a00 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core operation-template-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml index be9af17775..98bd4a25b2 100644 --- a/components/operation-template-mgt/pom.xml +++ b/components/operation-template-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml index 5ae6c5318b..4728f33b5b 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml index fae49b1eb5..ebd75b91b3 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml index 55d8346817..6e99e3e75c 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index fb7fee0d34..e11076e0fa 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index c40c2be2c6..efeba3f913 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index 5357522cc5..5a7c02f3e5 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core subtype-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml index 6aa8dde6c9..3e8d805473 100644 --- a/components/subtype-mgt/pom.xml +++ b/components/subtype-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml index f61896efe1..a3241acf58 100755 --- a/components/task-mgt/pom.xml +++ b/components/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml index 229d1b2649..07f1dc2275 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml @@ -20,7 +20,7 @@ task-manager io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml index dd2071131b..34b08491b0 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-manager - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml index 2c32e8fa3c..abfce90684 100755 --- a/components/task-mgt/task-manager/pom.xml +++ b/components/task-mgt/task-manager/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml index b0756f6c22..561261eeb4 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-watcher - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml index 74c6286d30..1a55909c13 100755 --- a/components/task-mgt/task-watcher/pom.xml +++ b/components/task-mgt/task-watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml index 1ba672260f..4422e92006 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 5bd0f06bd0..6fcfcec807 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml index 48bcd27692..f8f268bf7b 100644 --- a/components/tenant-mgt/pom.xml +++ b/components/tenant-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml index 5ef659f5d7..a4c606c1c9 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 1f5f3f2346..3c6fdd198d 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml index e5c2e9cfbf..e390345389 100644 --- a/components/transport-mgt/pom.xml +++ b/components/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml index 1e909a73fe..af14c9f584 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml index d7ed22ada0..57ffa87dff 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml index d3b162575b..34e67a357d 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml index adebcc43c4..2fd9297b66 100644 --- a/components/transport-mgt/sms-handler/pom.xml +++ b/components/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml index 599283fd5e..9bf3209ec2 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 4.0.0 diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml index 10874166b4..8e0929fcab 100644 --- a/components/ui-request-interceptor/pom.xml +++ b/components/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index 3676d4ac34..5dd42b9e34 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index bd44c3c9df..181f205782 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml index 9a7dc8a557..321f57a29a 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml index 29c45acc91..d902cb287f 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index 79c9fb75f9..2bf194589d 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index 9f1b1ba316..013e0c1b52 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml index 3af15a55a7..add4b6d028 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml index 598711cadb..8da39095b5 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml index 9e6d5d780b..eae1c14073 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml index 27c7281b55..3cb62ef843 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml index 5f79b7a979..ef4ad4829e 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 73a460e975..95fd4f58a3 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml index 2bc8bb9b47..506183168d 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core application-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index 21cfa686de..6faf3e45e1 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml index 8733172bf2..b43fb0d078 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml index fa77ee766a..15bbcd9fc4 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index f587885535..2892c7399d 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index c64d6c9c9f..f1932d1292 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml index 1e457a4f18..d6b5218a35 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml index c52a430c3a..7db85c403f 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml index a4db3180ae..50fc7e5ee9 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index d8f3b9cbba..c6cef88dd1 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index bcb9252892..9fabf853bd 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index d03b8021cf..9092cb5b28 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 4218cbcc1e..4b720e74aa 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml index f95a49f3c6..45b9ccfdea 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 2cc14fcb6e..155cd081f5 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml index 1b7eeed81d..804b7cfd6c 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml index 6143f9028f..1b0e46e1cc 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml index 2720311c7a..59d76e8632 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml index 3ab937f699..e82b8b4643 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml index 6871767234..d61046ae47 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 6cae36ae75..1ba75706a9 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml index 8900cf19e6..f3e5e05142 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heart-beat-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml index 8cbf3eeb8e..83b5165bad 100644 --- a/features/heartbeat-management/pom.xml +++ b/features/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml index 6d1547b8db..d1c1bf356a 100644 --- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core jwt-client-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 552307e550..e69b93753c 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml index 46d82e6b3a..fabde59bb7 100644 --- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml +++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/logger/pom.xml b/features/logger/pom.xml index 726a7256f3..3c8ba4053e 100644 --- a/features/logger/pom.xml +++ b/features/logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml index fd14d3ff3c..eb0ec107ae 100644 --- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core operation-template-mgt-plugin-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml index 8f6b7be783..d3ccdb998f 100644 --- a/features/operation-template-mgt-plugin-feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index 3e42c13a27..5b22560fab 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core policy-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 3c9108a566..6e6b1b2a31 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml index d5b803d410..4c543376b9 100644 --- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml +++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../../pom.xml diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml index f20e1e179e..9f21d7de54 100644 --- a/features/subtype-mgt/pom.xml +++ b/features/subtype-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml index 3164b15e1a..721eb68d12 100755 --- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml +++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../../pom.xml diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml index 792a4c642b..6f45c519c5 100755 --- a/features/task-mgt/pom.xml +++ b/features/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml index 6465284280..54df465191 100644 --- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml +++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ tenant-mgt-feature io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml index bfb68a1d0f..2e0a82f875 100644 --- a/features/tenant-mgt/pom.xml +++ b/features/tenant-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml index 9287b02b5d..e54fb9dbd0 100644 --- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index ddd2061af3..a695a2b847 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml index 64eaa579c1..5bed37f970 100644 --- a/features/transport-mgt/pom.xml +++ b/features/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml index 700f203300..ced82dbbcb 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml index da4c5ed136..d508682941 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml index 736902011c..b6575573d6 100644 --- a/features/transport-mgt/sms-handler/pom.xml +++ b/features/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml index 24c673bfdb..ba03f4b977 100644 --- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml +++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor-feature io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 4.0.0 diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml index ec03b2a611..b6f02c578a 100644 --- a/features/ui-request-interceptor/pom.xml +++ b/features/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml index 2a7d61052b..aec9691d73 100644 --- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework-feature - 5.0.29-SNAPSHOT + 5.0.29 ../pom.xml diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 2c8f050498..61cc1d7a51 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29-SNAPSHOT + 5.0.29 ../../pom.xml diff --git a/pom.xml b/pom.xml index 0b1c8e1e54..6d8622a74b 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent pom - 5.0.29-SNAPSHOT + 5.0.29 WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1879,7 +1879,7 @@ https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git - HEAD + v5.0.29 @@ -2091,7 +2091,7 @@ 1.2.11.wso2v10 - 5.0.29-SNAPSHOT + 5.0.29 4.7.35 From 7c0adfbc89d92a1a685b7f2c415f7d84f0180d1d Mon Sep 17 00:00:00 2001 From: builder Date: Thu, 24 Aug 2023 21:17:36 +0530 Subject: [PATCH 051/112] [maven-release-plugin] prepare for next development iteration --- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/analytics-mgt/grafana-mgt/pom.xml | 2 +- components/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.apimgt.annotations/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.application.mgt.core/pom.xml | 2 +- components/application-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.core/pom.xml | 2 +- components/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.config.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/identity-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.notification.logger/pom.xml | 2 +- components/logger/pom.xml | 2 +- .../io.entgra.device.mgt.core.operation.template/pom.xml | 2 +- components/operation-template-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.decision.point/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.core/pom.xml | 2 +- components/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt/pom.xml | 2 +- components/subtype-mgt/pom.xml | 2 +- components/task-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.core/pom.xml | 2 +- components/task-mgt/task-manager/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.watcher/pom.xml | 2 +- components/task-mgt/task-watcher/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.core/pom.xml | 2 +- components/tenant-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/email-sender/pom.xml | 2 +- components/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- components/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- components/webapp-authenticator-framework/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/analytics-mgt/grafana-mgt/pom.xml | 2 +- features/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- features/application-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.feature/pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- features/jwt-client/pom.xml | 2 +- .../pom.xml | 2 +- features/logger/pom.xml | 2 +- .../pom.xml | 2 +- features/operation-template-mgt-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- features/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml | 2 +- features/subtype-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.feature/pom.xml | 2 +- features/task-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/tenant-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.email.sender.feature/pom.xml | 2 +- features/transport-mgt/email-sender/pom.xml | 2 +- features/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- features/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- features/webapp-authenticator-framework/pom.xml | 2 +- pom.xml | 6 +++--- 132 files changed, 134 insertions(+), 134 deletions(-) diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml index 1df7d642f3..b32d9a1e1c 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml index 9c7d7e06fd..89eae93ae5 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index 695560e3a7..f9f8badfbe 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml index 257a1de501..ec516423ed 100644 --- a/components/analytics-mgt/grafana-mgt/pom.xml +++ b/components/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml index ee08e5c10c..91f8a622ca 100644 --- a/components/analytics-mgt/pom.xml +++ b/components/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml index 7abdc0e6c6..3fee6f0ecc 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml @@ -20,7 +20,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml index e1a30c8096..1c571dbc98 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index f38e387c6e..8a3b6181bf 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index d575421bfb..684f6865f6 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index 08dab148b0..9ca98815d4 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml index d9668cc40a..a1024405fd 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml index f635007086..0ba85a1063 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index 99f065b4c6..a8dd6d3ccb 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 00ce87c47c..7910e27c49 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml index 9ed7e0f5a6..021bf2c5c2 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index e147501260..402e3ad9ce 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 13889e3108..159f9f0163 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml index 0bba9befdb..e7097ed56b 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml index 9a5ae62560..acf67b4349 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index 4cd94b5914..102e439696 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core certificate-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index cb2d571b4b..77729dbbb5 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml index a01c2ced29..15ff431444 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index 3503a159ae..f3d0aa322a 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml index 5523e780b7..992fbb2667 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml @@ -21,7 +21,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml index 2b14cef903..b80ec875d9 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index b46a88f3f5..22f353d6f3 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 16a61bf16f..0f9d8f779a 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 71c48d9712..f9f866b111 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index c47f8f7749..e539c0aef4 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml index 84388f81bd..13a29a7abc 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index b72d7f697a..234f5da909 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index e7bc481cd5..506da93ba5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml index c597a6b32a..fc059870f6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml index 2867d603a5..0d786aa77f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index f5a4248ee4..c4cb0088ba 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index 9d2eba9d1a..401b08dde3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml index fc8867fff8..e03472fc2a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 536a86ac6c..4664e29926 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index a8193be17d..232dbf8646 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heartbeat-management - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml index 4853b3780d..ebfdca6986 100644 --- a/components/heartbeat-management/pom.xml +++ b/components/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml index 3bd4d2e159..740382f64a 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index 3d69954a19..8a93f07f67 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 577fe520cb..eb27a66d8d 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml index d930a921df..b19e707a7b 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger - 5.0.29 + 5.0.30-SNAPSHOT io.entgra.device.mgt.core.notification.logger diff --git a/components/logger/pom.xml b/components/logger/pom.xml index 2767f7ba93..b03fffa341 100644 --- a/components/logger/pom.xml +++ b/components/logger/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index 269c7e6a00..6c06e80a7c 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core operation-template-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml index 98bd4a25b2..b56c4e0b54 100644 --- a/components/operation-template-mgt/pom.xml +++ b/components/operation-template-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml index 4728f33b5b..5a8288a534 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml index ebd75b91b3..d4acdb1516 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml index 6e99e3e75c..a8b40c78fe 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index e11076e0fa..07cbd20972 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index efeba3f913..7beb2e1b0e 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index 5a7c02f3e5..2524e43727 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core subtype-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml index 3e8d805473..0d52b2e3a1 100644 --- a/components/subtype-mgt/pom.xml +++ b/components/subtype-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml index a3241acf58..12ba96dcc7 100755 --- a/components/task-mgt/pom.xml +++ b/components/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml index 07f1dc2275..d0dac69d7d 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml @@ -20,7 +20,7 @@ task-manager io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml index 34b08491b0..e1d035459e 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-manager - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml index abfce90684..e79f683ea2 100755 --- a/components/task-mgt/task-manager/pom.xml +++ b/components/task-mgt/task-manager/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml index 561261eeb4..ff732f9859 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-watcher - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml index 1a55909c13..ef069eacde 100755 --- a/components/task-mgt/task-watcher/pom.xml +++ b/components/task-mgt/task-watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml index 4422e92006..9a391ae96c 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 6fcfcec807..9fcbfb3c03 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml index f8f268bf7b..932cfedc90 100644 --- a/components/tenant-mgt/pom.xml +++ b/components/tenant-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml index a4c606c1c9..11b2dd31ee 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 3c6fdd198d..2d47730f6d 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml index e390345389..1d67cfe427 100644 --- a/components/transport-mgt/pom.xml +++ b/components/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml index af14c9f584..e03dba4d59 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml index 57ffa87dff..d93b627198 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml index 34e67a357d..57807ce24b 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml index 2fd9297b66..7a49ab761b 100644 --- a/components/transport-mgt/sms-handler/pom.xml +++ b/components/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml index 9bf3209ec2..25f6c8bdd9 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT 4.0.0 diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml index 8e0929fcab..3b606e80b3 100644 --- a/components/ui-request-interceptor/pom.xml +++ b/components/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index 5dd42b9e34..bb20afcae6 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 181f205782..75ea28eed2 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml index 321f57a29a..e1ff229cc9 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml index d902cb287f..2148f8a170 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index 2bf194589d..7c1c7f6023 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index 013e0c1b52..7819fbba79 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml index add4b6d028..3a59a88bb9 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml index 8da39095b5..c9c3bf2356 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml index eae1c14073..951f67486b 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml index 3cb62ef843..c5e71b5be5 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml index ef4ad4829e..bbdc761deb 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 95fd4f58a3..9d8dd0c992 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml index 506183168d..1727412fee 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core application-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index 6faf3e45e1..90f273060c 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml index b43fb0d078..6ece280074 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml index 15bbcd9fc4..0fcd7944ab 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index 2892c7399d..21e379eac8 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index f1932d1292..6ece3ab1df 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml index d6b5218a35..f21deac929 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml index 7db85c403f..c042f7ef2f 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml index 50fc7e5ee9..7d2479f428 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index c6cef88dd1..64a8641d9b 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index 9fabf853bd..fb53c4781e 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 9092cb5b28..4285c6ece7 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 4b720e74aa..7624822da7 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml index 45b9ccfdea..e8fefee74a 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 155cd081f5..6afa336258 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml index 804b7cfd6c..d27dbdfaa0 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml index 1b0e46e1cc..c109a9faf2 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml index 59d76e8632..9a61a5f54a 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml index e82b8b4643..6f1850577c 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml index d61046ae47..2b70c7fc5a 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 1ba75706a9..ef10f40c74 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml index f3e5e05142..b613f1cca1 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heart-beat-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml index 83b5165bad..512817824e 100644 --- a/features/heartbeat-management/pom.xml +++ b/features/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml index d1c1bf356a..d9b86c1343 100644 --- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core jwt-client-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index e69b93753c..c15cf0f45a 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml index fabde59bb7..f28d1cfa7a 100644 --- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml +++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/logger/pom.xml b/features/logger/pom.xml index 3c8ba4053e..0c5cd1cd67 100644 --- a/features/logger/pom.xml +++ b/features/logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml index eb0ec107ae..b70908056c 100644 --- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core operation-template-mgt-plugin-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml index d3ccdb998f..7b1dea0314 100644 --- a/features/operation-template-mgt-plugin-feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index 5b22560fab..e47f84684b 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core policy-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 6e6b1b2a31..c358cafad9 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml index 4c543376b9..e968e28ed6 100644 --- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml +++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../../pom.xml diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml index 9f21d7de54..40fae9d4b7 100644 --- a/features/subtype-mgt/pom.xml +++ b/features/subtype-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml index 721eb68d12..bc40d91ab0 100755 --- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml +++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../../pom.xml diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml index 6f45c519c5..c3d21e1571 100755 --- a/features/task-mgt/pom.xml +++ b/features/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml index 54df465191..6be7a7caf1 100644 --- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml +++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ tenant-mgt-feature io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml index 2e0a82f875..8a7995508d 100644 --- a/features/tenant-mgt/pom.xml +++ b/features/tenant-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml index e54fb9dbd0..705b391d9a 100644 --- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index a695a2b847..7c33cfc3f5 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml index 5bed37f970..f3cf53c254 100644 --- a/features/transport-mgt/pom.xml +++ b/features/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml index ced82dbbcb..ae4acd9ad7 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml index d508682941..2752a34bb9 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml index b6575573d6..69ddd54d33 100644 --- a/features/transport-mgt/sms-handler/pom.xml +++ b/features/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml index ba03f4b977..60a1f679f0 100644 --- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml +++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor-feature io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT 4.0.0 diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml index b6f02c578a..17283f83a2 100644 --- a/features/ui-request-interceptor/pom.xml +++ b/features/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml index aec9691d73..f368cc0ee6 100644 --- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework-feature - 5.0.29 + 5.0.30-SNAPSHOT ../pom.xml diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 61cc1d7a51..0d37e3731f 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.29 + 5.0.30-SNAPSHOT ../../pom.xml diff --git a/pom.xml b/pom.xml index 6d8622a74b..6cbbaaf673 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent pom - 5.0.29 + 5.0.30-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1879,7 +1879,7 @@ https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git - v5.0.29 + HEAD @@ -2091,7 +2091,7 @@ 1.2.11.wso2v10 - 5.0.29 + 5.0.30-SNAPSHOT 4.7.35 From 7b1907cd9054d7cbc3a3602096b827ad95170bb5 Mon Sep 17 00:00:00 2001 From: ThilinaPremachandra Date: Thu, 24 Aug 2023 14:55:39 +0530 Subject: [PATCH 052/112] resolve comments --- .../service/GroupManagementProviderServiceImpl.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 3ed40cdc57..0941d3d3a1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -860,15 +860,15 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid log.debug("Get groups count"); } try { - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); GroupManagementDAOFactory.openConnection(); + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); return groupDAO.getGroupCount(tenantId, null); - } catch (GroupManagementDAOException | SQLException e) { + } catch (GroupManagementDAOException e) { String msg = "Error occurred while retrieving all groups in tenant"; log.error(msg, e); throw new GroupManagementException(msg, e); - } catch (Exception e) { - String msg = "Error occurred"; + } catch (SQLException e) { + String msg = "Error occurred while opening a connection to the data source."; log.error(msg, e); throw new GroupManagementException(msg, e); } finally { @@ -1000,16 +1000,15 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid UserStoreManager userStoreManager; int count; try { + GroupManagementDAOFactory.openConnection(); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); userStoreManager = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId) .getUserStoreManager(); if (isAdminUser(username, userStoreManager)) { - GroupManagementDAOFactory.openConnection(); count = groupDAO.getGroupCount(tenantId, null); return count; - }else { + } else { String[] roleList = userStoreManager.getRoleListOfUser(username); - GroupManagementDAOFactory.openConnection(); count = groupDAO.getOwnGroupsCount(username, tenantId, parentPath); count += groupDAO.getGroupsCount(roleList, tenantId, parentPath); return count; From b9f12e49ee7df50f79c9a13af3b5b3ada0674786 Mon Sep 17 00:00:00 2001 From: builder Date: Mon, 28 Aug 2023 10:11:44 +0530 Subject: [PATCH 053/112] [maven-release-plugin] prepare release v5.0.30 --- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/analytics-mgt/grafana-mgt/pom.xml | 2 +- components/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.apimgt.annotations/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.application.mgt.core/pom.xml | 2 +- components/application-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.core/pom.xml | 2 +- components/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.config.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/identity-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.notification.logger/pom.xml | 2 +- components/logger/pom.xml | 2 +- .../io.entgra.device.mgt.core.operation.template/pom.xml | 2 +- components/operation-template-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.decision.point/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.core/pom.xml | 2 +- components/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt/pom.xml | 2 +- components/subtype-mgt/pom.xml | 2 +- components/task-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.core/pom.xml | 2 +- components/task-mgt/task-manager/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.watcher/pom.xml | 2 +- components/task-mgt/task-watcher/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.core/pom.xml | 2 +- components/tenant-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/email-sender/pom.xml | 2 +- components/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- components/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- components/webapp-authenticator-framework/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/analytics-mgt/grafana-mgt/pom.xml | 2 +- features/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- features/application-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.feature/pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- features/jwt-client/pom.xml | 2 +- .../pom.xml | 2 +- features/logger/pom.xml | 2 +- .../pom.xml | 2 +- features/operation-template-mgt-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- features/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml | 2 +- features/subtype-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.feature/pom.xml | 2 +- features/task-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/tenant-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.email.sender.feature/pom.xml | 2 +- features/transport-mgt/email-sender/pom.xml | 2 +- features/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- features/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- features/webapp-authenticator-framework/pom.xml | 2 +- pom.xml | 6 +++--- 132 files changed, 134 insertions(+), 134 deletions(-) diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml index b32d9a1e1c..812834905e 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml index 89eae93ae5..a9c1f62a3c 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index f9f8badfbe..53743eccba 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml index ec516423ed..5365871429 100644 --- a/components/analytics-mgt/grafana-mgt/pom.xml +++ b/components/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml index 91f8a622ca..12e64f670f 100644 --- a/components/analytics-mgt/pom.xml +++ b/components/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml index 3fee6f0ecc..c32ed3e745 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml @@ -20,7 +20,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml index 1c571dbc98..52a1c6cd37 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index 8a3b6181bf..22d8596d92 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index 684f6865f6..94593b7628 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index 9ca98815d4..a21e4b6503 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml index a1024405fd..319433a0fe 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml index 0ba85a1063..2c812597e1 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index a8dd6d3ccb..2f105bd5a4 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 7910e27c49..7b247f611c 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml index 021bf2c5c2..de58891663 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index 402e3ad9ce..cf805bb1a9 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 159f9f0163..ea7cba07ce 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml index e7097ed56b..fed271d5bd 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml index acf67b4349..e6cdb36309 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index 102e439696..5e499418d4 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core certificate-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 77729dbbb5..a66e5d8de8 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml index 15ff431444..913e24e0b2 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index f3d0aa322a..e760ce0359 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml index 992fbb2667..db0d231c45 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml @@ -21,7 +21,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml index b80ec875d9..710b6ad223 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index 22f353d6f3..eee939aa05 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 0f9d8f779a..1c9c8d3aca 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index f9f866b111..3537e52c9e 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index e539c0aef4..d549668e3c 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml index 13a29a7abc..ea73684383 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 234f5da909..abdc248648 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index 506da93ba5..1c49ee4e89 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml index fc059870f6..72da341181 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml index 0d786aa77f..21db6c3644 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index c4cb0088ba..40a75ec371 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index 401b08dde3..385207873d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml index e03472fc2a..3fbbbf9607 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 4664e29926..0c35d1eec9 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index e25d4da7ea..4536757a35 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heartbeat-management - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml index ebfdca6986..6517d06d10 100644 --- a/components/heartbeat-management/pom.xml +++ b/components/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml index 740382f64a..409d778db0 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index 8a93f07f67..1f0925d8f4 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index eb27a66d8d..23cb72ab9c 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml index b19e707a7b..0e8824932a 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger - 5.0.30-SNAPSHOT + 5.0.30 io.entgra.device.mgt.core.notification.logger diff --git a/components/logger/pom.xml b/components/logger/pom.xml index b03fffa341..e65af9cd80 100644 --- a/components/logger/pom.xml +++ b/components/logger/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index 6c06e80a7c..30a7838c9a 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core operation-template-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml index b56c4e0b54..e1fdb2132e 100644 --- a/components/operation-template-mgt/pom.xml +++ b/components/operation-template-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml index 5a8288a534..caa2d92bc5 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml index d4acdb1516..904a3967ea 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml index a8b40c78fe..76ba0ae86a 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index 07cbd20972..38a8682c4d 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index 7beb2e1b0e..7be38f077e 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index 2524e43727..e70f8082bd 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core subtype-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml index 0d52b2e3a1..41a51f5355 100644 --- a/components/subtype-mgt/pom.xml +++ b/components/subtype-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml index 12ba96dcc7..046c077455 100755 --- a/components/task-mgt/pom.xml +++ b/components/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml index d0dac69d7d..78f5b59acf 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml @@ -20,7 +20,7 @@ task-manager io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml index e1d035459e..94811a04a1 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-manager - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml index e79f683ea2..4ba3b16245 100755 --- a/components/task-mgt/task-manager/pom.xml +++ b/components/task-mgt/task-manager/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml index ff732f9859..e03787fbdc 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-watcher - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml index ef069eacde..8a36c0bba9 100755 --- a/components/task-mgt/task-watcher/pom.xml +++ b/components/task-mgt/task-watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml index 9a391ae96c..b19708ad69 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 9fcbfb3c03..40b0d801bd 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml index 932cfedc90..27d002faf1 100644 --- a/components/tenant-mgt/pom.xml +++ b/components/tenant-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml index 11b2dd31ee..69837168fd 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 2d47730f6d..0fd988bd8d 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml index 1d67cfe427..bc3b846552 100644 --- a/components/transport-mgt/pom.xml +++ b/components/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml index e03dba4d59..43bcbc38c8 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml index d93b627198..0b3be71b3b 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml index 57807ce24b..0cfbf0bd42 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml index 7a49ab761b..b4d9386850 100644 --- a/components/transport-mgt/sms-handler/pom.xml +++ b/components/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml index 25f6c8bdd9..283c28eeaa 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 4.0.0 diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml index 3b606e80b3..d03e269fc0 100644 --- a/components/ui-request-interceptor/pom.xml +++ b/components/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index bb20afcae6..9252e09206 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 75ea28eed2..77c174af21 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml index e1ff229cc9..5e63673429 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml index 2148f8a170..c0991434d2 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index 7c1c7f6023..b84c21f1ea 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index 7819fbba79..cee4c5a9f5 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml index 3a59a88bb9..aff5f07a92 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml index c9c3bf2356..fbef5027b9 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml index 951f67486b..7be7d4070a 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml index c5e71b5be5..74a9c9d51a 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml index bbdc761deb..9ca9275675 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 9d8dd0c992..06bea5a07b 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml index 1727412fee..3dc402f5aa 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core application-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index 90f273060c..abbf2ca022 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml index 6ece280074..5c7492f8db 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml index 0fcd7944ab..4ca30afc47 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index 21e379eac8..b5739c70c0 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 6ece3ab1df..26c60b267b 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml index f21deac929..83b12f0904 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml index c042f7ef2f..9230e7b6c9 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml index 7d2479f428..b6eaeafd9a 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index 64a8641d9b..e0212b6fc1 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index fb53c4781e..3fc13f7eb6 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 4285c6ece7..d3fe68d90b 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 7624822da7..e09c058d21 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml index e8fefee74a..d10a64bee8 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 6afa336258..472e82588b 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml index d27dbdfaa0..8ec16dda37 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml index c109a9faf2..6f9c880c4c 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml index 9a61a5f54a..afe22ce1a6 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml index 6f1850577c..5941babc81 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml index 2b70c7fc5a..d899322e53 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index ef10f40c74..82764cac61 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml index b613f1cca1..8ca9e7fd61 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heart-beat-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml index 512817824e..7939d07c03 100644 --- a/features/heartbeat-management/pom.xml +++ b/features/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml index d9b86c1343..cdc429749f 100644 --- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core jwt-client-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index c15cf0f45a..e9b7d1846d 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml index f28d1cfa7a..97e6f95bb8 100644 --- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml +++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/logger/pom.xml b/features/logger/pom.xml index 0c5cd1cd67..17c55d472f 100644 --- a/features/logger/pom.xml +++ b/features/logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml index b70908056c..eb1c7a44fe 100644 --- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core operation-template-mgt-plugin-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml index 7b1dea0314..b8e4f83ab9 100644 --- a/features/operation-template-mgt-plugin-feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index e47f84684b..345a936121 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core policy-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index c358cafad9..7eec9c5ef3 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml index e968e28ed6..6f92ea8ccb 100644 --- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml +++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../../pom.xml diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml index 40fae9d4b7..8d81825d02 100644 --- a/features/subtype-mgt/pom.xml +++ b/features/subtype-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml index bc40d91ab0..d11a06fcc3 100755 --- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml +++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../../pom.xml diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml index c3d21e1571..f012eca0b7 100755 --- a/features/task-mgt/pom.xml +++ b/features/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml index 6be7a7caf1..453c14c960 100644 --- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml +++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ tenant-mgt-feature io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml index 8a7995508d..b79e3d0192 100644 --- a/features/tenant-mgt/pom.xml +++ b/features/tenant-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml index 705b391d9a..cc407ebc17 100644 --- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index 7c33cfc3f5..81287a9267 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml index f3cf53c254..fd8728725f 100644 --- a/features/transport-mgt/pom.xml +++ b/features/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml index ae4acd9ad7..ad3da38a4b 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml index 2752a34bb9..892a6d0f05 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml index 69ddd54d33..a5b88caa36 100644 --- a/features/transport-mgt/sms-handler/pom.xml +++ b/features/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml index 60a1f679f0..7268d029f6 100644 --- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml +++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor-feature io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 4.0.0 diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml index 17283f83a2..4dccdcb091 100644 --- a/features/ui-request-interceptor/pom.xml +++ b/features/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml index f368cc0ee6..7297d850e2 100644 --- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework-feature - 5.0.30-SNAPSHOT + 5.0.30 ../pom.xml diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 0d37e3731f..c119e7f58a 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30-SNAPSHOT + 5.0.30 ../../pom.xml diff --git a/pom.xml b/pom.xml index 6cbbaaf673..c03a6e42b8 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent pom - 5.0.30-SNAPSHOT + 5.0.30 WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1879,7 +1879,7 @@ https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git - HEAD + v5.0.30 @@ -2091,7 +2091,7 @@ 1.2.11.wso2v10 - 5.0.30-SNAPSHOT + 5.0.30 4.7.35 From 7c66f6b693539d3ba934c1e938dee49efca4a628 Mon Sep 17 00:00:00 2001 From: builder Date: Mon, 28 Aug 2023 10:11:49 +0530 Subject: [PATCH 054/112] [maven-release-plugin] prepare for next development iteration --- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/analytics-mgt/grafana-mgt/pom.xml | 2 +- components/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.apimgt.annotations/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.application.mgt.core/pom.xml | 2 +- components/application-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.core/pom.xml | 2 +- components/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.config.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/identity-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.notification.logger/pom.xml | 2 +- components/logger/pom.xml | 2 +- .../io.entgra.device.mgt.core.operation.template/pom.xml | 2 +- components/operation-template-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.decision.point/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.core/pom.xml | 2 +- components/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt/pom.xml | 2 +- components/subtype-mgt/pom.xml | 2 +- components/task-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.core/pom.xml | 2 +- components/task-mgt/task-manager/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.watcher/pom.xml | 2 +- components/task-mgt/task-watcher/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.core/pom.xml | 2 +- components/tenant-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/email-sender/pom.xml | 2 +- components/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- components/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- components/webapp-authenticator-framework/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/analytics-mgt/grafana-mgt/pom.xml | 2 +- features/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- features/application-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.feature/pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- features/jwt-client/pom.xml | 2 +- .../pom.xml | 2 +- features/logger/pom.xml | 2 +- .../pom.xml | 2 +- features/operation-template-mgt-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- features/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml | 2 +- features/subtype-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.feature/pom.xml | 2 +- features/task-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/tenant-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.email.sender.feature/pom.xml | 2 +- features/transport-mgt/email-sender/pom.xml | 2 +- features/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- features/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- features/webapp-authenticator-framework/pom.xml | 2 +- pom.xml | 6 +++--- 132 files changed, 134 insertions(+), 134 deletions(-) diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml index 812834905e..649a3a26e3 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml index a9c1f62a3c..72b6963702 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index 53743eccba..059a9bc268 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml index 5365871429..7bc9db7e86 100644 --- a/components/analytics-mgt/grafana-mgt/pom.xml +++ b/components/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml index 12e64f670f..bc9ce9529f 100644 --- a/components/analytics-mgt/pom.xml +++ b/components/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml index c32ed3e745..e117cb7d5a 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml @@ -20,7 +20,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml index 52a1c6cd37..c446adc7ce 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index 22d8596d92..07c7081238 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index 94593b7628..1b5b4157f1 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index a21e4b6503..5a0dcfd826 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml index 319433a0fe..104c678198 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml index 2c812597e1..2b2272de5f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index 2f105bd5a4..e108eb7fb1 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 7b247f611c..fb96006ff6 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml index de58891663..25ca18c81b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index cf805bb1a9..f30bd9137e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index ea7cba07ce..b2feff02a1 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml index fed271d5bd..f9406c6ebd 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml index e6cdb36309..45bf67757a 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index 5e499418d4..fc26b8fab2 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core certificate-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index a66e5d8de8..78b9bcf6ae 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml index 913e24e0b2..54328884f0 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index e760ce0359..e724331237 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml index db0d231c45..f294a54405 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml @@ -21,7 +21,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml index 710b6ad223..510c445c39 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index eee939aa05..88b203d3e2 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 1c9c8d3aca..976477a4f8 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 3537e52c9e..9a60f537f4 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index d549668e3c..7c500e97b0 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml index ea73684383..e499a0e780 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index abdc248648..5dbed0b826 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index 1c49ee4e89..b486fc4b4e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml index 72da341181..6deb7e2a38 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml index 21db6c3644..9518c5392b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index 40a75ec371..82c807c7e3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index 385207873d..aae8132819 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml index 3fbbbf9607..a7f333af0a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 0c35d1eec9..1113b75870 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index 4536757a35..8983ad2349 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heartbeat-management - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml index 6517d06d10..5bf8605825 100644 --- a/components/heartbeat-management/pom.xml +++ b/components/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml index 409d778db0..87d89e8e68 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index 1f0925d8f4..2777b27949 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 23cb72ab9c..8855272bb3 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml index 0e8824932a..9382abf2cb 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger - 5.0.30 + 5.0.31-SNAPSHOT io.entgra.device.mgt.core.notification.logger diff --git a/components/logger/pom.xml b/components/logger/pom.xml index e65af9cd80..6ade814e79 100644 --- a/components/logger/pom.xml +++ b/components/logger/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index 30a7838c9a..da557dab90 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core operation-template-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml index e1fdb2132e..16ed95de0b 100644 --- a/components/operation-template-mgt/pom.xml +++ b/components/operation-template-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml index caa2d92bc5..e1d5ba34d7 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml index 904a3967ea..780e2b5bfb 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml index 76ba0ae86a..730b185024 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index 38a8682c4d..732e28e4da 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index 7be38f077e..36e73567d0 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index e70f8082bd..ad2c4fca02 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core subtype-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml index 41a51f5355..19bacdf54d 100644 --- a/components/subtype-mgt/pom.xml +++ b/components/subtype-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml index 046c077455..3fc9ee0375 100755 --- a/components/task-mgt/pom.xml +++ b/components/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml index 78f5b59acf..1410aaa765 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml @@ -20,7 +20,7 @@ task-manager io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml index 94811a04a1..ff891a074c 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-manager - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml index 4ba3b16245..83a3462056 100755 --- a/components/task-mgt/task-manager/pom.xml +++ b/components/task-mgt/task-manager/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml index e03787fbdc..a14fb2023b 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-watcher - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml index 8a36c0bba9..ebc0ec502c 100755 --- a/components/task-mgt/task-watcher/pom.xml +++ b/components/task-mgt/task-watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml index b19708ad69..283d376978 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 40b0d801bd..632fabe6c2 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml index 27d002faf1..3b1cbd62c7 100644 --- a/components/tenant-mgt/pom.xml +++ b/components/tenant-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml index 69837168fd..784635f0ed 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 0fd988bd8d..f30347a9d3 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml index bc3b846552..00911ea4e6 100644 --- a/components/transport-mgt/pom.xml +++ b/components/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml index 43bcbc38c8..ed91dae32d 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml index 0b3be71b3b..ab314cd805 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml index 0cfbf0bd42..911f695989 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml index b4d9386850..abbf64776e 100644 --- a/components/transport-mgt/sms-handler/pom.xml +++ b/components/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml index 283c28eeaa..6e588df279 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT 4.0.0 diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml index d03e269fc0..5a5ef82b68 100644 --- a/components/ui-request-interceptor/pom.xml +++ b/components/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index 9252e09206..fdd1b290cf 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 77c174af21..f9aa06177a 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml index 5e63673429..d5856bf8a4 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml index c0991434d2..195d9d610e 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index b84c21f1ea..907c8e8c75 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index cee4c5a9f5..f7eaeaeef9 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml index aff5f07a92..eb37dae2fe 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml index fbef5027b9..c910b2774c 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml index 7be7d4070a..9ac48cd779 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml index 74a9c9d51a..85d4212606 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml index 9ca9275675..8764cf8b6a 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 06bea5a07b..db886b2065 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml index 3dc402f5aa..911772e59a 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core application-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index abbf2ca022..b64abe8da0 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml index 5c7492f8db..1155b808c2 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml index 4ca30afc47..625d8eb508 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index b5739c70c0..208ef8b477 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 26c60b267b..f2f4d90c60 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml index 83b12f0904..8bfc5f955b 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml index 9230e7b6c9..8572d7620f 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml index b6eaeafd9a..da6c048c03 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index e0212b6fc1..d239526692 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index 3fc13f7eb6..f1219c71a1 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index d3fe68d90b..14157aa28d 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index e09c058d21..8d1e07c7b5 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml index d10a64bee8..179376353c 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 472e82588b..36516f0fe8 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml index 8ec16dda37..72eebca9e7 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml index 6f9c880c4c..dffbb06221 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml index afe22ce1a6..143c78e64e 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml index 5941babc81..450ab4bf92 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml index d899322e53..fcbb28f3c4 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 82764cac61..cc168cb5af 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml index 8ca9e7fd61..1907ddfd2f 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heart-beat-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml index 7939d07c03..4d2ab7d267 100644 --- a/features/heartbeat-management/pom.xml +++ b/features/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml index cdc429749f..a9d93aa465 100644 --- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core jwt-client-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index e9b7d1846d..6bd87998f4 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml index 97e6f95bb8..30aec98c84 100644 --- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml +++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/logger/pom.xml b/features/logger/pom.xml index 17c55d472f..bedf8aac4b 100644 --- a/features/logger/pom.xml +++ b/features/logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml index eb1c7a44fe..40efafd38e 100644 --- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core operation-template-mgt-plugin-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml index b8e4f83ab9..a3791b2afd 100644 --- a/features/operation-template-mgt-plugin-feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index 345a936121..b60be2da33 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core policy-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 7eec9c5ef3..e4a31fa307 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml index 6f92ea8ccb..9e70fb34d3 100644 --- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml +++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../../pom.xml diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml index 8d81825d02..3d388bd0b6 100644 --- a/features/subtype-mgt/pom.xml +++ b/features/subtype-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml index d11a06fcc3..883aa53cb6 100755 --- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml +++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../../pom.xml diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml index f012eca0b7..fca80b6ce9 100755 --- a/features/task-mgt/pom.xml +++ b/features/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml index 453c14c960..0eb9211c99 100644 --- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml +++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ tenant-mgt-feature io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml index b79e3d0192..6007c3d4af 100644 --- a/features/tenant-mgt/pom.xml +++ b/features/tenant-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml index cc407ebc17..a088484df3 100644 --- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index 81287a9267..da352d88c5 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml index fd8728725f..2403e63301 100644 --- a/features/transport-mgt/pom.xml +++ b/features/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml index ad3da38a4b..6f8e76a66e 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml index 892a6d0f05..de86b62306 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml index a5b88caa36..f5209b00b5 100644 --- a/features/transport-mgt/sms-handler/pom.xml +++ b/features/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml index 7268d029f6..014bf54fd9 100644 --- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml +++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor-feature io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT 4.0.0 diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml index 4dccdcb091..0c614753c6 100644 --- a/features/ui-request-interceptor/pom.xml +++ b/features/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml index 7297d850e2..5d45e37d10 100644 --- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework-feature - 5.0.30 + 5.0.31-SNAPSHOT ../pom.xml diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index c119e7f58a..ca35efa3ed 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.30 + 5.0.31-SNAPSHOT ../../pom.xml diff --git a/pom.xml b/pom.xml index c03a6e42b8..026b0bb4d4 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent pom - 5.0.30 + 5.0.31-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1879,7 +1879,7 @@ https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git - v5.0.30 + HEAD @@ -2091,7 +2091,7 @@ 1.2.11.wso2v10 - 5.0.30 + 5.0.31-SNAPSHOT 4.7.35 From dc4035129344a703bfd3735efd8a2dc57576577c Mon Sep 17 00:00:00 2001 From: shamalka Date: Mon, 28 Aug 2023 13:43:11 +0530 Subject: [PATCH 055/112] Change location publishing logic --- .../impl/DeviceInformationManagerImpl.java | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index 13867d1d4d..8331edd653 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -363,13 +363,6 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { DeviceManagementDAOFactory.beginTransaction(); DeviceLocation previousLocation = deviceDetailsDAO.getDeviceLocation(device.getId(), device.getEnrolmentInfo().getId()); - if (previousLocation == null) { - deviceDetailsDAO.addDeviceLocation(deviceLocation, device.getEnrolmentInfo().getId()); - } else { - deviceDetailsDAO.updateDeviceLocation(deviceLocation, device.getEnrolmentInfo().getId()); - } - deviceDetailsDAO.addDeviceLocationInfo(device, deviceLocation, - CarbonContext.getThreadLocalCarbonContext().getTenantId()); if (DeviceManagerUtil.isPublishLocationResponseEnabled()) { Object[] metaData = {device.getDeviceIdentifier(), device.getEnrolmentInfo().getOwner(), device.getType()}; Object[] payload = new Object[]{ @@ -382,11 +375,17 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { deviceLocation.getDistance() }; } - //Tracker update GPS Location if (HttpReportingUtil.isLocationPublishing() && HttpReportingUtil.isTrackerEnabled()) { DeviceManagementDataHolder.getInstance().getTraccarManagementService().updateLocation(device, deviceLocation); } else { + if (previousLocation == null) { + deviceDetailsDAO.addDeviceLocation(deviceLocation, device.getEnrolmentInfo().getId()); + } else { + deviceDetailsDAO.updateDeviceLocation(deviceLocation, device.getEnrolmentInfo().getId()); + } + deviceDetailsDAO.addDeviceLocationInfo(device, deviceLocation, + CarbonContext.getThreadLocalCarbonContext().getTenantId()); if(!HttpReportingUtil.isLocationPublishing()) { if (log.isDebugEnabled()) { log.debug("Location publishing is disabled"); @@ -453,29 +452,29 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { DeviceManagementDAOFactory.beginTransaction(); boolean previousLocation = deviceDetailsDAO.hasLocations(device.getId(), device.getEnrolmentInfo().getId()); - if (previousLocation) { - deviceDetailsDAO.updateDeviceLocation(mostRecentDeviceLocation, device.getEnrolmentInfo().getId()); - } else { - deviceDetailsDAO.addDeviceLocation(mostRecentDeviceLocation, device.getEnrolmentInfo().getId()); - } - - deviceDetailsDAO.addDeviceLocationsInfo(device, deviceLocations, - CarbonContext.getThreadLocalCarbonContext().getTenantId()); - - for (DeviceLocation deviceLocation: deviceLocations) { - //Tracker update GPS Location - if (HttpReportingUtil.isLocationPublishing() && HttpReportingUtil.isTrackerEnabled()) { - DeviceManagementDataHolder.getInstance().getTraccarManagementService().updateLocation(device, deviceLocation); + if(!HttpReportingUtil.isTrackerEnabled()) { + if (previousLocation) { + deviceDetailsDAO.updateDeviceLocation(mostRecentDeviceLocation, device.getEnrolmentInfo().getId()); } else { - if(!HttpReportingUtil.isLocationPublishing()) { - if (log.isDebugEnabled()) { - log.debug("Location publishing is disabled"); - } + deviceDetailsDAO.addDeviceLocation(mostRecentDeviceLocation, device.getEnrolmentInfo().getId()); + } + deviceDetailsDAO.addDeviceLocationsInfo(device, deviceLocations, + CarbonContext.getThreadLocalCarbonContext().getTenantId()); + } + if (HttpReportingUtil.isLocationPublishing() && HttpReportingUtil.isTrackerEnabled()) { + for (DeviceLocation deviceLocation: deviceLocations) { + //Tracker update GPS Location + DeviceManagementDataHolder.getInstance().getTraccarManagementService().updateLocation(device, deviceLocation); + } + } else { + if(!HttpReportingUtil.isLocationPublishing()) { + if (log.isDebugEnabled()) { + log.debug("Location publishing is disabled"); } - if (!HttpReportingUtil.isTrackerEnabled()) { - if (log.isDebugEnabled()) { - log.debug("Traccar is disabled"); - } + } + if (!HttpReportingUtil.isTrackerEnabled()) { + if (log.isDebugEnabled()) { + log.debug("Traccar is disabled"); } } } From 203475f87dc3ad08694a4309505ef56a35973abd Mon Sep 17 00:00:00 2001 From: shamalka Date: Fri, 1 Sep 2023 11:41:33 +0530 Subject: [PATCH 056/112] Remove custom properties from device table column selection --- .../src/main/resources/conf/mdm-ui-config.xml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index a5dad642b7..13553e3816 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -81,21 +81,6 @@ label_actions default - - FIRMWARE_VERSION - label_firmware_version - deviceDetailsMap - - - FIRMWARE_APP_VERSION - label_app_version - deviceDetailsMap - - - FIRMWARE_SYSTEM_VERSION - label_firmware_system_version - deviceDetailsMap - batteryLevel label_battery_leve From 680f57ade5b25f209b20a490f7458ad81c9631c1 Mon Sep 17 00:00:00 2001 From: Thameera Date: Mon, 4 Sep 2023 12:32:07 +0530 Subject: [PATCH 057/112] URL permission issue fixes (Removed * from root URLs) --- .../webapp/publisher/lifecycle/util/AnnotationProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index 48cb848c8f..d51fe20f63 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -63,7 +63,7 @@ public class AnnotationProcessor { private static final String PACKAGE_ORG_APACHE = "org.apache"; private static final String PACKAGE_ORG_CODEHAUS = "org.codehaus"; private static final String PACKAGE_ORG_SPRINGFRAMEWORK = "org.springframework"; - public static final String WILD_CARD = "/*"; + public static final String WILD_CARD = "/"; private static final String SWAGGER_ANNOTATIONS_INFO = "info"; private static final String SWAGGER_ANNOTATIONS_TAGS = "tags"; private static final String SWAGGER_ANNOTATIONS_EXTENSIONS = "extensions"; From 9c7fd9027ee5c4ab2d325b61687e07a0147823f1 Mon Sep 17 00:00:00 2001 From: Arshana Date: Tue, 5 Sep 2023 11:02:57 +0530 Subject: [PATCH 058/112] Fix the API to check if a device is enrolled --- .../mgt/api/jaxrs/service/api/DeviceManagementService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java index bb5349da68..467dd238c7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java @@ -838,9 +838,9 @@ public interface DeviceManagementService { Response getDeviceByIdList(List deviceIds); - @PUT + @GET @Produces(MediaType.APPLICATION_JSON) - @Path("/{type}/{id}") + @Path("/{type}/{id}/status") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", From 0fbe062e49781623cb894bc5c144e91005040a98 Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Tue, 5 Sep 2023 07:58:13 +0000 Subject: [PATCH 059/112] Fix the SSL error when invoking internal API via HttpClient (#215) Co-authored-by: Pahansith Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/215 --- .../pom.xml | 5 ++ .../core/impl/SubscriptionManagerImpl.java | 80 ++++++++++++------- .../application/mgt/core/util/Constants.java | 2 + pom.xml | 2 +- 4 files changed, 60 insertions(+), 29 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index f30bd9137e..5a713e5f5e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -112,6 +112,11 @@ + + + org.apache.httpcomponents + httpclient + org.eclipse.osgi org.eclipse.osgi diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java index 61e3961e12..fceb70e072 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -26,18 +26,20 @@ import io.entgra.device.mgt.core.application.mgt.core.dao.VppApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; -import io.entgra.device.mgt.core.application.mgt.core.util.VppHttpUtil; import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; import io.entgra.device.mgt.core.notification.logger.AppInstallLogContext; import io.entgra.device.mgt.core.notification.logger.impl.EntgraAppInstallLoggerImpl; import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpMethodBase; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; + +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.ssl.SSLContextBuilder; +import org.apache.http.conn.ssl.TrustSelfSignedStrategy; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; import org.json.JSONArray; import org.json.JSONObject; import io.entgra.device.mgt.core.apimgt.application.extension.dto.ApiApplicationKey; @@ -106,6 +108,9 @@ import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -1297,38 +1302,37 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } } - private int invokeIOTCoreAPI(HttpMethodBase request) throws UserStoreException, APIManagerException, IOException { - HttpClient httpClient; + private int invokeIOTCoreAPI(HttpPost request) throws UserStoreException, APIManagerException, IOException, + ApplicationManagementException { + CloseableHttpClient httpClient = getHttpClient(); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); ApiApplicationKey apiApplicationKey = OAuthUtils.getClientCredentials(tenantDomain); String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration() .getAdminUserName() + Constants.ApplicationInstall.AT + tenantDomain; AccessTokenInfo tokenInfo = OAuthUtils.getOAuthCredentials(apiApplicationKey, username); - request.addRequestHeader(Constants.ApplicationInstall.AUTHORIZATION, + request.addHeader(Constants.ApplicationInstall.AUTHORIZATION, Constants.ApplicationInstall.AUTHORIZATION_HEADER_VALUE + tokenInfo.getAccessToken()); - httpClient = new HttpClient(); - httpClient.executeMethod(request); - return request.getStatusCode(); + HttpResponse response = httpClient.execute(request); + return response.getStatusLine().getStatusCode(); } public int installEnrollmentApplications(ApplicationPolicyDTO applicationPolicyDTO) throws ApplicationManagementException { - - PostMethod request; + String requestUrl =null; try { - String requestUrl = Constants.ApplicationInstall.ENROLLMENT_APP_INSTALL_PROTOCOL + System - .getProperty(Constants.ApplicationInstall.IOT_CORE_HOST) + Constants.ApplicationInstall.COLON + requestUrl = Constants.ApplicationInstall.ENROLLMENT_APP_INSTALL_PROTOCOL + System + .getProperty(Constants.ApplicationInstall.IOT_GATEWAY_HOST) + Constants.ApplicationInstall.COLON + System.getProperty(Constants.ApplicationInstall.IOT_CORE_PORT) + Constants.ApplicationInstall.GOOGLE_APP_INSTALL_URL; Gson gson = new Gson(); String payload = gson.toJson(applicationPolicyDTO); + HttpPost httpPost = new HttpPost(requestUrl); - StringRequestEntity requestEntity = new StringRequestEntity(payload, MediaType.APPLICATION_JSON, - Constants.ApplicationInstall.ENCODING); - request = new PostMethod(requestUrl); - request.setRequestEntity(requestEntity); - return invokeIOTCoreAPI(request); + StringEntity stringEntity = new StringEntity(payload, Constants.ApplicationInstall.ENCODING); + httpPost.addHeader("Content-Type",MediaType.APPLICATION_JSON); + httpPost.setEntity(stringEntity); + return invokeIOTCoreAPI(httpPost); } catch (UserStoreException e) { String msg = "Error while accessing user store for user with Android device."; log.error(msg, e); @@ -1337,18 +1341,38 @@ public class SubscriptionManagerImpl implements SubscriptionManager { String msg = "Error while retrieving access token for Android device"; log.error(msg, e); throw new ApplicationManagementException(msg, e); - } catch (HttpException e) { - String msg = "Error while calling the app store to install enrollment app with id: " + applicationPolicyDTO - .getApplicationDTO().getId() + " on device"; - log.error(msg, e); - throw new ApplicationManagementException(msg, e); } catch (IOException e) { String msg = "Error while installing the enrollment with id: " + applicationPolicyDTO.getApplicationDTO().getId() - + " on device"; + + " on device: request URL: " + requestUrl; + log.error(msg + "request url: " + requestUrl, e); + throw new ApplicationManagementException(msg, e); + } + } + + private CloseableHttpClient getHttpClient() throws ApplicationManagementException { + try { + SSLContextBuilder builder = new SSLContextBuilder(); + builder.loadTrustMaterial(null, new TrustSelfSignedStrategy()); + SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build()); + return HttpClients.custom().setSSLSocketFactory(sslsf).useSystemProperties().build(); + } catch (NoSuchAlgorithmException e) { + String msg = "Failed while building the http client for EntApp installation. " + + "Used SSL algorithm not available"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (KeyStoreException e) { + String msg = "Failed while building the http client for EntApp installation. " + + "Failed to load required key stores"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (KeyManagementException e) { + String msg = "Failed while building the http client for EntApp installation. " + + "Failed while building SSL context"; log.error(msg, e); throw new ApplicationManagementException(msg, e); } + } private String getIOTCoreBaseUrl() { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java index 66976763e8..767b5e2bd2 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java @@ -178,6 +178,8 @@ public class Constants { public static final String DEVICE_TYPE_ANDROID = "android"; public static final String COLON = ":"; public static final String IOT_CORE_HOST = "iot.core.host"; + + public static final String IOT_GATEWAY_HOST = "iot.gateway.host"; public static final String IOT_CORE_PORT = "iot.core.https.port"; public static final String ENROLLMENT_APP_INSTALL_PROTOCOL = "https://"; public static final String GOOGLE_APP_INSTALL_URL = "/api/device-mgt/android/v1.0/enterprise/change-app"; diff --git a/pom.xml b/pom.xml index 026b0bb4d4..07205ca653 100644 --- a/pom.xml +++ b/pom.xml @@ -2145,7 +2145,7 @@ 9.3.1 1.1.1 1.2 - 4.5.6 + 4.5.13 4.4.10 4.5.8 From 44c7d324de574f26fb255e70792098c70a956165 Mon Sep 17 00:00:00 2001 From: ThilinaPremachandra Date: Thu, 7 Sep 2023 11:29:10 +0530 Subject: [PATCH 060/112] Fix: delete group with GeoFence references issue --- .../core/dao/impl/AbstractGroupDAOImpl.java | 8 +++ .../src/test/resources/sql/h2.sql | 59 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index 657924ca80..b9c655c4ba 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -526,6 +526,14 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { stmt.setInt(1, groupId); stmt.setInt(2, tenantId); stmt.executeUpdate(); + sql = "DELETE FROM DM_DEVICE_EVENT_GROUP_MAPPING WHERE GROUP_ID = ?"; + stmt = conn.prepareStatement(sql); + stmt.setInt(1, groupId); + stmt.executeUpdate(); + sql = "DELETE FROM DM_GEOFENCE_GROUP_MAPPING WHERE GROUP_ID = ?"; + stmt = conn.prepareStatement(sql); + stmt.setInt(1, groupId); + stmt.executeUpdate(); } catch (SQLException e) { throw new GroupManagementDAOException("Error occurred while removing mappings for group.'", e); } finally { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql index 4f83fa5b5e..57ee79b42c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql @@ -73,6 +73,65 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE ); +-- DM_GEOFENCE TABLE-- +CREATE TABLE IF NOT EXISTS DM_GEOFENCE +( + ID INT NOT NULL AUTO_INCREMENT, + FENCE_NAME VARCHAR(255) NOT NULL, + DESCRIPTION TEXT DEFAULT NULL, + LATITUDE DOUBLE DEFAULT NULL, + LONGITUDE DOUBLE DEFAULT NULL, + RADIUS DOUBLE DEFAULT NULL, + GEO_JSON TEXT DEFAULT NULL, + FENCE_SHAPE VARCHAR(100) DEFAULT NULL, + CREATED_TIMESTAMP TIMESTAMP NOT NULL, + OWNER VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (ID) +); +-- END OF DM_GEOFENCE TABLE-- + +-- DM_GEOFENCE_GROUP_MAPPING TABLE-- +CREATE TABLE IF NOT EXISTS DM_GEOFENCE_GROUP_MAPPING +( + ID INT NOT NULL AUTO_INCREMENT, + FENCE_ID INT NOT NULL, + GROUP_ID INT NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_dm_geofence_group_mapping_geofence FOREIGN KEY (FENCE_ID) REFERENCES + DM_GEOFENCE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT fk_dm_geofence_group_mapping_group FOREIGN KEY (GROUP_ID) REFERENCES + DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +-- END OF DM_GEOFENCE_GROUP_MAPPING TABLE-- + +-- DM_DEVICE_EVENT TABLE -- +CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT +( + ID INT NOT NULL AUTO_INCREMENT, + EVENT_SOURCE VARCHAR(100) NOT NULL, + EVENT_LOGIC VARCHAR(100) NOT NULL, + ACTIONS TEXT DEFAULT NULL, + CREATED_TIMESTAMP TIMESTAMP NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (ID) +); +-- END OF DM_DEVICE_EVENT TABLE -- + +-- DM_DEVICE_EVENT_GROUP_MAPPING TABLE-- +CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT_GROUP_MAPPING +( + ID INT NOT NULL AUTO_INCREMENT, + EVENT_ID INT NOT NULL, + GROUP_ID INT NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_dm_event_group_mapping_event FOREIGN KEY (EVENT_ID) REFERENCES + DM_DEVICE_EVENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT fk_dm_event_group_mapping_group FOREIGN KEY (GROUP_ID) REFERENCES + DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +-- END OF DM_DEVICE_EVENT_GROUP_MAPPING TABLE-- + CREATE TABLE IF NOT EXISTS DM_OPERATION ( ID INTEGER AUTO_INCREMENT NOT NULL, TYPE VARCHAR(50) NOT NULL, From ef47f0c20a2b83728170529a2f70cf9236081f58 Mon Sep 17 00:00:00 2001 From: pasindu Date: Fri, 8 Sep 2023 11:36:05 +0530 Subject: [PATCH 061/112] Update scopes including already existing roles --- .../apimgt/webapp/publisher/APIPublisherServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 871450c824..61196a1da0 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -513,8 +513,15 @@ public class APIPublisherServiceImpl implements APIPublisherService { if (scopeObj.getString("name").equals(scopeMapping[2] != null ? StringUtils.trim(scopeMapping[2]) : StringUtils.EMPTY)) { scope.setId(scopeObj.getString("id")); + +// Including already existing roles + JSONArray existingRolesArray = (JSONArray) scopeObj.get("bindings"); + for (int j = 0; j < existingRolesArray.length(); j++) { + roleString = roleString + "," + existingRolesArray.get(j); + } } } + scope.setRoles(roleString); if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getKey())) { publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope); From 94b027847167701119b06fddf525e16fa217d8cf Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Mon, 11 Sep 2023 08:47:10 +0530 Subject: [PATCH 062/112] Fix dbscripts causing errors on startup --- .../src/main/resources/dbscripts/cdm/mssql.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 16af46d997..eacceb2bc5 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -464,7 +464,7 @@ CREATE INDEX IDX_DM_APPLICATION ON DM_APPLICATION(DEVICE_ID, ENROLMENT_ID, TENAN -- POLICY RELATED TABLES FINISHED -- -IF NOT EXISTS (SELECT * SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_APP_ICONS]') AND TYPE IN (N'U')) +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_APP_ICONS]') AND TYPE IN (N'U')) CREATE TABLE DM_APP_ICONS ( ID INTEGER IDENTITY(1,1) NOT NULL, ICON_PATH VARCHAR(150) DEFAULT NULL, From 42ef84e8a3e9737ac4e300a3670e7dea5de60cad Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Mon, 11 Sep 2023 08:51:04 +0530 Subject: [PATCH 063/112] Fix table DM_TRACCAR_UNSYNCED_DEVICES --- .../src/main/resources/dbscripts/cdm/mssql.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index eacceb2bc5..d8c827f04d 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -874,7 +874,8 @@ CREATE TABLE DM_DEVICE_SUB_TYPE ( -- END OF DM_DEVICE_SUB_TYPE TABLE-- -- DM_TRACCAR_UNSYNCED_DEVICES TABLE -- -CREATE TABLE IF NOT EXISTS DM_TRACCAR_UNSYNCED_DEVICES ( +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_TRACCAR_UNSYNCED_DEVICES]') AND TYPE IN (N'U')) +CREATE TABLE DM_TRACCAR_UNSYNCED_DEVICES ( ID INT NOT NULL IDENTITY(1,1), DEVICE_NAME VARCHAR(100) NOT NULL, IOTS_DEVICE_IDENTIFIER VARCHAR(300) NULL UNIQUE, From 5d06485a251ef7209387725c1ebde53818678696 Mon Sep 17 00:00:00 2001 From: osh Date: Tue, 12 Sep 2023 08:31:47 +0530 Subject: [PATCH 064/112] Add device deletion scenario for billing --- .../core/device/mgt/common/EnrolmentInfo.java | 2 +- .../core/device/mgt/core/dao/DeviceDAO.java | 2 +- .../core/dao/impl/AbstractDeviceDAOImpl.java | 141 +++++++++++++----- .../core/dao/impl/DeviceStatusDAOImpl.java | 2 +- .../dao/impl/device/GenericDeviceDAOImpl.java | 12 +- .../DeviceManagementProviderServiceImpl.java | 16 +- 6 files changed, 126 insertions(+), 49 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/EnrolmentInfo.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/EnrolmentInfo.java index 6cfd4092dc..450fe0c5df 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/EnrolmentInfo.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/EnrolmentInfo.java @@ -32,7 +32,7 @@ public class EnrolmentInfo implements Serializable { public enum Status { CREATED, ACTIVE, INACTIVE, UNREACHABLE, UNCLAIMED, SUSPENDED, BLOCKED, REMOVED, DISENROLLMENT_REQUESTED, CONFIGURED, READY_TO_CONNECT, RETURN_PENDING, RETURNED, DEFECTIVE, WARRANTY_PENDING, WARRANTY_SENT, - WARRANTY_REPLACED, ASSIGNED + WARRANTY_REPLACED, ASSIGNED, DELETED } public enum OwnerShip { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceDAO.java index 68e475d2a4..7b05067899 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceDAO.java @@ -634,7 +634,7 @@ public interface DeviceDAO { * @param enrollmentIds list of enrollment ids. * @throws DeviceManagementDAOException when no enrolments are found for the given device. */ - void deleteDevices(List deviceIdentifiers, List deviceIds, List enrollmentIds) throws DeviceManagementDAOException; + void deleteDevices(List deviceIdentifiers, List deviceIds, List enrollmentIds, List validDevices) throws DeviceManagementDAOException; boolean transferDevice(String deviceType, String deviceId, String owner, int destinationTenantId) throws DeviceManagementDAOException, SQLException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 6b06c28d60..5696c0b23f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -52,6 +52,7 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.StringJoiner; +import java.util.Random; public abstract class AbstractDeviceDAOImpl implements DeviceDAO { @@ -2155,7 +2156,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { } @Override - public void deleteDevices(List deviceIdentifiers, List deviceIds, List enrollmentIds) + public void deleteDevices(List deviceIdentifiers, List deviceIds, List enrollmentIds, List validDevices) throws DeviceManagementDAOException { Connection conn; try { @@ -2210,7 +2211,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { "operation response, enrollment operation mapping data of " + "devices with identifiers: " + deviceIdentifiers); } - removeDeviceEnrollment(conn, deviceIds); + refactorEnrolment(conn, deviceIds); + refactorDeviceStatus(conn, validDevices); if (log.isDebugEnabled()) { log.debug("Successfully removed device enrollment data of devices: " + deviceIdentifiers); } @@ -2218,7 +2220,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { if (log.isDebugEnabled()) { log.debug("Successfully removed device group mapping data of devices: " + deviceIdentifiers); } - removeDevice(conn, deviceIds); + refactorDevice(conn, deviceIds); if (log.isDebugEnabled()) { log.debug("Successfully permanently deleted the device of devices: " + deviceIdentifiers); } @@ -2749,30 +2751,6 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { } } - /*** - * This method removes records of a given list of enrollments from the DM_ENROLMENT table - * @param conn Connection object - * @param enrollmentIds list of enrollment ids (primary keys) - * @throws DeviceManagementDAOException if deletion fails - */ - private void removeDeviceEnrollment(Connection conn, List enrollmentIds) - throws DeviceManagementDAOException { - String sql = "DELETE FROM DM_ENROLMENT WHERE DEVICE_ID = ?"; - try { - if (!executeBatchOperation(conn, sql, enrollmentIds)) { - String msg = "Failed to remove enrollments of devices with enrollmentIds : " + enrollmentIds - + " while executing batch operation"; - log.error(msg); - throw new DeviceManagementDAOException(msg); - } - } catch (SQLException e) { - String msg = "SQL error occurred while removing enrollments of devices with enrollmentIds : " - + enrollmentIds; - log.error(msg, e); - throw new DeviceManagementDAOException(msg, e); - } - } - /*** * This method removes records of a given list of devices from the DM_DEVICE_GROUP_MAP table * @param conn Connection object @@ -2797,26 +2775,115 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { } /*** - * This method removes records of a given list of devices from the DM_DEVICE table + * This method refactors some attributes of a given list of devices which are being deleted by the user * @param conn Connection object * @param deviceIds list of device ids (primary keys) - * @throws DeviceManagementDAOException if deletion fails + * @throws DeviceManagementDAOException if refactoring fails */ - private void removeDevice(Connection conn, List deviceIds) throws DeviceManagementDAOException { - String sql = "DELETE FROM DM_DEVICE WHERE ID = ?"; - try { - if (!executeBatchOperation(conn, sql, deviceIds)) { - String msg = "Failed to remove devices with deviceIds : " + deviceIds + " while executing batch operation"; - log.error(msg); - throw new DeviceManagementDAOException(msg); + public void refactorDevice(Connection conn, List deviceIds) throws DeviceManagementDAOException { + String updateQuery = "UPDATE DM_DEVICE SET DEVICE_IDENTIFICATION = ?, NAME = ? WHERE ID = ?"; + + try (PreparedStatement preparedStatement = conn.prepareStatement(updateQuery)) { + for (int deviceId : deviceIds) { + + String randomIdentification = generateRandomString(10); + String randomName = generateRandomString(20); + + preparedStatement.setString(1, randomIdentification); + preparedStatement.setString(2, randomName); + preparedStatement.setInt(3, deviceId); + + preparedStatement.executeUpdate(); } + } catch (SQLException e) { - String msg = "SQL error occurred while removing devices with deviceIds : " + deviceIds; + String msg = "SQL error occurred while refactoring device properties of deviceIds: " + deviceIds; log.error(msg, e); throw new DeviceManagementDAOException(msg, e); } } + + /*** + * This method refactors some attributes of a given list of devices in the DM_ENROLMENT table + * @param conn Connection object + * @param deviceIds list of device ids (primary keys) + * @throws DeviceManagementDAOException if refactoring fails + */ + public void refactorEnrolment(Connection conn, List deviceIds) throws DeviceManagementDAOException { + String updateQuery = "UPDATE DM_ENROLMENT SET OWNER = ?, OWNERSHIP = ?, STATUS = ? WHERE DEVICE_ID = ?"; + + try (PreparedStatement preparedStatement = conn.prepareStatement(updateQuery)) { + for (int deviceId : deviceIds) { + + String randomOwner = generateRandomString(4); + String randomOwnership = generateRandomString(6); + + preparedStatement.setString(1, randomOwner); + preparedStatement.setString(2, randomOwnership); + preparedStatement.setString(3, String.valueOf(Status.DELETED)); + preparedStatement.setInt(4, deviceId); + + preparedStatement.executeUpdate(); + } + + } catch (SQLException e) { + String msg = "SQL error occurred while refactoring device enrolment properties of deviceIds: " + deviceIds; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + /*** + * This method updates the status of a given list of devices to DELETED state in the DM_DEVICE_STATUS table + * @param conn Connection object + * @param validDevices list of devices + * @throws DeviceManagementDAOException if updating fails + */ + public void refactorDeviceStatus(Connection conn, List validDevices) throws DeviceManagementDAOException { + String updateQuery = "UPDATE DM_DEVICE_STATUS SET STATUS = ? WHERE ID = ?"; + String selectLastMatchingRecordQuery = "SELECT ID FROM DM_DEVICE_STATUS WHERE ENROLMENT_ID = ? AND DEVICE_ID = ? ORDER BY ID DESC LIMIT 1"; + + try (PreparedStatement selectStatement = conn.prepareStatement(selectLastMatchingRecordQuery); + PreparedStatement updateStatement = conn.prepareStatement(updateQuery)) { + + for (Device device : validDevices) { + + selectStatement.setInt(1, device.getEnrolmentInfo().getId()); + selectStatement.setInt(2, device.getId()); + + ResultSet resultSet = selectStatement.executeQuery(); + int lastRecordId = 0; + if (resultSet.next()) { + lastRecordId = resultSet.getInt("ID"); + } + + updateStatement.setString(1, String.valueOf(Status.DELETED)); + updateStatement.setInt(2, lastRecordId); + updateStatement.execute(); + } + + } catch (SQLException e) { + String msg = "SQL error occurred while updating device status properties."; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + private String generateRandomString(int length) { + String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + StringBuilder randomString = new StringBuilder(); + + Random random = new Random(); + + for (int i = 0; i < length; i++) { + int index = random.nextInt(characters.length()); + randomString.append(characters.charAt(index)); + } + + return randomString.toString(); + } + /*** * This method executes batch operations for a given list of primary keys * where the statement only has one param of type int, following the given pattern: diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceStatusDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceStatusDAOImpl.java index 4657b7e119..60c86f0876 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceStatusDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceStatusDAOImpl.java @@ -54,7 +54,7 @@ public class DeviceStatusDAOImpl implements DeviceStatusDAO { } if (billingStatus) { - sql += " ORDER BY UPDATE_TIME DESC"; + sql += " ORDER BY ID DESC"; } stmt = conn.prepareStatement(sql); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java index b3c6b8f18a..46595d94dc 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java @@ -205,7 +205,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { "WHERE " + "e.TENANT_ID=? AND " + "d.ID=e.DEVICE_ID AND " + - "STATUS !='REMOVED' AND " + + "STATUS NOT IN ('REMOVED', 'DELETED') AND " + "(" + "DATE_OF_ENROLMENT BETWEEN ? AND ? " + ")"; @@ -244,7 +244,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { "from DM_DEVICE d, DM_ENROLMENT e " + "where " + "e.TENANT_ID=? and d.ID=e.DEVICE_ID and " + - "STATUS ='REMOVED' and " + + "(" + + "STATUS = 'REMOVED' OR STATUS = 'DELETED' " + + ") and " + "(" + "DATE_OF_ENROLMENT between ? and ? " + ") and " + @@ -287,7 +289,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { "where " + "e.TENANT_ID=? and " + "d.ID=e.DEVICE_ID and " + - "STATUS !='REMOVED' and " + + "STATUS NOT IN ('REMOVED', 'DELETED') and " + "(" + "DATE_OF_ENROLMENT < ? " + ")"; @@ -326,7 +328,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { "from DM_DEVICE d, DM_ENROLMENT e " + "where " + "e.TENANT_ID=? and d.ID=e.DEVICE_ID and " + - "STATUS ='REMOVED' and " + + "(" + + "STATUS = 'REMOVED' OR STATUS = 'DELETED' " + + ") and " + "(" + "DATE_OF_ENROLMENT < ? " + ") and " + diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index ffd74099e7..00f68fc74d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -652,6 +652,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv Map deviceManagerMap = new HashMap<>(); List deviceCacheKeyList = new ArrayList<>(); List existingDevices; + List validDevices = new ArrayList<>();; int tenantId = this.getTenantId(); try { @@ -684,6 +685,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv deviceCacheKey.setDeviceType(device.getType()); deviceCacheKey.setTenantId(tenantId); deviceCacheKeyList.add(deviceCacheKey); + validDevices.add(device); deviceIds.add(device.getId()); validDeviceIdentifiers.add(device.getDeviceIdentifier()); enrollmentIds.add(device.getEnrolmentInfo().getId()); @@ -713,7 +715,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv try { DeviceManagementDAOFactory.beginTransaction(); //deleting device from the core - deviceDAO.deleteDevices(validDeviceIdentifiers, new ArrayList<>(deviceIds), enrollmentIds); + deviceDAO.deleteDevices(validDeviceIdentifiers, new ArrayList<>(deviceIds), enrollmentIds, validDevices); for (Map.Entry entry : deviceManagerMap.entrySet()) { try { // deleting device from the plugin level @@ -1057,19 +1059,23 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv device.setDeviceStatusInfo(getDeviceStatusHistory(device, null, endDate, true)); List deviceStatus = device.getDeviceStatusInfo(); if (device.getEnrolmentInfo().getDateOfEnrolment() < startDate.getTime()) { - if (!deviceStatus.isEmpty() && String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED")) { + if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { if (deviceStatus.get(0).getUpdateTime().getTime() >= startDate.getTime()) { dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - startDate.getTime(); } - } else if (!deviceStatus.isEmpty() && !String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED")) { + } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { dateDiff = endDate.getTime() - startDate.getTime(); } } else { - if (!deviceStatus.isEmpty() && String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED")) { + if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { if (deviceStatus.get(0).getUpdateTime().getTime() >= device.getEnrolmentInfo().getDateOfEnrolment()) { dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); } - } else if (!deviceStatus.isEmpty() && !String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED")) { + } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { dateDiff = endDate.getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); } } From 9011273ff4b2531b0d46b091491586980f5175d1 Mon Sep 17 00:00:00 2001 From: Charitha Goonetilleke Date: Tue, 12 Sep 2023 11:55:29 +0530 Subject: [PATCH 065/112] Apply role permission mapping along with scope role mapping --- .../pom.xml | 2 +- .../publisher/APIPublisherServiceImpl.java | 75 ++++++++++++++++--- .../internal/APIPublisherDataHolder.java | 24 ++++++ 3 files changed, 90 insertions(+), 11 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index e108eb7fb1..876a269e11 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -187,6 +187,7 @@ io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.util, org.wso2.carbon.base;version="1.0", org.wso2.carbon.context;version="4.6", + org.wso2.carbon;version="4.6", org.wso2.carbon.core;version="4.6", org.wso2.carbon.core.util;version="4.6", org.wso2.carbon.registry.core.service;version="1.0", @@ -195,7 +196,6 @@ org.wso2.carbon.user.core.tenant;version="4.6", org.wso2.carbon.utils;version="4.6", org.wso2.carbon.utils.multitenancy;version="4.6", - org.wso2.carbon.apimgt.impl.definitions, org.apache.commons.lang, org.json diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 61196a1da0..e815b5877a 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -38,23 +38,24 @@ import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherC import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherDataHolder; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.JSONArray; import org.json.JSONObject; +import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.api.model.APIIdentifier; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.utils.APIUtil; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.user.api.AuthorizationManager; +import org.wso2.carbon.user.api.Permission; import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.tenant.Tenant; import org.wso2.carbon.user.core.tenant.TenantSearchResult; @@ -454,6 +455,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { log.error(errorMsg, e); throw new APIManagerPublisherException(e); } + UserStoreManager userStoreManager; try { for (String tenantDomain : tenants) { @@ -466,20 +468,40 @@ public class APIPublisherServiceImpl implements APIPublisherService { String fileName = CarbonUtils.getCarbonConfigDirPath() + File.separator + "etc" + File.separator + tenantDomain + ".csv"; + try { + userStoreManager = APIPublisherDataHolder.getInstance().getUserStoreManager(); + } catch (UserStoreException e) { + log.error("Unable to retrieve user store manager for tenant: " + tenantDomain); + return; + } if (Files.exists(Paths.get(fileName))) { BufferedReader br = new BufferedReader(new FileReader(fileName)); int lineNumber = 0; Map roles = new HashMap<>(); - String line = ""; + Map> rolePermissions = new HashMap<>(); + String line; String splitBy = ","; - while ((line = br.readLine()) != null) //returns a Boolean value - { + while ((line = br.readLine()) != null) { //returns a Boolean value lineNumber++; String[] scopeMapping = line.split(splitBy); // use comma as separator + String role; if (lineNumber == 1) { // skip titles - for (int i = 0; i < scopeMapping.length; i++) { - if (i > 3) { - roles.put(i, scopeMapping[i]); // add roles to the map + for (int i = 4; i < scopeMapping.length; i++) { + role = scopeMapping[i]; + roles.put(i, role); // add roles to the map + if (!"admin".equals(role)) { + try { + if (!userStoreManager.isExistingRole(role)) { + try { + addRole(role); + } catch (UserStoreException e) { + log.error("Error occurred when adding new role: " + role, e); + } + } + } catch (UserStoreException e) { + log.error("Error occurred when checking the existence of role: " + role, e); + } + rolePermissions.put(role, new ArrayList<>()); } } continue; @@ -494,11 +516,15 @@ public class APIPublisherServiceImpl implements APIPublisherService { scopeMapping[2] != null ? StringUtils.trim(scopeMapping[2]) : StringUtils.EMPTY); // scope.setPermissions( // scopeMapping[3] != null ? StringUtils.trim(scopeMapping[3]) : StringUtils.EMPTY); + String permission = scopeMapping[3] != null ? StringUtils.trim(scopeMapping[3]) : StringUtils.EMPTY; String roleString = ""; for (int i = 4; i < scopeMapping.length; i++) { if (scopeMapping[i] != null && StringUtils.trim(scopeMapping[i]).equals("Yes")) { roleString = roleString + "," + roles.get(i); + if (rolePermissions.containsKey(roles.get(i)) && StringUtils.isNotEmpty(permission)) { + rolePermissions.get(roles.get(i)).add(permission); + } } } if (roleString.length() > 1) { @@ -532,6 +558,13 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } } + for (String role : rolePermissions.keySet()) { + try { + updatePermissions(role, rolePermissions.get(role)); + } catch (UserStoreException e) { + log.error("Error occurred when adding permissions to role: " + role, e); + } + } } } catch (IOException | DirectoryIteratorException ex) { log.error("failed to read scopes from file.", ex); @@ -560,6 +593,28 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } + private void updatePermissions(String role, List permissions) throws UserStoreException { + AuthorizationManager authorizationManager = APIPublisherDataHolder.getInstance().getUserRealm() + .getAuthorizationManager(); + if (log.isDebugEnabled()) { + log.debug("Updating the role '" + role + "'"); + } + if (permissions != null && !permissions.isEmpty()) { + authorizationManager.clearRoleAuthorization(role); + for (String permission : permissions) { + authorizationManager.authorizeRole(role, permission, CarbonConstants.UI_PERMISSION_ACTION); + } + } + } + + private void addRole(String role) throws UserStoreException { + UserStoreManager userStoreManager = APIPublisherDataHolder.getInstance().getUserStoreManager(); + if (log.isDebugEnabled()) { + log.debug("Persisting the role " + role + " in the underlying user store"); + } + userStoreManager.addRole(role, new String[]{"admin"}, new Permission[0]); + } + private APIInfo getAPI(APIConfig config, boolean includeScopes) { APIInfo apiInfo = new APIInfo(); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java index bc7b8af32c..4b47f8ba0f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java @@ -19,7 +19,12 @@ package io.entgra.device.mgt.core.apimgt.webapp.publisher.internal; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIConfig; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherService; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.service.RegistryService; +import org.wso2.carbon.user.api.UserRealm; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.tenant.TenantManager; import org.wso2.carbon.utils.ConfigurationContextService; @@ -79,6 +84,25 @@ public class APIPublisherDataHolder { realmService.getTenantManager() : null); } + public UserStoreManager getUserStoreManager() throws UserStoreException { + if (realmService == null) { + String msg = "Realm service has not initialized."; + throw new IllegalStateException(msg); + } + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + return realmService.getTenantUserRealm(tenantId).getUserStoreManager(); + } + + public UserRealm getUserRealm() throws UserStoreException { + UserRealm realm; + if (realmService == null) { + throw new IllegalStateException("Realm service not initialized"); + } + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + realm = realmService.getTenantUserRealm(tenantId); + return realm; + } + private void setTenantManager(TenantManager tenantManager) { this.tenantManager = tenantManager; } From 26a049473c6f067945be32d5c5dd1c0dab32a1ac Mon Sep 17 00:00:00 2001 From: Sasini_Sandamali Date: Tue, 12 Sep 2023 16:02:31 +0530 Subject: [PATCH 066/112] Modify View Activities endpoint by including operation id --- .../api/ActivityInfoProviderService.java | 5 +++++ .../impl/ActivityProviderServiceImpl.java | 4 ++++ .../mgt/common/ActivityPaginationRequest.java | 9 +++++++++ .../mgt/common/operation/mgt/Activity.java | 16 ++++++++++++++++ .../mgt/dao/impl/GenericOperationDAOImpl.java | 18 ++++++++++++++++++ .../mgt/dao/util/OperationDAOUtil.java | 1 + 6 files changed, 53 insertions(+) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java index 23076328e4..240f6bfb01 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java @@ -466,6 +466,11 @@ public interface ActivityInfoProviderService { value = "Operation Code to filter" ) @QueryParam("operationCode") String operationCode, + @ApiParam( + name = "operationId", + value = "Operation Id to filter" + ) + @QueryParam("operationId") int operationId, @ApiParam( name = "deviceType", value = "Device Type to filter" diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java index d9fec4b91b..0474a81a79 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -253,6 +253,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService @QueryParam("since") String since, @QueryParam("initiatedBy") String initiatedBy, @QueryParam("operationCode") String operationCode, + @QueryParam("operationId") int operationId, @QueryParam("deviceType") String deviceType, @QueryParam("deviceId") List deviceIds, @QueryParam("type") String type, @@ -321,6 +322,9 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService if (operationCode != null && !operationCode.isEmpty()) { activityPaginationRequest.setOperationCode(operationCode); } + if (operationId > 0) { + activityPaginationRequest.setOperationId(operationId); + } if (deviceType != null && !deviceType.isEmpty()) { activityPaginationRequest.setDeviceType(deviceType); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/ActivityPaginationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/ActivityPaginationRequest.java index b535ab4bd6..058b82dd2f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/ActivityPaginationRequest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/ActivityPaginationRequest.java @@ -32,6 +32,7 @@ public class ActivityPaginationRequest { private String deviceType; private List deviceIds; private String operationCode; + private int operationId; private String initiatedBy; private long since; private Operation.Type type; @@ -132,4 +133,12 @@ public class ActivityPaginationRequest { public void setEndTimestamp(long endTimestamp) { this.endTimestamp = endTimestamp; } + + public int getOperationId() { + return operationId; + } + + public void setOperationId(int operationId) { + this.operationId = operationId; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java index e001d72929..3c68fc74b2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/Activity.java @@ -49,6 +49,14 @@ public class Activity { @JsonProperty("code") private String code; + @ApiModelProperty( + name = "operationId", + value = "Operation Id", + required = false, + example = "10") + @JsonProperty("operationId") + private int operationId; + @ApiModelProperty( name = "type", value = "Activity type", @@ -122,6 +130,14 @@ public class Activity { this.code = code; } + public int getOperationId() { + return operationId; + } + + public void setOperationId(int operationId) { + this.operationId = operationId; + } + public Type getType() { return type; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index ff071365c6..5f95cbb62a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -2233,6 +2233,9 @@ public class GenericOperationDAOImpl implements OperationDAO { } sql.append("?) "); } + if (activityPaginationRequest.getOperationId() > 0) { + sql.append("AND OPERATION_ID = ? "); + } if (activityPaginationRequest.getOperationCode() != null) { sql.append("AND OPERATION_CODE = ? "); } @@ -2269,6 +2272,9 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getOperationCode() != null) { sql.append("AND eom.OPERATION_CODE = ? "); } + if (activityPaginationRequest.getOperationId() > 0) { + sql.append("AND eom.OPERATION_ID = ? "); + } if (activityPaginationRequest.getInitiatedBy() != null) { sql.append("AND eom.INITIATED_BY = ? "); } @@ -2301,6 +2307,9 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getOperationCode() != null) { stmt.setString(index++, activityPaginationRequest.getOperationCode()); } + if (activityPaginationRequest.getOperationId() > 0) { + stmt.setInt(index++, activityPaginationRequest.getOperationId()); + } if (activityPaginationRequest.getInitiatedBy() != null) { stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); } @@ -2333,6 +2342,9 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getOperationCode() != null) { stmt.setString(index++, activityPaginationRequest.getOperationCode()); } + if (activityPaginationRequest.getOperationId() > 0) { + stmt.setInt(index++, activityPaginationRequest.getOperationId()); + } if (activityPaginationRequest.getInitiatedBy() != null) { stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); } @@ -2390,6 +2402,9 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getOperationCode() != null) { sql.append("AND OPERATION_CODE = ? "); } + if (activityPaginationRequest.getOperationId() > 0) { + sql.append("AND OPERATION_ID = ? "); + } if (activityPaginationRequest.getInitiatedBy() != null) { sql.append("AND INITIATED_BY = ? "); } @@ -2421,6 +2436,9 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getOperationCode() != null) { stmt.setString(index++, activityPaginationRequest.getOperationCode()); } + if (activityPaginationRequest.getOperationId() > 0) { + stmt.setInt(index++, activityPaginationRequest.getOperationId()); + } if (activityPaginationRequest.getInitiatedBy() != null) { stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java index 273ec5c089..178cf8f8b3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java @@ -248,6 +248,7 @@ public class OperationDAOUtil { activity.setCreatedTimeStamp( new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); activity.setCode(rs.getString("OPERATION_CODE")); + activity.setOperationId(rs.getInt("OPERATION_ID")); activity.setInitiatedBy(rs.getString("INITIATED_BY")); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); From 4a6e0ce7278a8041deae50b2d400402ab789a2ae Mon Sep 17 00:00:00 2001 From: Sasini_Sandamali Date: Tue, 12 Sep 2023 16:14:54 +0530 Subject: [PATCH 067/112] Update get Activities to increase the performance --- .../mgt/dao/impl/GenericOperationDAOImpl.java | 346 +++++++++++------- .../src/main/resources/dbscripts/cdm/h2.sql | 1 + .../main/resources/dbscripts/cdm/mssql.sql | 10 + .../main/resources/dbscripts/cdm/mysql.sql | 6 + .../main/resources/dbscripts/cdm/oracle.sql | 1 + .../resources/dbscripts/cdm/postgresql.sql | 6 +- 6 files changed, 243 insertions(+), 127 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index 5f95cbb62a..fa831c317a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -2220,44 +2220,70 @@ public class GenericOperationDAOImpl implements OperationDAO { " DM_ENROLMENT_OP_MAPPING eom " + "LEFT JOIN " + " DM_DEVICE_OPERATION_RESPONSE opr ON opr.EN_OP_MAP_ID = eom.ID " + - "INNER JOIN " + - " (SELECT DISTINCT OPERATION_ID FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ? "); + "INNER JOIN "); - if (activityPaginationRequest.getDeviceType() != null) { - sql.append("AND DEVICE_TYPE = ? "); - } - if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { - sql.append("AND DEVICE_IDENTIFICATION IN ("); - for (int i = 0; i < activityPaginationRequest.getDeviceIds().size() - 1; i++) { - sql.append("?, "); + if (activityPaginationRequest.getDeviceType() != null || + (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) || + activityPaginationRequest.getSince() != 0 || + activityPaginationRequest.getStatus() != null) { + + sql.append("(SELECT DISTINCT OPERATION_ID FROM DM_ENROLMENT_OP_MAPPING eom WHERE TENANT_ID = ? "); + + if (activityPaginationRequest.getDeviceType() != null) { + sql.append("AND DEVICE_TYPE = ? "); + } + if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { + sql.append("AND eom.DEVICE_IDENTIFICATION IN ("); + for (int i = 0; i < activityPaginationRequest.getDeviceIds().size() - 1; i++) { + sql.append("?, "); + } + sql.append("?) "); + } + if (activityPaginationRequest.getOperationId() > 0) { + sql.append("AND OPERATION_ID = ? "); + } + if (activityPaginationRequest.getOperationCode() != null) { + sql.append("AND OPERATION_CODE = ? "); + } + if (activityPaginationRequest.getInitiatedBy() != null) { + sql.append("AND INITIATED_BY = ? "); + } + if (activityPaginationRequest.getSince() != 0) { + sql.append("AND UPDATED_TIMESTAMP > ? "); + } + if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) { + isTimeDurationFilteringProvided = true; + sql.append("AND CREATED_TIMESTAMP BETWEEN ? AND ? "); + } + if (activityPaginationRequest.getType() != null) { + sql.append("AND TYPE = ? "); + } + if (activityPaginationRequest.getStatus() != null) { + sql.append("AND STATUS = ? "); } - sql.append("?) "); - } - if (activityPaginationRequest.getOperationId() > 0) { - sql.append("AND OPERATION_ID = ? "); - } - if (activityPaginationRequest.getOperationCode() != null) { - sql.append("AND OPERATION_CODE = ? "); - } - if (activityPaginationRequest.getInitiatedBy() != null) { - sql.append("AND INITIATED_BY = ? "); - } - if (activityPaginationRequest.getSince() != 0) { - sql.append("AND UPDATED_TIMESTAMP > ? "); - } - if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) { - isTimeDurationFilteringProvided = true; - sql.append("AND CREATED_TIMESTAMP BETWEEN ? AND ? "); - } - if (activityPaginationRequest.getType() != null) { - sql.append("AND TYPE = ? "); - } - if (activityPaginationRequest.getStatus() != null) { - sql.append("AND STATUS = ? "); - } - sql.append("ORDER BY OPERATION_ID ASC limit ? , ? ) eom_ordered " + - "ON eom_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? "); + sql.append("ORDER BY OPERATION_ID ASC limit ? , ? ) eom_ordered " + + "ON eom_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? "); + } else { + sql.append("(SELECT ID AS OPERATION_ID FROM DM_OPERATION WHERE TENANT_ID = ? "); + + if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) { + isTimeDurationFilteringProvided = true; + sql.append("AND CREATED_TIMESTAMP BETWEEN ? AND ? "); + } + if (activityPaginationRequest.getOperationId() > 0) { + sql.append("AND ID = ? "); + } + if (activityPaginationRequest.getOperationCode() != null) { + sql.append("AND OPERATION_CODE = ? "); + } + if (activityPaginationRequest.getInitiatedBy() != null) { + sql.append("AND INITIATED_BY = ? "); + } + + sql.append("ORDER BY ID ASC ) dm_ordered " + + "ON dm_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? "); + } if (activityPaginationRequest.getDeviceType() != null) { sql.append("AND eom.DEVICE_TYPE = ? "); @@ -2282,7 +2308,7 @@ public class GenericOperationDAOImpl implements OperationDAO { sql.append("AND eom.UPDATED_TIMESTAMP > ? "); } if (isTimeDurationFilteringProvided) { - sql.append("AND eom.CREATED_TIMESTAMP BETWEEN ? AND ? "); + sql.append("AND eom.CREATED_TIMESTAMP BETWEEN ? AND ? "); } if (activityPaginationRequest.getType() != null) { sql.append("AND eom.TYPE = ? "); @@ -2296,47 +2322,78 @@ public class GenericOperationDAOImpl implements OperationDAO { int index = 1; try (PreparedStatement stmt = conn.prepareStatement(sql.toString())) { stmt.setInt(index++, tenantId); - if (activityPaginationRequest.getDeviceType() != null) { - stmt.setString(index++, activityPaginationRequest.getDeviceType()); - } - if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { - for (String deviceId : activityPaginationRequest.getDeviceIds()) { - stmt.setString(index++, deviceId); + if (activityPaginationRequest.getDeviceType() != null || + (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) || + activityPaginationRequest.getSince() != 0 || + activityPaginationRequest.getStatus() != null) { + + if (activityPaginationRequest.getDeviceType() != null) { + stmt.setString(index++, activityPaginationRequest.getDeviceType()); + } + if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { + for (String deviceId : activityPaginationRequest.getDeviceIds()) { + stmt.setString(index++, deviceId); + } + } + if (activityPaginationRequest.getOperationCode() != null) { + stmt.setString(index++, activityPaginationRequest.getOperationCode()); + } + if (activityPaginationRequest.getOperationId() > 0) { + stmt.setInt(index++, activityPaginationRequest.getOperationId()); + } + if (activityPaginationRequest.getInitiatedBy() != null) { + stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); + } + if (activityPaginationRequest.getSince() != 0) { + stmt.setLong(index++, activityPaginationRequest.getSince()); + } + if (isTimeDurationFilteringProvided) { + stmt.setLong(index++, activityPaginationRequest.getStartTimestamp()); + stmt.setLong(index++, activityPaginationRequest.getEndTimestamp()); + } + if (activityPaginationRequest.getType() != null) { + stmt.setString(index++, activityPaginationRequest.getType().name()); + } + if (activityPaginationRequest.getStatus() != null) { + stmt.setString(index++, activityPaginationRequest.getStatus().name()); } - } - if (activityPaginationRequest.getOperationCode() != null) { - stmt.setString(index++, activityPaginationRequest.getOperationCode()); - } - if (activityPaginationRequest.getOperationId() > 0) { - stmt.setInt(index++, activityPaginationRequest.getOperationId()); - } - if (activityPaginationRequest.getInitiatedBy() != null) { - stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); - } - if (activityPaginationRequest.getSince() != 0) { - stmt.setLong(index++, activityPaginationRequest.getSince()); - } - if (isTimeDurationFilteringProvided) { - stmt.setLong(index++, activityPaginationRequest.getStartTimestamp()); - stmt.setLong(index++, activityPaginationRequest.getEndTimestamp()); - } - if (activityPaginationRequest.getType() != null) { - stmt.setString(index++, activityPaginationRequest.getType().name()); - } - if (activityPaginationRequest.getStatus() != null) { - stmt.setString(index++, activityPaginationRequest.getStatus().name()); - } - stmt.setInt(index++, activityPaginationRequest.getOffset()); - stmt.setInt(index++, activityPaginationRequest.getLimit()); - stmt.setInt(index++, tenantId); + stmt.setInt(index++, activityPaginationRequest.getOffset()); + stmt.setInt(index++, activityPaginationRequest.getLimit()); + stmt.setInt(index++, tenantId); - if (activityPaginationRequest.getDeviceType() != null) { - stmt.setString(index++, activityPaginationRequest.getDeviceType()); - } - if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { - for (String deviceId : activityPaginationRequest.getDeviceIds()) { - stmt.setString(index++, deviceId); + if (activityPaginationRequest.getDeviceType() != null) { + stmt.setString(index++, activityPaginationRequest.getDeviceType()); + } + if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { + for (String deviceId : activityPaginationRequest.getDeviceIds()) { + stmt.setString(index++, deviceId); + } + } + } else { + if (isTimeDurationFilteringProvided) { + stmt.setLong(index++, activityPaginationRequest.getStartTimestamp()); + stmt.setLong(index++, activityPaginationRequest.getEndTimestamp()); + } + if (activityPaginationRequest.getOperationCode() != null) { + stmt.setString(index++, activityPaginationRequest.getOperationCode()); + } + if (activityPaginationRequest.getOperationId() > 0) { + stmt.setInt(index++, activityPaginationRequest.getOperationId()); + } + if (activityPaginationRequest.getInitiatedBy() != null) { + stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); + } + + stmt.setInt(index++, tenantId); + + if (activityPaginationRequest.getDeviceType() != null) { + stmt.setString(index++, activityPaginationRequest.getDeviceType()); + } + if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { + for (String deviceId : activityPaginationRequest.getDeviceIds()) { + stmt.setString(index++, deviceId); + } } } if (activityPaginationRequest.getOperationCode() != null) { @@ -2386,36 +2443,57 @@ public class GenericOperationDAOImpl implements OperationDAO { boolean isTimeDurationFilteringProvided = false; Connection conn = OperationManagementDAOFactory.getConnection(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - StringBuilder sql = new StringBuilder("SELECT count(DISTINCT OPERATION_ID) AS ACTIVITY_COUNT " + - "FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ? "); + StringBuilder sql = new StringBuilder(); - if (activityPaginationRequest.getDeviceType() != null) { - sql.append("AND DEVICE_TYPE = ? "); - } - if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { - sql.append("AND DEVICE_IDENTIFICATION IN ("); - for (int i = 0; i < activityPaginationRequest.getDeviceIds().size() - 1; i++) { - sql.append("?, "); + if (activityPaginationRequest.getDeviceType() != null || + (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) || + activityPaginationRequest.getSince() != 0 || + activityPaginationRequest.getStatus() != null) { + + sql.append("SELECT count(DISTINCT OPERATION_ID) AS ACTIVITY_COUNT " + + "FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ? "); + + if (activityPaginationRequest.getDeviceType() != null) { + sql.append("AND DEVICE_TYPE = ? "); + } + if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { + sql.append("AND DEVICE_IDENTIFICATION IN ("); + for (int i = 0; i < activityPaginationRequest.getDeviceIds().size() - 1; i++) { + sql.append("?, "); + } + sql.append("?) "); + } + if (activityPaginationRequest.getOperationCode() != null) { + sql.append("AND OPERATION_CODE = ? "); + } + if (activityPaginationRequest.getOperationId() > 0) { + sql.append("AND OPERATION_ID = ? "); + } + if (activityPaginationRequest.getInitiatedBy() != null) { + sql.append("AND INITIATED_BY = ? "); + } + if (activityPaginationRequest.getSince() != 0) { + sql.append("AND UPDATED_TIMESTAMP > ? "); + } + if (activityPaginationRequest.getType() != null) { + sql.append("AND TYPE = ? "); + } + if (activityPaginationRequest.getStatus() != null) { + sql.append("AND STATUS = ? "); + } + + } else { + sql.append("SELECT count(ID) AS ACTIVITY_COUNT FROM DM_OPERATION WHERE TENANT_ID = ? "); + + if (activityPaginationRequest.getOperationCode() != null) { + sql.append("AND OPERATION_CODE = ? "); + } + if (activityPaginationRequest.getOperationId() > 0) { + sql.append("AND ID = ? "); + } + if (activityPaginationRequest.getInitiatedBy() != null) { + sql.append("AND INITIATED_BY = ? "); } - sql.append("?) "); - } - if (activityPaginationRequest.getOperationCode() != null) { - sql.append("AND OPERATION_CODE = ? "); - } - if (activityPaginationRequest.getOperationId() > 0) { - sql.append("AND OPERATION_ID = ? "); - } - if (activityPaginationRequest.getInitiatedBy() != null) { - sql.append("AND INITIATED_BY = ? "); - } - if (activityPaginationRequest.getSince() != 0) { - sql.append("AND UPDATED_TIMESTAMP > ? "); - } - if (activityPaginationRequest.getType() != null) { - sql.append("AND TYPE = ? "); - } - if (activityPaginationRequest.getStatus() != null) { - sql.append("AND STATUS = ? "); } if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) { isTimeDurationFilteringProvided = true; @@ -2425,31 +2503,47 @@ public class GenericOperationDAOImpl implements OperationDAO { int index = 1; try (PreparedStatement stmt = conn.prepareStatement(sql.toString())) { stmt.setInt(index++, tenantId); - if (activityPaginationRequest.getDeviceType() != null) { - stmt.setString(index++, activityPaginationRequest.getDeviceType()); - } - if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { - for (String deviceId : activityPaginationRequest.getDeviceIds()) { - stmt.setString(index++, deviceId); + + if (activityPaginationRequest.getDeviceType() != null || + (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) || + activityPaginationRequest.getSince() != 0 || + activityPaginationRequest.getStatus() != null) { + if (activityPaginationRequest.getDeviceType() != null) { + stmt.setString(index++, activityPaginationRequest.getDeviceType()); + } + if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) { + for (String deviceId : activityPaginationRequest.getDeviceIds()) { + stmt.setString(index++, deviceId); + } + } + if (activityPaginationRequest.getOperationCode() != null) { + stmt.setString(index++, activityPaginationRequest.getOperationCode()); + } + if (activityPaginationRequest.getOperationId() > 0) { + stmt.setInt(index++, activityPaginationRequest.getOperationId()); + } + if (activityPaginationRequest.getInitiatedBy() != null) { + stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); + } + if (activityPaginationRequest.getSince() != 0) { + stmt.setLong(index++, activityPaginationRequest.getSince()); + } + if (activityPaginationRequest.getType() != null) { + stmt.setString(index++, activityPaginationRequest.getType().name()); + } + if (activityPaginationRequest.getStatus() != null) { + stmt.setString(index++, activityPaginationRequest.getStatus().name()); + } + } else { + if (activityPaginationRequest.getOperationCode() != null) { + stmt.setString(index++, activityPaginationRequest.getOperationCode()); + } + if (activityPaginationRequest.getOperationId() > 0) { + stmt.setInt(index++, activityPaginationRequest.getOperationId()); + } + if (activityPaginationRequest.getInitiatedBy() != null) { + stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); } - } - if (activityPaginationRequest.getOperationCode() != null) { - stmt.setString(index++, activityPaginationRequest.getOperationCode()); - } - if (activityPaginationRequest.getOperationId() > 0) { - stmt.setInt(index++, activityPaginationRequest.getOperationId()); - } - if (activityPaginationRequest.getInitiatedBy() != null) { - stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); - } - if (activityPaginationRequest.getSince() != 0) { - stmt.setLong(index++, activityPaginationRequest.getSince()); - } - if (activityPaginationRequest.getType() != null) { - stmt.setString(index++, activityPaginationRequest.getType().name()); - } - if (activityPaginationRequest.getStatus() != null) { - stmt.setString(index++, activityPaginationRequest.getStatus().name()); } if (isTimeDurationFilteringProvided) { stmt.setLong(index++, activityPaginationRequest.getStartTimestamp()); diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index a0be9fd704..f261a3b49e 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -92,6 +92,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + TENANT_ID INT NOT NULL, PRIMARY KEY (ID) ); diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 16af46d997..1c0a4b75a4 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -126,9 +126,17 @@ CREATE TABLE DM_OPERATION ( INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS VARBINARY(MAX) DEFAULT NULL, ENABLED BIT NOT NULL DEFAULT 0, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); +IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_OP_CREATED' AND OBJECT_ID = OBJECT_ID('DM_OPERATION')) +CREATE INDEX IDX_OP_CREATED ON DM_OPERATION(CREATED_TIMESTAMP); +IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_OP_CODE' AND OBJECT_ID = OBJECT_ID('DM_OPERATION')) +CREATE INDEX IDX_OP_CODE ON DM_OPERATION(OPERATION_CODE); +IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_OP_INITIATED_BY' AND OBJECT_ID = OBJECT_ID('DM_OPERATION')) +CREATE INDEX IDX_OP_INITIATED_BY ON DM_OPERATION(INITIATED_BY); + IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_ENROLMENT]') AND TYPE IN (N'U')) CREATE TABLE DM_ENROLMENT ( ID INTEGER IDENTITY(1,1) NOT NULL, @@ -196,6 +204,8 @@ IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_EN_OP_MAPPING_OP_ID' CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID); IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_EN_OP_MAPPING_EN_ID_STATUS' AND OBJECT_ID = OBJECT_ID('DM_ENROLMENT_OP_MAPPING')) CREATE INDEX IDX_EN_OP_MAPPING_EN_ID_STATUS ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, STATUS); +IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_ENROLMENT_OP_MAPPING_CREATED_TS' AND OBJECT_ID = OBJECT_ID('DM_ENROLMENT_OP_MAPPING')) +CREATE INDEX IDX_ENROLMENT_OP_MAPPING_CREATED_TS ON DM_ENROLMENT_OP_MAPPING(CREATED_TIMESTAMP); IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_OPERATION_RESPONSE]') AND TYPE IN (N'U')) CREATE TABLE DM_DEVICE_OPERATION_RESPONSE ( diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index d184237d44..1ea355fb81 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -107,9 +107,14 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + TENANT_ID INT NOT NULL, PRIMARY KEY (ID) )ENGINE = InnoDB; +CREATE INDEX IDX_OP_CREATED ON DM_OPERATION (CREATED_TIMESTAMP ASC); +CREATE INDEX IDX_OP_CODE ON DM_OPERATION (OPERATION_CODE ASC); +CREATE INDEX IDX_OP_INITIATED_BY ON DM_OPERATION (INITIATED_BY ASC); + CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( ID INTEGER AUTO_INCREMENT NOT NULL, DEVICE_ID INTEGER NOT NULL, @@ -170,6 +175,7 @@ CREATE INDEX IDX_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMEST CREATE INDEX IDX_EN_OP_MAPPING_EN_ID ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID); CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID); CREATE INDEX IDX_EN_OP_MAPPING_EN_ID_STATUS ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, STATUS); +CREATE INDEX IDX_ENROLMENT_OP_MAPPING_CREATED_TS ON DM_ENROLMENT_OP_MAPPING (CREATED_TIMESTAMP ASC); CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE ( diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index 60c7aaf89e..f19645cdb7 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -181,6 +181,7 @@ CREATE TABLE DM_OPERATION ( INITIATED_BY VARCHAR2(100) NULL, ENABLED NUMBER(10) DEFAULT 0 NOT NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + TENANT_ID INTEGER NOT NULL, CONSTRAINT PK_DM_OPERATION PRIMARY KEY (ID) ) / diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index f9f6879338..51361a90d3 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -100,10 +100,13 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BYTEA DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); - +CREATE INDEX IDX_OP_CREATED ON DM_OPERATION (CREATED_TIMESTAMP); +CREATE INDEX IDX_OP_CODE ON DM_OPERATION (OPERATION_CODE); +CREATE INDEX IDX_OP_INITIATED_BY ON DM_OPERATION (INITIATED_BY); CREATE SEQUENCE DM_ENROLMENT_seq; @@ -161,6 +164,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( CREATE INDEX fk_dm_device_operation_mapping_operation ON DM_ENROLMENT_OP_MAPPING (OPERATION_ID); CREATE INDEX IDX_DM_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (ENROLMENT_ID,OPERATION_ID); CREATE INDEX ID_DM_ENROLMENT_OP_MAPPING_UPDATED_TIMESTAMP ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMESTAMP); +CREATE INDEX IDX_ENROLMENT_OP_MAPPING_CREATED_TS ON DM_ENROLMENT_OP_MAPPING (CREATED_TIMESTAMP); ALTER TABLE DM_ENROLMENT_OP_MAPPING ADD OPERATION_CODE VARCHAR(50) NOT NULL, From 661feadcd518e1659d5cceafce3650b291c9c3f2 Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Tue, 12 Sep 2023 22:06:31 +0530 Subject: [PATCH 068/112] Fix added for loading device groups --- .../device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java index 87d649a6f8..340e4a8745 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java @@ -57,7 +57,7 @@ public class SQLServerGroupDAOImpl extends AbstractGroupDAOImpl { try { Connection conn = GroupManagementDAOFactory.getConnection(); - String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP " + String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP " + "WHERE TENANT_ID = ?"; if (groupName != null && !groupName.isEmpty()) { sql += " AND GROUP_NAME LIKE ?"; @@ -129,7 +129,7 @@ public class SQLServerGroupDAOImpl extends AbstractGroupDAOImpl { try { Connection conn = GroupManagementDAOFactory.getConnection(); - String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP " + String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP " + "WHERE TENANT_ID = ?"; if (groupName != null && !groupName.isEmpty()) { sql += " AND GROUP_NAME LIKE ?"; From 4fc6eb2aa4a00a5dd5ec654647fd16402ed05efb Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Wed, 13 Sep 2023 00:03:29 +0530 Subject: [PATCH 069/112] Fix error showing on startup in task-mgt --- .../core/task/mgt/core/dao/common/TaskManagementDAOFactory.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/common/TaskManagementDAOFactory.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/common/TaskManagementDAOFactory.java index be464c2a90..7c0aa2ff0b 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/common/TaskManagementDAOFactory.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/common/TaskManagementDAOFactory.java @@ -48,6 +48,7 @@ public class TaskManagementDAOFactory { public static DynamicTaskDAO getDynamicTaskDAO() { if (databaseEngine != null) { switch (databaseEngine) { + case TaskMgtConstants.DataBaseTypes.DB_TYPE_MSSQL: case TaskMgtConstants.DataBaseTypes.DB_TYPE_H2: case TaskMgtConstants.DataBaseTypes.DB_TYPE_MYSQL: return new DynamicTaskDAOImpl(); @@ -61,6 +62,7 @@ public class TaskManagementDAOFactory { public static DynamicTaskPropDAO getDynamicTaskPropDAO() { if (databaseEngine != null) { switch (databaseEngine) { + case TaskMgtConstants.DataBaseTypes.DB_TYPE_MSSQL: case TaskMgtConstants.DataBaseTypes.DB_TYPE_H2: case TaskMgtConstants.DataBaseTypes.DB_TYPE_MYSQL: return new DynamicTaskPropDAOImpl(); From 6fd84dcbef139a976637110d24d9c06dfba68568 Mon Sep 17 00:00:00 2001 From: osh Date: Wed, 13 Sep 2023 14:50:23 +0530 Subject: [PATCH 070/112] Comment out cost related code --- .../DeviceManagementAdminServiceImpl.java | 2 +- .../DeviceManagementProviderServiceImpl.java | 60 +++++++++---------- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java index 5a9c4fa55d..31bf740d95 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java @@ -248,7 +248,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe devices.setList((List) result.getData()); devices.setDeviceCount(result.getTotalDeviceCount()); devices.setMessage(result.getMessage()); - devices.setTotalCost(result.getTotalCost()); +// devices.setTotalCost(result.getTotalCost()); devices.setBillPeriod(startDate.toString() + " - " + endDate.toString()); return Response.status(Response.Status.OK).entity(devices).build(); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 00f68fc74d..4f4624aa84 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -1034,26 +1034,27 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv * @return Whether status is changed or not * @throws DeviceManagementException on errors while trying to calculate Cost */ - public BillingResponse calculateCost(String tenantDomain, Timestamp startDate, Timestamp endDate, List allDevices) throws MetadataManagementDAOException, DeviceManagementException { + public BillingResponse calculateUsage(String tenantDomain, Timestamp startDate, Timestamp endDate, List allDevices) throws MetadataManagementDAOException, DeviceManagementException { + // All code related to cost calculation has being commented out to comply with the current requirements BillingResponse billingResponse = new BillingResponse(); List deviceStatusNotAvailable = new ArrayList<>(); - double totalCost = 0.0; +// double totalCost = 0.0; try { - MetadataManagementService meta = DeviceManagementDataHolder - .getInstance().getMetadataManagementService(); - Metadata metadata = meta.retrieveMetadata(DeviceManagementConstants.META_KEY); - - Gson g = new Gson(); - Collection costData = null; - - Type collectionType = new TypeToken>() { - }.getType(); - if (metadata != null) { - costData = g.fromJson(metadata.getMetaValue(), collectionType); - for (Cost tenantCost : costData) { - if (tenantCost.getTenantDomain().equals(tenantDomain)) { +// MetadataManagementService meta = DeviceManagementDataHolder +// .getInstance().getMetadataManagementService(); +// Metadata metadata = meta.retrieveMetadata(DeviceManagementConstants.META_KEY); +// +// Gson g = new Gson(); +// Collection costData = null; +// +// Type collectionType = new TypeToken>() { +// }.getType(); +// if (metadata != null) { +// costData = g.fromJson(metadata.getMetaValue(), collectionType); +// for (Cost tenantCost : costData) { +// if (tenantCost.getTenantDomain().equals(tenantDomain)) { for (Device device : allDevices) { long dateDiff = 0; device.setDeviceStatusInfo(getDeviceStatusHistory(device, null, endDate, true)); @@ -1088,9 +1089,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } long dateInDays = (long) dateDiffInDays; - double cost = (tenantCost.getCost() / 365) * dateInDays; - totalCost += cost; - device.setCost(Math.round(cost * 100.0) / 100.0); +// double cost = (tenantCost.getCost() / 365) * dateInDays; +// totalCost += cost; +// device.setCost(Math.round(cost * 100.0) / 100.0); long totalDays = dateInDays + device.getDaysUsed(); device.setDaysUsed((int) totalDays); if (deviceStatus.isEmpty()) { @@ -1098,17 +1099,13 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } } - } - } - } +// } +// } +// } } catch (DeviceManagementException e) { String msg = "Error occurred calculating cost of devices"; log.error(msg, e); throw new DeviceManagementException(msg, e); - } catch (MetadataManagementException e) { - String msg = "Error when retrieving metadata of billing feature"; - log.error(msg, e); - throw new DeviceManagementException(msg, e); } if (!deviceStatusNotAvailable.isEmpty()) { @@ -1125,7 +1122,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv billingResponse.setStartDate(startDate.toString()); billingResponse.setEndDate(endDate.toString()); billingResponse.setBillPeriod(calStart.get(Calendar.YEAR) + " - " + calEnd.get(Calendar.YEAR)); - billingResponse.setTotalCostPerYear(Math.round(totalCost * 100.0) / 100.0); +// billingResponse.setTotalCostPerYear(Math.round(totalCost * 100.0) / 100.0); billingResponse.setDeviceCount(allDevices.size()); return billingResponse; @@ -1134,6 +1131,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public PaginationResult createBillingFile(int tenantId, String tenantDomain, Timestamp startDate, Timestamp endDate) throws DeviceManagementException { + // All code related to cost calculation has being commented out to comply with the current requirements PaginationResult paginationResult = new PaginationResult(); List allDevices = new ArrayList<>(); List billingResponseList = new ArrayList<>(); @@ -1192,10 +1190,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv // The query returns devices which are enrolled prior this year now in removed state allDevicesPerYear.addAll(deviceDAO.getRemovedPriorYearsDeviceList(tenantId, newStartDate, newEndDate)); - BillingResponse billingResponse = calculateCost(tenantDomain, newStartDate, newEndDate, allDevicesPerYear); + BillingResponse billingResponse = calculateUsage(tenantDomain, newStartDate, newEndDate, allDevicesPerYear); billingResponseList.add(billingResponse); allDevices.addAll(billingResponse.getDevice()); - totalCost = totalCost + billingResponse.getTotalCostPerYear(); +// totalCost = totalCost + billingResponse.getTotalCostPerYear(); deviceCount = deviceCount + billingResponse.getDeviceCount(); LocalDateTime nextStartDate = oneYearAfterStart.plusDays(1).with(LocalTime.of(00, 00, 00)); startDate = Timestamp.valueOf(nextStartDate); @@ -1216,10 +1214,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv // The query returns devices which are enrolled prior this year now in removed state allDevicesPerRemainingDays.addAll(deviceDAO.getRemovedPriorYearsDeviceList(tenantId, startDate, endDate)); - BillingResponse billingResponse = calculateCost(tenantDomain, startDate, endDate, allDevicesPerRemainingDays); + BillingResponse billingResponse = calculateUsage(tenantDomain, startDate, endDate, allDevicesPerRemainingDays); billingResponseList.add(billingResponse); allDevices.addAll(billingResponse.getDevice()); - totalCost = totalCost + billingResponse.getTotalCostPerYear(); +// totalCost = totalCost + billingResponse.getTotalCostPerYear(); deviceCount = deviceCount + billingResponse.getDeviceCount(); } @@ -1231,7 +1229,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv BillingResponse billingResponse = new BillingResponse("all", Math.round(totalCost * 100.0) / 100.0, allDevices, calStart.get(Calendar.YEAR) + " - " + calEnd.get(Calendar.YEAR), initialStartDate.toString(), endDate.toString(), allDevices.size()); billingResponseList.add(billingResponse); paginationResult.setData(billingResponseList); - paginationResult.setTotalCost(Math.round(totalCost * 100.0) / 100.0); +// paginationResult.setTotalCost(Math.round(totalCost * 100.0) / 100.0); paginationResult.setTotalDeviceCount(deviceCount); BillingCacheManagerImpl.getInstance().addBillingToCache(paginationResult, tenantDomain, initialStartDate, endDate); return paginationResult; From 8bc0fa37de9810edacc12d65ab99a8495533fd64 Mon Sep 17 00:00:00 2001 From: osh Date: Thu, 14 Sep 2023 14:35:18 +0530 Subject: [PATCH 071/112] Add cost calculation for carbon super --- .../DeviceManagementAdminServiceImpl.java | 2 +- .../DeviceManagementProviderServiceImpl.java | 142 ++++++++++-------- 2 files changed, 78 insertions(+), 66 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java index 31bf740d95..5a9c4fa55d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java @@ -248,7 +248,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe devices.setList((List) result.getData()); devices.setDeviceCount(result.getTotalDeviceCount()); devices.setMessage(result.getMessage()); -// devices.setTotalCost(result.getTotalCost()); + devices.setTotalCost(result.getTotalCost()); devices.setBillPeriod(startDate.toString() + " - " + endDate.toString()); return Response.status(Response.Status.OK).entity(devices).build(); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 4f4624aa84..8413b1499f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -1036,76 +1036,39 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv */ public BillingResponse calculateUsage(String tenantDomain, Timestamp startDate, Timestamp endDate, List allDevices) throws MetadataManagementDAOException, DeviceManagementException { - // All code related to cost calculation has being commented out to comply with the current requirements BillingResponse billingResponse = new BillingResponse(); List deviceStatusNotAvailable = new ArrayList<>(); -// double totalCost = 0.0; + double totalCost = 0.0; try { -// MetadataManagementService meta = DeviceManagementDataHolder -// .getInstance().getMetadataManagementService(); -// Metadata metadata = meta.retrieveMetadata(DeviceManagementConstants.META_KEY); -// -// Gson g = new Gson(); -// Collection costData = null; -// -// Type collectionType = new TypeToken>() { -// }.getType(); -// if (metadata != null) { -// costData = g.fromJson(metadata.getMetaValue(), collectionType); -// for (Cost tenantCost : costData) { -// if (tenantCost.getTenantDomain().equals(tenantDomain)) { - for (Device device : allDevices) { - long dateDiff = 0; - device.setDeviceStatusInfo(getDeviceStatusHistory(device, null, endDate, true)); - List deviceStatus = device.getDeviceStatusInfo(); - if (device.getEnrolmentInfo().getDateOfEnrolment() < startDate.getTime()) { - if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") - || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { - if (deviceStatus.get(0).getUpdateTime().getTime() >= startDate.getTime()) { - dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - startDate.getTime(); - } - } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") - && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { - dateDiff = endDate.getTime() - startDate.getTime(); - } - } else { - if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") - || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { - if (deviceStatus.get(0).getUpdateTime().getTime() >= device.getEnrolmentInfo().getDateOfEnrolment()) { - dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); - } - } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") - && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { - dateDiff = endDate.getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); - } - } + MetadataManagementService meta = DeviceManagementDataHolder + .getInstance().getMetadataManagementService(); + Metadata metadata = meta.retrieveMetadata(DeviceManagementConstants.META_KEY); - // Convert dateDiff to days as a decimal value - double dateDiffInDays = (double) dateDiff / (24 * 60 * 60 * 1000); + Gson g = new Gson(); + Collection costData = null; + int tenantIdContext = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - if (dateDiffInDays % 1 >= 0.9) { - dateDiffInDays = Math.ceil(dateDiffInDays); - } - - long dateInDays = (long) dateDiffInDays; -// double cost = (tenantCost.getCost() / 365) * dateInDays; -// totalCost += cost; -// device.setCost(Math.round(cost * 100.0) / 100.0); - long totalDays = dateInDays + device.getDaysUsed(); - device.setDaysUsed((int) totalDays); - if (deviceStatus.isEmpty()) { - deviceStatusNotAvailable.add(device); - } - } - -// } -// } -// } + Type collectionType = new TypeToken>() { + }.getType(); + if (tenantIdContext == MultitenantConstants.SUPER_TENANT_ID && metadata != null) { + costData = g.fromJson(metadata.getMetaValue(), collectionType); + for (Cost tenantCost : costData) { + if (tenantCost.getTenantDomain().equals(tenantDomain)) { + totalCost = generateCost(allDevices, startDate, endDate, tenantCost, deviceStatusNotAvailable, totalCost); + } + } + } else { + totalCost = generateCost(allDevices, startDate, endDate, null, deviceStatusNotAvailable, totalCost); + } } catch (DeviceManagementException e) { String msg = "Error occurred calculating cost of devices"; log.error(msg, e); throw new DeviceManagementException(msg, e); + } catch (MetadataManagementException e) { + String msg = "Error when retrieving metadata of billing feature"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); } if (!deviceStatusNotAvailable.isEmpty()) { @@ -1122,16 +1085,65 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv billingResponse.setStartDate(startDate.toString()); billingResponse.setEndDate(endDate.toString()); billingResponse.setBillPeriod(calStart.get(Calendar.YEAR) + " - " + calEnd.get(Calendar.YEAR)); -// billingResponse.setTotalCostPerYear(Math.round(totalCost * 100.0) / 100.0); + billingResponse.setTotalCostPerYear(Math.round(totalCost * 100.0) / 100.0); billingResponse.setDeviceCount(allDevices.size()); return billingResponse; } + public double generateCost(List allDevices, Timestamp startDate, Timestamp endDate, Cost tenantCost, List deviceStatusNotAvailable, double totalCost) throws DeviceManagementException { + for (Device device : allDevices) { + long dateDiff = 0; + device.setDeviceStatusInfo(getDeviceStatusHistory(device, null, endDate, true)); + List deviceStatus = device.getDeviceStatusInfo(); + if (device.getEnrolmentInfo().getDateOfEnrolment() < startDate.getTime()) { + if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { + if (deviceStatus.get(0).getUpdateTime().getTime() >= startDate.getTime()) { + dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - startDate.getTime(); + } + } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { + dateDiff = endDate.getTime() - startDate.getTime(); + } + } else { + if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { + if (deviceStatus.get(0).getUpdateTime().getTime() >= device.getEnrolmentInfo().getDateOfEnrolment()) { + dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); + } + } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { + dateDiff = endDate.getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); + } + } + + // Convert dateDiff to days as a decimal value + double dateDiffInDays = (double) dateDiff / (24 * 60 * 60 * 1000); + + if (dateDiffInDays % 1 >= 0.9) { + dateDiffInDays = Math.ceil(dateDiffInDays); + } + + long dateInDays = (long) dateDiffInDays; + double cost = 0; + if (tenantCost != null) { + cost = (tenantCost.getCost() / 365) * dateInDays; + } + totalCost += cost; + device.setCost(Math.round(cost * 100.0) / 100.0); + long totalDays = dateInDays + device.getDaysUsed(); + device.setDaysUsed((int) totalDays); + if (deviceStatus.isEmpty()) { + deviceStatusNotAvailable.add(device); + } + } + return totalCost; + } + @Override public PaginationResult createBillingFile(int tenantId, String tenantDomain, Timestamp startDate, Timestamp endDate) throws DeviceManagementException { - // All code related to cost calculation has being commented out to comply with the current requirements PaginationResult paginationResult = new PaginationResult(); List allDevices = new ArrayList<>(); List billingResponseList = new ArrayList<>(); @@ -1193,7 +1205,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv BillingResponse billingResponse = calculateUsage(tenantDomain, newStartDate, newEndDate, allDevicesPerYear); billingResponseList.add(billingResponse); allDevices.addAll(billingResponse.getDevice()); -// totalCost = totalCost + billingResponse.getTotalCostPerYear(); + totalCost = totalCost + billingResponse.getTotalCostPerYear(); deviceCount = deviceCount + billingResponse.getDeviceCount(); LocalDateTime nextStartDate = oneYearAfterStart.plusDays(1).with(LocalTime.of(00, 00, 00)); startDate = Timestamp.valueOf(nextStartDate); @@ -1217,7 +1229,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv BillingResponse billingResponse = calculateUsage(tenantDomain, startDate, endDate, allDevicesPerRemainingDays); billingResponseList.add(billingResponse); allDevices.addAll(billingResponse.getDevice()); -// totalCost = totalCost + billingResponse.getTotalCostPerYear(); + totalCost = totalCost + billingResponse.getTotalCostPerYear(); deviceCount = deviceCount + billingResponse.getDeviceCount(); } @@ -1229,7 +1241,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv BillingResponse billingResponse = new BillingResponse("all", Math.round(totalCost * 100.0) / 100.0, allDevices, calStart.get(Calendar.YEAR) + " - " + calEnd.get(Calendar.YEAR), initialStartDate.toString(), endDate.toString(), allDevices.size()); billingResponseList.add(billingResponse); paginationResult.setData(billingResponseList); -// paginationResult.setTotalCost(Math.round(totalCost * 100.0) / 100.0); + paginationResult.setTotalCost(Math.round(totalCost * 100.0) / 100.0); paginationResult.setTotalDeviceCount(deviceCount); BillingCacheManagerImpl.getInstance().addBillingToCache(paginationResult, tenantDomain, initialStartDate, endDate); return paginationResult; From fccae9b8c09049b152ec210b2851c517fb97395a Mon Sep 17 00:00:00 2001 From: Pramila Niroshan Date: Fri, 15 Sep 2023 04:02:34 +0000 Subject: [PATCH 072/112] Add Devices filtering by a Custom Property feature to API and dao layer (#208) ## Purpose * Related ticket https://roadmap.entgra.net/issues/10262 ## Description This modifed API accept any custom property key value pair as a encoded JSON String for filtering devices /devicescustomProperty=%7B%22FIRMWARE_APP_VERSION%22%3A%22122%22%2C%22FIRMWARE_VERSION%22%3A%22123%22%7D ## Add Custom property to mdm-ui-config.xml ``` FIRMWARE_VERSION label_firmware_version deviceDetailsMap FIRMWARE_APP_VERSION label_app_version deviceDetailsMap FIRMWARE_SYSTEM_VERSION label_firmware_system_version deviceDetailsMap ``` DefinedValue = Key_value in DM_DEVECE_INFO table DisplayValue = UI display text for filtering Type = Dont change Co-authored-by: pramilaniroshan Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/208 Co-authored-by: Pramila Niroshan Co-committed-by: Pramila Niroshan --- .../service/api/DeviceManagementService.java | 7 ++ .../impl/DeviceManagementServiceImpl.java | 26 ++++- .../impl/DeviceManagementServiceImplTest.java | 34 +++---- .../device/mgt/common/PaginationRequest.java | 13 +++ .../dao/impl/device/GenericDeviceDAOImpl.java | 97 +++++++++++++++++-- .../dao/impl/device/OracleDeviceDAOImpl.java | 97 +++++++++++++++++-- .../impl/device/PostgreSQLDeviceDAOImpl.java | 97 +++++++++++++++++-- .../impl/device/SQLServerDeviceDAOImpl.java | 97 +++++++++++++++++-- 8 files changed, 414 insertions(+), 54 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java index 467dd238c7..e3d9416a2c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java @@ -65,6 +65,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.sql.Timestamp; import java.util.List; +import java.util.Map; /** * Device related REST-API. This can be used to manipulated device related details. @@ -283,6 +284,12 @@ public interface DeviceManagementService { required = false) @QueryParam("serialNumber") String serialNumber, + @ApiParam( + name = "customProperty", + value = "CustomProperty from device as a JSON encoded string.", + required = false) + @QueryParam("customProperty") + String customProperty, @ApiParam( name = "status", value = "Provide the device status details, such as active or inactive.", diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java index 2eaa0a5595..1960d0e41d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstallResponse; import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; @@ -29,7 +30,6 @@ import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.json.JSONObject; import io.entgra.device.mgt.core.apimgt.keymgt.extension.DCRResponse; import io.entgra.device.mgt.core.apimgt.keymgt.extension.TokenRequest; import io.entgra.device.mgt.core.apimgt.keymgt.extension.TokenResponse; @@ -64,7 +64,6 @@ import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; import io.entgra.device.mgt.core.device.mgt.core.app.mgt.ApplicationManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; -import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.DeviceDetailsMgtException; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.DeviceInformationManager; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; @@ -75,10 +74,7 @@ import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchManagerService import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchMgtException; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.DeviceAPIClientService; -import io.entgra.device.mgt.core.device.mgt.core.traccar.common.TraccarHandlerConstants; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; -import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.InputValidationException; @@ -98,6 +94,7 @@ import javax.validation.Valid; import javax.validation.constraints.Size; import javax.ws.rs.*; import javax.ws.rs.core.Response; +import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -105,6 +102,7 @@ import java.util.Date; import java.util.List; import java.util.Properties; import java.util.concurrent.ExecutionException; +import java.util.Map; @Path("/devices") public class DeviceManagementServiceImpl implements DeviceManagementService { @@ -142,6 +140,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @QueryParam("role") String role, @QueryParam("ownership") String ownership, @QueryParam("serialNumber") String serialNumber, + @QueryParam("customProperty") String customProperty, @QueryParam("status") List status, @QueryParam("groupId") int groupId, @QueryParam("since") String since, @@ -155,6 +154,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } // RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status); + final ObjectMapper objectMapper = new ObjectMapper(); RequestValidationUtil.validatePaginationParameters(offset, limit); DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService(); DeviceAccessAuthorizationService deviceAccessAuthorizationService = @@ -166,6 +166,22 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { if (name != null && !name.isEmpty()) { request.setDeviceName(name); } + if (customProperty != null && !customProperty.isEmpty()) { + try { + Map customProperties = objectMapper.readValue(customProperty, Map.class); + // Extract and set custom properties + for (Map.Entry entry : customProperties.entrySet()) { + String propertyName = entry.getKey(); + String propertyValue = entry.getValue(); + // Add custom property to the paginationRequest object + request.addCustomProperty(propertyName, propertyValue); + } + } catch (IOException e) { + String msg = "Error occurred while converting custom property string to a Java Map"; + log.error(msg); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } if (type != null && !type.isEmpty()) { request.setDeviceType(type); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java index 3a24db49f5..2ef62073bd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java @@ -157,7 +157,7 @@ public class DeviceManagementServiceImplTest { .toReturn(this.deviceAccessAuthorizationService); Response response = this.deviceManagementService .getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 1, null, null, false, + null, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); } @@ -177,22 +177,22 @@ public class DeviceManagementServiceImplTest { Response response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 1, null, null, false, + null,null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); response = this.deviceManagementService .getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, null, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 1, null, null, false, + null, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); response = this.deviceManagementService .getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, null, null, null, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 1, null, null, false, + null, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); response = this.deviceManagementService .getDevices(TEST_DEVICE_NAME, TEST_DEVICE_TYPE, null, null, null, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 1, null, null, true, + null, null, DEFAULT_STATUS_LIST, 1, null, null, true, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); } @@ -306,7 +306,7 @@ public class DeviceManagementServiceImplTest { .toReturn(this.deviceManagementProviderService); Mockito.when(deviceAccessAuthorizationService.isDeviceAdminUser()).thenReturn(true); deviceManagementService.getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, - DEFAULT_ROLE, DEFAULT_OWNERSHIP, null, DEFAULT_STATUS_LIST, 1, + DEFAULT_ROLE, DEFAULT_OWNERSHIP, null,null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); } @@ -326,11 +326,11 @@ public class DeviceManagementServiceImplTest { Response response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP - , null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); + , null, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, null, DEFAULT_USERNAME, DEFAULT_ROLE, DEFAULT_OWNERSHIP - , null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); + , null, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); } @@ -352,7 +352,7 @@ public class DeviceManagementServiceImplTest { Response response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, "newuser", null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 0, null, null, false, + null, null, DEFAULT_STATUS_LIST, 0, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.UNAUTHORIZED.getStatusCode()); Mockito.reset(this.deviceAccessAuthorizationService); @@ -374,17 +374,17 @@ public class DeviceManagementServiceImplTest { Response response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 0, null, ifModifiedSince, false, + null, null, DEFAULT_STATUS_LIST, 0, null, ifModifiedSince, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode()); response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 0, null, ifModifiedSince, true, + null, null, DEFAULT_STATUS_LIST, 0, null, ifModifiedSince, true, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode()); response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 0, null, "ErrorModifiedSince", + null, null, DEFAULT_STATUS_LIST, 0, null, "ErrorModifiedSince", false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); } @@ -405,17 +405,17 @@ public class DeviceManagementServiceImplTest { Response response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 0, since, null, false, + null, null,DEFAULT_STATUS_LIST, 0, since, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 0, since, null, true, + null, null,DEFAULT_STATUS_LIST, 0, since, null, true, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 0, "ErrorSince", null, false, + null, null,DEFAULT_STATUS_LIST, 0, "ErrorSince", null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); } @@ -438,7 +438,7 @@ public class DeviceManagementServiceImplTest { Response response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 1, null, null, false, + null, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); Mockito.reset(this.deviceManagementProviderService); @@ -461,7 +461,7 @@ public class DeviceManagementServiceImplTest { Response response = this.deviceManagementService .getDevices(null, TEST_DEVICE_TYPE, DEFAULT_USERNAME, null, DEFAULT_ROLE, DEFAULT_OWNERSHIP, - null, DEFAULT_STATUS_LIST, 1, null, null, false, + null, null, DEFAULT_STATUS_LIST, 1, null, null, false, 10, 5); Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); Mockito.reset(this.deviceAccessAuthorizationService); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/PaginationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/PaginationRequest.java index d9c2c62d47..c0783fe18f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/PaginationRequest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/PaginationRequest.java @@ -41,6 +41,7 @@ public class PaginationRequest { private Date since; private String filter; private String serialNumber; + private Map customProperty = new HashMap<>(); private Map property = new HashMap<>(); private List statusList = new ArrayList<>(); private OperationLogFilters operationLogFilters = new OperationLogFilters(); @@ -115,6 +116,18 @@ public class PaginationRequest { return ownership; } + public Map getCustomProperty() { + return customProperty; + } + + public void setCustomProperty(Map customProperty) { + this.customProperty = customProperty; + } + + public void addCustomProperty(String key, String value) { + customProperty.put(key, value); + } + public void setOwnership(String ownership) { this.ownership = ownership; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java index b3c6b8f18a..fbd3b05d24 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java @@ -41,6 +41,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.StringJoiner; +import java.util.Map; /** * This class holds the generic implementation of DeviceDAO which can be used to support ANSI db syntax. @@ -92,14 +93,40 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { "d.DEVICE_IDENTIFICATION, " + "t.NAME AS DEVICE_TYPE "; - if (serial != null) { - sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " + - "WHERE DEVICE_TYPE_ID = t.ID " + - "AND d.ID= i.DEVICE_ID " + - "AND i.KEY_FIELD = 'serial' " + - "AND i.VALUE_FIELD LIKE ? " + - "AND d.TENANT_ID = ? "; - isSerialProvided = true; + //Filter by serial number or any Custom Property in DM_DEVICE_INFO + if (serial != null || !request.getCustomProperty().isEmpty()) { + sql = sql + + "FROM DM_DEVICE d " + + "INNER JOIN DM_DEVICE_TYPE t ON d.DEVICE_TYPE_ID = t.ID " + + "WHERE "; + if (serial != null) { + sql += "EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d.ID " + + "AND di.KEY_FIELD = 'serial' " + + "AND di.VALUE_FIELD LIKE ? ) "; + isSerialProvided = true; + } + if (!request.getCustomProperty().isEmpty()) { + if (serial != null) { + sql += "AND "; + } + boolean firstCondition = true; + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + if (!firstCondition) { + sql += "AND "; + } + sql += "EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d.ID " + + "AND di.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di.VALUE_FIELD LIKE ? ) "; + firstCondition = false; + } + } + sql += "AND d.TENANT_ID = ? "; } else { sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? "; } @@ -143,6 +170,11 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { if (isSerialProvided) { stmt.setString(paramIdx++, "%" + serial + "%"); } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); + } + } stmt.setInt(paramIdx++, tenantId); if (isSinceProvided) { stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); @@ -624,6 +656,8 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { boolean isStatusProvided = false; Date since = request.getSince(); boolean isSinceProvided = false; + String serial = request.getSerialNumber(); + boolean isSerialProvided = false; try { Connection conn = getConnection(); @@ -692,6 +726,28 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { sql += buildStatusQuery(statusList); isStatusProvided = true; } + //Filter Group with serial number or any Custom Property in DM_DEVICE_INFO + if (serial != null || !request.getCustomProperty().isEmpty()) { + if (serial != null) { + sql += "AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d1.DEVICE_ID " + + "AND di.KEY_FIELD = 'serial' " + + "AND di.VALUE_FIELD LIKE ?) "; + isSerialProvided = true; + } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + sql += "AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di2 " + + "WHERE di2.DEVICE_ID = d1.DEVICE_ID " + + "AND di2.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di2.VALUE_FIELD LIKE ?)"; + } + } + } sql = sql + " LIMIT ?,?"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { @@ -721,6 +777,14 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { stmt.setString(paramIdx++, status); } } + if (isSerialProvided) { + stmt.setString(paramIdx++, "%" + serial + "%"); + } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); + } + } stmt.setInt(paramIdx++, request.getStartIndex()); stmt.setInt(paramIdx, request.getRowCount()); @@ -1250,6 +1314,17 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { query += buildStatusQuery(status); isStatusProvided = true; } + // Loop through custom properties and add conditions + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + query += " AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di2 " + + "WHERE di2.DEVICE_ID = DM_DEVICE.ID " + + "AND di2.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di2.VALUE_FIELD LIKE ?)"; + } + } query = query + " LIMIT ?,?"; @@ -1277,6 +1352,12 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { ps.setString(index++, deviceStatus); } } + // Set custom property values in the loop + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + ps.setString(index++, "%" + entry.getValue() + "%"); + } + } ps.setInt(index++, offsetValue); ps.setInt(index, limitValue); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java index 722a19b4bf..cecf4e510b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java @@ -42,6 +42,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.StringJoiner; +import java.util.Map; /** * This class holds the generic implementation of DeviceDAO which can be used to support ANSI db syntax. @@ -93,14 +94,40 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { "d.DEVICE_IDENTIFICATION, " + "t.NAME AS DEVICE_TYPE "; - if (serial != null) { - sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " + - "WHERE DEVICE_TYPE_ID = t.ID " + - "AND d.ID= i.DEVICE_ID " + - "AND i.KEY_FIELD = 'serial' " + - "AND i.VALUE_FIELD LIKE ? " + - "AND d.TENANT_ID = ? "; - isSerialProvided = true; + //Filter by serial number or any Custom Property in DM_DEVICE_INFO + if (serial != null || !request.getCustomProperty().isEmpty()) { + sql = sql + + "FROM DM_DEVICE d " + + "INNER JOIN DM_DEVICE_TYPE t ON d.DEVICE_TYPE_ID = t.ID " + + "WHERE "; + if (serial != null) { + sql += "EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d.ID " + + "AND di.KEY_FIELD = 'serial' " + + "AND di.VALUE_FIELD LIKE ? ) "; + isSerialProvided = true; + } + if (!request.getCustomProperty().isEmpty()) { + if (serial != null) { + sql += "AND "; + } + boolean firstCondition = true; + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + if (!firstCondition) { + sql += "AND "; + } + sql += "EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d.ID " + + "AND di.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di.VALUE_FIELD LIKE ? ) "; + firstCondition = false; + } + } + sql += "AND d.TENANT_ID = ? "; } else { sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? "; } @@ -144,6 +171,11 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { if (isSerialProvided) { stmt.setString(paramIdx++, "%" + serial + "%"); } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); + } + } stmt.setInt(paramIdx++, tenantId); if (isSinceProvided) { stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); @@ -454,6 +486,8 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { boolean isStatusProvided = false; Date since = request.getSince(); boolean isSinceProvided = false; + String serial = request.getSerialNumber(); + boolean isSerialProvided = false; try { conn = getConnection(); @@ -522,6 +556,28 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { sql += buildStatusQuery(statusList); isStatusProvided = true; } + //Filter Group with serial number or any Custom Property in DM_DEVICE_INFO + if (serial != null || !request.getCustomProperty().isEmpty()) { + if (serial != null) { + sql += "AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d1.DEVICE_ID " + + "AND di.KEY_FIELD = 'serial' " + + "AND di.VALUE_FIELD LIKE ?) "; + isSerialProvided = true; + } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + sql += "AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di2 " + + "WHERE di2.DEVICE_ID = d1.DEVICE_ID " + + "AND di2.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di2.VALUE_FIELD LIKE ?)"; + } + } + } sql = sql + " ORDER BY ENROLMENT_ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { @@ -551,6 +607,14 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { stmt.setString(paramIdx++, status); } } + if (isSerialProvided) { + stmt.setString(paramIdx++, "%" + serial + "%"); + } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); + } + } stmt.setInt(paramIdx++, request.getStartIndex()); stmt.setInt(paramIdx, request.getRowCount()); @@ -1035,6 +1099,17 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { query += buildStatusQuery(status); isStatusProvided = true; } + // Loop through custom properties and add conditions + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + query += " AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di2 " + + "WHERE di2.DEVICE_ID = DM_DEVICE.ID " + + "AND di2.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di2.VALUE_FIELD LIKE ?)"; + } + } query = query + " ORDER BY DM_DEVICE.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; @@ -1059,6 +1134,12 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { ps.setString(index++, deviceStatus); } } + // Set custom property values in the loop + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + ps.setString(index++, "%" + entry.getValue() + "%"); + } + } ps.setInt(index++, offsetValue); ps.setInt(index, limitValue); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java index 7b0cd9369b..c467165851 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java @@ -41,6 +41,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.StringJoiner; +import java.util.Map; /** * This class holds the generic implementation of DeviceDAO which can be used to support ANSI db syntax. @@ -92,14 +93,40 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { "d.DEVICE_IDENTIFICATION, " + "t.NAME AS DEVICE_TYPE "; - if (serial != null) { - sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " + - "WHERE DEVICE_TYPE_ID = t.ID " + - "AND d.ID= i.DEVICE_ID " + - "AND i.KEY_FIELD = 'serial' " + - "AND i.VALUE_FIELD LIKE ? " + - "AND d.TENANT_ID = ? "; - isSerialProvided = true; + //Filter by serial number or any Custom Property in DM_DEVICE_INFO + if (serial != null || !request.getCustomProperty().isEmpty()) { + sql = sql + + "FROM DM_DEVICE d " + + "INNER JOIN DM_DEVICE_TYPE t ON d.DEVICE_TYPE_ID = t.ID " + + "WHERE "; + if (serial != null) { + sql += "EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d.ID " + + "AND di.KEY_FIELD = 'serial' " + + "AND di.VALUE_FIELD LIKE ? ) "; + isSerialProvided = true; + } + if (!request.getCustomProperty().isEmpty()) { + if (serial != null) { + sql += "AND "; + } + boolean firstCondition = true; + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + if (!firstCondition) { + sql += "AND "; + } + sql += "EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d.ID " + + "AND di.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di.VALUE_FIELD LIKE ? ) "; + firstCondition = false; + } + } + sql += "AND d.TENANT_ID = ? "; } else { sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? "; } @@ -138,6 +165,11 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { if (isSerialProvided) { stmt.setString(paramIdx++, "%" + serial + "%"); } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); + } + } stmt.setInt(paramIdx++, tenantId); if (isDeviceTypeProvided) { stmt.setString(paramIdx++, deviceType); @@ -435,6 +467,8 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { boolean isStatusProvided = false; Date since = request.getSince(); boolean isSinceProvided = false; + String serial = request.getSerialNumber(); + boolean isSerialProvided = false; try { conn = getConnection(); @@ -502,6 +536,28 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { sql += buildStatusQuery(statusList); isStatusProvided = true; } + //Filter Group with serial number or any Custom Property in DM_DEVICE_INFO + if (serial != null || !request.getCustomProperty().isEmpty()) { + if (serial != null) { + sql += "AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d1.DEVICE_ID " + + "AND di.KEY_FIELD = 'serial' " + + "AND di.VALUE_FIELD LIKE ?) "; + isSerialProvided = true; + } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + sql += "AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di2 " + + "WHERE di2.DEVICE_ID = d1.DEVICE_ID " + + "AND di2.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di2.VALUE_FIELD LIKE ?)"; + } + } + } sql = sql + " LIMIT ? OFFSET ?"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { @@ -531,6 +587,14 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { stmt.setString(paramIdx++, status); } } + if (isSerialProvided) { + stmt.setString(paramIdx++, "%" + serial + "%"); + } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); + } + } stmt.setInt(paramIdx++, request.getRowCount()); stmt.setInt(paramIdx, request.getStartIndex()); @@ -1014,6 +1078,17 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { query += buildStatusQuery(status); isStatusProvided = true; } + // Loop through custom properties and add conditions + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + query += " AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di2 " + + "WHERE di2.DEVICE_ID = DM_DEVICE.ID " + + "AND di2.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di2.VALUE_FIELD LIKE ?)"; + } + } query = query + " LIMIT ? OFFSET ?"; @@ -1038,6 +1113,12 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { ps.setString(index++, deviceStatus); } } + // Set custom property values in the loop + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + ps.setString(index++, "%" + entry.getValue() + "%"); + } + } ps.setInt(index++, offsetValue); ps.setInt(index, limitValue); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java index 3a7f0f95b9..5628b77a2d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java @@ -43,6 +43,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.StringJoiner; +import java.util.Map; /** * This class holds the generic implementation of DeviceDAO which can be used to support ANSI db syntax. @@ -94,14 +95,40 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { "d.DEVICE_IDENTIFICATION, " + "t.NAME AS DEVICE_TYPE "; - if (serial != null) { - sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_INFO i " + - "WHERE DEVICE_TYPE_ID = t.ID " + - "AND d.ID= i.DEVICE_ID " + - "AND i.KEY_FIELD = 'serial' " + - "AND i.VALUE_FIELD LIKE ? " + - "AND d.TENANT_ID = ? "; - isSerialProvided = true; + //Filter by serial number or any Custom Property in DM_DEVICE_INFO + if (serial != null || !request.getCustomProperty().isEmpty()) { + sql = sql + + "FROM DM_DEVICE d " + + "INNER JOIN DM_DEVICE_TYPE t ON d.DEVICE_TYPE_ID = t.ID " + + "WHERE "; + if (serial != null) { + sql += "EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d.ID " + + "AND di.KEY_FIELD = 'serial' " + + "AND di.VALUE_FIELD LIKE ? ) "; + isSerialProvided = true; + } + if (!request.getCustomProperty().isEmpty()) { + if (serial != null) { + sql += "AND "; + } + boolean firstCondition = true; + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + if (!firstCondition) { + sql += "AND "; + } + sql += "EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d.ID " + + "AND di.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di.VALUE_FIELD LIKE ? ) "; + firstCondition = false; + } + } + sql += "AND d.TENANT_ID = ? "; } else { sql = sql + "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? "; } @@ -145,6 +172,11 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { if (isSerialProvided) { stmt.setString(paramIdx++, "%" + serial + "%"); } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); + } + } stmt.setInt(paramIdx++, tenantId); if (isSinceProvided) { stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); @@ -455,6 +487,8 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { boolean isStatusProvided = false; Date since = request.getSince(); boolean isSinceProvided = false; + String serial = request.getSerialNumber(); + boolean isSerialProvided = false; try { conn = getConnection(); @@ -522,6 +556,28 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { sql += buildStatusQuery(statusList); isStatusProvided = true; } + //Filter Group with serial number or any Custom Property in DM_DEVICE_INFO + if (serial != null || !request.getCustomProperty().isEmpty()) { + if (serial != null) { + sql += "AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di " + + "WHERE di.DEVICE_ID = d1.DEVICE_ID " + + "AND di.KEY_FIELD = 'serial' " + + "AND di.VALUE_FIELD LIKE ?) "; + isSerialProvided = true; + } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + sql += "AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di2 " + + "WHERE di2.DEVICE_ID = d1.DEVICE_ID " + + "AND di2.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di2.VALUE_FIELD LIKE ?)"; + } + } + } sql = sql + " ORDER BY ENROLMENT_ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { @@ -551,6 +607,14 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { stmt.setString(paramIdx++, status); } } + if (isSerialProvided) { + stmt.setString(paramIdx++, "%" + serial + "%"); + } + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); + } + } stmt.setInt(paramIdx++, request.getStartIndex()); stmt.setInt(paramIdx, request.getRowCount()); @@ -883,6 +947,17 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { query += buildStatusQuery(status); isStatusProvided = true; } + // Loop through custom properties and add conditions + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + query += " AND EXISTS (" + + "SELECT VALUE_FIELD " + + "FROM DM_DEVICE_INFO di2 " + + "WHERE di2.DEVICE_ID = DM_DEVICE.ID " + + "AND di2.KEY_FIELD = '" + entry.getKey() + "' " + + "AND di2.VALUE_FIELD LIKE ?)"; + } + } query = query + " ORDER BY DM_DEVICE.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; @@ -907,6 +982,12 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { ps.setString(index++, deviceStatus); } } + // Set custom property values in the loop + if (!request.getCustomProperty().isEmpty()) { + for (Map.Entry entry : request.getCustomProperty().entrySet()) { + ps.setString(index++, "%" + entry.getValue() + "%"); + } + } ps.setInt(index++, offsetValue); ps.setInt(index, limitValue); From 664dfd21c9de5b987ebe9664883ab078e862b34e Mon Sep 17 00:00:00 2001 From: Charitha Goonetilleke Date: Mon, 18 Sep 2023 00:50:40 +0000 Subject: [PATCH 073/112] Warn about orphan scopes --- .../core/apimgt/webapp/publisher/APIPublisherServiceImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index e815b5877a..46e7481857 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -553,9 +553,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope); } else { // todo: come to this level means, that scope is removed from API, but haven't removed from the scope-role-permission-mappings list - if (log.isDebugEnabled()) { - log.debug(scope.getKey() + " not available as shared scope"); - } + log.warn(scope.getKey() + " not available as shared scope"); } } for (String role : rolePermissions.keySet()) { From bb0369cde95c95b4d1073cf68bc846a52a003795 Mon Sep 17 00:00:00 2001 From: Sasini_Sandamali Date: Thu, 21 Sep 2023 09:53:11 +0530 Subject: [PATCH 074/112] Update addOperation and sql files --- .../operation/mgt/dao/impl/CommandOperationDAOImpl.java | 4 +++- .../operation/mgt/dao/impl/ConfigOperationDAOImpl.java | 4 +++- .../operation/mgt/dao/impl/GenericOperationDAOImpl.java | 8 +++++--- .../operation/mgt/dao/impl/PolicyOperationDAOImpl.java | 4 +++- .../operation/mgt/dao/impl/ProfileOperationDAOImpl.java | 4 +++- .../src/test/resources/sql/h2.sql | 1 + .../src/test/resources/sql-files/h2.sql | 4 ++++ .../src/test/resources/carbon-home/dbscripts/dm-db-h2.sql | 1 + .../src/test/resources/sql/CreateH2TestDB.sql | 1 + .../src/test/resources/carbon-home/dbscripts/dm-db-h2.sql | 1 + 10 files changed, 25 insertions(+), 7 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java index 5a12769bea..cfef55c428 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; @@ -46,7 +47,7 @@ public class CommandOperationDAOImpl extends GenericOperationDAOImpl { try { Connection connection = OperationManagementDAOFactory.getConnection(); String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " + - "INITIATED_BY, ENABLED) VALUES (?, ?, ?, ?, ?, ?)"; + "INITIATED_BY, ENABLED, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?)"; stmt = connection.prepareStatement(sql, new String[]{"id"}); stmt.setString(1, operation.getType().toString()); stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime()); @@ -54,6 +55,7 @@ public class CommandOperationDAOImpl extends GenericOperationDAOImpl { stmt.setString(4, operation.getCode()); stmt.setString(5, operation.getInitiatedBy()); stmt.setBoolean(6, operation.isEnabled()); + stmt.setInt(7, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java index 9e19b5b5d8..3d7ceeaa18 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ConfigOperation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; @@ -49,7 +50,7 @@ public class ConfigOperationDAOImpl extends GenericOperationDAOImpl { operation.setCreatedTimeStamp(new Timestamp(new Date().getTime()).toString()); Connection connection = OperationManagementDAOFactory.getConnection(); String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " + - "INITIATED_BY, OPERATION_DETAILS) VALUES (?, ?, ?, ?, ?, ?)"; + "INITIATED_BY, OPERATION_DETAILS, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?)"; stmt = connection.prepareStatement(sql, new String[]{"id"}); stmt.setString(1, operation.getType().toString()); stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime()); @@ -57,6 +58,7 @@ public class ConfigOperationDAOImpl extends GenericOperationDAOImpl { stmt.setString(4, operation.getCode()); stmt.setString(5, operation.getInitiatedBy()); stmt.setObject(6, operation); + stmt.setInt(7, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index fa831c317a..5d964d4a53 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -74,7 +74,7 @@ public class GenericOperationDAOImpl implements OperationDAO { try { Connection connection = OperationManagementDAOFactory.getConnection(); String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " + - "INITIATED_BY, OPERATION_DETAILS) VALUES (?, ?, ?, ?, ?, ?)"; + "INITIATED_BY, OPERATION_DETAILS, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?)"; stmt = connection.prepareStatement(sql, new String[]{"id"}); stmt.setString(1, operation.getType().toString()); stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime()); @@ -82,6 +82,7 @@ public class GenericOperationDAOImpl implements OperationDAO { stmt.setString(4, operation.getCode()); stmt.setString(5, operation.getInitiatedBy()); stmt.setObject(6, operation); + stmt.setInt(7, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); @@ -2281,7 +2282,7 @@ public class GenericOperationDAOImpl implements OperationDAO { sql.append("AND INITIATED_BY = ? "); } - sql.append("ORDER BY ID ASC ) dm_ordered " + + sql.append("ORDER BY ID ASC limit ? , ? ) dm_ordered " + "ON dm_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? "); } @@ -2384,7 +2385,8 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getInitiatedBy() != null) { stmt.setString(index++, activityPaginationRequest.getInitiatedBy()); } - + stmt.setInt(index++, activityPaginationRequest.getOffset()); + stmt.setInt(index++, activityPaginationRequest.getLimit()); stmt.setInt(index++, tenantId); if (activityPaginationRequest.getDeviceType() != null) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java index b8a1b135a3..bd4d74386a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.PolicyOperation; @@ -49,7 +50,7 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl { operation.setEnabled(true); Connection connection = OperationManagementDAOFactory.getConnection(); String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " + - "INITIATED_BY, OPERATION_DETAILS, ENABLED) VALUES (?, ?, ?, ?, ?, ?, ?)"; + "INITIATED_BY, OPERATION_DETAILS, ENABLED, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; stmt = connection.prepareStatement(sql, new String[]{"id"}); stmt.setString(1, operation.getType().toString()); stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime()); @@ -63,6 +64,7 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl { stmt.setBytes(6, bao.toByteArray()); stmt.setBoolean(7, operation.isEnabled()); + stmt.setInt(8, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java index e972afba65..93b25f47dc 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ProfileOperation; @@ -46,7 +47,7 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl { operation.setEnabled(true); Connection connection = OperationManagementDAOFactory.getConnection(); String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " + - "INITIATED_BY, OPERATION_DETAILS, ENABLED) VALUES (?, ?, ?, ?, ?, ?, ?)"; + "INITIATED_BY, OPERATION_DETAILS, ENABLED, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; stmt = connection.prepareStatement(sql, new String[]{"id"}); stmt.setString(1, operation.getType().toString()); stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime()); @@ -60,6 +61,7 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl { stmt.setBytes(6, bao.toByteArray()); stmt.setBoolean(7, operation.isEnabled()); + stmt.setInt(8, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql index 4f83fa5b5e..664eb333d1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql @@ -82,6 +82,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/resources/sql-files/h2.sql b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/resources/sql-files/h2.sql index 2b2200bb2b..b282aa59ce 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/resources/sql-files/h2.sql +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/resources/sql-files/h2.sql @@ -68,6 +68,10 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATED_TIMESTAMP BIGINT NOT NULL, RECEIVED_TIMESTAMP BIGINT NULL, OPERATION_CODE VARCHAR(1000) NOT NULL, + INITIATED_BY VARCHAR(100) NULL, + OPERATION_DETAILS BLOB DEFAULT NULL, + ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql index 6052156588..c2f33227b7 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql @@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index f5a25e36a2..2570e7dd7f 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql index 40ad63072f..295433b55c 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql @@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); From cc6bbf1435de1db1d20c5bc5cc2313bb52e58630 Mon Sep 17 00:00:00 2001 From: pasindu Date: Thu, 21 Sep 2023 01:56:53 +0530 Subject: [PATCH 075/112] Improvements in App registration --- .../APIManagementProviderServiceImpl.java | 66 +- .../rest/api/APIApplicationServices.java | 2 +- .../rest/api/APIApplicationServicesImpl.java | 2 +- .../rest/api/ConsumerRESTAPIServices.java | 30 +- .../rest/api/ConsumerRESTAPIServicesImpl.java | 586 ++++++------------ .../extension/rest/api/dto/TokenInfo.java | 44 -- .../extension/service/KeyMgtServiceImpl.java | 9 +- .../impl/DeviceManagementServiceImpl.java | 3 - 8 files changed, 246 insertions(+), 496 deletions(-) delete mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/TokenInfo.java diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java index 0f0791170b..837a1b902c 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -26,7 +26,6 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.API import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.ApplicationKey; import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.KeyManager; import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Subscription; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.TokenInfo; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyAlreadyExistsException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; @@ -96,12 +95,11 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe boolean isMappingRequired) throws APIManagerException { - TokenInfo tokenInfo = new TokenInfo(); + ApiApplicationInfo apiApplicationInfo = new ApiApplicationInfo(); if (StringUtils.isEmpty(accessToken)) { - ApiApplicationInfo applicationInfo = getApplicationInfo(username, password); - tokenInfo.setApiApplicationInfo(applicationInfo); + apiApplicationInfo = getApplicationInfo(username, password); } else { - tokenInfo.setAccessToken(accessToken); + apiApplicationInfo.setAccess_token(accessToken); } ConsumerRESTAPIServices consumerRESTAPIServices = @@ -118,16 +116,16 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe Map queryParams = new HashMap<>(); queryParams.put("tag", tag); - APIInfo[] apiInfos = consumerRESTAPIServices.getAllApis(tokenInfo, queryParams, headerParams); + APIInfo[] apiInfos = consumerRESTAPIServices.getAllApis(apiApplicationInfo, queryParams, headerParams); Arrays.stream(apiInfos).forEach(apiInfo -> uniqueApiSet.putIfAbsent(apiInfo.getName(), apiInfo)); } List uniqueApiList = new ArrayList<>(uniqueApiSet.values()); io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application[] applications = - consumerRESTAPIServices.getAllApplications(tokenInfo, applicationName); + consumerRESTAPIServices.getAllApplications(apiApplicationInfo, applicationName); if (applications.length == 0) { - return handleNewAPIApplication(applicationName, uniqueApiList, tokenInfo, keyType, + return handleNewAPIApplication(applicationName, uniqueApiList, apiApplicationInfo, keyType, validityTime, supportedGrantTypes, callbackUrl, isMappingRequired); } else { if (applications.length == 1) { @@ -140,17 +138,17 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe Metadata metaData = metadataManagementService.retrieveMetadata(applicationName); if (metaData == null) { // Todo add a comment - consumerRESTAPIServices.deleteApplication(tokenInfo, application.getApplicationId()); - return handleNewAPIApplication(applicationName, uniqueApiList, tokenInfo, keyType, + consumerRESTAPIServices.deleteApplication(apiApplicationInfo, application.getApplicationId()); + return handleNewAPIApplication(applicationName, uniqueApiList, apiApplicationInfo, keyType, validityTime, supportedGrantTypes, callbackUrl, isMappingRequired); } else { - Subscription[] subscriptions = consumerRESTAPIServices.getAllSubscriptions(tokenInfo, application.getApplicationId()); + Subscription[] subscriptions = consumerRESTAPIServices.getAllSubscriptions(apiApplicationInfo, application.getApplicationId()); for (Subscription subscription : subscriptions) { uniqueApiList.removeIf(apiInfo -> Objects.equals(apiInfo.getId(), subscription.getApiInfo().getId())); } if (!uniqueApiList.isEmpty()) { - addSubscriptions(application, uniqueApiList, tokenInfo); + addSubscriptions(application, uniqueApiList, apiApplicationInfo); } String[] metaValues = metaData.getMetaValue().split(":"); @@ -162,7 +160,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe } String applicationId = metaValues[0]; String keyMappingId = metaValues[1]; - ApplicationKey applicationKey = consumerRESTAPIServices.getKeyDetails(tokenInfo, applicationId, keyMappingId); + ApplicationKey applicationKey = consumerRESTAPIServices.getKeyDetails(apiApplicationInfo, applicationId, keyMappingId); ApiApplicationKey apiApplicationKey = new ApiApplicationKey(); apiApplicationKey.setConsumerKey(applicationKey.getConsumerKey()); apiApplicationKey.setConsumerSecret(applicationKey.getConsumerSecret()); @@ -195,7 +193,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe private ApiApplicationKey handleNewAPIApplication(String applicationName, List uniqueApiList, - TokenInfo tokenInfo, String keyType, String validityTime, + ApiApplicationInfo apiApplicationInfo, String keyType, String validityTime, ArrayList supportedGrantTypes, String callbackUrl, boolean isMappingRequired) throws APIManagerException { ConsumerRESTAPIServices consumerRESTAPIServices = @@ -205,10 +203,10 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe application.setThrottlingPolicy(UNLIMITED_TIER); try { - application = consumerRESTAPIServices.createApplication(tokenInfo, application); - addSubscriptions(application, uniqueApiList, tokenInfo); + application = consumerRESTAPIServices.createApplication(apiApplicationInfo, application); + addSubscriptions(application, uniqueApiList, apiApplicationInfo); - KeyManager[] keyManagers = consumerRESTAPIServices.getAllKeyManagers(tokenInfo); + KeyManager[] keyManagers = consumerRESTAPIServices.getAllKeyManagers(apiApplicationInfo); KeyManager keyManager; if (keyManagers.length == 1) { keyManager = keyManagers[0]; @@ -219,21 +217,29 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe throw new APIManagerException(msg); } - tokenInfo.setApiApplicationInfo(getApplicationInfo(null, null)); ApplicationKey applicationKey; - if (isMappingRequired) { - // If we need to get opaque token instead of the JWT token, we have to do the mapping. Therefore,, if + // If we need to get opaque token instead of the JWT token, we have to do the mapping. Therefore, if // it is a requirement then we have to call the method with enabling the flag. - applicationKey = consumerRESTAPIServices.mapApplicationKeys(tokenInfo, application, - keyManager.getName(), keyType); + APIApplicationServices apiApplicationServices = APIApplicationManagerExtensionDataHolder.getInstance() + .getApiApplicationServices(); + + APIApplicationKey apiApplicationKey = apiApplicationServices.createAndRetrieveApplicationCredentials( + "ClientForMapping", + "client_credentials password refresh_token urn:ietf:params:oauth:grant-type:jwt-bearer"); + + apiApplicationInfo.setClientId(apiApplicationKey.getClientId()); + apiApplicationInfo.setClientSecret(apiApplicationKey.getClientSecret()); + + applicationKey = consumerRESTAPIServices.mapApplicationKeys(apiApplicationInfo, application, + keyManager.getName(), keyType); } else { - applicationKey = consumerRESTAPIServices.generateApplicationKeys(tokenInfo, application.getApplicationId(), + applicationKey = consumerRESTAPIServices.generateApplicationKeys(apiApplicationInfo, application.getApplicationId(), keyManager.getName(), validityTime, keyType); } if (supportedGrantTypes != null || StringUtils.isNotEmpty(callbackUrl)) { - applicationKey = consumerRESTAPIServices.updateGrantType(tokenInfo, application.getApplicationId(), + applicationKey = consumerRESTAPIServices.updateGrantType(apiApplicationInfo, application.getApplicationId(), applicationKey.getKeyMappingId(), keyManager.getName(), supportedGrantTypes, callbackUrl); } @@ -277,16 +283,16 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe /** * This method can be used to add a new subscriptions providing the ids of the APIs and the applications. * - * @param application {@link io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application} - * @param apiInfos {@link List} - * @param tokenInfo {@link TokenInfo} + * @param application {@link io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application} + * @param apiInfos {@link List} + * @param apiApplicationInfo {@link ApiApplicationInfo} * @throws BadRequestException if incorrect data provided to call subscribing REST API. * @throws UnexpectedResponseException if error occurred while processing the subscribing REST API. * @throws APIServicesException if error occurred while invoking the subscribing REST API. */ private void addSubscriptions( io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application application, - List apiInfos, TokenInfo tokenInfo) + List apiInfos, ApiApplicationInfo apiApplicationInfo) throws BadRequestException, UnexpectedResponseException, APIServicesException { ConsumerRESTAPIServices consumerRESTAPIServices = @@ -302,7 +308,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe subscriptionList.add(subscription); }); - consumerRESTAPIServices.createSubscriptions(tokenInfo, subscriptionList); + consumerRESTAPIServices.createSubscriptions(apiApplicationInfo, subscriptionList); } @Override @@ -407,7 +413,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe "ClientForConsumerRestCalls", "client_credentials password refresh_token urn:ietf:params:oauth:grant-type:jwt-bearer"); } else { - apiApplicationKey = apiApplicationServices.generateAndRetrieveApplicationKeys( + apiApplicationKey = apiApplicationServices.createAndRetrieveApplicationCredentialsWithUser( "ClientForConsumerRestCalls", username, password, "client_credentials password refresh_token urn:ietf:params:oauth:grant-type:jwt-bearer"); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServices.java index f5cc8b3ec1..7b14f48800 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServices.java @@ -27,7 +27,7 @@ public interface APIApplicationServices { APIApplicationKey createAndRetrieveApplicationCredentials(String clientName, String grantType) throws APIServicesException; - APIApplicationKey generateAndRetrieveApplicationKeys(String clientName, String username, String password, String grantType) + APIApplicationKey createAndRetrieveApplicationCredentialsWithUser(String clientName, String username, String password, String grantType) throws APIServicesException; AccessTokenInfo generateAccessTokenFromRegisteredApplication(String clientId, String clientSecret) throws APIServicesException; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java index a03f81d086..68ea575e02 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java @@ -75,7 +75,7 @@ public class APIApplicationServicesImpl implements APIApplicationServices { } @Override - public APIApplicationKey generateAndRetrieveApplicationKeys(String clientName, String username, String password, String grantType) + public APIApplicationKey createAndRetrieveApplicationCredentialsWithUser(String clientName, String username, String password, String grantType) throws APIServicesException { String applicationEndpoint = config.getFirstProperty(Constants.DCR_END_POINT); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/ConsumerRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/ConsumerRESTAPIServices.java index e8342b18d5..2cb3cf692c 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/ConsumerRESTAPIServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/ConsumerRESTAPIServices.java @@ -19,7 +19,7 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api; import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.*; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.TokenInfo; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.ApiApplicationInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; @@ -28,43 +28,45 @@ import java.util.List; import java.util.Map; public interface ConsumerRESTAPIServices { - Application[] getAllApplications(TokenInfo tokenInfo, String appName) + + Application[] getAllApplications(ApiApplicationInfo apiApplicationInfo, String appName) throws APIServicesException, BadRequestException, UnexpectedResponseException; - Application getDetailsOfAnApplication(TokenInfo tokenInfo, String applicationId) + Application getDetailsOfAnApplication(ApiApplicationInfo apiApplicationInfo, String applicationId) throws APIServicesException, BadRequestException, UnexpectedResponseException; - Application createApplication(TokenInfo tokenInfo, Application application) + Application createApplication(ApiApplicationInfo apiApplicationInfo, Application application) throws APIServicesException, BadRequestException, UnexpectedResponseException; - Boolean deleteApplication(TokenInfo tokenInfo, String applicationId) + Boolean deleteApplication(ApiApplicationInfo apiApplicationInfo, String applicationId) throws APIServicesException, BadRequestException, UnexpectedResponseException; - Subscription[] getAllSubscriptions(TokenInfo tokenInfo, String applicationId) + Subscription[] getAllSubscriptions(ApiApplicationInfo apiApplicationInfo, String applicationId) throws APIServicesException, BadRequestException, UnexpectedResponseException; - APIInfo[] getAllApis(TokenInfo tokenInfo, Map queryParams, Map headerParams) + APIInfo[] getAllApis(ApiApplicationInfo apiApplicationInfo, Map queryParams, Map headerParams) throws APIServicesException, BadRequestException, UnexpectedResponseException; - Subscription createSubscription(TokenInfo tokenInfo, Subscription subscriptions) + Subscription createSubscription(ApiApplicationInfo apiApplicationInfo, Subscription subscriptions) throws APIServicesException, BadRequestException, UnexpectedResponseException; - Subscription[] createSubscriptions(TokenInfo tokenInfo, List subscriptions) + Subscription[] createSubscriptions(ApiApplicationInfo apiApplicationInfo, List subscriptions) throws APIServicesException, BadRequestException, UnexpectedResponseException; - ApplicationKey generateApplicationKeys(TokenInfo tokenInfo, String applicationId, String keyManager, String validityTime, String keyType) + ApplicationKey generateApplicationKeys(ApiApplicationInfo apiApplicationInfo, String applicationId, String keyManager, + String validityTime, String keyType) throws APIServicesException, BadRequestException, UnexpectedResponseException; - ApplicationKey mapApplicationKeys(TokenInfo tokenInfo, Application application, String keyManager, String keyType) + ApplicationKey mapApplicationKeys(ApiApplicationInfo apiApplicationInfo, Application application, String keyManager, String keyType) throws APIServicesException, BadRequestException, UnexpectedResponseException; - ApplicationKey getKeyDetails(TokenInfo tokenInfo, String applicationId, String keyMapId) + ApplicationKey getKeyDetails(ApiApplicationInfo apiApplicationInfo, String applicationId, String keyMapId) throws APIServicesException, BadRequestException, UnexpectedResponseException; - ApplicationKey updateGrantType(TokenInfo tokenInfo, String applicationId, String keyMapId, String keyManager, + ApplicationKey updateGrantType(ApiApplicationInfo apiApplicationInfo, String applicationId, String keyMapId, String keyManager, List supportedGrantTypes, String callbackUrl) throws APIServicesException, BadRequestException, UnexpectedResponseException; - KeyManager[] getAllKeyManagers(TokenInfo tokenInfo) + KeyManager[] getAllKeyManagers(ApiApplicationInfo apiApplicationInfo) throws APIServicesException, BadRequestException, UnexpectedResponseException; } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/ConsumerRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/ConsumerRESTAPIServicesImpl.java index e5608d5cbc..998331cc0d 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/ConsumerRESTAPIServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/ConsumerRESTAPIServicesImpl.java @@ -23,7 +23,6 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.*; import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.ApiApplicationInfo; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.TokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; @@ -51,22 +50,15 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { + Constants.COLON + port; @Override - public Application[] getAllApplications(TokenInfo tokenInfo, String appName) + public Application[] getAllApplications(ApiApplicationInfo apiApplicationInfo, String appName) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String getAllApplicationsUrl = endPointPrefix + Constants.APPLICATIONS_API + "?query=" + appName; Request.Builder builder = new Request.Builder(); builder.url(getAllApplicationsUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.get(); Request request = builder.build(); @@ -76,21 +68,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { JSONArray applicationList = (JSONArray) new JSONObject(response.body().string()).get("list"); return gson.fromJson(applicationList.toString(), Application[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - tokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - tokenInfo.setAccessToken(null); - return getAllApplications(tokenInfo, appName); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return getAllApplications(refreshedApiApplicationInfo, appName); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -107,22 +91,15 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public Application getDetailsOfAnApplication(TokenInfo tokenInfo, String applicationId) + public Application getDetailsOfAnApplication(ApiApplicationInfo apiApplicationInfo, String applicationId) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String getDetailsOfAPPUrl = endPointPrefix + Constants.APPLICATIONS_API + Constants.SLASH + applicationId; Request.Builder builder = new Request.Builder(); builder.url(getDetailsOfAPPUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.get(); Request request = builder.build(); @@ -131,22 +108,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_OK == response.code()) { return gson.fromJson(response.body().string(), Application.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return getDetailsOfAnApplication(refreshedTokenInfo, applicationId); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return getDetailsOfAnApplication(refreshedApiApplicationInfo, applicationId); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -163,33 +131,38 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public Application createApplication(TokenInfo tokenInfo, Application application) + public Application createApplication(ApiApplicationInfo apiApplicationInfo, Application application) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String getAllScopesUrl = endPointPrefix + Constants.APPLICATIONS_API; - String applicationInfo = "{\n" + - " \"name\": \"" + application.getName() + "\",\n" + - " \"throttlingPolicy\": \"" + application.getThrottlingPolicy() + "\",\n" + - " \"description\": \"" + application.getDescription() + "\",\n" + - " \"tokenType\": \"" + application.getTokenType() + "\",\n" + - " \"groups\": " + gson.toJson(application.getGroups()) + ",\n" + - " \"attributes\": " + gson.toJson(application.getAttributes()) + ",\n" + - " \"subscriptionScopes\": " + gson.toJson(application.getSubscriptionScopes()) + "\n" + - "}"; - RequestBody requestBody = RequestBody.create(JSON, applicationInfo); + JSONArray groups = new JSONArray(); + JSONArray subscriptionScope = new JSONArray(); + + if (application.getGroups() != null && application.getSubscriptionScopes() != null) { + for (String string : application.getGroups()) { + groups.put(string); + } + for (Scopes string : application.getSubscriptionScopes()) { + subscriptionScope.put(string); + } + } + + JSONObject applicationInfo = new JSONObject(); + applicationInfo.put("name", application.getName()); + applicationInfo.put("throttlingPolicy", application.getThrottlingPolicy()); + applicationInfo.put("description", application.getDescription()); + applicationInfo.put("tokenType", application.getTokenType()); + applicationInfo.put("groups", groups); + applicationInfo.put("attributes", new JSONObject()); + applicationInfo.put("subscriptionScopes", subscriptionScope); + + RequestBody requestBody = RequestBody.create(JSON, applicationInfo.toString()); Request.Builder builder = new Request.Builder(); builder.url(getAllScopesUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.post(requestBody); Request request = builder.build(); @@ -198,22 +171,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_CREATED == response.code()) { return gson.fromJson(response.body().string(), Application.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return createApplication(refreshedTokenInfo, application); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return createApplication(refreshedApiApplicationInfo, application); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request body"; log.error(msg); @@ -230,22 +194,15 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public Boolean deleteApplication(TokenInfo tokenInfo, String applicationId) + public Boolean deleteApplication(ApiApplicationInfo apiApplicationInfo, String applicationId) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String deleteScopesUrl = endPointPrefix + Constants.APPLICATIONS_API + Constants.SLASH + applicationId; Request.Builder builder = new Request.Builder(); builder.url(deleteScopesUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.delete(); Request request = builder.build(); @@ -254,22 +211,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_OK == response.code()) { return true; } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return deleteApplication(refreshedTokenInfo, applicationId); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return deleteApplication(refreshedApiApplicationInfo, applicationId); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request body"; log.error(msg); @@ -286,22 +234,15 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public Subscription[] getAllSubscriptions(TokenInfo tokenInfo, String applicationId) + public Subscription[] getAllSubscriptions(ApiApplicationInfo apiApplicationInfo, String applicationId) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String getAllScopesUrl = endPointPrefix + Constants.SUBSCRIPTION_API + "?applicationId=" + applicationId + "&limit=1000"; Request.Builder builder = new Request.Builder(); builder.url(getAllScopesUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.get(); Request request = builder.build(); @@ -311,22 +252,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { JSONArray subscriptionList = (JSONArray) new JSONObject(response.body().string()).get("list"); return gson.fromJson(subscriptionList.toString(), Subscription[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return getAllSubscriptions(refreshedTokenInfo, applicationId); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return getAllSubscriptions(refreshedApiApplicationInfo, applicationId); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -343,11 +275,9 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public APIInfo[] getAllApis(TokenInfo tokenInfo, Map queryParams, Map headerParams) + public APIInfo[] getAllApis(ApiApplicationInfo apiApplicationInfo, Map queryParams, Map headerParams) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); StringBuilder getAPIsURL = new StringBuilder(endPointPrefix + Constants.DEV_PORTAL_API); for (Map.Entry query : queryParams.entrySet()) { @@ -356,13 +286,9 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { Request.Builder builder = new Request.Builder(); builder.url(getAPIsURL.toString()); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); + for (Map.Entry header : headerParams.entrySet()) { builder.addHeader(header.getKey(), header.getValue()); } @@ -375,22 +301,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { JSONArray apiList = (JSONArray) new JSONObject(response.body().string()).get("list"); return gson.fromJson(apiList.toString(), APIInfo[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return getAllApis(refreshedTokenInfo, queryParams, headerParams); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return getAllApis(refreshedApiApplicationInfo, queryParams, headerParams); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -407,31 +324,24 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public Subscription createSubscription(TokenInfo tokenInfo, Subscription subscriptions) + public Subscription createSubscription(ApiApplicationInfo apiApplicationInfo, Subscription subscriptions) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String createSubscriptionUrl = endPointPrefix + Constants.SUBSCRIPTION_API; - String subscriptionObject = "{\n" + - " \"applicationId\": \"" + subscriptions.getApplicationId() + "\",\n" + - " \"apiId\": \"" + subscriptions.getApiId() + "\",\n" + - " \"throttlingPolicy\": \"" + subscriptions.getThrottlingPolicy() + "\",\n" + - " \"requestedThrottlingPolicy\": \"" + subscriptions.getRequestedThrottlingPolicy() + "\"\n" + - "}"; + JSONObject subscriptionObject = new JSONObject(); + subscriptionObject.put("applicationId", subscriptions.getApplicationId()); + subscriptionObject.put("apiId", subscriptions.getApiId()); + subscriptionObject.put("throttlingPolicy", subscriptions.getThrottlingPolicy()); + subscriptionObject.put("requestedThrottlingPolicy", subscriptions.getRequestedThrottlingPolicy()); - RequestBody requestBody = RequestBody.create(JSON, subscriptionObject); + RequestBody requestBody = RequestBody.create(JSON, subscriptionObject.toString()); Request.Builder builder = new Request.Builder(); builder.url(createSubscriptionUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); + builder.post(requestBody); Request request = builder.build(); @@ -440,22 +350,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_CREATED == response.code()) { return gson.fromJson(response.body().string(), Subscription.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return createSubscription(refreshedTokenInfo, subscriptions); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return createSubscription(refreshedApiApplicationInfo, subscriptions); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request body"; log.error(msg); @@ -472,11 +373,9 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public Subscription[] createSubscriptions(TokenInfo tokenInfo, List subscriptions) + public Subscription[] createSubscriptions(ApiApplicationInfo apiApplicationInfo, List subscriptions) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String createSubscriptionsUrl = endPointPrefix + Constants.SUBSCRIPTION_API + "/multiple"; String subscriptionsList = gson.toJson(subscriptions); @@ -484,13 +383,9 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { Request.Builder builder = new Request.Builder(); builder.url(createSubscriptionsUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); + builder.post(requestBody); Request request = builder.build(); @@ -499,22 +394,12 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_OK == response.code()) { return gson.fromJson(response.body().string(), Subscription[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return createSubscriptions(refreshedTokenInfo, subscriptions); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return createSubscriptions(refreshedApiApplicationInfo, subscriptions); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request body"; log.error(msg); @@ -531,42 +416,36 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public ApplicationKey generateApplicationKeys(TokenInfo tokenInfo, String applicationId, String keyManager, + public ApplicationKey generateApplicationKeys(ApiApplicationInfo apiApplicationInfo, String applicationId, String keyManager, String validityTime, String keyType) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String generateApplicationKeysUrl = endPointPrefix + Constants.APPLICATIONS_API + Constants.SLASH + applicationId + "/generate-keys"; - String keyInfo = "{\n" + - " \"keyType\": \"" + keyType + "\",\n" + - " \"keyManager\": \"" + keyManager + "\",\n" + - " \"grantTypesToBeSupported\": [\n" + - " \"password\",\n" + - " \"client_credentials\"\n" + - " ],\n" + - " \"callbackUrl\": \"\",\n" + - " \"scopes\": [\n" + - " \"am_application_scope\",\n" + - " \"default\"\n" + - " ],\n" + - " \"validityTime\": " + validityTime + ",\n" + - " \"additionalProperties\": {}\n" + - "}"; + JSONArray grantTypesToBeSupported = new JSONArray(); + grantTypesToBeSupported.put("password"); + grantTypesToBeSupported.put("client_credentials"); - RequestBody requestBody = RequestBody.create(JSON, keyInfo); + JSONArray scopes = new JSONArray(); + scopes.put("am_application_scope"); + scopes.put("default"); + + JSONObject keyInfo = new JSONObject(); + keyInfo.put("keyType", keyType); + keyInfo.put("keyManager", keyManager); + keyInfo.put("grantTypesToBeSupported", grantTypesToBeSupported); + keyInfo.put("callbackUrl", ""); + keyInfo.put("scopes", scopes); + keyInfo.put("validityTime", 3600); + keyInfo.put("additionalProperties", new JSONObject()); + + RequestBody requestBody = RequestBody.create(JSON, keyInfo.toString()); Request.Builder builder = new Request.Builder(); builder.url(generateApplicationKeysUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.post(requestBody); Request request = builder.build(); @@ -575,22 +454,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_OK == response.code()) { return gson.fromJson(response.body().string(), ApplicationKey.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return generateApplicationKeys(refreshedTokenInfo, applicationId, keyManager, validityTime, keyType); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return generateApplicationKeys(refreshedApiApplicationInfo, applicationId, keyManager, validityTime, keyType); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request body"; log.error(msg); @@ -607,31 +477,24 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public ApplicationKey mapApplicationKeys(TokenInfo tokenInfo, Application application, String keyManager, String keyType) + public ApplicationKey mapApplicationKeys(ApiApplicationInfo apiApplicationInfo, Application application, String keyManager, String keyType) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String getAllScopesUrl = endPointPrefix + Constants.APPLICATIONS_API + Constants.SLASH + application.getApplicationId() + "/map-keys"; - String payload = "{\n" + - " \"consumerKey\": \"" + apiApplicationInfo.getClientId() + "\",\n" + - " \"consumerSecret\": \"" + apiApplicationInfo.getClientSecret() + "\",\n" + - " \"keyManager\": \"" + keyManager + "\",\n" + - " \"keyType\": \"" + keyType + "\"\n" + - "}"; - RequestBody requestBody = RequestBody.create(JSON, payload); + JSONObject payload = new JSONObject(); + payload.put("consumerKey", apiApplicationInfo.getClientId()); + payload.put("consumerSecret", apiApplicationInfo.getClientSecret()); + payload.put("keyManager", keyManager); + payload.put("keyType", keyType); + + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request.Builder builder = new Request.Builder(); builder.url(getAllScopesUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.post(requestBody); Request request = builder.build(); @@ -640,22 +503,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_OK == response.code()) { return gson.fromJson(response.body().string(), ApplicationKey.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return mapApplicationKeys(refreshedTokenInfo, application, keyManager, keyType); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return mapApplicationKeys(refreshedApiApplicationInfo, application, keyManager, keyType); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request body"; log.error(msg); @@ -672,22 +526,15 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public ApplicationKey getKeyDetails(TokenInfo tokenInfo, String applicationId, String keyMapId) + public ApplicationKey getKeyDetails(ApiApplicationInfo apiApplicationInfo, String applicationId, String keyMapId) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String getKeyDetails = endPointPrefix + Constants.APPLICATIONS_API + Constants.SLASH + applicationId + "/oauth-keys/" + keyMapId; Request.Builder builder = new Request.Builder(); builder.url(getKeyDetails); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.get(); Request request = builder.build(); @@ -696,22 +543,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_OK == response.code()) { return gson.fromJson(response.body().string(), ApplicationKey.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return getKeyDetails(refreshedTokenInfo, applicationId, keyMapId); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return getKeyDetails(refreshedApiApplicationInfo, applicationId, keyMapId); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -728,23 +566,16 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public ApplicationKey updateGrantType(TokenInfo tokenInfo, String applicationId, String keyMapId, String keyManager, + public ApplicationKey updateGrantType(ApiApplicationInfo apiApplicationInfo, String applicationId, String keyMapId, String keyManager, List supportedGrantTypes, String callbackUrl) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String getKeyDetails = endPointPrefix + Constants.APPLICATIONS_API + Constants.SLASH + applicationId + "/oauth-keys/" + keyMapId; Request.Builder builder = new Request.Builder(); builder.url(getKeyDetails); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); JSONArray supportedGrantTypeList = new JSONArray(); for (String string : supportedGrantTypes) { @@ -768,22 +599,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { if (HttpStatus.SC_OK == response.code()) { return gson.fromJson(response.body().string(), ApplicationKey.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return updateGrantType(refreshedTokenInfo, applicationId, keyMapId, keyManager, supportedGrantTypes, callbackUrl); - } else { - String msg = "Invalid access token. Unauthorized request"; - log.error(msg); - throw new APIServicesException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return updateGrantType(refreshedApiApplicationInfo, applicationId, keyMapId, keyManager, supportedGrantTypes, callbackUrl); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -800,22 +622,15 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } @Override - public KeyManager[] getAllKeyManagers(TokenInfo tokenInfo) + public KeyManager[] getAllKeyManagers(ApiApplicationInfo apiApplicationInfo) throws APIServicesException, BadRequestException, UnexpectedResponseException { - ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); - boolean token = isTokenNull(apiApplicationInfo, tokenInfo.getAccessToken()); String getAllKeyManagersUrl = endPointPrefix + Constants.KEY_MANAGERS_API; Request.Builder builder = new Request.Builder(); builder.url(getAllKeyManagersUrl); - if (!token) { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + apiApplicationInfo.getAccess_token()); - } else { - builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER - + tokenInfo.getAccessToken()); - } + builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + apiApplicationInfo.getAccess_token()); builder.get(); Request request = builder.build(); @@ -825,22 +640,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { JSONArray keyManagerList = (JSONArray) new JSONObject(response.body().string()).get("list"); return gson.fromJson(keyManagerList.toString(), KeyManager[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { - if (!token) { - APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); - AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), - apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); - ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); - //TODO: max attempt count - TokenInfo refreshedTokenInfo = new TokenInfo(); - refreshedTokenInfo.setApiApplicationInfo(refreshedApiApplicationInfo); - refreshedTokenInfo.setAccessToken(null); - return getAllKeyManagers(refreshedTokenInfo); - } else { - String msg = "Invalid or null access token"; - log.error(msg); - throw new BadRequestException(msg); - } + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + AccessTokenInfo refreshedAccessToken = apiApplicationServices. + generateAccessTokenFromRefreshToken(apiApplicationInfo.getRefresh_token(), + apiApplicationInfo.getClientId(), apiApplicationInfo.getClientSecret()); + ApiApplicationInfo refreshedApiApplicationInfo = returnApplicationInfo(apiApplicationInfo, refreshedAccessToken); + return getAllKeyManagers(refreshedApiApplicationInfo); + //TODO: max attempt count } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { String msg = "Bad Request, Invalid request"; log.error(msg); @@ -856,29 +662,13 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices { } } - private ApiApplicationInfo returnApplicationInfo(ApiApplicationInfo refreshedApplicationInfo, AccessTokenInfo refreshedToken) { + private ApiApplicationInfo returnApplicationInfo(ApiApplicationInfo apiApplicationInfo, AccessTokenInfo refreshedToken) { - ApiApplicationInfo applicationInfo = null; - applicationInfo.setClientId(refreshedApplicationInfo.getClientId()); - applicationInfo.setClientSecret(refreshedApplicationInfo.getClientSecret()); + ApiApplicationInfo applicationInfo = new ApiApplicationInfo(); + applicationInfo.setClientId(apiApplicationInfo.getClientId()); + applicationInfo.setClientSecret(apiApplicationInfo.getClientSecret()); applicationInfo.setAccess_token(refreshedToken.getAccess_token()); applicationInfo.setRefresh_token(refreshedToken.getRefresh_token()); - return applicationInfo; } - - private boolean isTokenNull(ApiApplicationInfo apiApplicationInfo, String accessToken) throws BadRequestException { - - boolean token; - if ((!(accessToken == null))) { - token = true; - } else if (!(apiApplicationInfo == null) && accessToken == null) { - token = false; - } else { - String msg = "Null access token or Rest Application info"; - log.error(msg); - throw new BadRequestException(msg); - } - return token; - } } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/TokenInfo.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/TokenInfo.java deleted file mode 100644 index 72100c982b..0000000000 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/TokenInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto; - -/** - * This holds the API application information and access token for REST APIS cals. - */ -public class TokenInfo { - - private ApiApplicationInfo apiApplicationInfo; - private String accessToken; - - public ApiApplicationInfo getApiApplicationInfo() { - return apiApplicationInfo; - } - - public void setApiApplicationInfo(ApiApplicationInfo apiApplicationInfo) { - this.apiApplicationInfo = apiApplicationInfo; - } - - public String getAccessToken() { - return accessToken; - } - - public void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } -} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java index f1d3c73641..5afd9dbc65 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java @@ -20,7 +20,7 @@ package io.entgra.device.mgt.core.apimgt.keymgt.extension.service; import com.google.gson.Gson; import io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.TokenInfo; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.ApiApplicationInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; import io.entgra.device.mgt.core.apimgt.keymgt.extension.*; @@ -437,14 +437,13 @@ public class KeyMgtServiceImpl implements KeyMgtService { */ private io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application getApplication(String applicationName, String accessToken) throws KeyMgtException { - TokenInfo tokenInfo = new TokenInfo(); - tokenInfo.setApiApplicationInfo(null); - tokenInfo.setAccessToken(accessToken); + ApiApplicationInfo apiApplicationInfo = new ApiApplicationInfo(); + apiApplicationInfo.setAccess_token(accessToken); try { ConsumerRESTAPIServices consumerRESTAPIServices = KeyMgtDataHolder.getInstance().getConsumerRESTAPIServices(); io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application[] applications = - consumerRESTAPIServices.getAllApplications(tokenInfo, applicationName); + consumerRESTAPIServices.getAllApplications(apiApplicationInfo, applicationName); if (applications.length == 1) { return applications[0]; } else { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java index f7f46b7df1..3ba6e390f5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -27,7 +27,6 @@ import io.entgra.device.mgt.core.apimgt.application.extension.internal.APIApplic import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.TokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.keymgt.extension.DCRResponse; import io.entgra.device.mgt.core.apimgt.keymgt.extension.TokenRequest; @@ -828,8 +827,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { "perm:users:send-invitation"); APIManagementProviderService apiManagementProviderService = DeviceMgtAPIUtils.getAPIManagementService(); -// TokenInfo tokenInfo = new TokenInfo(); -// tokenInfo.setAccessToken(accessTokenInfo.getAccessToken()); apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(applicationName, new String[] {"device_management"}, "PRODUCTION", null, false, String.valueOf(validityTime), null, accessTokenInfo.getAccessToken(), null, null,true); From 69efff10bd0dfe3ea947f3d519600c7046916dc8 Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Mon, 25 Sep 2023 09:51:11 +0000 Subject: [PATCH 076/112] Implement state checking and csrf protection ## Purpose * Fixes for http://roadmap.entgra.net/issues/9846 Co-authored-by: rajitha Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/232 Co-authored-by: Rajitha Kumara Co-committed-by: Rajitha Kumara --- .../request/interceptor/SsoLoginCallbackHandler.java | 10 +++++++++- .../core/ui/request/interceptor/SsoLoginHandler.java | 12 +++++++----- .../ui/request/interceptor/util/HandlerUtil.java | 6 ++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginCallbackHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginCallbackHandler.java index 9e5c806723..2730090125 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginCallbackHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginCallbackHandler.java @@ -27,6 +27,7 @@ import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpHeaders; +import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -39,6 +40,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; +import java.util.Objects; @MultipartConfig @WebServlet("/ssoLoginCallback") @@ -47,6 +49,7 @@ public class SsoLoginCallbackHandler extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + String state = req.getParameter("state"); String code = req.getParameter("code"); HttpSession session = req.getSession(false); @@ -66,6 +69,11 @@ public class SsoLoginCallbackHandler extends HttpServlet { return; } + if (state == null || !Objects.equals(state, session.getAttribute("state").toString())) { + resp.sendError(HttpStatus.SC_BAD_REQUEST, "MismatchingStateError: CSRF Warning! State not equal in request and response"); + return; + } + String scope = session.getAttribute("scope").toString(); HttpPost tokenEndpoint = new HttpPost(keyManagerUrl + HandlerConstants.OAUTH2_TOKEN_ENDPOINT); @@ -75,7 +83,7 @@ public class SsoLoginCallbackHandler extends HttpServlet { String loginCallbackUrl = iotsCoreUrl + req.getContextPath() + HandlerConstants.SSO_LOGIN_CALLBACK; StringEntity tokenEPPayload = new StringEntity( - "grant_type=" + HandlerConstants.CODE_GRANT_TYPE + "&code=" + code + "&state=&scope=" + scope + + "grant_type=" + HandlerConstants.CODE_GRANT_TYPE + "&code=" + code + "&scope=" + scope + "&redirect_uri=" + loginCallbackUrl, ContentType.APPLICATION_FORM_URLENCODED); tokenEndpoint.setEntity(tokenEPPayload); diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java index 4686a8d0d7..78fb91f7ae 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java @@ -86,6 +86,7 @@ public class SsoLoginHandler extends HttpServlet { private LoginCache loginCache; private OAuthApp oAuthApp; private OAuthAppCacheKey oAuthAppCacheKey; + private String state; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { @@ -97,6 +98,7 @@ public class SsoLoginHandler extends HttpServlet { httpSession = req.getSession(true); + state = HandlerUtil.generateStateToken(); initializeAdminCredentials(); baseContextPath = req.getContextPath(); applicationName = baseContextPath.substring(1, baseContextPath.indexOf("-ui-request-handler")); @@ -127,12 +129,11 @@ public class SsoLoginHandler extends HttpServlet { String scopesSsoString = HandlerUtil.getScopeString(scopesSsoJson); String loginCallbackUrl = iotsCoreUrl + baseContextPath + HandlerConstants.SSO_LOGIN_CALLBACK; persistAuthSessionData(req, oAuthApp.getClientId(), oAuthApp.getClientSecret(), - oAuthApp.getEncodedClientApp(), scopesSsoString); - + oAuthApp.getEncodedClientApp(), scopesSsoString, state); resp.sendRedirect(keyManagerUrl + HandlerConstants.AUTHORIZATION_ENDPOINT + "?response_type=code" + + "&state=" + state + "&client_id=" + clientId + - "&state=" + "&scope=openid " + scopesSsoString + "&redirect_uri=" + loginCallbackUrl); } catch (IOException e) { @@ -186,7 +187,7 @@ public class SsoLoginHandler extends HttpServlet { clientSecret = jClientAppResultAsJsonObject.get("client_secret").getAsString(); encodedClientApp = Base64.getEncoder().encodeToString((clientId + ":" + clientSecret).getBytes()); String scopesString = HandlerUtil.getScopeString(scopes); - persistAuthSessionData(req, clientId, clientSecret, encodedClientApp, scopesString); + persistAuthSessionData(req, clientId, clientSecret, encodedClientApp, scopesString, state); } // cache the oauth app credentials @@ -287,13 +288,14 @@ public class SsoLoginHandler extends HttpServlet { * @param scopes - User scopes */ private void persistAuthSessionData(HttpServletRequest req, String clientId, String clientSecret, - String encodedClientApp, String scopes) { + String encodedClientApp, String scopes, String state) { httpSession = req.getSession(false); httpSession.setAttribute("clientId", clientId); httpSession.setAttribute("clientSecret", clientSecret); httpSession.setAttribute("encodedClientApp", encodedClientApp); httpSession.setAttribute("scope", scopes); httpSession.setAttribute("redirectUrl", req.getParameter("redirect")); + httpSession.setAttribute("state", state); httpSession.setMaxInactiveInterval(sessionTimeOut); } diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java index 75b1643598..0fca3811c0 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java @@ -71,6 +71,8 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringWriter; +import java.math.BigInteger; +import java.security.SecureRandom; import java.util.Enumeration; import java.util.List; @@ -763,4 +765,8 @@ public class HandlerUtil { } return otpManagementService; } + + public static String generateStateToken() { + return new BigInteger(130, new SecureRandom()).toString(32); + } } From 3c658f0afe61908f1a0cc5d74cc1e4428ba280c3 Mon Sep 17 00:00:00 2001 From: osh Date: Tue, 26 Sep 2023 17:42:37 +0530 Subject: [PATCH 077/112] Fix ownership issue in device deletion --- .../device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 5696c0b23f..1199203539 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -2811,18 +2811,16 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { * @throws DeviceManagementDAOException if refactoring fails */ public void refactorEnrolment(Connection conn, List deviceIds) throws DeviceManagementDAOException { - String updateQuery = "UPDATE DM_ENROLMENT SET OWNER = ?, OWNERSHIP = ?, STATUS = ? WHERE DEVICE_ID = ?"; + String updateQuery = "UPDATE DM_ENROLMENT SET OWNER = ?, STATUS = ? WHERE DEVICE_ID = ?"; try (PreparedStatement preparedStatement = conn.prepareStatement(updateQuery)) { for (int deviceId : deviceIds) { String randomOwner = generateRandomString(4); - String randomOwnership = generateRandomString(6); preparedStatement.setString(1, randomOwner); - preparedStatement.setString(2, randomOwnership); - preparedStatement.setString(3, String.valueOf(Status.DELETED)); - preparedStatement.setInt(4, deviceId); + preparedStatement.setString(2, String.valueOf(Status.DELETED)); + preparedStatement.setInt(3, deviceId); preparedStatement.executeUpdate(); } From 966b9194f2c9c7499bd21cf1c71538101bfef590 Mon Sep 17 00:00:00 2001 From: rajitha Date: Wed, 27 Sep 2023 11:05:48 +0530 Subject: [PATCH 078/112] Add missing scope --- .../src/main/resources/conf/mdm-ui-config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index 13553e3816..9a399dbe5f 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -367,6 +367,7 @@ perm:app:vpp:user:view perm:app:vpp:asset:modify perm:app:vpp:asset:view + perm:android:enroll device-mgt From 144170c4c9a443b7982c1a5dbf959d0d65e736ee Mon Sep 17 00:00:00 2001 From: pasindu Date: Wed, 27 Sep 2023 15:10:51 +0530 Subject: [PATCH 079/112] Fix sso loging app creation payload --- .../ui/request/interceptor/LoginHandler.java | 3 +- .../request/interceptor/SsoLoginHandler.java | 236 +++++++++--------- .../interceptor/util/HandlerConstants.java | 1 + .../request/interceptor/util/HandlerUtil.java | 12 +- 4 files changed, 131 insertions(+), 121 deletions(-) diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java index b058322933..9aa6eec0ad 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java @@ -86,7 +86,8 @@ public class LoginHandler extends HttpServlet { apiRegEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + Base64.getEncoder() .encodeToString((username + HandlerConstants.COLON + password).getBytes())); apiRegEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); - apiRegEndpoint.setEntity(HandlerUtil.constructAppRegPayload(tags, HandlerConstants.PUBLISHER_APPLICATION_NAME, username, password)); + apiRegEndpoint.setEntity(HandlerUtil.constructAppRegPayload(tags, HandlerConstants.PUBLISHER_APPLICATION_NAME, + username, password, null, null)); ProxyResponse clientAppResponse = HandlerUtil.execute(apiRegEndpoint); diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java index 78a95c019f..29ccff3519 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java @@ -38,7 +38,6 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.protocol.HTTP; import org.json.JSONArray; -import org.json.JSONObject; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; @@ -157,6 +156,8 @@ public class SsoLoginHandler extends HttpServlet { JsonArray tags = uiConfigJsonObject.get("appRegistration").getAsJsonObject().get("tags").getAsJsonArray(); JsonArray scopes = uiConfigJsonObject.get("scopes").getAsJsonArray(); sessionTimeOut = Integer.parseInt(String.valueOf(uiConfigJsonObject.get("sessionTimeOut"))); + JsonArray supportedGrantTypes = constructAppGrantTypeUpdateArray(); + String callbackUrl = iotsCoreUrl + baseContextPath + HandlerConstants.SSO_LOGIN_CALLBACK; // Register the client application HttpPost apiRegEndpoint = new HttpPost(gatewayUrl + HandlerConstants.APP_REG_ENDPOINT); @@ -165,7 +166,8 @@ public class SsoLoginHandler extends HttpServlet { apiRegEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + encodedAdminCredentials); apiRegEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); - apiRegEndpoint.setEntity(HandlerUtil.constructAppRegPayload(tags, applicationName, adminUsername, adminPassword)); + apiRegEndpoint.setEntity(HandlerUtil.constructAppRegPayload(tags, applicationName, adminUsername, adminPassword, + callbackUrl, supportedGrantTypes)); ProxyResponse clientAppResponse = HandlerUtil.execute(apiRegEndpoint); @@ -325,21 +327,17 @@ public class SsoLoginHandler extends HttpServlet { /*** * Generates payload for application grant_type update payload * - * @return {@link StringEntity} of the payload to update application grant type + * @return {@link JsonArray} of the payload to update application grant type */ - private StringEntity constructAppGrantTypeUpdatePayload() { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("supportedGrantTypes", - new JSONArray(new Object[]{ - HandlerConstants.CODE_GRANT_TYPE, - HandlerConstants.REFRESH_TOKEN_GRANT_TYPE, - HandlerConstants.PASSWORD_GRANT_TYPE, - HandlerConstants.JWT_BEARER_GRANT_TYPE - }) - ); - jsonObject.put(HandlerConstants.CALLBACK_URL_KEY, iotsCoreUrl + baseContextPath + HandlerConstants.SSO_LOGIN_CALLBACK); - String payload = jsonObject.toString(); - return new StringEntity(payload, ContentType.APPLICATION_JSON); + private JsonArray constructAppGrantTypeUpdateArray() { + JsonArray jsonArray = new JsonArray(); + + jsonArray.add( HandlerConstants.CODE_GRANT_TYPE); + jsonArray.add( HandlerConstants.REFRESH_TOKEN_GRANT_TYPE); + jsonArray.add( HandlerConstants.PASSWORD_GRANT_TYPE); + jsonArray.add( HandlerConstants.JWT_BEARER_GRANT_TYPE); + + return jsonArray; } /*** @@ -390,107 +388,107 @@ public class SsoLoginHandler extends HttpServlet { return jTokenResultAsJsonObject.get("access_token").getAsString(); } - /*** - * Updates Application - * - * @param appName - Application name - * @throws IOException IO exception throws if an error occurred when invoking token endpoint - * @throws ParserConfigurationException,SAXException throws if an error occurred when parsing xml - */ - private void updateSaasApp(String appName) throws ParserConfigurationException, IOException, SAXException { - File getAppRequestXmlFile = new File(HandlerConstants.PAYLOADS_DIR + "/get-app-request.xml"); - String identityAppMgtUrl = apiMgtUrl + HandlerConstants.IDENTITY_APP_MGT_ENDPOINT; - - HttpPost getApplicationEndpoint = new HttpPost(identityAppMgtUrl); - getApplicationEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + - encodedAdminCredentials); - getApplicationEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.TEXT_XML.toString()); - getApplicationEndpoint.setHeader(HandlerConstants.SOAP_ACTION_HEADER, "urn:getApplication"); - - String requestBodyString = HandlerUtil.xmlToString(getAppRequestXmlFile); - - Map data = new HashMap<>(); - appName = adminUsername + HandlerConstants.UNDERSCORE + appName + HandlerConstants.UNDERSCORE + - HandlerConstants.PRODUCTION_KEY; - data.put("applicationName", appName); - requestBodyString = StrSubstitutor.replace(requestBodyString, data); - getApplicationEndpoint.setEntity(new StringEntity(requestBodyString, ContentType.TEXT_XML)); - - ProxyResponse getApplicationEndpointResponse = HandlerUtil.execute(getApplicationEndpoint); - - Document doc = DocumentBuilderFactory.newInstance() - .newDocumentBuilder() - .parse(new InputSource(new StringReader(getApplicationEndpointResponse.getData()))); - NodeList nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "inboundAuthenticationConfig"); - NodeList childNodeList; - String nodeName; - - data.clear(); - data.put("applicationId", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "applicationID").item(0).getTextContent()); - data.put("applicationName", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "applicationName").item(0).getTextContent()); - data.put("description", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "description").item(0).getTextContent()); - data.put("saasApp", "true"); - - for (int i = 0; i < nodeList.getLength(); i++) { - childNodeList = nodeList.item(i).getChildNodes(); - for (int j = 0; j < childNodeList.getLength(); j++) { - if (childNodeList.item(j).getNodeName().equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthenticationRequestConfigs")) { - NodeList inboundAuthRequestConfigs = childNodeList.item(j).getChildNodes(); - for (int k = 0; k < inboundAuthRequestConfigs.getLength(); k++) { - nodeName = inboundAuthRequestConfigs.item(k).getNodeName(); - if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthKey")) { - data.put("inboundAuthKey", inboundAuthRequestConfigs.item(k).getTextContent()); - } - if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthType")) { - data.put("inboundAuthType", inboundAuthRequestConfigs.item(k).getTextContent()); - } - if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundConfigType")) { - data.put("inboundConfigType", inboundAuthRequestConfigs.item(k).getTextContent()); - } - } - } - } - } - - nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "owner"); - for (int i = 0; i < nodeList.getLength(); i++) { - childNodeList = nodeList.item(i).getChildNodes(); - for (int j = 0; j < childNodeList.getLength(); j++) { - switch (childNodeList.item(j).getNodeName()) { - case HandlerConstants.AX_PREFIX + "tenantDomain": - data.put("tenantDomain", childNodeList.item(j).getTextContent()); - break; - case HandlerConstants.AX_PREFIX + "userName": - data.put("userName", childNodeList.item(j).getTextContent()); - break; - case HandlerConstants.AX_PREFIX + "userStoreDomain": - data.put("userStoreDomain", childNodeList.item(j).getTextContent()); - break; - } - } - } - - nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "spProperties"); - for (int k = 0; k < nodeList.getLength(); k++) { - childNodeList = nodeList.item(k).getChildNodes(); - for (int l = 0; l < childNodeList.getLength(); l++) { - if (childNodeList.item(l).getNodeName().equalsIgnoreCase(HandlerConstants.AX_PREFIX + "value")) { - data.put("displayName", childNodeList.item(l).getTextContent()); - } - } - } - - File appUpdateRequest = new File(HandlerConstants.PAYLOADS_DIR + "/update-app-request.xml"); - String docStr = HandlerUtil.xmlToString(appUpdateRequest); - requestBodyString = StrSubstitutor.replace(docStr, data); - - HttpPost updateApplicationEndpoint = new HttpPost(identityAppMgtUrl); - updateApplicationEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + - encodedAdminCredentials); - updateApplicationEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.TEXT_XML.toString()); - updateApplicationEndpoint.setHeader(HandlerConstants.SOAP_ACTION_HEADER, "urn:updateApplication"); - updateApplicationEndpoint.setEntity(new StringEntity(requestBodyString, ContentType.TEXT_XML)); - - HandlerUtil.execute(updateApplicationEndpoint); - } +// /*** +// * Updates Application +// * +// * @param appName - Application name +// * @throws IOException IO exception throws if an error occurred when invoking token endpoint +// * @throws ParserConfigurationException,SAXException throws if an error occurred when parsing xml +// */ +// private void updateSaasApp(String appName) throws ParserConfigurationException, IOException, SAXException { +// File getAppRequestXmlFile = new File(HandlerConstants.PAYLOADS_DIR + "/get-app-request.xml"); +// String identityAppMgtUrl = apiMgtUrl + HandlerConstants.IDENTITY_APP_MGT_ENDPOINT; +// +// HttpPost getApplicationEndpoint = new HttpPost(identityAppMgtUrl); +// getApplicationEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + +// encodedAdminCredentials); +// getApplicationEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.TEXT_XML.toString()); +// getApplicationEndpoint.setHeader(HandlerConstants.SOAP_ACTION_HEADER, "urn:getApplication"); +// +// String requestBodyString = HandlerUtil.xmlToString(getAppRequestXmlFile); +// +// Map data = new HashMap<>(); +// appName = adminUsername + HandlerConstants.UNDERSCORE + appName + HandlerConstants.UNDERSCORE + +// HandlerConstants.PRODUCTION_KEY; +// data.put("applicationName", appName); +// requestBodyString = StrSubstitutor.replace(requestBodyString, data); +// getApplicationEndpoint.setEntity(new StringEntity(requestBodyString, ContentType.TEXT_XML)); +// +// ProxyResponse getApplicationEndpointResponse = HandlerUtil.execute(getApplicationEndpoint); +// +// Document doc = DocumentBuilderFactory.newInstance() +// .newDocumentBuilder() +// .parse(new InputSource(new StringReader(getApplicationEndpointResponse.getData()))); +// NodeList nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "inboundAuthenticationConfig"); +// NodeList childNodeList; +// String nodeName; +// +// data.clear(); +// data.put("applicationId", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "applicationID").item(0).getTextContent()); +// data.put("applicationName", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "applicationName").item(0).getTextContent()); +// data.put("description", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "description").item(0).getTextContent()); +// data.put("saasApp", "true"); +// +// for (int i = 0; i < nodeList.getLength(); i++) { +// childNodeList = nodeList.item(i).getChildNodes(); +// for (int j = 0; j < childNodeList.getLength(); j++) { +// if (childNodeList.item(j).getNodeName().equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthenticationRequestConfigs")) { +// NodeList inboundAuthRequestConfigs = childNodeList.item(j).getChildNodes(); +// for (int k = 0; k < inboundAuthRequestConfigs.getLength(); k++) { +// nodeName = inboundAuthRequestConfigs.item(k).getNodeName(); +// if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthKey")) { +// data.put("inboundAuthKey", inboundAuthRequestConfigs.item(k).getTextContent()); +// } +// if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthType")) { +// data.put("inboundAuthType", inboundAuthRequestConfigs.item(k).getTextContent()); +// } +// if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundConfigType")) { +// data.put("inboundConfigType", inboundAuthRequestConfigs.item(k).getTextContent()); +// } +// } +// } +// } +// } +// +// nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "owner"); +// for (int i = 0; i < nodeList.getLength(); i++) { +// childNodeList = nodeList.item(i).getChildNodes(); +// for (int j = 0; j < childNodeList.getLength(); j++) { +// switch (childNodeList.item(j).getNodeName()) { +// case HandlerConstants.AX_PREFIX + "tenantDomain": +// data.put("tenantDomain", childNodeList.item(j).getTextContent()); +// break; +// case HandlerConstants.AX_PREFIX + "userName": +// data.put("userName", childNodeList.item(j).getTextContent()); +// break; +// case HandlerConstants.AX_PREFIX + "userStoreDomain": +// data.put("userStoreDomain", childNodeList.item(j).getTextContent()); +// break; +// } +// } +// } +// +// nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "spProperties"); +// for (int k = 0; k < nodeList.getLength(); k++) { +// childNodeList = nodeList.item(k).getChildNodes(); +// for (int l = 0; l < childNodeList.getLength(); l++) { +// if (childNodeList.item(l).getNodeName().equalsIgnoreCase(HandlerConstants.AX_PREFIX + "value")) { +// data.put("displayName", childNodeList.item(l).getTextContent()); +// } +// } +// } +// +// File appUpdateRequest = new File(HandlerConstants.PAYLOADS_DIR + "/update-app-request.xml"); +// String docStr = HandlerUtil.xmlToString(appUpdateRequest); +// requestBodyString = StrSubstitutor.replace(docStr, data); +// +// HttpPost updateApplicationEndpoint = new HttpPost(identityAppMgtUrl); +// updateApplicationEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + +// encodedAdminCredentials); +// updateApplicationEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.TEXT_XML.toString()); +// updateApplicationEndpoint.setHeader(HandlerConstants.SOAP_ACTION_HEADER, "urn:updateApplication"); +// updateApplicationEndpoint.setEntity(new StringEntity(requestBodyString, ContentType.TEXT_XML)); +// +// HandlerUtil.execute(updateApplicationEndpoint); +// } } diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerConstants.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerConstants.java index c6058102b6..0b56bbc578 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerConstants.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerConstants.java @@ -43,6 +43,7 @@ public class HandlerConstants { public static final String SESSION_DEFAULT_AUTH_DATA_KEY = "defaultAuthInfo"; public static final String UI_CONFIG_KEY = "ui-config"; public static final String CALLBACK_URL_KEY = "callbackUrl"; + public static final String GRANT_TYPE_KEY = "supportedGrantTypes"; public static final String IS_ALLOWED_TO_ALL_DOMAINS_KEY = "isAllowedToAllDomains"; public static final String JSESSIONID_KEY = "JSESSIONID"; public static final String COMMON_AUTH_ID_KEY = "commonAuthId"; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java index cd2f1f8fe0..2257d9e6d0 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java @@ -461,15 +461,25 @@ public class HandlerUtil { * @param tags - tags which are retrieved by reading app manager configuration * @param username - username provided from login form or admin username * @param password - password provided from login form or admin password + * @param callbackUrl - callback url + * @param supportedGrantTypes - supported grant types * @return {@link StringEntity} of the payload to create the client application */ - public static StringEntity constructAppRegPayload(JsonArray tags, String appName, String username, String password) { + public static StringEntity constructAppRegPayload(JsonArray tags, String appName, String username, String password, + String callbackUrl, JsonArray supportedGrantTypes) { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty(HandlerConstants.APP_NAME_KEY, appName); jsonObject.addProperty(HandlerConstants.USERNAME, username); jsonObject.addProperty(HandlerConstants.PASSWORD, password); jsonObject.addProperty(HandlerConstants.IS_ALLOWED_TO_ALL_DOMAINS_KEY, "false"); jsonObject.add(HandlerConstants.TAGS_KEY, tags); + if (callbackUrl != null) { + jsonObject.addProperty(HandlerConstants.CALLBACK_URL_KEY, callbackUrl); + } + if (supportedGrantTypes != null) { + jsonObject.add(HandlerConstants.GRANT_TYPE_KEY, supportedGrantTypes); + + } String payload = jsonObject.toString(); return new StringEntity(payload, ContentType.APPLICATION_JSON); } From e128a2479f248c0886fa2e1298492018faaa4b4f Mon Sep 17 00:00:00 2001 From: pasindu Date: Wed, 27 Sep 2023 15:37:35 +0530 Subject: [PATCH 080/112] Clear unused method --- .../request/interceptor/SsoLoginHandler.java | 188 +----------------- 1 file changed, 4 insertions(+), 184 deletions(-) diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java index 29ccff3519..d063079e74 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java @@ -203,87 +203,11 @@ public class SsoLoginHandler extends HttpServlet { HandlerUtil.handleError(resp, null); throw new LoginException(msg); } - - // Get the details of the registered application -// String getApplicationEndpointUrl = apiMgtUrl + HandlerConstants.APIM_APPLICATIONS_ENDPOINT + -// "?query=" + applicationName; -// HttpGet getApplicationEndpoint = new HttpGet(getApplicationEndpointUrl); -// getApplicationEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BEARER + -// getAccessToken(resp, encodedClientApp)); -// -// ProxyResponse getApplicationResponse = HandlerUtil.execute(getApplicationEndpoint); -// -// if (getApplicationResponse.getCode() == HttpStatus.SC_OK) { -// JsonParser jsonParser = new JsonParser(); -// JsonElement jAppResult = jsonParser.parse(getApplicationResponse.getData()); -// if (jAppResult.isJsonObject()) { -// JsonObject jClientAppResultAsJsonObject = jAppResult.getAsJsonObject(); -// JsonArray appList = jClientAppResultAsJsonObject.getAsJsonArray("list"); -// JsonObject app; -// for (JsonElement appJson : appList) { -// app = appJson.getAsJsonObject(); -// if (app.get("name").getAsString().equals(applicationName)) { -// applicationId = app.get("applicationId").getAsString(); -// break; -// } -// } -// } -// } else if (getApplicationResponse.getCode() == HttpStatus.SC_UNAUTHORIZED) { -// String msg = "Unauthorized attempt to get registered application data. " + -// "Application Name: " + applicationName + ". Response message: " + clientAppResponse.getData(); -// log.error(msg); -// HandlerUtil.handleError(resp, getApplicationResponse); -// throw new LoginException(msg); -// } else { -// String msg = "Failed the process while getting the data of registered application. " + -// "Application Name: " + applicationName + ". Response Code: " -// + clientAppResponse.getCode() + ", Response message: " + clientAppResponse.getData(); -// log.error(msg); -// HandlerUtil.handleError(resp, null); -// throw new LoginException(msg); -// } - - // Update the grant types of the application -// String url = apiMgtUrl + HandlerConstants.APIM_APPLICATIONS_ENDPOINT + "/" + applicationId + "/keys/" + -// HandlerConstants.PRODUCTION_KEY; -// HttpPut updateApplicationGrantTypesEndpoint = new HttpPut(url); -// updateApplicationGrantTypesEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BEARER + -// getAccessToken(resp, encodedClientApp)); -// updateApplicationGrantTypesEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); -// updateApplicationGrantTypesEndpoint.setEntity(constructAppGrantTypeUpdatePayload()); -// -// ProxyResponse updateApplicationGrantTypesEndpointResponse = HandlerUtil.execute(updateApplicationGrantTypesEndpoint); -// -// // Update app as a SaaS app -// this.updateSaasApp(applicationId); -// -// if (updateApplicationGrantTypesEndpointResponse.getCode() == HttpStatus.SC_UNAUTHORIZED) { -// String msg = "Unauthorized attempt to update the grant types of the application. " + -// "Application ID: " + applicationId + ". Response message: " -// + updateApplicationGrantTypesEndpointResponse.getData(); -// log.error(msg); -// HandlerUtil.handleError(resp, updateApplicationGrantTypesEndpointResponse); -// throw new LoginException(msg); -// } else if (updateApplicationGrantTypesEndpointResponse.getCode() != HttpStatus.SC_OK) { -// String msg = "Failed the process while updating the grant types of the application. " + -// "Application ID: " + applicationId + ". Response Code: " -// + updateApplicationGrantTypesEndpointResponse.getCode() + ", Response message: " -// + updateApplicationGrantTypesEndpointResponse.getData(); -// log.error(msg); -// HandlerUtil.handleError(resp, null); -// throw new LoginException(msg); -// } } catch (IOException e) { throw new LoginException("Error occurred while sending the response into the socket.", e); } catch (JsonSyntaxException e) { throw new LoginException("Error occurred while parsing the response.", e); } -// catch (ParserConfigurationException e) { -// throw new LoginException("Error while creating the document builder.", e); -// } -// catch (SAXException e) { -// throw new LoginException("Error while parsing xml file.", e); -// } } /** @@ -332,10 +256,10 @@ public class SsoLoginHandler extends HttpServlet { private JsonArray constructAppGrantTypeUpdateArray() { JsonArray jsonArray = new JsonArray(); - jsonArray.add( HandlerConstants.CODE_GRANT_TYPE); - jsonArray.add( HandlerConstants.REFRESH_TOKEN_GRANT_TYPE); - jsonArray.add( HandlerConstants.PASSWORD_GRANT_TYPE); - jsonArray.add( HandlerConstants.JWT_BEARER_GRANT_TYPE); + jsonArray.add(HandlerConstants.CODE_GRANT_TYPE); + jsonArray.add(HandlerConstants.REFRESH_TOKEN_GRANT_TYPE); + jsonArray.add(HandlerConstants.PASSWORD_GRANT_TYPE); + jsonArray.add(HandlerConstants.JWT_BEARER_GRANT_TYPE); return jsonArray; } @@ -387,108 +311,4 @@ public class SsoLoginHandler extends HttpServlet { JsonObject jTokenResultAsJsonObject = jTokenResult.getAsJsonObject(); return jTokenResultAsJsonObject.get("access_token").getAsString(); } - -// /*** -// * Updates Application -// * -// * @param appName - Application name -// * @throws IOException IO exception throws if an error occurred when invoking token endpoint -// * @throws ParserConfigurationException,SAXException throws if an error occurred when parsing xml -// */ -// private void updateSaasApp(String appName) throws ParserConfigurationException, IOException, SAXException { -// File getAppRequestXmlFile = new File(HandlerConstants.PAYLOADS_DIR + "/get-app-request.xml"); -// String identityAppMgtUrl = apiMgtUrl + HandlerConstants.IDENTITY_APP_MGT_ENDPOINT; -// -// HttpPost getApplicationEndpoint = new HttpPost(identityAppMgtUrl); -// getApplicationEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + -// encodedAdminCredentials); -// getApplicationEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.TEXT_XML.toString()); -// getApplicationEndpoint.setHeader(HandlerConstants.SOAP_ACTION_HEADER, "urn:getApplication"); -// -// String requestBodyString = HandlerUtil.xmlToString(getAppRequestXmlFile); -// -// Map data = new HashMap<>(); -// appName = adminUsername + HandlerConstants.UNDERSCORE + appName + HandlerConstants.UNDERSCORE + -// HandlerConstants.PRODUCTION_KEY; -// data.put("applicationName", appName); -// requestBodyString = StrSubstitutor.replace(requestBodyString, data); -// getApplicationEndpoint.setEntity(new StringEntity(requestBodyString, ContentType.TEXT_XML)); -// -// ProxyResponse getApplicationEndpointResponse = HandlerUtil.execute(getApplicationEndpoint); -// -// Document doc = DocumentBuilderFactory.newInstance() -// .newDocumentBuilder() -// .parse(new InputSource(new StringReader(getApplicationEndpointResponse.getData()))); -// NodeList nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "inboundAuthenticationConfig"); -// NodeList childNodeList; -// String nodeName; -// -// data.clear(); -// data.put("applicationId", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "applicationID").item(0).getTextContent()); -// data.put("applicationName", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "applicationName").item(0).getTextContent()); -// data.put("description", doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "description").item(0).getTextContent()); -// data.put("saasApp", "true"); -// -// for (int i = 0; i < nodeList.getLength(); i++) { -// childNodeList = nodeList.item(i).getChildNodes(); -// for (int j = 0; j < childNodeList.getLength(); j++) { -// if (childNodeList.item(j).getNodeName().equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthenticationRequestConfigs")) { -// NodeList inboundAuthRequestConfigs = childNodeList.item(j).getChildNodes(); -// for (int k = 0; k < inboundAuthRequestConfigs.getLength(); k++) { -// nodeName = inboundAuthRequestConfigs.item(k).getNodeName(); -// if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthKey")) { -// data.put("inboundAuthKey", inboundAuthRequestConfigs.item(k).getTextContent()); -// } -// if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundAuthType")) { -// data.put("inboundAuthType", inboundAuthRequestConfigs.item(k).getTextContent()); -// } -// if (nodeName.equalsIgnoreCase(HandlerConstants.AX_PREFIX + "inboundConfigType")) { -// data.put("inboundConfigType", inboundAuthRequestConfigs.item(k).getTextContent()); -// } -// } -// } -// } -// } -// -// nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "owner"); -// for (int i = 0; i < nodeList.getLength(); i++) { -// childNodeList = nodeList.item(i).getChildNodes(); -// for (int j = 0; j < childNodeList.getLength(); j++) { -// switch (childNodeList.item(j).getNodeName()) { -// case HandlerConstants.AX_PREFIX + "tenantDomain": -// data.put("tenantDomain", childNodeList.item(j).getTextContent()); -// break; -// case HandlerConstants.AX_PREFIX + "userName": -// data.put("userName", childNodeList.item(j).getTextContent()); -// break; -// case HandlerConstants.AX_PREFIX + "userStoreDomain": -// data.put("userStoreDomain", childNodeList.item(j).getTextContent()); -// break; -// } -// } -// } -// -// nodeList = doc.getElementsByTagName(HandlerConstants.AX_PREFIX + "spProperties"); -// for (int k = 0; k < nodeList.getLength(); k++) { -// childNodeList = nodeList.item(k).getChildNodes(); -// for (int l = 0; l < childNodeList.getLength(); l++) { -// if (childNodeList.item(l).getNodeName().equalsIgnoreCase(HandlerConstants.AX_PREFIX + "value")) { -// data.put("displayName", childNodeList.item(l).getTextContent()); -// } -// } -// } -// -// File appUpdateRequest = new File(HandlerConstants.PAYLOADS_DIR + "/update-app-request.xml"); -// String docStr = HandlerUtil.xmlToString(appUpdateRequest); -// requestBodyString = StrSubstitutor.replace(docStr, data); -// -// HttpPost updateApplicationEndpoint = new HttpPost(identityAppMgtUrl); -// updateApplicationEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + -// encodedAdminCredentials); -// updateApplicationEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.TEXT_XML.toString()); -// updateApplicationEndpoint.setHeader(HandlerConstants.SOAP_ACTION_HEADER, "urn:updateApplication"); -// updateApplicationEndpoint.setEntity(new StringEntity(requestBodyString, ContentType.TEXT_XML)); -// -// HandlerUtil.execute(updateApplicationEndpoint); -// } } From 48a72e80e9020c5c35b97fce2ed170e6b0e5c037 Mon Sep 17 00:00:00 2001 From: Viranga Gunarathna Date: Wed, 27 Sep 2023 23:48:16 +0530 Subject: [PATCH 081/112] Modify scope keys --- .../proxy/api/GrafanaAPIProxyService.java | 12 +- .../lifecycle/util/AnnotationProcessor.java | 2 +- .../webapp/publisher/utils/TestUtils.java | 2 +- .../mgt/api/CertificateMgtService.java | 4 +- .../CertificateManagementAdminService.java | 20 +- .../api/ActivityInfoProviderService.java | 12 +- .../AnalyticsArtifactsManagementService.java | 38 +- .../api/ConfigurationManagementService.java | 8 +- .../jaxrs/service/api/DeviceAgentService.java | 30 +- .../api/DeviceEventManagementService.java | 16 +- .../service/api/DeviceManagementService.java | 98 ++--- .../api/DeviceTypeManagementService.java | 16 +- .../service/api/GeoLocationBasedService.java | 42 +- .../service/api/GroupManagementService.java | 75 ++-- .../jaxrs/service/api/MetadataService.java | 18 +- .../api/NotificationManagementService.java | 10 +- .../service/api/PolicyManagementService.java | 46 +-- .../service/api/RemoteSessionService.java | 4 +- .../service/api/ReportManagementService.java | 18 +- .../service/api/RoleManagementService.java | 36 +- .../service/api/UserManagementService.java | 64 +-- .../jaxrs/service/api/WhiteLabelService.java | 10 +- .../ApplicationManagementAdminService.java | 8 +- ...DeviceAccessAuthorizationAdminService.java | 6 +- ...AnalyticsArtifactUploaderAdminService.java | 4 +- .../admin/DeviceManagementAdminService.java | 20 +- .../DeviceTypeManagementAdminService.java | 26 +- .../admin/GroupManagementAdminService.java | 18 +- .../api/admin/UserManagementAdminService.java | 10 +- .../DeviceManagementConfigService.java | 14 +- .../mgt/core/DeviceManagementConstants.java | 2 +- .../devicemgt/app/conf/config.json | 195 ++++----- .../modules/business-controllers/device.js | 4 +- .../private/config.json | 16 +- .../type-view.hbs | 2 +- .../api/ConfigurationManagementService.java | 4 +- .../src/main/resources/conf/mdm-ui-config.xml | 389 +++++++++--------- 37 files changed, 649 insertions(+), 650 deletions(-) diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java index c7081b8b97..d87eef1034 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java @@ -58,7 +58,7 @@ import javax.ws.rs.core.UriInfo; @Scope( name = "Using Grafana APIs required for Grafana iframes", description = "Grafana API proxy to validate requests.", - key = "perm:grafana:api:view", + key = "grafana:api:view", roles = {"Internal/grafanamgt-user"}, permissions = {"/analytics-mgt/grafana-mgt/api/view"} ) @@ -84,7 +84,7 @@ public interface GrafanaAPIProxyService { tags = "Analytics", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:grafana:api:view") + @ExtensionProperty(name = SCOPE, value = "grafana:api:view") }) } ) @@ -101,7 +101,7 @@ public interface GrafanaAPIProxyService { tags = "Analytics", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:grafana:api:view") + @ExtensionProperty(name = SCOPE, value = "grafana:api:view") }) } ) @@ -117,7 +117,7 @@ public interface GrafanaAPIProxyService { tags = "Analytics", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:grafana:api:view") + @ExtensionProperty(name = SCOPE, value = "grafana:api:view") }) } ) @@ -134,7 +134,7 @@ public interface GrafanaAPIProxyService { tags = "Analytics", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:grafana:api:view") + @ExtensionProperty(name = SCOPE, value = "grafana:api:view") }) } ) @@ -150,7 +150,7 @@ public interface GrafanaAPIProxyService { tags = "Analytics", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:grafana:api:view") + @ExtensionProperty(name = SCOPE, value = "grafana:api:view") }) } ) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index d51fe20f63..704de6442c 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -86,7 +86,7 @@ public class AnnotationProcessor { private static final String ANNOTATIONS_SCOPES = "scopes"; private static final String ANNOTATIONS_SCOPE = "scope"; private static final String DEFAULT_SCOPE_NAME = "default admin scope"; - private static final String DEFAULT_SCOPE_KEY = "perm:admin"; + private static final String DEFAULT_SCOPE_KEY = "dm:admin"; private static final String DEFAULT_SCOPE_PERMISSION = "/permision/device-mgt"; private static final String DEFAULT_SCOPE_ROLE = "admin"; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/utils/TestUtils.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/utils/TestUtils.java index 0161c5cef5..988bd9c5f7 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/utils/TestUtils.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/utils/TestUtils.java @@ -37,7 +37,7 @@ public class TestUtils { template.setResourceURI("https://localhost:9443/api/device-mgt/windows/v1.0/admin/devices/reboot"); template.setUriTemplate(uriTemplate); ApiScope scope = new ApiScope(); - scope.setKey("perm:windows:reboot"); + scope.setKey("win:ops:reboot"); scope.setName("Reboot"); scope.setRoles("/permission/admin/device-mgt/devices/owning-device/operations/windows/reboot"); scope.setDescription("Lock reset on Windows devices"); diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/api/CertificateMgtService.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/api/CertificateMgtService.java index db14d6f072..f2bdb8fafd 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/api/CertificateMgtService.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/api/CertificateMgtService.java @@ -58,7 +58,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Sign CSR", description = "Sign CSR", - key = "perm:sign-csr", + key = "dm:sign-csr", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/certificates/manage"} ) @@ -87,7 +87,7 @@ public interface CertificateMgtService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:sign-csr") + @ExtensionProperty(name = SCOPE, value = "dm:sign-csr") }) } ) diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java index af77d74719..34ddbd193a 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java @@ -62,35 +62,35 @@ import javax.ws.rs.core.Response; @Scope( name = "Adding a new SSL certificate", description = "Adding a new SSL certificate", - key = "perm:admin:certificates:add", + key = "cm:cert:add", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/certificates/add"} ), @Scope( name = "Getting Details of an SSL Certificate", description = "Getting Details of an SSL Certificate", - key = "perm:admin:certificates:details", + key = "cm:cert:details:get", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/certificates/details"} ), @Scope( name = "Getting Details of Certificates", description = "Getting Details of Certificates", - key = "perm:admin:certificates:view", + key = "cm:cert:view", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/certificates/view"} ), @Scope( name = "Deleting an SSL Certificate", description = "Deleting an SSL Certificate", - key = "perm:admin:certificates:delete", + key = "cm:cert:delete", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/certificates/delete"} ), @Scope( name = "Verify SSL certificate", description = "Verify SSL certificate", - key = "perm:admin:certificates:verify", + key = "cm:cert:verify", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/certificates/verify"} ) @@ -119,7 +119,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:add") + @ExtensionProperty(name = SCOPE, value = "cm:cert:add") }) } ) @@ -188,7 +188,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:details") + @ExtensionProperty(name = SCOPE, value = "cm:cert:details:get") }) } ) @@ -260,7 +260,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:view") + @ExtensionProperty(name = SCOPE, value = "cm:cert:view") }) } ) @@ -353,7 +353,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:delete") + @ExtensionProperty(name = SCOPE, value = "cm:cert:delete") }) } ) @@ -399,7 +399,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:verify") + @ExtensionProperty(name = SCOPE, value = "cm:cert:verify") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java index 240f6bfb01..a1846536a1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java @@ -76,7 +76,7 @@ import java.util.List; @Scope( name = "Get activities", description = "Get activities", - key = "perm:get-activity", + key = "dm:activity:get", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ) @@ -97,7 +97,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:activity:get") }) } ) @@ -171,7 +171,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:activity:get") }) }, nickname = "getActivitiesByActivityIdList" @@ -234,7 +234,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:activity:get") }) } ) @@ -331,7 +331,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:activity:get") }) }, nickname = "getActivitiesByOperationCode" @@ -395,7 +395,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:activity:get") }) }, nickname = "getActivitiesWithFilters" diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AnalyticsArtifactsManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AnalyticsArtifactsManagementService.java index a6b519d03b..0b627554bb 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AnalyticsArtifactsManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AnalyticsArtifactsManagementService.java @@ -67,49 +67,49 @@ import javax.ws.rs.core.Response; @Scope( name = "Create Event Stream Artifact", description = "Create Event Stream Artifact", - key = "perm:analytics:artifacts:stream", + key = "dm:an:artifacts:stream:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/analytics/artifacts/stream/add"}), @Scope( name = "Delete Stream Artifact", description = "Delete Stream Artifact", - key = "perm:analytics:artifacts:stream:delete", + key = "dm:an:artifacts:stream:delete", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/analytics/artifacts/stream/delete"}), @Scope( name = "Create Event Receiver Artifact", description = "Create Event Receiver Artifact", - key = "perm:analytics:artifacts:receiver", + key = "dm:an:artifacts:rcv:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/analytics/artifacts/receiver/add"}), @Scope( name = "Delete Receiver Artifact", description = "Delete Receiver Artifact", - key = "perm:analytics:artifacts:receiver:delete", + key = "dm:an:artifacts:rcv:delete", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/analytics/artifacts/receiver/delete"}), @Scope( name = "Create Event Publisher Artifact", description = "Create Event Publisher Artifact", - key = "perm:analytics:artifacts:publisher", + key = "dm:an:artifacts:pub:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/analytics/artifacts/publisher/add"}), @Scope( name = "Delete Publisher Artifact", description = "Delete Publisher Artifact", - key = "perm:analytics:artifacts:publisher:delete", + key = "dm:an:artifacts:pub:delete", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/analytics/artifacts/publisher/delete"}), @Scope( name = "Create Siddhi Script Artifact", description = "Create Siddhi Script Artifact", - key = "perm:analytics:artifacts:siddhi", + key = "dm:an:artifacts:siddhi:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/analytics/artifacts/siddhi-script/add"}), @Scope( name = "Delete Siddhi Script Artifact", description = "Delete Siddhi Script Artifact", - key = "perm:analytics:artifacts:siddhi:delete", + key = "dm:an:artifacts:siddhi:delete", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/analytics/artifacts/siddhi-script/delete"}) } @@ -134,7 +134,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:stream" + value = "dm:an:artifacts:stream:add" )}) } ) @@ -192,7 +192,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:stream" + value = "dm:an:artifacts:stream:add" )}) } ) @@ -238,7 +238,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:stream:delete" + value = "dm:an:artifacts:stream:delete" )}) } ) @@ -291,7 +291,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:receiver" + value = "dm:an:artifacts:rcv:add" )}) } ) @@ -343,7 +343,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:receiver" + value = "dm:an:artifacts:rcv:add" )}) } ) @@ -390,7 +390,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:receiver:delete" + value = "dm:an:artifacts:rcv:delete" )}) } ) @@ -437,7 +437,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:publisher" + value = "dm:an:artifacts:pub:add" )}) } ) @@ -489,7 +489,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:publisher" + value = "dm:an:artifacts:pub:add" )}) } ) @@ -536,7 +536,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:publisher:delete" + value = "dm:an:artifacts:pub:delete" )}) } ) @@ -580,7 +580,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:siddhi" + value = "dm:an:artifacts:siddhi:add" )}) } ) @@ -631,7 +631,7 @@ public interface AnalyticsArtifactsManagementService { @Extension(properties = { @ExtensionProperty( name = Constants.SCOPE, - value = "perm:analytics:artifacts:siddhi:delete" + value = "dm:an:artifacts:siddhi:delete" ) }) } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ConfigurationManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ConfigurationManagementService.java index b419564cc3..164d85371e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ConfigurationManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ConfigurationManagementService.java @@ -67,14 +67,14 @@ import javax.ws.rs.core.Response; @Scope( name = "View configurations", description = "", - key = "perm:view-configuration", + key = "dm:conf:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/platform-configurations/view"} ), @Scope( name = "Manage configurations", description = "", - key = "perm:manage-configuration", + key = "dm:conf:manage", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/platform-configurations/manage"} ) @@ -93,7 +93,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:view-configuration") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:conf:view") }) } ) @@ -153,7 +153,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:manage-configuration") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:conf:manage") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java index b6fb084e24..50f7c1e465 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java @@ -75,35 +75,35 @@ import java.util.Map; @Scope( name = "Enroll Device", description = "Register a device", - key = "perm:device:enroll", + key = "dm:device:enroll", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/add"} ), @Scope( name = "Modify Device", description = "Modify a device", - key = "perm:device:modify", + key = "dm:device:modify", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/modify"} ), @Scope( name = "Disenroll Device", description = "Disenroll a device", - key = "perm:device:disenroll", + key = "dm:device:disenroll", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/remove"} ), @Scope( name = "Publish Event", description = "publish device event", - key = "perm:device:publish-event", + key = "dm:device:event:publish", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/event"} ), @Scope( name = "Getting Device Operation Details", description = "Getting Device Operation Details", - key = "perm:device:operations", + key = "dm:ops:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ) @@ -121,7 +121,7 @@ public interface DeviceAgentService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:enroll") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device:enroll") }) } ) @@ -173,7 +173,7 @@ public interface DeviceAgentService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:disenroll") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device:disenroll") }) } ) @@ -203,7 +203,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:modify") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device:modify") }) } ) @@ -261,7 +261,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:publish-event") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device:event:publish") }) }, nickname = "publishEventFromAgent" @@ -327,7 +327,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:publish-event") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device:event:publish") }) }, nickname = "publishEventsByTypeAndDevice" @@ -394,7 +394,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:operations") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:ops:view") }) } ) @@ -453,7 +453,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:operations") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:ops:view") }) } ) @@ -511,7 +511,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:operations") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:ops:view") }) } ) @@ -570,7 +570,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:modify") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device:modify") }) } ) @@ -630,7 +630,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:operations") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:ops:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java index 9bb14ff135..8d8ad05607 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java @@ -69,14 +69,14 @@ import java.util.List; @Scope( name = "Add or Delete Event Definition for device type", description = "Add or Delete Event Definition for device type", - key = "perm:device-types:events", + key = "dm:device-type:event:modify", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/device-type/add"} ), @Scope( name = "Get Events Details of a Device Type", description = "Get Events Details of a Device Type", - key = "perm:device-types:events:view", + key = "dm:device-type:event:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ) @@ -98,7 +98,7 @@ public interface DeviceEventManagementService { tags = "Device Event Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:event:modify") }) } ) @@ -157,7 +157,7 @@ public interface DeviceEventManagementService { tags = "Device Event Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:event:modify") }) } ) @@ -209,7 +209,7 @@ public interface DeviceEventManagementService { // tags = "Device Event Management", // extensions = { // @Extension(properties = { -// @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") +// @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:event:view") // }) // } // ) @@ -271,7 +271,7 @@ public interface DeviceEventManagementService { // tags = "Device Event Management", // extensions = { // @Extension(properties = { -// @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") +// @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:event:view") // }) // } // ) @@ -327,7 +327,7 @@ public interface DeviceEventManagementService { // tags = "Device Event Management", // extensions = { // @Extension(properties = { -// @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") +// @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:event:view") // }) // } // ) @@ -387,7 +387,7 @@ public interface DeviceEventManagementService { tags = "Device Event Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:event:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java index e3d9416a2c..f4dd947cc2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java @@ -90,91 +90,91 @@ import java.util.Map; @Scope( name = "Getting Details of Registered Devices", description = "Getting Details of Registered Devices", - key = "perm:devices:view", + key = "dm:devices:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Details of a Device", description = "Getting Details of a Device", - key = "perm:devices:details", + key = "dm:devices:details", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Update the device specified by device id", description = "Update the device specified by device id", - key = "perm:devices:update", + key = "dm:devices:update", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Delete the device specified by device id", description = "Delete the device specified by device id", - key = "perm:devices:delete", + key = "dm:devices:delete", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Feature Details of a Device", description = "Getting Feature Details of a Device", - key = "perm:devices:features", + key = "dm:devices:features:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Advanced Search for Devices", description = "Advanced Search for Devices", - key = "perm:devices:search", + key = "dm:devices:search", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Installed Application Details of a Device", description = "Getting Installed Application Details of a Device", - key = "perm:devices:applications", + key = "dm:devices:app:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Device Operation Details", description = "Getting Device Operation Details", - key = "perm:devices:operations", + key = "dm:devices:ops:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Get the details of the policy that is enforced on a device.", description = "Get the details of the policy that is enforced on a device.", - key = "perm:devices:effective-policy", + key = "dm:devices:policy:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Policy Compliance Details of a Device", description = "Getting Policy Compliance Details of a Device", - key = "perm:devices:compliance-data", + key = "dm:devices:compliance:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Change device status.", description = "Change device status.", - key = "perm:devices:change-status", + key = "dm:devices:status:change", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/change-status"} ), @Scope( name = "Enroll Device", description = "Register a device", - key = "perm:device:enroll", + key = "dm:device:enroll", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/add"} ), @Scope( name = "Viewing Enrollment Guide", description = "Show enrollment guide to users", - key = "perm:devices:enrollment-guide:view", + key = "dm:devices:enrollment-guide:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/enrollment-guide/view"} ), @@ -195,7 +195,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -350,7 +350,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -426,7 +426,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:details") }) } ) @@ -516,7 +516,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:details") }) } ) @@ -604,7 +604,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:details") }) } ) @@ -680,7 +680,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:details") }) } ) @@ -758,7 +758,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:enrollment-guide:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:enrollment-guide:view") }) } ) @@ -809,7 +809,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:details") }) } ) @@ -856,7 +856,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) }, nickname = "isEnrolledByType" @@ -913,7 +913,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:details") }) } ) @@ -990,7 +990,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:details") }) } ) @@ -1066,7 +1066,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:details") }) } ) @@ -1146,7 +1146,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:update") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:update") }) } ) @@ -1221,7 +1221,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:delete") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:delete") }) }, nickname = "deleteDeviceByTypeAndId" @@ -1292,7 +1292,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:features") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:features:view") }) } ) @@ -1374,7 +1374,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:search") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:search") }) } ) @@ -1454,7 +1454,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:search") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:search") }) } ) @@ -1532,7 +1532,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:applications") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:app:view") }) } @@ -1637,7 +1637,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:applications") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:app:view") }) }) @ApiResponses( @@ -1701,7 +1701,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:operations") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:ops:view") }) } ) @@ -1843,7 +1843,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:effective-policy") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:policy:view") }) } ) @@ -1932,7 +1932,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:compliance-data") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:compliance:view") }) } ) @@ -1979,7 +1979,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -2047,7 +2047,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -2117,7 +2117,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:change-status") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:status:change") }) } ) @@ -2193,7 +2193,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:operations") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:ops:view") }) } ) @@ -2250,7 +2250,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -2319,7 +2319,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -2389,7 +2389,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:change-status") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:status:change") }) } ) @@ -2450,7 +2450,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:compliance-data") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:compliance:view") }) } ) @@ -2518,7 +2518,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:compliance-data") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:compliance:view") }) } ) @@ -2558,7 +2558,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:applications") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:app:view") }) } ) @@ -2625,7 +2625,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:applications") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:app:view") }) } ) @@ -2670,7 +2670,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:operations") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:ops:view") }) } ) @@ -2722,7 +2722,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -2761,7 +2761,7 @@ public interface DeviceManagementService { notes = "Getting the default access token by using given client ID and the client secret value.", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:enroll") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device:enroll") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java index 73e99d1136..9f436a80e7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java @@ -68,28 +68,28 @@ import javax.ws.rs.core.Response; @Scope( name = "Getting the Supported Device Platforms", description = "Getting the Supported Device Platforms", - key = "perm:device-types:types", + key = "dm:device-type:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/device-type/view"} ), @Scope( name = "Get Feature Details of a Device Type", description = "Get Feature Details of a Device Type", - key = "perm:device-types:features", + key = "dm:device-type:features:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/device-type/features/view"} ), @Scope( name = "Get Config Details of a Device Type", description = "Get Config Details of a Device Type", - key = "perm:device-types:configs", + key = "dm:device-type:conf:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/device-type/config/view"} ), @Scope( name = "Getting Details of Policies", description = "Getting Details of Policies", - key = "perm:policies:get-details", + key = "dm:device-type:policies:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/view"} ) @@ -111,7 +111,7 @@ public interface DeviceTypeManagementService { tags = "Device Type Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:types") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:view") }) }, nickname = "getAllDeviceTypesPaginated" @@ -193,7 +193,7 @@ public interface DeviceTypeManagementService { tags = "Device Type Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:types") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:view") }) }, nickname = "getDeviceTypeByDeviceTypeName" @@ -248,7 +248,7 @@ public interface DeviceTypeManagementService { tags = "Device Type Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:features") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:features:view") }) } ) @@ -327,7 +327,7 @@ public interface DeviceTypeManagementService { tags = "Device Type Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:configs") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:conf:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GeoLocationBasedService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GeoLocationBasedService.java index 2c358382d8..a0ff8dda0d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GeoLocationBasedService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GeoLocationBasedService.java @@ -72,21 +72,21 @@ import java.util.List; @Scope( name = "View Analytics", description = "", - key = "perm:geo-service:analytics-view", + key = "dm:geo:an:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view-analytics"} ), @Scope( name = "Manage Alerts", description = "", - key = "perm:geo-service:alerts-manage", + key = "dm:geo:alerts:manage", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/manage-alerts"} ), @Scope( name = "Manage Geo Fences", description = "", - key = "perm:geo-service:geo-fence", + key = "dm:geo:geo-fence:manage", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/manage-geo-fence"} ) @@ -111,7 +111,7 @@ public interface GeoLocationBasedService { // tags = "Geo Service Management", // extensions = { // @Extension(properties = { -// @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:analytics-view") +// @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:an:view") // }) // } // ) @@ -180,7 +180,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:analytics-view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:an:view") }) } ) @@ -264,7 +264,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:analytics-view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:an:view") }) } ) @@ -381,7 +381,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") }) } ) @@ -447,7 +447,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") }) } ) @@ -500,7 +500,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") }) } ) @@ -565,7 +565,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") }) } ) @@ -618,7 +618,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") }) } ) @@ -682,7 +682,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") }) } ) @@ -735,7 +735,7 @@ public interface GeoLocationBasedService { // tags = "Geo Service Management", // extensions = { // @Extension(properties = { -// @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") +// @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") // }) // } // ) @@ -804,7 +804,7 @@ public interface GeoLocationBasedService { // tags = "Geo Service Management", // extensions = { // @Extension(properties = { -// @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") +// @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") // }) // } // ) @@ -863,7 +863,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") }) } ) @@ -928,7 +928,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:alerts:manage") }) } ) @@ -978,7 +978,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:geo-fence") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:geo-fence:manage") }) } ) @@ -1020,7 +1020,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:geo-fence") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:geo-fence:manage") }) }, nickname = "getGeofenceByFenceId" @@ -1071,7 +1071,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:geo-fence") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:geo-fence:manage") }) } ) @@ -1123,7 +1123,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:geo-fence") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:geo-fence:manage") }) } ) @@ -1169,7 +1169,7 @@ public interface GeoLocationBasedService { tags = "Geo Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:geo-fence") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:geo:geo-fence:manage") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java index 94cf447f92..63ce185bfa 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java @@ -82,112 +82,105 @@ import java.util.List; @Scope( name = "Get the list of groups belongs to current user.", description = "Get the list of groups belongs to current user.", - key = "perm:groups:groups", + key = "gm:groups:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Get the count of groups belongs to current user.", description = "Get the count of groups belongs to current user.", - key = "perm:groups:count", + key = "gm:groups:count", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Add new device group to the system.", description = "Add new device group to the system.", - key = "perm:groups:add", + key = "gm:groups:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/add"} ), @Scope( name = "View group specified", description = "View group specified", - key = "perm:groups:groups-view", + key = "gm:groups:groups-view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Update a group", description = "Update a group", - key = "perm:groups:update", + key = "gm:groups:update", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/update"} ), @Scope( name = "Delete a group", description = "Delete a group", - key = "perm:groups:remove", + key = "gm:groups:remove", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/remove"} ), @Scope( name = "Manage group sharing with a user", description = "Manage group sharing with a user", - key = "perm:groups:share", + key = "gm:roles:share", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/share"} ), @Scope( name = "View list of roles of a device group", description = "View list of roles of a device group", - key = "perm:groups:roles", + key = "gm:roles:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/roles/view"} ), @Scope( name = "View list of devices in the device group", description = "View list of devices in the device group", - key = "perm:groups:devices", + key = "gm:devices:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/devices/view"} ), @Scope( name = "View list of device count in the device group", description = "View list of device count in the device group", - key = "perm:groups:devices-count", + key = "gm:devices:count", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/devices/view"} ), @Scope( name = "Add devices to group", description = "Add devices to group", - key = "perm:groups:devices-add", + key = "gm:devices:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/devices/add"} ), @Scope( name = "Remove devices from group", description = "Remove devices from group", - key = "perm:groups:devices-remove", + key = "gm:devices:remove", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/devices/remove"} ), @Scope( name = "Assign devices to groups", description = "Assign devices to groups", - key = "perm:groups:assign", + key = "gm:devices:assign", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/devices/add"} ), @Scope( name = "List of groups that have the device", description = "List of groups that have the device", - key = "perm:groups:device", + key = "gm:groups:device:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/devices/view"} ), @Scope( name = "View whether the groups has relevant device types", description = "View whether the groups has relevant device types", - key = "perm:groups:devices-types", - roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/groups/devices/types"} - ), - @Scope( - name = "View whether the groups has relevant device types", - description = "View whether the groups has relevant device types", - key = "perm:groups:add", + key = "gm:devices-types:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/groups/device-types"} ) @@ -209,7 +202,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:view") }) }, nickname = "getGroupsWithFilter" @@ -284,7 +277,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:view") }) }, nickname = "getGroupsWithHierarchyNonAdmin" @@ -365,7 +358,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:count") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:count") }) }, nickname = "getGroupCountNonAdmin" @@ -411,7 +404,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:count") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:count") }) }, nickname = "getGroupCountNonAdmin" @@ -456,7 +449,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:add") }) }, nickname = "createGroupByGroupObject" @@ -525,7 +518,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups-view") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:groups-view") }) } ) @@ -598,7 +591,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups-view") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:groups-view") }) }, nickname = "getGroupByGroupNameFilter" @@ -665,7 +658,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:update") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:update") }) } ) @@ -723,7 +716,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:remove") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:remove") }) } ) @@ -780,7 +773,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:share") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:roles:share") }) } ) @@ -837,7 +830,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:roles") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:roles:view") }) } ) @@ -889,7 +882,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:devices:view") }) } ) @@ -963,7 +956,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-count") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:devices:count") }) } ) @@ -1016,7 +1009,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-add") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:devices:add") }) } ) @@ -1072,7 +1065,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-remove") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:devices:remove") }) } ) @@ -1129,7 +1122,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:assign") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:devices:assign") }) } ) @@ -1184,7 +1177,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:device") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:device:view") }) }, nickname = "getGroupsNonAdmin" @@ -1246,7 +1239,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-types") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:devices-types:view") }) }, nickname = "getGroupByGroupNameFilter" @@ -1301,7 +1294,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:add") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/MetadataService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/MetadataService.java index aa23780783..b8aca4c550 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/MetadataService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/MetadataService.java @@ -73,28 +73,28 @@ import javax.ws.rs.core.Response; @Scope( name = "View metadata records", description = "View metadata records", - key = "perm:metadata:view", + key = "dm:metadata:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/metadata/view"} ), @Scope( name = "Create a metadata record", description = "Create a metadata record", - key = "perm:metadata:create", + key = "dm:metadata:create", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/metadata/create"} ), @Scope( name = "Update a metadata record", description = "Updating a specified metadata record", - key = "perm:metadata:update", + key = "dm:metadata:update", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/metadata/update"} ), @Scope( name = "Delete a metadata record", description = "Delete a specified metadata record", - key = "perm:metadata:remove", + key = "dm:metadata:remove", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/metadata/remove"} ) @@ -115,7 +115,7 @@ public interface MetadataService { tags = "Device Metadata Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:metadata:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:metadata:view") }) } ) @@ -171,7 +171,7 @@ public interface MetadataService { tags = "Device Metadata Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:metadata:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:metadata:view") }) } ) @@ -216,7 +216,7 @@ public interface MetadataService { tags = "Device Metadata Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:metadata:create") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:metadata:create") }) } ) @@ -267,7 +267,7 @@ public interface MetadataService { tags = "Device Metadata Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:metadata:update") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:metadata:update") }) } ) @@ -314,7 +314,7 @@ public interface MetadataService { tags = "Device Metadata Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:metadata:remove") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:metadata:remove") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java index fe2049bd55..3dad471bc0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java @@ -71,14 +71,14 @@ import javax.ws.rs.core.Response; @Scope( name = "Getting All Device Notification Details", description = "Getting All Device Notification Details", - key = "perm:notifications:view", + key = "dm:notifications:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/notifications/view"} ), @Scope( name = "Updating the Device Notification Status", description = "Updating the Device Notification Status", - key = "perm:notifications:mark-checked", + key = "dm:notif:mark-checked", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/notifications/view"} ) @@ -99,7 +99,7 @@ public interface NotificationManagementService { tags = "Device Notification Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:notifications:view") }) } ) @@ -188,7 +188,7 @@ public interface NotificationManagementService { tags = "Device Notification Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:mark-checked") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:notif:mark-checked") }) } ) @@ -228,7 +228,7 @@ public interface NotificationManagementService { tags = "Device Notification Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:mark-checked") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:notif:mark-checked") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java index ae7f541234..b4bfa14a73 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java @@ -77,70 +77,70 @@ import java.util.List; @Scope( name = "Adding a Policy", description = "Adding a Policy", - key = "perm:policies:manage", + key = "pm:policies:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Getting Details of Policies", description = "Getting Details of Policies", - key = "perm:policies:get-details", + key = "pm:policies:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/view"} ), @Scope( name = "Getting Details of a Policy", description = "Getting Details of a Policy", - key = "perm:policies:get-policy-details", + key = "pm:policies:details:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/view"} ), @Scope( name = "Updating a Policy", description = "Updating a Policy", - key = "perm:policies:update", + key = "pm:policies:update", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Removing Multiple Policies", description = "Removing Multiple Policies", - key = "perm:policies:remove", + key = "pm:policies:remove", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Activating Policies", description = "Activating Policies", - key = "perm:policies:activate", + key = "pm:policies:activate", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Deactivating Policies", description = "Deactivating Policies", - key = "perm:policies:deactivate", + key = "pm:policies:deactivate", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Applying Changes on Policies", description = "Applying Changes on Policies", - key = "perm:policies:changes", + key = "pm:policies:change", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Updating the Policy Priorities", description = "Updating the Policy Priorities", - key = "perm:policies:priorities", + key = "pm:policies:priorities:update", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Fetching the Effective Policy", description = "Fetching the Effective Policy", - key = "perm:policies:effective-policy", + key = "pm:policies:effective-policy", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/view"} ) @@ -166,7 +166,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:manage") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:add") }) } ) @@ -237,7 +237,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:manage") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:add") }) } ) @@ -306,7 +306,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:get-details") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:view") }) } ) @@ -382,7 +382,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:get-policy-details") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:details:view") }) } ) @@ -451,7 +451,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:update") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:update") }) } ) @@ -520,7 +520,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:remove") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:remove") }) } ) @@ -568,7 +568,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:activate") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:activate") }) } ) @@ -610,7 +610,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:deactivate") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:deactivate") }) } ) @@ -656,7 +656,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:changes") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:change") }) } ) @@ -684,7 +684,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:priorities") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:priorities:update") }) } ) @@ -720,7 +720,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:effective-policy") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:effective-policy") }) } ) @@ -790,7 +790,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:get-details") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:view") }) }, nickname = "getPoliciesFilteredByType" @@ -874,7 +874,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:get-details") + @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RemoteSessionService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RemoteSessionService.java index 57c96dc373..508c29100c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RemoteSessionService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RemoteSessionService.java @@ -60,7 +60,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Remote Session Connection", description = "", - key = "perm:remote-session-service:connect", + key = "dm:remote:connect", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/remote-session"} ) @@ -85,7 +85,7 @@ public interface RemoteSessionService { tags = "Remote Session Service Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:remote-session-service:connect") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:remote:connect") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java index b2d8bd1b65..f2c8447483 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java @@ -70,7 +70,7 @@ import java.util.List; @Scope( name = "Getting Details of Registered Devices", description = "Getting Details of Registered Devices", - key = "perm:devices:view", + key = "rep:devices:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @@ -93,7 +93,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") }) } ) @@ -177,7 +177,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") }) } ) @@ -249,7 +249,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") }) } ) @@ -327,7 +327,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") }) } ) @@ -386,7 +386,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") }) } ) @@ -436,7 +436,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") }) } ) @@ -511,7 +511,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") }) } ) @@ -579,7 +579,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java index 8a3e4242cd..d0cee93215 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java @@ -51,56 +51,56 @@ import java.util.List; @Scope( name = "Getting the List of Roles", description = "Getting the List of Roles", - key = "perm:roles:view", + key = "rm:roles:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Getting Permission Details of a Role", description = "Getting Permission Details of a Role", - key = "perm:roles:permissions", + key = "rm:roles:permissions:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Getting the List of Roles", description = "Getting the List of Roles", - key = "perm:roles:details", + key = "rm:roles:details:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Adding a Role", description = "Adding a Role", - key = "perm:roles:add", + key = "rm:roles:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Adding a combined Role", description = "Adding a combined Role", - key = "perm:roles:create-combined-role", + key = "rm:roles:combined:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Updating Role Details", description = "Updating Role Details", - key = "perm:roles:update", + key = "rm:roles:update", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Deleting a Role", description = "Deleting a Role", - key = "perm:roles:delete", + key = "rm:roles:delete", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Adding Users to a Role", description = "Adding Users to a Role", - key = "perm:roles:add-users", + key = "rm:users:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/roles/manage"} ) @@ -122,7 +122,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:view") }) } ) @@ -198,7 +198,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:view") }) } ) @@ -296,7 +296,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:view") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:view") }) } ) @@ -382,7 +382,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:permissions") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:permissions:view") }) } ) @@ -457,7 +457,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:details") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:details:view") }) } ) @@ -531,7 +531,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:add") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:add") }) } ) @@ -593,7 +593,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:create-combined-role") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:combined:add") }) } ) @@ -657,7 +657,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:update") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:update") }) } ) @@ -727,7 +727,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:delete") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:roles:delete") }) } ) @@ -779,7 +779,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:add-users") + @ExtensionProperty(name = Constants.SCOPE, value = "rm:users:add") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java index b6665cd9ec..70924123de 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java @@ -80,91 +80,91 @@ import javax.ws.rs.core.Response; @Scope( name = "Adding a User", description = "Adding a User", - key = "perm:users:add", + key = "um:users:add", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/manage"} ), @Scope( name = "Getting Details of a User", description = "Getting Details of a User", - key = "perm:users:details", + key = "um:users:details:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/view"} ), @Scope( name = "Updating Details of a User", description = "Updating Details of a User", - key = "perm:users:update", + key = "um:users:update", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/manage"} ), @Scope( name = "Deleting a User", description = "Deleting a User", - key = "perm:users:delete", + key = "um:users:delete", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/manage"} ), @Scope( name = "Getting the Role Details of a User", description = "Getting the Role Details of a User", - key = "perm:users:roles", + key = "um:roles:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/view"} ), @Scope( name = "Getting Details of Users", description = "Getting Details of Users", - key = "perm:users:user-details", + key = "um:users:user-details:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/view"} ), @Scope( name = "Getting the User Count", description = "Getting the User Count", - key = "perm:users:count", + key = "um:users:count", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/view"} ), @Scope( name = "Getting the User existence status", description = "Getting the User existence status", - key = "perm:users:is-exist", + key = "um:users:is-exist", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/view"} ), @Scope( name = "Searching for a User Name", description = "Searching for a User Name", - key = "perm:users:search", + key = "um:users:search", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/view"} ), @Scope( name = "Changing the User Password", description = "Adding a User", - key = "perm:users:credentials", + key = "um:users:cred:change", roles = {"Internal/devicemgt-user"}, permissions = {"/login"} ), @Scope( name = "Sending Enrollment Invitations to Users", description = "Sending Enrollment Invitations to Users", - key = "perm:users:send-invitation", + key = "um:users:invite", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/users/manage"} ), @Scope( name = "Get activities", description = "Get activities", - key = "perm:get-activity", + key = "um:activity:get", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting the Permissions of the User", description = "Getting the Permissions of the User", - key = "perm:user:permission-view", + key = "um:users:permission:view", roles = {"Internal/devicemgt-user"}, permissions = {"/login"} ) @@ -187,7 +187,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:add") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:add") }) } ) @@ -246,7 +246,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:details") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:details:view") }) } ) @@ -317,7 +317,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:update") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:update") }) } ) @@ -384,7 +384,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:delete") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:delete") }) } ) @@ -429,7 +429,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:roles") + @ExtensionProperty(name = Constants.SCOPE, value = "um:roles:view") }) } ) @@ -494,7 +494,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:user-details") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:user-details:view") }) } ) @@ -572,7 +572,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:user-details") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:user-details:view") }) }, nickname = "getUsersByFilter" @@ -658,7 +658,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:count") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:count") }) } ) @@ -694,7 +694,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:is-exist") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:is-exist") }) } ) @@ -738,7 +738,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:search") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:search") }) } ) @@ -817,7 +817,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:credentials") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:cred:change") }) } ) @@ -864,7 +864,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:send-invitation") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:invite") }) } ) @@ -907,7 +907,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:send-invitation") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:invite") }) } ) @@ -955,7 +955,7 @@ public interface UserManagementService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "um:activity:get") }) } ) @@ -1031,7 +1031,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:details") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:details:view") }) } ) @@ -1091,7 +1091,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:details") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:details:view") }) } ) @@ -1147,7 +1147,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:details") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:details:view") }) } ) @@ -1203,7 +1203,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:user:permission-view") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:permission:view") }) } ) @@ -1250,7 +1250,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:user-details") + @ExtensionProperty(name = Constants.SCOPE, value = "um:users:user-details:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/WhiteLabelService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/WhiteLabelService.java index ff989bf095..22544b9ff0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/WhiteLabelService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/WhiteLabelService.java @@ -67,14 +67,14 @@ import javax.ws.rs.core.Response; @Scope( name = "View Whitelabel", description = "View whitelabel details", - key = "perm:whitelabel:view", + key = "dm:whitelable:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/whitelabel/view"} ), @Scope( name = "Update Whitelabel", description = "Updating whitelabel", - key = "perm:whitelabel:update", + key = "dm:whitelable:update", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/whitelabel/update"} ), @@ -210,7 +210,7 @@ public interface WhiteLabelService { tags = "Tenant Metadata Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:whitelabel:update") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:whitelable:update") }) } ) @@ -250,7 +250,7 @@ public interface WhiteLabelService { tags = "Tenant Metadata Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:whitelabel:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:whitelable:view") }) } ) @@ -291,7 +291,7 @@ public interface WhiteLabelService { tags = "Tenant Metadata Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:whitelabel:update") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:whitelable:update") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 2dbc5f4062..1cb5325dcc 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -65,14 +65,14 @@ import javax.ws.rs.core.Response; @Scope( name = "Installing an Application (Internal API)", description = "Installing an Application (Internal API)", - key = "perm:applications:install", + key = "am:admin:app:install", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/applications/manage"} ), @Scope( name = "Uninstalling an Application (Internal API)", description = "Uninstalling an Application (Internal API)", - key = "perm:applications:uninstall", + key = "am:admin:app:uninstall", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/applications/manage"} ) @@ -94,7 +94,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:applications:install") + @ExtensionProperty(name = Constants.SCOPE, value = "am:admin:app:install") }) } ) @@ -138,7 +138,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:applications:uninstall") + @ExtensionProperty(name = Constants.SCOPE, value = "am:admin:app:uninstall") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAccessAuthorizationAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAccessAuthorizationAdminService.java index d361e5ccc1..e26e5bb29f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAccessAuthorizationAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAccessAuthorizationAdminService.java @@ -65,7 +65,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Verify device authorization", description = "Verify device authorization", - key = "perm:authorization:verify", + key = "dm:authorization:verify", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/authorization/verify"} ) @@ -89,7 +89,7 @@ public interface DeviceAccessAuthorizationAdminService { tags = "Authorization Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:authorization:verify") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:authorization:verify") }) }) @@ -128,7 +128,7 @@ public interface DeviceAccessAuthorizationAdminService { tags = "Authorization Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:authorization:verify") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:authorization:verify") }) }) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAnalyticsArtifactUploaderAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAnalyticsArtifactUploaderAdminService.java index bb88a87d26..889714066e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAnalyticsArtifactUploaderAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAnalyticsArtifactUploaderAdminService.java @@ -55,7 +55,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Devicetype deployment", description = "Deploy devicetype", - key = "perm:devicetype:deployment", + key = "dm:device-type:deploy", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/devicetype/deploy"} ) @@ -74,7 +74,7 @@ public interface DeviceAnalyticsArtifactUploaderAdminService { tags = "Devicetype Deployment Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devicetype:deployment") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:device-type:deploy") }) }) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java index 73d96fcfe1..9ebef18d15 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -77,28 +77,28 @@ import java.util.List; @Scope( name = "Getting Details of a Device", description = "Getting Details of a Device", - key = "perm:admin:devices:view", + key = "dm:admin:devices:view", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Update the Device Owner", description = "Update the ownership of the device", - key = "perm:admin:devices:update-enrollment", + key = "dm:admin:enrollment:update", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/devices/update-enrollment"} ), @Scope( name = "Permanently Delete the device specified by device id", description = "Permanently Delete the device specified by device id", - key = "perm:devices:permanent-delete", + key = "dm:admin:devices:permanent-delete", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/devices/permanent-delete"} ), @Scope( name = "Get Usage of Devices", description = "Get Usage of Devices", - key = "perm:admin:usage:view", + key = "dm:admin:devices:usage:view", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/devices/usage/view"} ), @@ -117,7 +117,7 @@ public interface DeviceManagementAdminService { tags = "Device Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:devices:view") }) } ) @@ -211,7 +211,7 @@ public interface DeviceManagementAdminService { tags = "Device Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:devices:view") }) } ) @@ -264,7 +264,7 @@ public interface DeviceManagementAdminService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:devices:update-enrollment") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:enrollment:update") }) } ) @@ -315,7 +315,7 @@ public interface DeviceManagementAdminService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:permanent-delete") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:devices:permanent-delete") }) } ) @@ -366,7 +366,7 @@ public interface DeviceManagementAdminService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:android:enroll") + @ExtensionProperty(name = Constants.SCOPE, value = "and:devices:enroll") }) } ) @@ -425,7 +425,7 @@ public interface DeviceManagementAdminService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:usage:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:devices:usage:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceTypeManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceTypeManagementAdminService.java index 816f52dd6a..ed5add345b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceTypeManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceTypeManagementAdminService.java @@ -73,21 +73,21 @@ import javax.ws.rs.core.Response; @Scope( name = "Manage a Device Type", description = "Add, Edit or View a Device Type", - key = "perm:admin:device-type", + key = "dm:admin:device-type:modify", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/device-type"} ), @Scope( name = "Getting Details of a Device Type", description = "Getting Details of a Device Type", - key = "perm:admin:device-type:view", + key = "dm:admin:device-type:view", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/device-type/view"} ), @Scope( name = "Add Device Type Config", description = "Add Platform Config of a Device Type", - key = "perm:admin:device-type:configs", + key = "dm:admin:device-type:conf:add", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/device-type/config"} ) @@ -105,7 +105,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:view") }) } ) @@ -159,7 +159,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:view") }) } ) @@ -212,7 +212,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:modify") }) } ) @@ -265,7 +265,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:modify") }) } ) @@ -321,7 +321,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type:configs") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:conf:add") }) } ) @@ -379,7 +379,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:modify") }) } ) @@ -433,7 +433,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:modify") }) } ) @@ -485,7 +485,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:modify") }) } ) @@ -539,7 +539,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:modify") }) } ) @@ -592,7 +592,7 @@ public interface DeviceTypeManagementAdminService { tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:device-type") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:admin:device-type:modify") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java index 93bc0fabc6..cec3ce0237 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -75,21 +75,21 @@ import javax.ws.rs.core.Response; @Scope( name = "View groups", description = "", - key = "perm:admin-groups:view", + key = "gm:admin:groups:view", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/groups/view"} ), @Scope( name = "Count groups", description = "", - key = "perm:admin-groups:count", + key = "gm:admin:groups:count", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/groups/view"} ), @Scope( name = "Add groups", description = "", - key = "perm:admin-groups:add", + key = "gm:admin:groups:add", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/groups/add"} ) @@ -106,7 +106,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-groups:view") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:admin:groups:view") }) } ) @@ -182,7 +182,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-groups:view") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:admin:groups:view") }) } ) @@ -266,7 +266,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-groups:count") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:admin:groups:count") }) } ) @@ -318,7 +318,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-groups:count") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:admin:groups:count") }) } ) @@ -369,7 +369,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-groups:add") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:admin:groups:add") }) } ) @@ -439,7 +439,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add") + @ExtensionProperty(name = Constants.SCOPE, value = "gm:groups:add") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java index 3929f67b09..7e5e5ce232 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java @@ -51,14 +51,14 @@ import javax.ws.rs.core.Response; @Scope( name = "View Users", description = "View Users", - key = "perm:admin-users:view", + key = "um:admin:users:view", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/users/manage"} ), @Scope( name = "Delete Users Device Information", description = "Delete users device details", - key = "perm:admin-users:remove", + key = "um:admin:users:remove", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/users/manage"} ) @@ -84,7 +84,7 @@ public interface UserManagementAdminService { tags = "User Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-users:view") + @ExtensionProperty(name = Constants.SCOPE, value = "um:admin:users:view") }) } ) @@ -143,7 +143,7 @@ public interface UserManagementAdminService { tags = "Device details remove", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-users:remove") + @ExtensionProperty(name = Constants.SCOPE, value = "um:admin:users:remove") }) } ) @@ -201,7 +201,7 @@ public interface UserManagementAdminService { tags = "Device details remove privacy compliance", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-users:remove") + @ExtensionProperty(name = Constants.SCOPE, value = "um:admin:users:remove") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java index ad8b11b5a3..63467ddb28 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java @@ -70,28 +70,28 @@ import java.util.List; @Scope( name = "View configurations", description = "", - key = "perm:view-configuration", + key = "dm:conf:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/platform-configurations/view"} ), @Scope( name = "Manage configurations", description = "", - key = "perm:manage-configuration", + key = "dm:conf:manage", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/platform-configurations/manage"} ), @Scope( name = "Getting Details of Device tenants", description = "Getting Details of Device tenants", - key = "perm:admin:tenant:view", + key = "admin:tenant:view", roles = {"Internal/devicemgt-user"}, permissions = {"/tenants/view"} ), @Scope( name = "Add a permission to the permission tree", description = "Add a permission to the permission tree", - key = "perm:admin:permissions:add", + key = "admin:permissions:add", roles = {"Internal/devicemgt-user"}, permissions = {"/permissions/add"} ) @@ -173,7 +173,7 @@ public interface DeviceManagementConfigService { tags = "Device Management Configuration", extensions = { @Extension(properties = { - @ExtensionProperty(name = "scope", value = "perm:manage-configuration") + @ExtensionProperty(name = "scope", value = "dm:conf:manage") }) } ) @@ -257,7 +257,7 @@ public interface DeviceManagementConfigService { tags = "Device Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = "scope", value ="perm:admin:tenant:view") + @ExtensionProperty(name = "scope", value ="admin:tenant:view") }) } ) @@ -305,7 +305,7 @@ public interface DeviceManagementConfigService { extensions = { @Extension(properties = { @ExtensionProperty(name = "scope", value = - "perm:admin:permissions:add") + "admin:permissions:add") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java index 770c6db022..ebf11e54ee 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java @@ -38,7 +38,7 @@ public final class DeviceManagementConstants { private ConfigurationManagement(){ throw new AssertionError(); } - public static final String SCOPES_FOR_TOKEN = "perm:device:operations perm:device:publish-event perm:windows:enroll"; + public static final String SCOPES_FOR_TOKEN = "dm:ops:view dm:device:event:publish win:devices:enroll"; public static final String IOT_GATEWAY_HOST = "iot.gateway.host"; public static final String IOT_GATEWAY_HTTPS_PORT = "iot.gateway.https.port"; public static final String IOT_CORE_HOST = "iot.core.host"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index d17c6c8a4e..7f7f5324d9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -68,103 +68,106 @@ "copyrightSuffix": " All Rights Reserved." }, "scopes": [ - "perm:sign-csr", - "perm:admin:devices:view", - "perm:admin:topics:view", - "perm:roles:add", - "perm:roles:add-users", - "perm:roles:update", - "perm:roles:permissions", - "perm:roles:details", - "perm:roles:view", - "perm:roles:create-combined-role", - "perm:roles:delete", - "perm:dashboard:vulnerabilities", - "perm:dashboard:non-compliant-count", - "perm:dashboard:non-compliant", - "perm:dashboard:by-groups", - "perm:dashboard:device-counts", - "perm:dashboard:feature-non-compliant", - "perm:dashboard:count-overview", - "perm:dashboard:filtered-count", - "perm:dashboard:details", - "perm:get-activity", - "perm:devices:delete", - "perm:devices:applications", - "perm:devices:effective-policy", - "perm:devices:compliance-data", - "perm:devices:features", - "perm:devices:operations", - "perm:devices:search", - "perm:devices:details", - "perm:devices:update", - "perm:devices:view", - "perm:view-configuration", - "perm:manage-configuration", - "perm:policies:remove", - "perm:policies:priorities", - "perm:policies:deactivate", - "perm:policies:get-policy-details", - "perm:policies:manage", - "perm:policies:activate", - "perm:policies:update", - "perm:policies:changes", - "perm:policies:get-details", - "perm:users:add", - "perm:users:details", - "perm:users:count", - "perm:users:delete", - "perm:users:roles", - "perm:users:user-details", - "perm:users:credentials", - "perm:users:search", - "perm:users:is-exist", - "perm:users:update", - "perm:users:send-invitation", - "perm:admin-users:view", - "perm:admin:devices:update-enrollment", - "perm:groups:devices", - "perm:groups:update", - "perm:groups:add", - "perm:groups:device", - "perm:groups:devices-count", - "perm:groups:remove", - "perm:groups:groups", - "perm:groups:groups-view", - "perm:groups:share", - "perm:groups:count", - "perm:groups:roles", - "perm:groups:devices-remove", - "perm:groups:devices-add", - "perm:groups:assign", - "perm:device-types:configs", - "perm:device-types:features", - "perm:device-types:types", - "perm:applications:install", - "perm:applications:uninstall", - "perm:admin-groups:count", - "perm:admin-groups:view", - "perm:notifications:mark-checked", - "perm:notifications:view", - "perm:admin:certificates:delete", - "perm:admin:certificates:details", - "perm:admin:certificates:view", - "perm:admin:certificates:add", - "perm:admin:certificates:verify", - "perm:admin", - "perm:devicetype:deployment", - "perm:device-types:events", - "perm:device-types:events:view", - "perm:admin:device-type", - "perm:admin:device-type:view", - "perm:admin:device-type:configs", - "perm:device:enroll", - "perm:geo-service:analytics-view", - "perm:geo-service:alerts-manage", - "perm:devices:permanent-delete", + "dm:sign-csr", + "dm:admin:devices:view", + "dm:admin:topics:view", + "rm:roles:add", + "rm:users:add", + "rm:roles:update", + "rm:roles:permissions:view", + "rm:roles:details:view", + "rm:roles:view", + "rm:roles:combined:add", + "rm:roles:delete", + "an:db:vulnerabilities", + "an:db:non-compliant:count", + "an:db:non-compliant", + "an:db:by-groups", + "an:db:device:count", + "an:db:feature-non-compliant", + "an:db:overview:count", + "an:db:filtered-count", + "an:db:details", + "dm:activity:get", + "dm:devices:delete", + "dm:devices:app:view", + "dm:devices:policy:view", + "dm:devices:compliance:view", + "dm:devices:features:view", + "dm:devices:ops:view", + "dm:devices:search", + "dm:devices:details", + "dm:devices:update", + "dm:devices:view", + "rep:devices:view", + "dm:conf:view", + "dm:conf:manage", + "pm:policies:remove", + "pm:policies:priorities:update", + "pm:policies:deactivate", + "pm:policies:details:view", + "pm:policies:add", + "pm:policies:activate", + "pm:policies:update", + "pm:policies:change", + "pm:policies:view", + "dm:device-type:policies:view", + "um:users:add", + "um:users:details:view", + "um:users:count", + "um:users:delete", + "um:roles:view", + "um:users:user-details:view", + "um:users:cred:change", + "um:users:search", + "um:users:is-exist", + "um:users:update", + "um:users:invite", + "um:admin:users:view", + "um:activity:get", + "dm:admin:enrollment:update", + "gm:devices:view", + "gm:groups:update", + "gm:groups:add", + "gm:groups:device:view", + "gm:devices:count", + "gm:groups:remove", + "gm:groups:view", + "gm:groups:groups-view", + "gm:roles:share", + "gm:groups:count", + "gm:roles:view", + "gm:devices:remove", + "gm:devices:add", + "gm:devices:assign", + "dm:device-type:conf:view", + "dm:device-type:features:view", + "dm:device-type:view", + "am:admin:app:install", + "am:admin:app:uninstall", + "gm:admin:groups:count", + "gm:admin:groups:view", + "dm:notif:mark-checked", + "dm:notifications:view", + "cm:cert:delete", + "cm:cert:details:get", + "cm:cert:view", + "cm:cert:add", + "cm:cert:verify", + "dm:admin", + "dm:device-type:deploy", + "dm:device-type:event:modify", + "dm:device-type:event:view", + "dm:admin:device-type:modify", + "dm:admin:device-type:view", + "dm:admin:device-type:conf:add", + "dm:device:enroll", + "dm:geo:an:view", + "dm:geo:alerts:manage", + "dm:admin:devices:permanent-delete", "appm:read", - "perm:enterprise:modify", - "perm:enterprise:view" + "and:enterprise:modify", + "and:enterprise:view" ], "isOAuthEnabled": true, "backendRestEndpoints": { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index 2e604c3ad1..69995e840b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -408,8 +408,8 @@ deviceModule = function () { //noinspection JSUnresolvedFunction var jwtClient = JWTClientManagerService.getJWTClient(); // returning access token by JWT grant type - var deviceScope = "device_" + type.replace(" ", "") + "_" + deviceId + " perm:device:enroll " + - "perm:device:disenroll perm:device:modify perm:device:operations perm:device:publish-event"; + var deviceScope = "device_" + type.replace(" ", "") + "_" + deviceId + " dm:device:enroll " + + "dm:device:disenroll dm:device:modify dm:ops:view dm:device:event:publish"; var tokenInfo = jwtClient.getAccessToken(config.clientId, config.clientSecret, userName, deviceScope); config.accessToken = tokenInfo.getAccessToken(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/private/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/private/config.json index f5d01d0d77..9596bc2838 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/private/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/private/config.json @@ -3,14 +3,14 @@ "label": "Windows", "category": "mobile", "scopes" : [ - "perm:windows:enroll", - "perm:windows:lock-devices", - "perm:windows:ring", - "perm:windows:wipe", - "perm:windows:lock-reset", - "perm:windows:reboot", - "perm:windows:location", - "perm:windows:disenroll" + "win:devices:enroll", + "win:ops:lock-devices", + "win:ops:ring", + "win:ops:wipe", + "win:ops:lock-reset", + "win:ops:reboot", + "win:ops:location", + "win:ops:disenroll" ], "analyticsEnabled": "false", "groupingEnabled": "false", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs index d93197ede7..410693a3b5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs @@ -120,7 +120,7 @@ -d '{ "applicationName":"testme", "isAllowedToAllDomains":false, "tags":["device_agent"]}'
  • Generate Token

    - curl -k -d "grant_type=password&username=%username%&password=%password%&scope=perm:device:enroll perm:device:disenroll perm:device:modify perm:device:operations perm:device:publish-event" + curl -k -d "grant_type=password&username=%username%&password=%password%&scope=dm:device:enroll dm:device:disenroll dm:device:modify dm:ops:view dm:device:event:publish" -H "Authorization: Basic Base64(client_id:client_secret)" -H "Content-Type: application/x-www-form-urlencoded" {{httpsGateway}}/token
  • diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/ConfigurationManagementService.java b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/ConfigurationManagementService.java index fc2300a7fd..c45d96abce 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/ConfigurationManagementService.java +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/ConfigurationManagementService.java @@ -63,7 +63,7 @@ import javax.ws.rs.core.Response; @Scope( name = "View configurations", description = "", - key = "perm:sms-handler:view-configuration", + key = "conf:sms-handler:view", roles = {"Internal/devicemgt-user"}, permissions = {"/sms-handler/platform-configurations/view"} ) @@ -79,7 +79,7 @@ public interface ConfigurationManagementService { tags = "SMS Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SMSHandlerConstants.SCOPE, value = "perm:sms-handler:view-configuration") + @ExtensionProperty(name = SMSHandlerConstants.SCOPE, value = "conf:sms-handler:view") }) } ) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index 13553e3816..d0369c8431 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -173,200 +173,203 @@ true
    - perm:grafana:api:view - perm:app:review:view - perm:app:review:update - perm:app:publisher:service-provider:view - perm:app:publisher:service-provider:create - perm:app:publisher:service-provider:attach - perm:app:publisher:service-provider:detach - perm:app:publisher:service-provider:connect - perm:app:publisher:view - perm:app:publisher:update - perm:app:store:view - perm:app:store:modify - perm:app:subscription:install - perm:app:subscription:uninstall - perm:admin:app:review:update - perm:admin:app:review:view - perm:admin:app:publisher:update - perm:admin:app:review:update - perm:admin:app:subscription:view - perm:admin:app:subscription:modify - perm:device-types:types - perm:enterprise:modify - perm:enterprise:view - perm:android-work:customer - perm:android-work:admin - perm:application-command:modify - perm:sign-csr - perm:admin:devices:view - perm:admin:topics:view - perm:roles:add - perm:roles:add-users - perm:roles:update - perm:roles:permissions - perm:roles:details - perm:roles:view - perm:roles:create-combined-role - perm:roles:delete - perm:dashboard:vulnerabilities - perm:dashboard:non-compliant-count - perm:dashboard:non-compliant - perm:dashboard:by-groups - perm:dashboard:device-counts - perm:dashboard:feature-non-compliant - perm:dashboard:count-overview - perm:dashboard:filtered-count - perm:dashboard:details - perm:get-activity - perm:devices:delete - perm:devices:applications - perm:devices:effective-policy - perm:devices:compliance-data - perm:devices:features - perm:devices:operations - perm:devices:search - perm:devices:details - perm:devices:update - perm:devices:view - perm:devices:enrollment-guide:view - perm:view-configuration - perm:manage-configuration - perm:policies:remove - perm:policies:priorities - perm:policies:deactivate - perm:policies:get-policy-details - perm:policies:manage - perm:policies:activate - perm:policies:update - perm:policies:changes - perm:policies:get-details - perm:users:add - perm:users:details - perm:users:count - perm:users:delete - perm:users:roles - perm:users:user-details - perm:users:credentials - perm:users:search - perm:users:is-exist - perm:users:update - perm:users:send-invitation - perm:admin-users:view - perm:admin:devices:update-enrollment - perm:groups:devices - perm:groups:update - perm:groups:add - perm:groups:device - perm:groups:devices-count - perm:groups:devices-types - perm:groups:remove - perm:groups:groups - perm:groups:groups-view - perm:groups:share - perm:groups:count - perm:groups:roles - perm:groups:devices-remove - perm:groups:devices-add - perm:groups:assign - perm:device-types:configs - perm:device-types:features - perm:device-types:types - perm:applications:install - perm:applications:uninstall - perm:admin-groups:count - perm:admin-groups:view - perm:admin-groups:add - perm:notifications:mark-checked - perm:notifications:view - perm:admin:certificates:delete - perm:admin:certificates:details - perm:admin:certificates:view - perm:admin:certificates:add - perm:admin:certificates:verify - perm:admin - perm:devicetype:deployment - perm:device-types:events - perm:device-types:events:view - perm:admin:device-type - perm:admin:device-type:view - perm:admin:device-type:configs - perm:device:enroll - perm:geo-service:analytics-view - perm:geo-service:alerts-manage + grafana:api:view + am:store:app:review:view + am:store:app:review:update + am:pub:sp:app:view + am:pub:sp:create + am:pub:sp:attach + am:pub:sp:detach + am:pub:sp:connect + am:pub:app:view + am:pub:app:update + am:store:app:view + am:store:app:modify + am:store:app:sub:install + am:store:app:sub:uninstall + am:admin:pub:app:review:update + am:admin:pub:app:review:view + am:admin:pub:app:update + am:admin:store:app:review:update + am:admin:store:app:sub:view + am:admin:store:app:sub:modify + dm:device-type:view + and:enterprise:modify + and:enterprise:view + and:work:customer + and:work:admin + app:command:modify + dm:sign-csr + dm:admin:devices:view + dm:admin:topics:view + rm:roles:add + rm:users:add + rm:roles:update + rm:roles:permissions:view + rm:roles:details:view + rm:roles:view + rm:roles:combined:add + rm:roles:delete + an:db:vulnerabilities + an:db:non-compliant:count + an:db:non-compliant + an:db:by-groups + an:db:device:count + an:db:feature-non-compliant + an:db:overview:count + an:db:filtered-count + an:db:details + dm:activity:get + dm:devices:delete + dm:devices:app:view + dm:devices:policy:view + dm:devices:compliance:view + dm:devices:features:view + dm:devices:ops:view + dm:devices:search + dm:devices:details + dm:devices:update + dm:devices:view + dm:devices:enrollment-guide:view + rep:devices:view + dm:conf:view + dm:conf:manage + pm:policies:remove + pm:policies:priorities:update + pm:policies:deactivate + pm:policies:details:view + pm:policies:add + pm:policies:activate + pm:policies:update + pm:policies:change + pm:policies:view + dm:device-type:policies:view + um:users:add + um:users:details:view + um:users:count + um:users:delete + um:roles:view + um:users:user-details:view + um:users:cred:change + um:users:search + um:users:is-exist + um:users:update + um:users:invite + um:admin:users:view + um:activity:get + dm:admin:enrollment:update + gm:devices:view + gm:groups:update + gm:groups:add + gm:groups:device:view + gm:devices:count + gm:devices-types:view + gm:groups:remove + gm:groups:view + gm:groups:groups-view + gm:roles:share + gm:groups:count + gm:roles:view + gm:devices:remove + gm:devices:add + gm:devices:assign + dm:device-type:conf:view + dm:device-type:features:view + dm:device-type:view + am:admin:app:install + am:admin:app:uninstall + gm:admin:groups:count + gm:admin:groups:view + gm:admin:groups:add + dm:notif:mark-checked + dm:notifications:view + cm:cert:delete + cm:cert:details:get + cm:cert:view + cm:cert:add + cm:cert:verify + dm:admin + dm:device-type:deploy + dm:device-type:event:modify + dm:device-type:event:view + dm:admin:device-type:modify + dm:admin:device-type:view + dm:admin:device-type:conf:add + dm:device:enroll + dm:geo:an:view + dm:geo:alerts:manage appm:read - perm:devices:permanent-delete - perm:android:manage-configuration - perm:android:view-configuration - perm:user:permission-view - perm:ios:view-configuration - perm:ios:manage-configuration - perm:ios:dep-view - perm:ios:dep-add - perm:windows:view-configuration - perm:windows:manage-configuration - perm:android:lock-devices - perm:android:unlock-devices - perm:android:location - perm:android:clear-password - perm:android:control-camera - perm:android:enterprise-wipe - perm:android:wipe - perm:android:ring - perm:android:applications - perm:android:reboot - perm:android:change-LockTask - perm:android:mute - perm:android:configure-display-message - perm:android:send-app-restrictions - perm:android:file-transfer - perm:android:set-webclip - perm:android:set-password-policy - perm:android:change-lock-code - perm:android:upgrade-firmware - perm:android:send-notification - perm:geo-service:geo-fence - perm:whitelabel:view - perm:whitelabel:update - perm:metadata:view - perm:metadata:create - perm:metadata:update - perm:android:google-account - perm:android:update-default-sim - perm:android:google-account - perm:android:info - perm:windows:lock-devices - perm:windows:enroll - perm:windows:disenroll - perm:windows:wipe - perm:windows:ring - perm:windows:lock-reset - perm:windows:reboot - perm:windows:location - perm:admin:tenant:view - perm:admin:metadata:view - perm:admin:usage:view - perm:android:clear-application - perm:android:suspend-package - perm:android:alternate-install - perm:ios:lock - perm:ios:location - perm:ios:ring - perm:ios:clear-passcode - perm:ios:enterprise-wipe - perm:ios:notification - perm:ios:wipe-data - perm:ios:boolean-setting - perm:ios:wallpaper - perm:ios:app-attributes - perm:ios:app-configurations - perm:mac-os:restart - perm:mac-os:shut-down - perm:app:vpp:user:modify - perm:app:vpp:user:view - perm:app:vpp:asset:modify - perm:app:vpp:asset:view + dm:admin:devices:permanent-delete + and:conf:manage + and:conf:view + um:users:permission:view + ios:conf:view + ios:conf:manage + ios:dep:view + ios:dep:add + win:conf:view + win:conf:manage + and:ops:lock-devices + and:ops:unlock-devices + and:ops:location + and:ops:clear-password + and:ops:control-camera + and:ops:enterprise-wipe + and:ops:wipe + and:ops:ring + and:ops:app-list + and:ops:reboot + and:ops:change-LockTask + and:ops:mute + and:ops:conf-display-msg + and:ops:send-app-restrictions + and:ops:file-transfer + and:ops:set-webclip + and:ops:password-policy + and:ops:change-lock-code + and:ops:upgrade-firmware + and:ops:send-notif + dm:geo:geo-fence:manage + dm:whitelable:view + dm:whitelable:update + dm:metadata:view + dm:metadata:create + dm:metadata:update + and:ops:add-google-acc + and:ops:update-default-sim + and:ops:add-google-acc + and:ops:device-info + win:ops:lock-devices + win:devices:enroll + win:ops:disenroll + win:ops:wipe + win:ops:ring + win:ops:lock-reset + win:ops:reboot + win:ops:location + admin:tenant:view + dm:admin:metadata:view + dm:admin:devices:usage:view + and:ops:clear-app + and:ops:suspend-package + and:ops:alternate-install + ios:ops:lock + ios:ops:location + ios:ops:ring + ios:ops:clear-passcode + ios:ops:enterprise-wipe + ios:ops:notif + ios:ops:wipe + ios:ops:boolean-setting + ios:ops:wallpaper + ios:ops:app-attributes + ios:ops:app-conf + mac:ops:restart + mac:ops:shutdown + am:store:vpp:user:modify + am:store:vpp:user:view + am:store:vpp:assets:modify + am:store:vpp:assets:view device-mgt From 9e0427021ed9d56cadbfaedc8efb355e25245212 Mon Sep 17 00:00:00 2001 From: Viranga Gunarathna Date: Thu, 28 Sep 2023 20:14:10 +0530 Subject: [PATCH 082/112] Duplicate keys for same permission in different files --- .../api/DeviceTypeManagementService.java | 2 +- .../service/api/PolicyManagementService.java | 8 ++++---- .../service/api/ReportManagementService.java | 18 +++++++++--------- .../service/api/UserManagementService.java | 4 ++-- .../jaggeryapps/devicemgt/app/conf/config.json | 5 +---- .../src/main/resources/conf/mdm-ui-config.xml | 5 +---- 6 files changed, 18 insertions(+), 24 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java index 9f436a80e7..9236bb9790 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java @@ -89,7 +89,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Getting Details of Policies", description = "Getting Details of Policies", - key = "dm:device-type:policies:view", + key = "dm:policies:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/view"} ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java index b4bfa14a73..bcdb180e3d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java @@ -84,7 +84,7 @@ import java.util.List; @Scope( name = "Getting Details of Policies", description = "Getting Details of Policies", - key = "pm:policies:view", + key = "dm:policies:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/policies/view"} ), @@ -306,7 +306,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:policies:view") }) } ) @@ -790,7 +790,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:policies:view") }) }, nickname = "getPoliciesFilteredByType" @@ -874,7 +874,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "pm:policies:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:policies:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java index f2c8447483..e22f938684 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java @@ -70,7 +70,7 @@ import java.util.List; @Scope( name = "Getting Details of Registered Devices", description = "Getting Details of Registered Devices", - key = "rep:devices:view", + key = "dm:devices:view", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @@ -93,7 +93,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -177,7 +177,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -249,7 +249,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -327,7 +327,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -386,7 +386,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -436,7 +436,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -511,7 +511,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) @@ -579,7 +579,7 @@ public interface ReportManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "rep:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java index 70924123de..ded3961a62 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java @@ -157,7 +157,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Get activities", description = "Get activities", - key = "um:activity:get", + key = "dm:activity:get", roles = {"Internal/devicemgt-user"}, permissions = {"/device-mgt/devices/owning-device/view"} ), @@ -955,7 +955,7 @@ public interface UserManagementService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "um:activity:get") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:activity:get") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 7f7f5324d9..0d6874aa66 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -99,7 +99,6 @@ "dm:devices:details", "dm:devices:update", "dm:devices:view", - "rep:devices:view", "dm:conf:view", "dm:conf:manage", "pm:policies:remove", @@ -110,8 +109,7 @@ "pm:policies:activate", "pm:policies:update", "pm:policies:change", - "pm:policies:view", - "dm:device-type:policies:view", + "dm:policies:view", "um:users:add", "um:users:details:view", "um:users:count", @@ -124,7 +122,6 @@ "um:users:update", "um:users:invite", "um:admin:users:view", - "um:activity:get", "dm:admin:enrollment:update", "gm:devices:view", "gm:groups:update", diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index bfe8dd6406..612bb39ec4 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -231,7 +231,6 @@ dm:devices:update dm:devices:view dm:devices:enrollment-guide:view - rep:devices:view dm:conf:view dm:conf:manage pm:policies:remove @@ -242,8 +241,7 @@ pm:policies:activate pm:policies:update pm:policies:change - pm:policies:view - dm:device-type:policies:view + dm:policies:view um:users:add um:users:details:view um:users:count @@ -256,7 +254,6 @@ um:users:update um:users:invite um:admin:users:view - um:activity:get dm:admin:enrollment:update gm:devices:view gm:groups:update From f8e3fb90e67b238267ac91f80234bef13d2a2f30 Mon Sep 17 00:00:00 2001 From: navodzoysa Date: Mon, 2 Oct 2023 23:11:45 +0530 Subject: [PATCH 083/112] Fix analytics publishing for Windows devices --- .../impl/DeviceInformationManagerImpl.java | 21 ++++++++++++++++--- .../mgt/core/util/HttpReportingUtil.java | 5 +++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index 8331edd653..c048bd4422 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -22,6 +22,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsWrapper; @@ -232,9 +233,19 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { deviceDetailsWrapper.setGroups(groups); } - String[] rolesOfUser = DeviceManagerUtil.getRolesOfUser(CarbonContext - .getThreadLocalCarbonContext() - .getUsername()); + String username = CarbonContext.getThreadLocalCarbonContext().getUsername(); + if (StringUtils.isEmpty(username)) { + boolean isUserAuthorized = DeviceManagementDataHolder.getInstance(). + getDeviceAccessAuthorizationService().isUserAuthorized( + new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()), + device.getEnrolmentInfo().getOwner() + ); + if (isUserAuthorized) { + username = device.getEnrolmentInfo().getOwner(); + } + } + + String[] rolesOfUser = DeviceManagerUtil.getRolesOfUser(username); if (rolesOfUser != null && rolesOfUser.length > 0) { deviceDetailsWrapper.setRole(rolesOfUser); } @@ -248,6 +259,10 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { log.error("Error occurred while getting group list", e); } catch (UserStoreException e) { log.error("Error occurred while getting role list", e); + } catch (DeviceAccessAuthorizationException e) { + log.error("User with name '" + device.getEnrolmentInfo().getOwner() + + "' is unauthorized to publish events for device with the id '" + + device.getDeviceIdentifier() + "'", e); } } else { if(log.isTraceEnabled()) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java index 9b565b8048..288d0c0fc5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java @@ -21,6 +21,7 @@ package io.entgra.device.mgt.core.device.mgt.core.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -31,6 +32,7 @@ import org.json.JSONObject; import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import java.io.IOException; +import java.net.ConnectException; public class HttpReportingUtil { @@ -56,6 +58,9 @@ public class HttpReportingUtil { apiEndpoint.setEntity(requestEntity); HttpResponse response = client.execute(apiEndpoint); return response.getStatusLine().getStatusCode(); + } catch (ConnectException e) { + log.error("Connection refused to API endpoint: " + endpoint, e); + return HttpStatus.SC_SERVICE_UNAVAILABLE; } catch (IOException e) { throw new EventPublishingException("Error occurred when " + "invoking API. API endpoint: " + endpoint, e); From 03a0539d929cefc14f029a9c86063d084459e6a9 Mon Sep 17 00:00:00 2001 From: navodzoysa Date: Mon, 2 Oct 2023 00:48:36 +0530 Subject: [PATCH 084/112] Fix incorrect grafana permission annotations --- .../mgt/grafana/proxy/api/GrafanaAPIProxyService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java index d87eef1034..18fb6201af 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java @@ -59,8 +59,8 @@ import javax.ws.rs.core.UriInfo; name = "Using Grafana APIs required for Grafana iframes", description = "Grafana API proxy to validate requests.", key = "grafana:api:view", - roles = {"Internal/grafanamgt-user"}, - permissions = {"/analytics-mgt/grafana-mgt/api/view"} + roles = {"Internal/devicemgt-user"}, + permissions = {"/device-mgt/grafana/view"} ) } ) From 77823e2839c67db35b1163ed9884f7e74899307e Mon Sep 17 00:00:00 2001 From: pramilaniroshan Date: Fri, 6 Oct 2023 08:04:38 +0530 Subject: [PATCH 085/112] Modify get Geofence API to get total count --- .../impl/GeoLocationBasedServiceImpl.java | 8 ++++++ .../service/GeoLocationProviderService.java | 7 +++++ .../core/device/mgt/core/dao/GeofenceDAO.java | 8 ++++++ .../dao/impl/AbstractGeofenceDAOImpl.java | 24 +++++++++++++++++ .../GeoLocationProviderServiceImpl.java | 26 +++++++++++++++++++ 5 files changed, 73 insertions(+) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImpl.java index b45725c5c1..837e9ea9e7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImpl.java @@ -870,6 +870,14 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService { PaginationResult paginationResult = new PaginationResult(); paginationResult.setData(geofenceList); paginationResult.setRecordsTotal(geofenceList.size()); + try { + GeoLocationProviderService geoService = DeviceMgtAPIUtils.getGeoService(); + paginationResult.setTotalDeviceCount(geoService.getGeoFenceCount()); + } catch (GeoLocationBasedServiceException e) { + String msg = "Failed to retrieve geofence data"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } return Response.status(Response.Status.OK).entity(paginationResult).build(); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java index 920cdac80e..c214971604 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java @@ -171,4 +171,11 @@ public interface GeoLocationProviderService { * @throws GeoLocationBasedServiceException any errors occurred while reading event records to geofence */ List getEventsOfGeoFence(int geoFenceId) throws GeoLocationBasedServiceException; + + /** + * Get geo fence count by tenant id + * @return returns the geofence count of tenant. + * @throws GeoLocationBasedServiceException any errors occurred while reading event records to geofence + */ + int getGeoFenceCount() throws GeoLocationBasedServiceException; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GeofenceDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GeofenceDAO.java index a6fcf172e5..1546d4034e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GeofenceDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GeofenceDAO.java @@ -174,4 +174,12 @@ public interface GeofenceDAO { * @throws DeviceManagementDAOException */ GeofenceData getGeofence(int fenceId, boolean requireGroupData) throws DeviceManagementDAOException; + + /** + * This method is used to get the geofence count by tenant id. + * @param tenantId tenant id. + * @return returns the geofence count of tenant. + * @throws DeviceManagementDAOException + */ + int getGeofenceCount(int tenantId) throws DeviceManagementDAOException; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGeofenceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGeofenceDAOImpl.java index c575ea60dc..393a11bf20 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGeofenceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGeofenceDAOImpl.java @@ -644,4 +644,28 @@ public abstract class AbstractGeofenceDAOImpl implements GeofenceDAO { throw new DeviceManagementDAOException(msg, e); } } + + @Override + public int getGeofenceCount(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = this.getConnection(); + String sql = "SELECT COUNT(*) AS geofence_count " + + "FROM DM_GEOFENCE " + + "WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + try (ResultSet rst = stmt.executeQuery()) { + if (rst.next()) { + return rst.getInt("geofence_count"); + } + } + } + return 0; // Return 0 if no records found for the given tenantId. + } catch (SQLException e) { + String msg = "Error occurred while retrieving Geofence count of the tenant " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java index ac5c6fac5b..edac4eaa09 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java @@ -1747,6 +1747,32 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic } } + @Override + public int getGeoFenceCount() throws GeoLocationBasedServiceException { + int tenantId; + try { + tenantId = DeviceManagementDAOUtil.getTenantId(); + } catch (DeviceManagementDAOException e) { + String msg = "Error occurred while retrieving tenant id while get geofence data"; + log.error(msg, e); + throw new GeoLocationBasedServiceException(msg, e); + } + try { + EventManagementDAOFactory.openConnection(); + return geofenceDAO.getGeofenceCount(tenantId); + } catch (DeviceManagementDAOException e) { + String msg = "Error occurred while retrieving geofence data for the tenant " + tenantId; + log.error(msg, e); + throw new GeoLocationBasedServiceException(msg, e); + } catch (SQLException e) { + String msg = "Failed to open the DB connection to retrieve Geofence"; + log.error(msg, e); + throw new GeoLocationBasedServiceException(msg, e); + } finally { + EventManagementDAOFactory.closeConnection(); + } + } + /** * Delete events of geofence * From 563077fbfb026207fc409624bd39cf68e6e11e30 Mon Sep 17 00:00:00 2001 From: tcdlpds Date: Wed, 27 Sep 2023 00:45:19 +0530 Subject: [PATCH 086/112] Add scope perm mapping logic --- .../pom.xml | 2 + .../webapp/publisher/APIPublisherService.java | 5 + .../publisher/APIPublisherServiceImpl.java | 146 ++++++++++++- .../publisher/APIPublisherStartupHandler.java | 1 + .../APIManagerPublisherException.java | 8 + .../internal/APIPublisherDataHolder.java | 18 ++ .../APIPublisherServiceComponent.java | 21 ++ .../APIPublisherLifecycleListener.java | 205 +++++++++++++----- .../pom.xml | 5 + .../impl/RoleManagementServiceImpl.java | 182 +++++++--------- .../mgt/api/jaxrs/util/DeviceMgtAPIUtils.java | 21 ++ .../src/main/resources/dbscripts/cdm/h2.sql | 2 +- 12 files changed, 443 insertions(+), 173 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index 876a269e11..f40935568f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -185,6 +185,8 @@ io.entgra.device.mgt.core.apimgt.webapp.publisher.exception, io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.listener, io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.util, + io.entgra.device.mgt.core.device.mgt.common.exceptions, + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt, org.wso2.carbon.base;version="1.0", org.wso2.carbon.context;version="4.6", org.wso2.carbon;version="4.6", diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java index 5edf16d076..94eae16cb8 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java @@ -35,4 +35,9 @@ public interface APIPublisherService { void publishAPI(APIConfig api) throws APIManagerPublisherException; void updateScopeRoleMapping() throws APIManagerPublisherException; + + void addDefaultScopesIfNotExist(); + + void updateScopeRoleMapping(String roleName, String[] permissions) throws APIManagerPublisherException; + } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 46e7481857..d78de2c901 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher; +import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl; import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServices; @@ -165,7 +166,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { for (int i = 0; i < apiList.length(); i++) { JSONObject apiObj = apiList.getJSONObject(i); if (apiObj.getString("name").equals(apiIdentifier.getApiName().replace(Constants.SPACE, - Constants.EMPTY_STRING))){ + Constants.EMPTY_STRING))) { apiFound = true; apiIdentifier.setUuid(apiObj.getString("id")); break; @@ -364,7 +365,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiUuid, apiRevisionId, apiRevisionDeploymentList); if (CREATED_STATUS.equals(existingAPI.getString("lifeCycleStatus"))) { - publisherRESTAPIServices.changeLifeCycleStatus(apiApplicationKey,accessTokenInfo, + publisherRESTAPIServices.changeLifeCycleStatus(apiApplicationKey, accessTokenInfo, apiUuid, PUBLISH_ACTION); } } @@ -435,6 +436,44 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } + public void addDefaultScopesIfNotExist() { + ArrayList defaultScopes = new ArrayList<>(); + defaultScopes.add("dm:devices:any:permitted"); + defaultScopes.add("dm:device:api:subscribe"); + defaultScopes.add("am:admin:lc:app:approve"); + defaultScopes.add("am:admin:lc:app:create"); + defaultScopes.add("am:admin:lc:app:reject"); + defaultScopes.add("am:admin:lc:app:block"); + defaultScopes.add("am:admin:lc:app:review"); + defaultScopes.add("am:admin:lc:app:retire"); + defaultScopes.add("am:admin:lc:app:deprecate"); + defaultScopes.add("am:admin:lc:app:publish"); + + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + try { + APIApplicationKey apiApplicationKey = + apiApplicationServices.createAndRetrieveApplicationCredentials(); + AccessTokenInfo accessTokenInfo = + apiApplicationServices.generateAccessTokenFromRegisteredApplication( + apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); + + PublisherRESTAPIServices publisherRESTAPIServices = new PublisherRESTAPIServicesImpl(); + + Scope scope = new Scope(); + for (String defaultScope: defaultScopes) { + //todo check whether scope is available or not + scope.setName(defaultScope); + scope.setDescription(defaultScope); + scope.setKey(defaultScope); + scope.setRoles("Internal/devicemgt-user"); + publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); + } + } catch (BadRequestException | UnexpectedResponseException | APIServicesException e) { + log.error("Error occurred while adding default scopes"); + } + } + + @Override public void updateScopeRoleMapping() throws APIManagerPublisherException { @@ -573,8 +612,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } - } - catch (APIServicesException e) { + } catch (APIServicesException e) { String errorMsg = "Error while processing Publisher REST API response"; log.error(errorMsg, e); throw new APIManagerPublisherException(e); @@ -586,11 +624,94 @@ public class APIPublisherServiceImpl implements APIPublisherService { String errorMsg = "Unexpected response from the server"; log.error(errorMsg, e); throw new APIManagerPublisherException(e); - }finally { + } finally { PrivilegedCarbonContext.endTenantFlow(); } } + @Override + public void updateScopeRoleMapping(String roleName, String[] permissions) throws APIManagerPublisherException { + APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); + APIApplicationKey apiApplicationKey; + AccessTokenInfo accessTokenInfo; + try { + apiApplicationKey = apiApplicationServices.createAndRetrieveApplicationCredentials(); + accessTokenInfo = apiApplicationServices.generateAccessTokenFromRegisteredApplication( + apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); + } catch (APIServicesException e) { + String errorMsg = "Error occurred while generating the API application"; + log.error(errorMsg, e); + throw new APIManagerPublisherException(e); + } + + try { + PublisherRESTAPIServices publisherRESTAPIServices = new PublisherRESTAPIServicesImpl(); + JSONObject scopeObject = publisherRESTAPIServices.getScopes(apiApplicationKey, accessTokenInfo); + + Map permScopeMap = APIPublisherDataHolder.getInstance().getPermScopeMapping(); + for (String permission : permissions) { + String scopeValue = permScopeMap.get(permission); + if (scopeValue == null) { + String msg = "Found invalid permission: " + permission + ". Hence aborting the scope role " + + "mapping process"; + log.error(msg); + throw new APIManagerPublisherException(msg); + } + + JSONArray scopeList = (JSONArray) scopeObject.get("list"); + for (int i = 0; i < scopeList.length(); i++) { + JSONObject scopeObj = scopeList.getJSONObject(i); + if (scopeObj.getString("name").equals(scopeValue)) { + Scope scope = new Scope(); + scope.setName(scopeObj.getString("name")); + scope.setKey(scopeObj.getString("name")); + scope.setDescription(scopeObj.getString("description")); + scope.setId(scopeObj.getString("id")); + + // Including already existing roles + JSONArray existingRolesArray = (JSONArray) scopeObj.get("bindings"); + List existingRoleList = new ArrayList(); + + for (int j = 0; j < existingRolesArray.length(); j++) { + existingRoleList.add((String) existingRolesArray.get(j)); + } + if (!existingRoleList.contains(roleName)) { + existingRoleList.add(roleName); + } + scope.setRoles(String.join(",", existingRoleList)); + + if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getKey())) { + publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope); + } else { + // todo: come to this level means, that scope is removed from API, but haven't removed from the scope-role-permission-mappings list + log.warn(scope.getKey() + " not available as shared scope"); + } + break; + } + } + } + try { + updatePermissions(roleName, Arrays.asList(permissions)); + } catch (UserStoreException e) { + String errorMsg = "Error occurred when adding permissions to role: " + roleName; + log.error(errorMsg, e); + throw new APIManagerPublisherException(errorMsg, e); + } + } catch (APIServicesException e) { + String errorMsg = "Error while processing Publisher REST API response"; + log.error(errorMsg, e); + throw new APIManagerPublisherException(errorMsg, e); + } catch (BadRequestException e) { + String errorMsg = "Error while calling Publisher REST APIs"; + log.error(errorMsg, e); + throw new APIManagerPublisherException(errorMsg, e); + } catch (UnexpectedResponseException e) { + String errorMsg = "Unexpected response from the server"; + log.error(errorMsg, e); + throw new APIManagerPublisherException(errorMsg, e); + } + } + private void updatePermissions(String role, List permissions) throws UserStoreException { AuthorizationManager authorizationManager = APIPublisherDataHolder.getInstance().getUserRealm() .getAuthorizationManager(); @@ -730,7 +851,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { // if ws endpoint if (config.getEndpointType() != null && "WS".equals(config.getEndpointType())) { - endpointConfig = "{\n" + + endpointConfig = "{\n" + " \"endpoint_type\": \"ws\",\n" + " \"sandbox_endpoints\": {\n" + " \"url\": \"" + config.getEndpoint() + "\"\n" + @@ -778,4 +899,17 @@ public class APIPublisherServiceImpl implements APIPublisherService { return apiInfo; } + + /** + * This method will construct the permission scope mapping hash map. This will call in each API publish call. + * @param scopes API Scopes + */ + private void constructPemScopeMap(Set scopes) { + APIPublisherDataHolder apiPublisherDataHolder = APIPublisherDataHolder.getInstance(); + Map permScopeMap = apiPublisherDataHolder.getPermScopeMapping(); + for (ApiScope scope : scopes) { + permScopeMap.put(scope.getPermissions(), scope.getKey()); + } + apiPublisherDataHolder.setPermScopeMapping(permScopeMap); + } } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java index c986c798ce..244cc99b06 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java @@ -86,6 +86,7 @@ public class APIPublisherStartupHandler implements ServerStartupObserver { try { publisher.updateScopeRoleMapping(); + publisher.addDefaultScopesIfNotExist(); } catch (APIManagerPublisherException e) { log.error("failed to update scope role mapping.", e); } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/exception/APIManagerPublisherException.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/exception/APIManagerPublisherException.java index 47e28aefb9..281fdbbf16 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/exception/APIManagerPublisherException.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/exception/APIManagerPublisherException.java @@ -28,4 +28,12 @@ public class APIManagerPublisherException extends Exception { public APIManagerPublisherException(Throwable cause) { super(cause); } + + public APIManagerPublisherException(String errorMessage) { + super(errorMessage); + } + + public APIManagerPublisherException(String errorMessage, Throwable cause) { + super(errorMessage, cause); + } } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java index 4b47f8ba0f..0d67edc7a9 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.apimgt.webapp.publisher.internal; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIConfig; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherService; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.service.RegistryService; @@ -29,6 +30,8 @@ import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.tenant.TenantManager; import org.wso2.carbon.utils.ConfigurationContextService; +import java.util.HashMap; +import java.util.Map; import java.util.Stack; public class APIPublisherDataHolder { @@ -40,6 +43,10 @@ public class APIPublisherDataHolder { private RegistryService registryService; private boolean isServerStarted; private Stack unpublishedApis = new Stack<>(); + private Map permScopeMapping; + + private MetadataManagementService metadataManagementService; + private static APIPublisherDataHolder thisInstance = new APIPublisherDataHolder(); private APIPublisherDataHolder() { @@ -138,4 +145,15 @@ public class APIPublisherDataHolder { this.unpublishedApis = unpublishedApis; } + public Map getPermScopeMapping() {return permScopeMapping;} + + public void setPermScopeMapping(Map permScopeMapping) {this.permScopeMapping = permScopeMapping;} + + public MetadataManagementService getMetadataManagementService() { + return metadataManagementService; + } + + public void setMetadataManagementService(MetadataManagementService metadataManagementService) { + this.metadataManagementService = metadataManagementService; + } } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java index 8ab4d924b8..616a1c3987 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher.internal; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; @@ -29,6 +30,8 @@ import org.wso2.carbon.core.ServerStartupObserver; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; +import java.util.HashMap; + /** * @scr.component name="io.entgra.device.mgt.core.apimgt.webapp.publisher" immediate="true" * @scr.reference name="user.realmservice.default" @@ -43,6 +46,12 @@ import org.wso2.carbon.user.core.service.RealmService; * policy="dynamic" * bind="setRegistryService" * unbind="unsetRegistryService" + * @scr.reference name="io.entgra.meta.mgt" + * interface="io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService" + * cardinality="0..1" + * policy="dynamic" + * bind="setMetaDataMgtService" + * unbind="unsetMetaDataMgtService" */ public class APIPublisherServiceComponent { @@ -62,6 +71,7 @@ public class APIPublisherServiceComponent { /* Registering declarative service instances exposed by DeviceManagementServiceComponent */ this.registerServices(componentContext); + APIPublisherDataHolder.getInstance().setPermScopeMapping(new HashMap<>()); if (log.isDebugEnabled()) { log.debug("Webapp publisher bundle has been successfully initialized"); @@ -113,4 +123,15 @@ public class APIPublisherServiceComponent { APIPublisherDataHolder.getInstance().setRegistryService(null); } + protected void setMetaDataMgtService(MetadataManagementService metadataManagementService) { + if (metadataManagementService != null && log.isDebugEnabled()) { + log.debug("Meta data mgt mgt service initialized"); + } + APIPublisherDataHolder.getInstance().setMetadataManagementService(metadataManagementService); + } + + protected void unsetMetaDataMgtService(MetadataManagementService metadataManagementService) { + APIPublisherDataHolder.getInstance().setMetadataManagementService(null); + } + } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java index fcded26688..544b04637f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java @@ -17,6 +17,18 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.listener; +import com.google.gson.Gson; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServices; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServicesImpl; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; @@ -35,8 +47,7 @@ import org.wso2.carbon.user.api.UserStoreException; import javax.servlet.ServletContext; import java.io.IOException; -import java.util.List; -import java.util.Set; +import java.util.*; @SuppressWarnings("unused") public class APIPublisherLifecycleListener implements LifecycleListener { @@ -49,68 +60,142 @@ public class APIPublisherLifecycleListener implements LifecycleListener { @Override public void lifecycleEvent(LifecycleEvent lifecycleEvent) { - if (Lifecycle.AFTER_START_EVENT.equals(lifecycleEvent.getType()) && WebappPublisherConfig.getInstance() - .isPublished()) { - StandardContext context = (StandardContext) lifecycleEvent.getLifecycle(); - ServletContext servletContext = context.getServletContext(); - String param = servletContext.getInitParameter(PARAM_MANAGED_API_ENABLED); - boolean isManagedApi = (param != null && !param.isEmpty()) && Boolean.parseBoolean(param); + if (Lifecycle.AFTER_START_EVENT.equals(lifecycleEvent.getType()) ) { + if (WebappPublisherConfig.getInstance() + .isPublished()) { + StandardContext context = (StandardContext) lifecycleEvent.getLifecycle(); + ServletContext servletContext = context.getServletContext(); + String param = servletContext.getInitParameter(PARAM_MANAGED_API_ENABLED); + boolean isManagedApi = (param != null && !param.isEmpty()) && Boolean.parseBoolean(param); - String profile = System.getProperty(PROPERTY_PROFILE); - if (WebappPublisherConfig.getInstance().getProfiles().getProfile().contains(profile.toLowerCase()) - && isManagedApi) { - try { - AnnotationProcessor annotationProcessor = new AnnotationProcessor(context); - Set annotatedSwaggerAPIClasses = annotationProcessor. - scanStandardContext(io.swagger.annotations.SwaggerDefinition.class.getName()); - List apiDefinitions = annotationProcessor.extractAPIInfo(servletContext, - annotatedSwaggerAPIClasses); - for (APIResourceConfiguration apiDefinition : apiDefinitions) { - APIConfig apiConfig = APIPublisherUtil.buildApiConfig(servletContext, apiDefinition); - APIPublisherUtil.setResourceAuthTypes(servletContext,apiConfig); - try { - int tenantId = APIPublisherDataHolder.getInstance().getTenantManager(). - getTenantId(apiConfig.getTenantDomain()); + String profile = System.getProperty(PROPERTY_PROFILE); + if (WebappPublisherConfig.getInstance().getProfiles().getProfile().contains(profile.toLowerCase()) + && isManagedApi) { + try { + AnnotationProcessor annotationProcessor = new AnnotationProcessor(context); + Set annotatedSwaggerAPIClasses = annotationProcessor. + scanStandardContext(io.swagger.annotations.SwaggerDefinition.class.getName()); + List apiDefinitions = annotationProcessor.extractAPIInfo(servletContext, + annotatedSwaggerAPIClasses); - boolean isTenantActive = APIPublisherDataHolder.getInstance(). - getTenantManager().isTenantActive(tenantId); - if (isTenantActive) { - boolean isServerStarted = APIPublisherDataHolder.getInstance().isServerStarted(); - if (isServerStarted) { - APIPublisherService apiPublisherService = - APIPublisherDataHolder.getInstance().getApiPublisherService(); - if (apiPublisherService == null) { - throw new IllegalStateException( - "API Publisher service is not initialized properly"); - } - apiPublisherService.publishAPI(apiConfig); - } else { - if (log.isDebugEnabled()) { - log.debug("Server has not started yet. Hence adding API '" + - apiConfig.getName() + "' to the queue"); - } - APIPublisherDataHolder.getInstance().getUnpublishedApis().push(apiConfig); - } - } else { - log.error("No tenant [" + apiConfig.getTenantDomain() + "] " + - "found when publishing the Web app"); - } - } catch (Throwable e) { - log.error("Error occurred while publishing API '" + apiConfig.getName() + - "' with the context '" + apiConfig.getContext() + - "' and version '" + apiConfig.getVersion() + "'", e); + APIPublisherDataHolder apiPublisherDataHolder = APIPublisherDataHolder.getInstance(); + MetadataManagementService metadataManagementService = + apiPublisherDataHolder.getMetadataManagementService(); + Metadata metadata = metadataManagementService.retrieveMetadata("perm-scope-mapping"); + if (metadata != null) { + HashMap permScopeMapping = + new Gson().fromJson(metadata.getMetaValue().toString(), HashMap.class); + apiPublisherDataHolder.setPermScopeMapping(permScopeMapping); } + + Map permScopeMap = apiPublisherDataHolder.getPermScopeMapping(); + for (APIResourceConfiguration apiDefinition : apiDefinitions) { + APIConfig apiConfig = APIPublisherUtil.buildApiConfig(servletContext, apiDefinition); + for (ApiScope scope : apiConfig.getScopes()) { + permScopeMap.put(scope.getPermissions(), scope.getKey()); + } + APIPublisherUtil.setResourceAuthTypes(servletContext,apiConfig); + try { + int tenantId = APIPublisherDataHolder.getInstance().getTenantManager(). + getTenantId(apiConfig.getTenantDomain()); + + boolean isTenantActive = APIPublisherDataHolder.getInstance(). + getTenantManager().isTenantActive(tenantId); + if (isTenantActive) { + boolean isServerStarted = APIPublisherDataHolder.getInstance().isServerStarted(); + if (isServerStarted) { + APIPublisherService apiPublisherService = + APIPublisherDataHolder.getInstance().getApiPublisherService(); + if (apiPublisherService == null) { + throw new IllegalStateException( + "API Publisher service is not initialized properly"); + } + apiPublisherService.publishAPI(apiConfig); + } else { + if (log.isDebugEnabled()) { + log.debug("Server has not started yet. Hence adding API '" + + apiConfig.getName() + "' to the queue"); + } + APIPublisherDataHolder.getInstance().getUnpublishedApis().push(apiConfig); + } + } else { + log.error("No tenant [" + apiConfig.getTenantDomain() + "] " + + "found when publishing the Web app"); + } + } catch (Throwable e) { + log.error("Error occurred while publishing API '" + apiConfig.getName() + + "' with the context '" + apiConfig.getContext() + + "' and version '" + apiConfig.getVersion() + "'", e); + } + } + apiPublisherDataHolder.setPermScopeMapping(permScopeMap); + + Map permScopeMapping = apiPublisherDataHolder.getPermScopeMapping(); + if (!permScopeMapping.isEmpty()) { + Metadata existingMetaData = metadataManagementService.retrieveMetadata("perm-scope" + + "-mapping"); + if (existingMetaData != null) { + existingMetaData.setMetaValue(new Gson().toJson(apiPublisherDataHolder.getPermScopeMapping() + )); + metadataManagementService.updateMetadata(existingMetaData); + } else { + Metadata newMetaData = new Metadata(); + newMetaData.setMetaKey("perm-scope-mapping"); + permScopeMapping = + apiPublisherDataHolder.getPermScopeMapping(); + + //Todo fix this properly with a config + Map defaultScopePermMap = new HashMap<>(); + defaultScopePermMap.put("/permission/admin/device-mgt/devices/any-device/permitted-actions-under-owning-device", "dm:devices:any:permitted"); + defaultScopePermMap.put("/permission/admin/device-mgt/device/api/subscribe", "dm:device:api:subscribe"); + defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/approve", "am:admin:lc:app:approve"); + defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/create", "am:admin:lc:app:create"); + defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/reject", "am:admin:lc:app:reject"); + defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/block", "am:admin:lc:app:block"); + defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/review", "am:admin:lc:app:review"); + defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/retire", "am:admin:lc:app:retire"); + defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/deprecate", "am:admin:lc:app:deprecate"); + defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/publish", "am:admin:lc:app:publish"); + + for (Map.Entry mapElement : defaultScopePermMap.entrySet()) { + String key = mapElement.getKey(); + String value = mapElement.getValue(); + permScopeMapping.put(key,value); + } + apiPublisherDataHolder.setPermScopeMapping(permScopeMapping); + newMetaData.setMetaValue(new Gson().toJson(permScopeMapping)); + metadataManagementService.createMetadata(newMetaData); + } + } + } catch (IOException e) { + log.error("Error encountered while discovering annotated classes", e); + } catch (ClassNotFoundException e) { + log.error("Error while scanning class for annotations", e); + } catch (UserStoreException e) { + log.error("Error while retrieving tenant admin user for the tenant domain" + + PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(), e); + } catch (Throwable e) { + // This is done to stop tomcat failure if a webapp failed to publish apis. + log.error("Failed to Publish api from " + servletContext.getContextPath(), e); } - } catch (IOException e) { - log.error("Error encountered while discovering annotated classes", e); - } catch (ClassNotFoundException e) { - log.error("Error while scanning class for annotations", e); - } catch (UserStoreException e) { - log.error("Error while retrieving tenant admin user for the tenant domain" - + PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(), e); - } catch (Throwable e) { - // This is done to stop tomcat failure if a webapp failed to publish apis. - log.error("Failed to Publish api from " + servletContext.getContextPath(), e); + } + } else { + APIPublisherDataHolder apiPublisherDataHolder = APIPublisherDataHolder.getInstance(); + MetadataManagementService metadataManagementService = + apiPublisherDataHolder.getMetadataManagementService(); + try { + Metadata existingMetaData = metadataManagementService.retrieveMetadata("perm-scope" + + "-mapping"); + if (existingMetaData != null) { + existingMetaData.setMetaValue(new Gson().toJson(apiPublisherDataHolder.getPermScopeMapping() + )); + metadataManagementService.updateMetadata(existingMetaData); + } else { + log.error("Couldn't find 'perm-scope-mapping' Meta entry while API publishing has been turned" + + " off."); + } + } catch (MetadataManagementException e) { + log.error("Failed to Load Meta-Mgt data.", e); } } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index b486fc4b4e..48128f3dd7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -455,5 +455,10 @@ io.entgra.device.mgt.core.apimgt.analytics.extension provided + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.apimgt.webapp.publisher + provided + \ No newline at end of file diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java index 748bcc485c..036c4f6766 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; @@ -28,6 +29,7 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.RegistryType; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleInfo; @@ -56,6 +58,8 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import static io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants.PRIMARY_USER_STORE; @@ -277,15 +281,32 @@ public class RoleManagementServiceImpl implements RoleManagementService { } } - private UIPermissionNode getAllRolePermissions(String roleName, UserRealm userRealm) throws UserAdminException { - org.wso2.carbon.user.core.UserRealm userRealmCore = null; - if (userRealm instanceof org.wso2.carbon.user.core.UserRealm) { - userRealmCore = (org.wso2.carbon.user.core.UserRealm) userRealm; + private List processAndFilterPermissions(UIPermissionNode[] rolePermissions, List permissionPaths, List permissions) { + + for (UIPermissionNode rolePermission : rolePermissions) { + if (permissionPaths.isEmpty()) { + return permissions; + } + + if (rolePermission.getNodeList().length == 0) { + if (permissionPaths.contains(rolePermission.getResourcePath())) { + permissions.add(rolePermission.getResourcePath()); + } + } + permissionPaths.remove(rolePermission.getResourcePath()); + if (rolePermission.getNodeList().length != 0) { + processAndFilterPermissions(rolePermission.getNodeList(), permissionPaths, permissions); + } } - final UserRealmProxy userRealmProxy = new UserRealmProxy(userRealmCore); - final UIPermissionNode rolePermissions = - userRealmProxy.getRolePermissions(roleName, MultitenantConstants.SUPER_TENANT_ID); - return rolePermissions; + return permissions; + } + + private String[] getPlatformUIPermissions(String roleName, UserRealm userRealm, String[] permissions) + throws UserAdminException { + UIPermissionNode uiPermissionNode = getUIPermissionNode(roleName, userRealm); + List permissionsArray = processAndFilterPermissions(uiPermissionNode.getNodeList(), new ArrayList<>(Arrays.asList(permissions)), + new ArrayList<>()); + return permissionsArray.toArray(new String[0]); } private UIPermissionNode getUIPermissionNode(String roleName, UserRealm userRealm) @@ -361,18 +382,6 @@ public class RoleManagementServiceImpl implements RoleManagementService { } } - private List getAuthorizedPermissions(UIPermissionNode uiPermissionNode, List list) { - for (UIPermissionNode permissionNode : uiPermissionNode.getNodeList()) { - if (permissionNode.isSelected()) { - list.add(permissionNode.getResourcePath()); - } - if (permissionNode.getNodeList() != null && permissionNode.getNodeList().length > 0) { - getAuthorizedPermissions(permissionNode, list); - } - } - return list; - } - @POST @Override public Response addRole(RoleInfo roleInfo) { @@ -383,6 +392,7 @@ public class RoleManagementServiceImpl implements RoleManagementService { if (log.isDebugEnabled()) { log.debug("Persisting the role in the underlying user store"); } + Permission[] permissions = null; if (roleInfo.getPermissions() != null && roleInfo.getPermissions().length > 0) { permissions = new Permission[roleInfo.getPermissions().length]; @@ -392,7 +402,33 @@ public class RoleManagementServiceImpl implements RoleManagementService { } } userStoreManager.addRole(roleInfo.getRoleName(), roleInfo.getUsers(), permissions); - authorizeRoleForAppmgt(roleInfo.getRoleName(), roleInfo.getPermissions()); + try { + if (roleInfo.getPermissions() != null && roleInfo.getPermissions().length > 0) { + String finalRoleName = roleInfo.getRoleName(); + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); + final UserRealm userRealm = DeviceMgtAPIUtils.getUserRealm(); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); + DeviceMgtAPIUtils.getApiPublisher().updateScopeRoleMapping(roleInfo.getRoleName(), + RoleManagementServiceImpl.this.getPlatformUIPermissions(finalRoleName, userRealm, roleInfo.getPermissions())); + } catch (APIManagerPublisherException | UserAdminException e) { + log.error("Error Occurred while updating role scope mapping. ", e); + } finally { + PrivilegedCarbonContext.endTenantFlow(); + } + } + }); + thread.start(); + } + } catch (UserStoreException e) { + String msg = "Error occurred while loading the user store."; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } //TODO fix what's returned in the entity return Response.created(new URI(API_BASE_PATH + "/" + URLEncoder.encode(roleInfo.getRoleName(), "UTF-8"))). @@ -502,11 +538,10 @@ public class RoleManagementServiceImpl implements RoleManagementService { final UserRealm userRealm = DeviceMgtAPIUtils.getUserRealm(); final UserStoreManager userStoreManager = userRealm.getUserStoreManager(); if (!userStoreManager.isExistingRole(roleName)) { - String msg = "No role exists with the name : " + roleName ; + String msg = "No role exists with the name : " + roleName; return Response.status(404).entity(msg).build(); } - final AuthorizationManager authorizationManager = userRealm.getAuthorizationManager(); if (log.isDebugEnabled()) { log.debug("Updating the role to user store"); } @@ -528,31 +563,24 @@ public class RoleManagementServiceImpl implements RoleManagementService { } if (roleInfo.getPermissions() != null) { - // Get all role permissions - final UIPermissionNode rolePermissions = this.getAllRolePermissions(roleName, userRealm); - List permissions = new ArrayList(); - final UIPermissionNode emmRolePermissions = (UIPermissionNode) this.getRolePermissions(roleName); - List emmConsolePermissions = new ArrayList(); - this.getAuthorizedPermissions(emmRolePermissions, emmConsolePermissions); - emmConsolePermissions.removeAll(new ArrayList(Arrays.asList(roleInfo.getPermissions()))); - this.getAuthorizedPermissions(rolePermissions, permissions); - for (String permission : roleInfo.getPermissions()) { - permissions.add(permission); - } - permissions.removeAll(emmConsolePermissions); - String[] allApplicablePerms = new String[permissions.size()]; - allApplicablePerms = permissions.toArray(allApplicablePerms); - roleInfo.setPermissions(allApplicablePerms); - - // Delete all authorizations for the current role before authorizing the permission tree - authorizationManager.clearRoleAuthorization(roleName); - if (roleInfo.getPermissions().length > 0) { - for (int i = 0; i < roleInfo.getPermissions().length; i++) { - String permission = roleInfo.getPermissions()[i]; - authorizationManager.authorizeRole(roleName, permission, CarbonConstants.UI_PERMISSION_ACTION); + String finalRoleName = roleName; + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); + DeviceMgtAPIUtils.getApiPublisher().updateScopeRoleMapping(roleInfo.getRoleName(), + RoleManagementServiceImpl.this.getPlatformUIPermissions(finalRoleName, userRealm, roleInfo.getPermissions())); + } catch (APIManagerPublisherException | UserAdminException e) { + log.error("Error Occurred while updating role scope mapping. ", e); + } finally { + PrivilegedCarbonContext.endTenantFlow(); + } } - } - authorizeRoleForAppmgt(roleName, roleInfo.getPermissions()); + }); + thread.start(); } //TODO: Need to send the updated role information in the entity back to the client return Response.status(Response.Status.OK).entity("Role '" + roleInfo.getRoleName() + "' has " + @@ -569,70 +597,12 @@ public class RoleManagementServiceImpl implements RoleManagementService { String msg = "Role already exists with name : " + role + ". Try with another role name."; log.warn(msg); return Response.status(Response.Status.CONFLICT).entity(msg).build(); - }else{ + } else { String msg = "Error occurred while updating role '" + roleName + "'"; log.error(msg, e); return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } - } catch (UserAdminException e) { - String msg = "Error occurred while updating permissions of the role '" + roleName + "'"; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); - } - } - - /** - * When presented with role and a set of permissions, if given role has permission to - * perform mobile app management, said role will be given rights mobile app collection in the - * governance registry. - * - * @param role - * @param permissions - * @return state of role update Operation - */ - private boolean authorizeRoleForAppmgt(String role, String[] permissions) { - String permissionString = - "ra^true:rd^false:wa^true:wd^false:da^true:dd^false:aa^true:ad^false"; - String resourcePath = "/_system/governance/mobileapps/"; - boolean appmPermAvailable = false; - - if (permissions != null) { - for (int i = 0; i < permissions.length; i++) - switch (permissions[i]) { - case "/permission/admin/manage/mobileapp": - appmPermAvailable = true; - break; - case "/permission/admin/manage/mobileapp/create": - appmPermAvailable = true; - break; - case "/permission/admin/manage/mobileapp/publish": - appmPermAvailable = true; - break; - } - } - - if (appmPermAvailable) { - try { - Registry registry = CarbonContext.getThreadLocalCarbonContext(). - getRegistry(RegistryType.SYSTEM_GOVERNANCE); - ChangeRolePermissionsUtil.changeRolePermissions((UserRegistry) registry, - resourcePath, role + ":" + permissionString); - - return true; - } catch (Exception e) { - String msg = "Error while retrieving user registry in order to update permissions " - + "for resource : " + resourcePath; - log.error(msg, e); - return false; - } - } else { - if (log.isDebugEnabled()) { - log.debug("Mobile App Management permissions not selected, therefore role : " + - role + " not given permission for registry collection : " + resourcePath); - } - return false; } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java index 2760482a65..1c3be6a797 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.util; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherService; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; import org.apache.axis2.AxisFault; @@ -157,6 +158,8 @@ public class DeviceMgtAPIUtils { private static volatile SubscriptionManager subscriptionManager; private static volatile ApplicationManager applicationManager; + private static volatile APIPublisherService apiPublisher; + static { String keyStorePassword = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Password"); String trustStorePassword = ServerConfiguration.getInstance().getFirstProperty( @@ -235,6 +238,24 @@ public class DeviceMgtAPIUtils { return applicationManager; } + public static APIPublisherService getApiPublisher() { + if (apiPublisher == null) { + synchronized (DeviceMgtAPIUtils.class) { + if (apiPublisher == null) { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + apiPublisher = + (APIPublisherService) ctx.getOSGiService(APIPublisherService.class, null); + if (apiPublisher == null) { + String msg = "Application Manager service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + } + } + } + return apiPublisher; + } + public static void scheduleTaskService(int notifierFrequency) { TaskScheduleService taskScheduleService; try { diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index f261a3b49e..4d87dbdcca 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -594,7 +594,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA ( METADATA_ID INT AUTO_INCREMENT NOT NULL, DATA_TYPE VARCHAR(16) NOT NULL, METADATA_KEY VARCHAR(128) NOT NULL, - METADATA_VALUE VARCHAR(8000) NOT NULL, + METADATA_VALUE VARCHAR(20000) NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (METADATA_ID), CONSTRAINT METADATA_KEY_TENANT_ID UNIQUE (METADATA_KEY, TENANT_ID) From 58670028c09c82c1dedb48eedb94c4595ef2412c Mon Sep 17 00:00:00 2001 From: tcdlpds Date: Wed, 11 Oct 2023 06:54:46 +0530 Subject: [PATCH 087/112] Fix scope attaching issue --- .../impl/RoleManagementServiceImpl.java | 75 ++++++++----------- .../impl/UserManagementServiceImpl.java | 49 +----------- .../src/main/resources/conf/mdm-ui-config.xml | 16 ---- 3 files changed, 32 insertions(+), 108 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java index 036c4f6766..a9ea688d05 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java @@ -30,7 +30,6 @@ import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.context.RegistryType; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleInfo; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList; @@ -40,9 +39,6 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestV import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.SetReferenceTransformer; -import org.wso2.carbon.registry.api.Registry; -import org.wso2.carbon.registry.core.session.UserRegistry; -import org.wso2.carbon.registry.resource.services.utils.ChangeRolePermissionsUtil; import org.wso2.carbon.user.api.*; import org.wso2.carbon.user.core.common.AbstractUserStoreManager; import org.wso2.carbon.user.core.constants.UserCoreErrorConstants.ErrorMessages; @@ -57,9 +53,11 @@ import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; -import java.util.*; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import static io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants.PRIMARY_USER_STORE; @@ -404,25 +402,9 @@ public class RoleManagementServiceImpl implements RoleManagementService { userStoreManager.addRole(roleInfo.getRoleName(), roleInfo.getUsers(), permissions); try { if (roleInfo.getPermissions() != null && roleInfo.getPermissions().length > 0) { - String finalRoleName = roleInfo.getRoleName(); - String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); - final UserRealm userRealm = DeviceMgtAPIUtils.getUserRealm(); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); - DeviceMgtAPIUtils.getApiPublisher().updateScopeRoleMapping(roleInfo.getRoleName(), - RoleManagementServiceImpl.this.getPlatformUIPermissions(finalRoleName, userRealm, roleInfo.getPermissions())); - } catch (APIManagerPublisherException | UserAdminException e) { - log.error("Error Occurred while updating role scope mapping. ", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - }); - thread.start(); + String[] roleName = roleInfo.getRoleName().split("/"); + addPermissions(roleName[roleName.length - 1], roleInfo.getPermissions(), + DeviceMgtAPIUtils.getUserRealm()); } } catch (UserStoreException e) { String msg = "Error occurred while loading the user store."; @@ -563,24 +545,8 @@ public class RoleManagementServiceImpl implements RoleManagementService { } if (roleInfo.getPermissions() != null) { - String finalRoleName = roleName; - String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); - DeviceMgtAPIUtils.getApiPublisher().updateScopeRoleMapping(roleInfo.getRoleName(), - RoleManagementServiceImpl.this.getPlatformUIPermissions(finalRoleName, userRealm, roleInfo.getPermissions())); - } catch (APIManagerPublisherException | UserAdminException e) { - log.error("Error Occurred while updating role scope mapping. ", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - }); - thread.start(); + String[] roleDetails = roleName.split("/"); + addPermissions(roleDetails[roleDetails.length - 1], roleInfo.getPermissions(), userRealm); } //TODO: Need to send the updated role information in the entity back to the client return Response.status(Response.Status.OK).entity("Role '" + roleInfo.getRoleName() + "' has " + @@ -730,4 +696,25 @@ public class RoleManagementServiceImpl implements RoleManagementService { } return rolePermissions; } + + private void addPermissions(String roleName, String[] permissions, UserRealm userRealm) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); + DeviceMgtAPIUtils.getApiPublisher().updateScopeRoleMapping(roleName, + RoleManagementServiceImpl.this.getPlatformUIPermissions(roleName, userRealm, + permissions)); + } catch (APIManagerPublisherException | UserAdminException e) { + log.error("Error Occurred while updating role scope mapping. ", e); + } finally { + PrivilegedCarbonContext.endTenantFlow(); + } + } + }); + thread.start(); + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java index 71528bf32d..6d24ee6aa3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java @@ -114,11 +114,6 @@ public class UserManagementServiceImpl implements UserManagementService { private static final String API_BASE_PATH = "/users"; private static final Log log = LogFactory.getLog(UserManagementServiceImpl.class); - private static final String ADMIN_ROLE = "admin"; - private static final String DEFAULT_DEVICE_USER = "Internal/devicemgt-user"; - private static final String DEFAULT_DEVICE_ADMIN = "Internal/devicemgt-admin"; - private static final String DEFAULT_SUBSCRIBER = "Internal/subscriber"; - // Permissions that are given for a normal device user. private static final Permission[] PERMISSIONS_FOR_DEVICE_USER = { new Permission("/permission/admin/Login", "ui.execute"), @@ -155,51 +150,9 @@ public class UserManagementServiceImpl implements UserManagementService { Map defaultUserClaims = this.buildDefaultUserClaims(userInfo.getFirstname(), userInfo.getLastname(), userInfo.getEmailAddress(), true); - // calling addUser method of carbon user api - List tmpRoles = new ArrayList<>(); - String[] userInfoRoles = userInfo.getRoles(); - tmpRoles.add(DEFAULT_DEVICE_USER); - - boolean subscriberFound = false; - boolean adminFound = false; - - if (userInfoRoles != null) { - //check if subscriber role is coming in the payload - for (String r : userInfoRoles) { - if (!subscriberFound || !adminFound) { - if (DEFAULT_SUBSCRIBER.equals(r)) { - subscriberFound = true; - } else if (ADMIN_ROLE.equals(r)) { - tmpRoles.add(DEFAULT_DEVICE_ADMIN); - adminFound = true; - } - } else { - break; - } - } - tmpRoles.addAll(Arrays.asList(userInfoRoles)); - } - - if (!subscriberFound) { - // Add Internal/subscriber role to new users - if (userStoreManager.isExistingRole(DEFAULT_SUBSCRIBER)) { - tmpRoles.add(DEFAULT_SUBSCRIBER); - } else { - log.warn("User: " + userInfo.getUsername() + " will not be able to enroll devices as '" + - DEFAULT_SUBSCRIBER + "' is missing in the system"); - } - } - - String[] roles = new String[tmpRoles.size()]; - tmpRoles.toArray(roles); - - // If the normal device user role does not exist, create a new role with the minimal permissions - if (!userStoreManager.isExistingRole(DEFAULT_DEVICE_USER)) { - userStoreManager.addRole(DEFAULT_DEVICE_USER, null, PERMISSIONS_FOR_DEVICE_USER); - } userStoreManager.addUser(userInfo.getUsername(), initialUserPassword, - roles, defaultUserClaims, null); + userInfo.getRoles(), defaultUserClaims, null); // Outputting debug message upon successful addition of user if (log.isDebugEnabled()) { log.debug("User '" + userInfo.getUsername() + "' has successfully been added."); diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index 612bb39ec4..aada3c5255 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -187,7 +187,6 @@ am:store:app:modify am:store:app:sub:install am:store:app:sub:uninstall - am:admin:pub:app:review:update am:admin:pub:app:review:view am:admin:pub:app:update am:admin:store:app:review:update @@ -196,12 +195,8 @@ dm:device-type:view and:enterprise:modify and:enterprise:view - and:work:customer - and:work:admin - app:command:modify dm:sign-csr dm:admin:devices:view - dm:admin:topics:view rm:roles:add rm:users:add rm:roles:update @@ -210,15 +205,6 @@ rm:roles:view rm:roles:combined:add rm:roles:delete - an:db:vulnerabilities - an:db:non-compliant:count - an:db:non-compliant - an:db:by-groups - an:db:device:count - an:db:feature-non-compliant - an:db:overview:count - an:db:filtered-count - an:db:details dm:activity:get dm:devices:delete dm:devices:app:view @@ -295,7 +281,6 @@ dm:device:enroll dm:geo:an:view dm:geo:alerts:manage - appm:read dm:admin:devices:permanent-delete and:conf:manage and:conf:view @@ -345,7 +330,6 @@ win:ops:reboot win:ops:location admin:tenant:view - dm:admin:metadata:view dm:admin:devices:usage:view and:ops:clear-app and:ops:suspend-package From 54cdab5085eb4a12053394fee8dae9a0586bfdc6 Mon Sep 17 00:00:00 2001 From: "amalka.subasinghe" Date: Thu, 12 Oct 2023 11:54:23 +0530 Subject: [PATCH 088/112] Improvements to the device sub type impl --- .../cache/GetDeviceSubTypeCacheLoader.java | 2 +- .../subtype/mgt/dao/DeviceSubTypeDAO.java | 12 +++---- .../mgt/dao/DeviceSubTypeDAOFactory.java | 15 +++++++++ .../mgt/dao/impl/DeviceSubTypeDAOImpl.java | 24 +++++++------- .../core/subtype/mgt/dao/util/DAOUtil.java | 9 ++++-- .../core/subtype/mgt/dto/DeviceSubType.java | 24 +++++++++----- .../mgt/dto/DeviceSubTypeCacheKey.java | 6 ++-- .../mgt/impl/DeviceSubTypeServiceImpl.java | 32 ++++--------------- .../subtype/mgt/spi/DeviceSubTypeService.java | 12 +++---- .../mgt/util/DeviceSubTypeMgtUtil.java | 4 +-- .../mgt/core/subtype/mgt/DAONegativeTest.java | 17 +++++----- .../device/mgt/core/subtype/mgt/DAOTest.java | 17 +++++----- .../core/subtype/mgt/ServiceNegativeTest.java | 13 ++++---- .../mgt/core/subtype/mgt/ServiceTest.java | 17 +++++----- .../mgt/core/subtype/mgt/TestUtils.java | 8 ++--- .../src/main/resources/dbscripts/cdm/h2.sql | 4 +-- .../main/resources/dbscripts/cdm/mssql.sql | 4 +-- .../main/resources/dbscripts/cdm/mysql.sql | 4 +-- .../main/resources/dbscripts/cdm/oracle.sql | 4 +-- .../resources/dbscripts/cdm/postgresql.sql | 4 +-- 20 files changed, 122 insertions(+), 110 deletions(-) diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/cache/GetDeviceSubTypeCacheLoader.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/cache/GetDeviceSubTypeCacheLoader.java index 7819a2ed99..c6d8c0e69d 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/cache/GetDeviceSubTypeCacheLoader.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/cache/GetDeviceSubTypeCacheLoader.java @@ -47,7 +47,7 @@ public class GetDeviceSubTypeCacheLoader extends CacheLoader getAllDeviceSubTypes(int tenantId, DeviceSubType.DeviceType deviceType) + List getAllDeviceSubTypes(int tenantId, String deviceType) throws SubTypeMgtDAOException; - int getDeviceSubTypeCount(DeviceSubType.DeviceType deviceType) throws SubTypeMgtDAOException; + int getDeviceSubTypeCount(String deviceType) throws SubTypeMgtDAOException; - boolean checkDeviceSubTypeExist(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType) + boolean checkDeviceSubTypeExist(String subTypeId, int tenantId, String deviceType) throws SubTypeMgtDAOException; - DeviceSubType getDeviceSubTypeByProvider(String subTypeName, int tenantId, DeviceSubType.DeviceType deviceType) + DeviceSubType getDeviceSubTypeByProvider(String subTypeName, int tenantId, String deviceType) throws SubTypeMgtDAOException; } diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAOFactory.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAOFactory.java index 0a6c962cd4..d83558cd59 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAOFactory.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAOFactory.java @@ -26,10 +26,14 @@ import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; +import javax.sql.DataSource; +import java.sql.SQLException; + public class DeviceSubTypeDAOFactory { private static final Log log = LogFactory.getLog(DeviceSubTypeDAOFactory.class); private static String databaseEngine; + private static DataSource dataSource; public static void init(DataSourceConfig dataSourceConfiguration) { if (log.isDebugEnabled()) { log.debug("Initializing Device SubType Mgt Data Source"); @@ -38,6 +42,17 @@ public class DeviceSubTypeDAOFactory { databaseEngine = ConnectionManagerUtil.getDatabaseType(); } + public static void init(DataSource dtSource) { + dataSource = dtSource; + + try { + databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName(); + } catch (SQLException var2) { + log.error("Error occurred while retrieving config.datasource connection", var2); + } + + } + public static DeviceSubTypeDAO getDeviceSubTypeDAO() { if (databaseEngine != null) { //noinspection SwitchStatementWithTooFewBranches diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/impl/DeviceSubTypeDAOImpl.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/impl/DeviceSubTypeDAOImpl.java index a6224a2ed2..ecfc1fbcc4 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/impl/DeviceSubTypeDAOImpl.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/impl/DeviceSubTypeDAOImpl.java @@ -67,7 +67,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { } @Override - public boolean updateDeviceSubType(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType, + public boolean updateDeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition) throws SubTypeMgtDAOException { try { @@ -80,7 +80,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { stmt.setString(2, subTypeName); stmt.setString(3, subTypeId); stmt.setInt(4, tenantId); - stmt.setString(5, deviceType.toString()); + stmt.setString(5, deviceType); return stmt.executeUpdate() > 0; } @@ -98,7 +98,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { } @Override - public DeviceSubType getDeviceSubType(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType) + public DeviceSubType getDeviceSubType(String subTypeId, int tenantId, String deviceType) throws SubTypeMgtDAOException { try { String sql = "SELECT * FROM DM_DEVICE_SUB_TYPE WHERE SUB_TYPE_ID = ? AND TENANT_ID = ? AND DEVICE_TYPE = ?"; @@ -107,7 +107,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setString(1, subTypeId); stmt.setInt(2, tenantId); - stmt.setString(3, deviceType.toString()); + stmt.setString(3, deviceType); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { return DAOUtil.loadDeviceSubType(rs); @@ -130,7 +130,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { } @Override - public List getAllDeviceSubTypes(int tenantId, DeviceSubType.DeviceType deviceType) + public List getAllDeviceSubTypes(int tenantId, String deviceType) throws SubTypeMgtDAOException { try { String sql = "SELECT * FROM DM_DEVICE_SUB_TYPE WHERE TENANT_ID = ? AND DEVICE_TYPE = ? ORDER BY " + @@ -139,7 +139,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { Connection conn = ConnectionManagerUtil.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); - stmt.setString(2, deviceType.toString()); + stmt.setString(2, deviceType); try (ResultSet rs = stmt.executeQuery()) { return DAOUtil.loadDeviceSubTypes(rs); } @@ -159,13 +159,13 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { } @Override - public int getDeviceSubTypeCount(DeviceSubType.DeviceType deviceType) throws SubTypeMgtDAOException { + public int getDeviceSubTypeCount(String deviceType) throws SubTypeMgtDAOException { try { String sql = "SELECT COUNT(*) as DEVICE_COUNT FROM DM_DEVICE_SUB_TYPE WHERE DEVICE_TYPE = ? "; Connection conn = ConnectionManagerUtil.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setString(1, deviceType.toString()); + stmt.setString(1, deviceType); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { return rs.getInt("DEVICE_COUNT"); @@ -188,7 +188,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { } @Override - public boolean checkDeviceSubTypeExist(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType) + public boolean checkDeviceSubTypeExist(String subTypeId, int tenantId, String deviceType) throws SubTypeMgtDAOException { try { String sql = "SELECT * FROM DM_DEVICE_SUB_TYPE WHERE SUB_TYPE_ID = ? AND TENANT_ID = ? AND DEVICE_TYPE " + @@ -198,7 +198,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setString(1, subTypeId); stmt.setInt(2, tenantId); - stmt.setString(3, deviceType.toString()); + stmt.setString(3, deviceType); try (ResultSet rs = stmt.executeQuery()) { return rs.next(); } @@ -219,7 +219,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { @Override public DeviceSubType getDeviceSubTypeByProvider(String subTypeName, int tenantId, - DeviceSubType.DeviceType deviceType) + String deviceType) throws SubTypeMgtDAOException { try { String sql = "SELECT * FROM DM_DEVICE_SUB_TYPE WHERE SUB_TYPE_NAME = ? AND TENANT_ID = ? AND DEVICE_TYPE " + @@ -229,7 +229,7 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO { try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setString(1, subTypeName); stmt.setInt(2, tenantId); - stmt.setString(3, deviceType.toString()); + stmt.setString(3, deviceType); try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { return DAOUtil.loadDeviceSubType(rs); diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/DAOUtil.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/DAOUtil.java index 9473a88c6b..34e108a4a6 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/DAOUtil.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/DAOUtil.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.subtype.mgt.dao.util; +import com.fasterxml.jackson.core.JsonProcessingException; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; import java.sql.ResultSet; @@ -30,17 +31,19 @@ public class DAOUtil { public static DeviceSubType loadDeviceSubType(ResultSet rs) throws SQLException { DeviceSubType deviceSubType = new DeviceSubType() { @Override - public DeviceSubType setDeviceSubType(T objType, String typeDef) { + public DeviceSubType convertToDeviceSubType() { return null; } @Override - public String parseSubTypeToJson(Object objType) { return null; } + public String parseSubTypeToJson() throws JsonProcessingException { + return null; + } }; deviceSubType.setTenantId(rs.getInt("TENANT_ID")); deviceSubType.setSubTypeId(rs.getString("SUB_TYPE_ID")); deviceSubType.setSubTypeName(rs.getString("SUB_TYPE_NAME")); - deviceSubType.setDeviceType(DeviceSubType.DeviceType.valueOf(rs.getString("DEVICE_TYPE"))); + deviceSubType.setDeviceType(rs.getString("DEVICE_TYPE")); deviceSubType.setTypeDefinition(rs.getString("TYPE_DEFINITION")); return deviceSubType; } diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubType.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubType.java index f914bf9930..84eaa124c6 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubType.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubType.java @@ -26,10 +26,21 @@ public abstract class DeviceSubType { private String subTypeId; private int tenantId; - private DeviceType deviceType; + private String deviceType; private String subTypeName; private String typeDefinition; + public DeviceSubType() { + } + + public DeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition) { + this.subTypeId = subTypeId; + this.tenantId = tenantId; + this.deviceType = deviceType; + this.subTypeName = subTypeName; + this.typeDefinition = typeDefinition; + } + public String getSubTypeId() { return subTypeId; } @@ -46,11 +57,11 @@ public abstract class DeviceSubType { this.tenantId = tenantId; } - public DeviceType getDeviceType() { + public String getDeviceType() { return deviceType; } - public void setDeviceType(DeviceType deviceType) { + public void setDeviceType(String deviceType) { this.deviceType = deviceType; } @@ -70,11 +81,8 @@ public abstract class DeviceSubType { this.typeDefinition = typeDefinition; } - public abstract DeviceSubType setDeviceSubType(T objType, String typeDef); + public abstract DeviceSubType convertToDeviceSubType(); - public abstract String parseSubTypeToJson(Object objType) throws JsonProcessingException; + public abstract String parseSubTypeToJson() throws JsonProcessingException; - public enum DeviceType { - COM, METER, SIM - } } diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubTypeCacheKey.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubTypeCacheKey.java index eb66f92a46..2834300d5f 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubTypeCacheKey.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubTypeCacheKey.java @@ -21,7 +21,7 @@ package io.entgra.device.mgt.core.subtype.mgt.dto; public class DeviceSubTypeCacheKey { int tenantId; String subTypeId; - DeviceSubType.DeviceType deviceType; + String deviceType; public int getTenantId() { return tenantId; @@ -39,11 +39,11 @@ public class DeviceSubTypeCacheKey { this.subTypeId = subTypeId; } - public DeviceSubType.DeviceType getDeviceType() { + public String getDeviceType() { return deviceType; } - public void setDeviceType(DeviceSubType.DeviceType deviceType) { + public void setDeviceType(String deviceType) { this.deviceType = deviceType; } } diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/impl/DeviceSubTypeServiceImpl.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/impl/DeviceSubTypeServiceImpl.java index 5af54eabf9..24d8ced648 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/impl/DeviceSubTypeServiceImpl.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/impl/DeviceSubTypeServiceImpl.java @@ -93,7 +93,7 @@ public class DeviceSubTypeServiceImpl implements DeviceSubTypeService { } @Override - public boolean updateDeviceSubType(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType, + public boolean updateDeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition) throws SubTypeMgtPluginException { String msg = ""; @@ -139,13 +139,13 @@ public class DeviceSubTypeServiceImpl implements DeviceSubTypeService { } @Override - public DeviceSubType getDeviceSubType(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType) + public DeviceSubType getDeviceSubType(String subTypeId, int tenantId, String deviceType) throws SubTypeMgtPluginException { try { String key = DeviceSubTypeMgtUtil.setDeviceSubTypeCacheKey(tenantId, subTypeId, deviceType); return deviceSubTypeCache.get(key); } catch (CacheLoader.InvalidCacheLoadException e) { - String msg = "Not having any sim subtype for subtype id: " + subTypeId; + String msg = "Not having any" + deviceType + " subtype for subtype id: " + subTypeId; log.error(msg, e); return null; } catch (ExecutionException e) { @@ -156,7 +156,7 @@ public class DeviceSubTypeServiceImpl implements DeviceSubTypeService { } @Override - public List getAllDeviceSubTypes(int tenantId, DeviceSubType.DeviceType deviceType) + public List getAllDeviceSubTypes(int tenantId, String deviceType) throws SubTypeMgtPluginException { try { ConnectionManagerUtil.openDBConnection(); @@ -177,20 +177,14 @@ public class DeviceSubTypeServiceImpl implements DeviceSubTypeService { } @Override - public int getDeviceSubTypeCount(DeviceSubType.DeviceType deviceType) throws SubTypeMgtPluginException { + public int getDeviceSubTypeCount(String deviceType) throws SubTypeMgtPluginException { try { - ConnectionManagerUtil.openDBConnection(); int result = deviceSubTypeDAO.getDeviceSubTypeCount(deviceType); if (result <= 0) { String msg = "There are no any subtypes for device type: " + deviceType; log.error(msg); } return result; - } catch (DBConnectionException e) { - String msg = "Error occurred while obtaining the database connection to retrieve device subtypes count " + - "for " + deviceType + " subtypes"; - log.error(msg); - throw new SubTypeMgtPluginException(msg, e); } catch (SubTypeMgtDAOException e) { String msg = "Error occurred in the database level while retrieving device subtypes count for " + deviceType + " subtypes"; @@ -203,16 +197,10 @@ public class DeviceSubTypeServiceImpl implements DeviceSubTypeService { @Override public DeviceSubType getDeviceSubTypeByProvider(String subTypeName, int tenantId, - DeviceSubType.DeviceType deviceType) + String deviceType) throws SubTypeMgtPluginException { try { - ConnectionManagerUtil.openDBConnection(); return deviceSubTypeDAO.getDeviceSubTypeByProvider(subTypeName, tenantId, deviceType); - } catch (DBConnectionException e) { - String msg = "Error occurred while obtaining the database connection to retrieve device subtype for " + - deviceType + " subtype & subtype name: " + subTypeName; - log.error(msg); - throw new SubTypeMgtPluginException(msg, e); } catch (SubTypeMgtDAOException e) { String msg = "Error occurred in the database level while retrieving device subtype for " + deviceType + " subtype & subtype name: " + subTypeName; @@ -224,16 +212,10 @@ public class DeviceSubTypeServiceImpl implements DeviceSubTypeService { } @Override - public boolean checkDeviceSubTypeExist(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType) + public boolean checkDeviceSubTypeExist(String subTypeId, int tenantId, String deviceType) throws SubTypeMgtPluginException { try { - ConnectionManagerUtil.openDBConnection(); return deviceSubTypeDAO.checkDeviceSubTypeExist(subTypeId, tenantId, deviceType); - } catch (DBConnectionException e) { - String msg = "Error occurred while obtaining the database connection to check device subtype exist for " + - deviceType + " subtype & subtype id: " + subTypeId; - log.error(msg); - throw new SubTypeMgtPluginException(msg, e); } catch (SubTypeMgtDAOException e) { String msg = "Error occurred in the database level while checking device subtype exist for " + deviceType + " subtype & subtype id: " + subTypeId; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/spi/DeviceSubTypeService.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/spi/DeviceSubTypeService.java index 6ccf98d748..c77987f255 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/spi/DeviceSubTypeService.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/spi/DeviceSubTypeService.java @@ -27,20 +27,20 @@ public interface DeviceSubTypeService { boolean addDeviceSubType(DeviceSubType deviceSubType) throws SubTypeMgtPluginException; - boolean updateDeviceSubType(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType, String subTypeName, + boolean updateDeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition) throws SubTypeMgtPluginException; - DeviceSubType getDeviceSubType(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType) + DeviceSubType getDeviceSubType(String subTypeId, int tenantId, String deviceType) throws SubTypeMgtPluginException; - List getAllDeviceSubTypes(int tenantId, DeviceSubType.DeviceType deviceType) + List getAllDeviceSubTypes(int tenantId, String deviceType) throws SubTypeMgtPluginException; - int getDeviceSubTypeCount(DeviceSubType.DeviceType deviceType) throws SubTypeMgtPluginException; + int getDeviceSubTypeCount(String deviceType) throws SubTypeMgtPluginException; - DeviceSubType getDeviceSubTypeByProvider(String subTypeName, int tenantId, DeviceSubType.DeviceType deviceType) + DeviceSubType getDeviceSubTypeByProvider(String subTypeName, int tenantId, String deviceType) throws SubTypeMgtPluginException; - boolean checkDeviceSubTypeExist(String subTypeId, int tenantId, DeviceSubType.DeviceType deviceType) + boolean checkDeviceSubTypeExist(String subTypeId, int tenantId, String deviceType) throws SubTypeMgtPluginException; } diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/util/DeviceSubTypeMgtUtil.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/util/DeviceSubTypeMgtUtil.java index 76222e21f7..1d84bbf0f9 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/util/DeviceSubTypeMgtUtil.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/util/DeviceSubTypeMgtUtil.java @@ -22,7 +22,7 @@ import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubTypeCacheKey; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; public class DeviceSubTypeMgtUtil { - public static String setDeviceSubTypeCacheKey(int tenantId, String subTypeId, DeviceSubType.DeviceType deviceType) { + public static String setDeviceSubTypeCacheKey(int tenantId, String subTypeId, String deviceType) { return tenantId + "|" + subTypeId + "|" + deviceType.toString(); } @@ -30,7 +30,7 @@ public class DeviceSubTypeMgtUtil { String[] keys = key.split("\\|"); int tenantId = Integer.parseInt(keys[0]); String subTypeId = keys[1]; - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.valueOf(keys[2]); + String deviceType = keys[2]; DeviceSubTypeCacheKey deviceSubTypesCacheKey = new DeviceSubTypeCacheKey(); deviceSubTypesCacheKey.setTenantId(tenantId); diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/DAONegativeTest.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/DAONegativeTest.java index 421fb804ae..e0492ace14 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/DAONegativeTest.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/DAONegativeTest.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.subtype.mgt; +import com.fasterxml.jackson.core.JsonProcessingException; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAOFactory; import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; @@ -48,12 +49,12 @@ public class DAONegativeTest extends BaseDeviceSubTypePluginTest { public void testAddDeviceSubType() throws SubTypeMgtDAOException { DeviceSubType deviceSubType = new DeviceSubType() { @Override - public DeviceSubType setDeviceSubType(T objType, String typeDef) { + public DeviceSubType convertToDeviceSubType() { return null; } @Override - public String parseSubTypeToJson(Object objType) { + public String parseSubTypeToJson() throws JsonProcessingException { return null; } }; @@ -85,18 +86,18 @@ public class DAONegativeTest extends BaseDeviceSubTypePluginTest { String subTypeName = "TestSubType"; DeviceSubType deviceSubType = new DeviceSubType() { @Override - public DeviceSubType setDeviceSubType(T objType, String typeDef) { + public DeviceSubType convertToDeviceSubType() { return null; } @Override - public String parseSubTypeToJson(Object objType) { + public String parseSubTypeToJson() throws JsonProcessingException { return null; } }; deviceSubType.setSubTypeId(subTypeId); deviceSubType.setSubTypeName(subTypeName); - deviceSubType.setDeviceType(DeviceSubType.DeviceType.COM); + deviceSubType.setDeviceType("COM"); try { ConnectionManagerUtil.beginDBTransaction(); deviceSubTypeDAO.addDeviceSubType(deviceSubType); @@ -127,17 +128,17 @@ public class DAONegativeTest extends BaseDeviceSubTypePluginTest { String typeDefinition = TestUtils.createNewDeviceSubType(subTypeId); DeviceSubType deviceSubType = new DeviceSubType() { @Override - public DeviceSubType setDeviceSubType(T objType, String typeDef) { + public DeviceSubType convertToDeviceSubType() { return null; } @Override - public String parseSubTypeToJson(Object objType) { + public String parseSubTypeToJson() throws JsonProcessingException { return null; } }; deviceSubType.setSubTypeName(subTypeName); - deviceSubType.setDeviceType(DeviceSubType.DeviceType.COM); + deviceSubType.setDeviceType("COM"); deviceSubType.setTenantId(tenantId); deviceSubType.setTypeDefinition(typeDefinition); try { diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/DAOTest.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/DAOTest.java index f4c51ab6d1..89d5797491 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/DAOTest.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/DAOTest.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.subtype.mgt; +import com.fasterxml.jackson.core.JsonProcessingException; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAOFactory; import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; @@ -50,14 +51,14 @@ public class DAOTest extends BaseDeviceSubTypePluginTest { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); ConnectionManagerUtil.openDBConnection(); DeviceSubType subTypeActual = deviceSubTypeDAO.getDeviceSubType("1", tenantId, - DeviceSubType.DeviceType.COM); + "COM"); ConnectionManagerUtil.closeDBConnection(); Assert.assertNotNull(subTypeActual, "Should not be null"); } @Test(dependsOnMethods = "testAddDeviceSubType") public void testGetAllDeviceSubTypes() throws DBConnectionException, SubTypeMgtDAOException { - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.COM; + String deviceType = "COM"; int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); ConnectionManagerUtil.openDBConnection(); List subTypesActual = deviceSubTypeDAO.getAllDeviceSubTypes(tenantId, deviceType); @@ -71,17 +72,17 @@ public class DAOTest extends BaseDeviceSubTypePluginTest { String subTypeId = "1"; int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); String subTypeName = "TestSubType"; - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.COM; + String deviceType = "COM"; String typeDefinition = TestUtils.createNewDeviceSubType(subTypeId); DeviceSubType deviceSubType = new DeviceSubType() { @Override - public DeviceSubType setDeviceSubType(T objType, String typeDef) { + public DeviceSubType convertToDeviceSubType() { return null; } @Override - public String parseSubTypeToJson(Object objType) { + public String parseSubTypeToJson() throws JsonProcessingException { return null; } }; @@ -104,7 +105,7 @@ public class DAOTest extends BaseDeviceSubTypePluginTest { public void testUpdateDeviceSubType() throws DBConnectionException, SubTypeMgtDAOException { String subTypeId = "1"; int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.COM; + String deviceType = "COM"; String subTypeName = "TestSubType"; String subTypeExpected = TestUtils.createUpdateDeviceSubType(subTypeId); @@ -121,7 +122,7 @@ public class DAOTest extends BaseDeviceSubTypePluginTest { @Test(dependsOnMethods = "testAddDeviceSubType") public void testGetDeviceTypeByProvider() throws DBConnectionException, SubTypeMgtDAOException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.COM; + String deviceType = "COM"; String subTypeName = "TestSubType"; ConnectionManagerUtil.openDBConnection(); DeviceSubType subTypeActual = deviceSubTypeDAO.getDeviceSubTypeByProvider(subTypeName, tenantId, deviceType); @@ -131,7 +132,7 @@ public class DAOTest extends BaseDeviceSubTypePluginTest { @Test(dependsOnMethods = "testAddDeviceSubType") public void testGetDeviceTypeCount() throws DBConnectionException, SubTypeMgtDAOException { - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.COM; + String deviceType = "COM"; ConnectionManagerUtil.openDBConnection(); int subTypeCount = deviceSubTypeDAO.getDeviceSubTypeCount(deviceType); ConnectionManagerUtil.closeDBConnection(); diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/ServiceNegativeTest.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/ServiceNegativeTest.java index 0c1d15e382..0624cd0afd 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/ServiceNegativeTest.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/ServiceNegativeTest.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.subtype.mgt; +import com.fasterxml.jackson.core.JsonProcessingException; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtPluginException; import io.entgra.device.mgt.core.subtype.mgt.impl.DeviceSubTypeServiceImpl; @@ -45,12 +46,12 @@ public class ServiceNegativeTest extends BaseDeviceSubTypePluginTest { public void testAddDeviceSubType() throws SubTypeMgtPluginException { DeviceSubType deviceSubType = new DeviceSubType() { @Override - public DeviceSubType setDeviceSubType(T objType, String typeDef) { + public DeviceSubType convertToDeviceSubType() { return null; } @Override - public String parseSubTypeToJson(Object objType) { + public String parseSubTypeToJson() throws JsonProcessingException { return null; } }; @@ -65,16 +66,16 @@ public class ServiceNegativeTest extends BaseDeviceSubTypePluginTest { public void testAddDeviceSubTypes() throws SubTypeMgtPluginException { String subTypeId = "1"; String subTypeName = "TestSubType"; - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.SIM; + String deviceType = "SIM"; DeviceSubType deviceSubType = new DeviceSubType() { @Override - public DeviceSubType setDeviceSubType(T objType, String typeDef) { + public DeviceSubType convertToDeviceSubType() { return null; } @Override - public String parseSubTypeToJson(Object objType) { + public String parseSubTypeToJson() throws JsonProcessingException { return null; } }; @@ -91,7 +92,7 @@ public class ServiceNegativeTest extends BaseDeviceSubTypePluginTest { public void testUpdateDeviceSubTypes() throws SubTypeMgtPluginException { String subTypeId = "15"; int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.SIM; + String deviceType = "SIM"; String subTypeName = "TestSubType"; String subTypeExpected = TestUtils.createUpdateDeviceSubType(subTypeId); diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/ServiceTest.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/ServiceTest.java index d5e3b96556..8d800a2c69 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/ServiceTest.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/ServiceTest.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.subtype.mgt; +import com.fasterxml.jackson.core.JsonProcessingException; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtPluginException; import io.entgra.device.mgt.core.subtype.mgt.impl.DeviceSubTypeServiceImpl; @@ -48,13 +49,13 @@ public class ServiceTest extends BaseDeviceSubTypePluginTest { public void testGetDeviceType() throws SubTypeMgtPluginException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); DeviceSubType subTypeActual = deviceSubTypeService.getDeviceSubType("1", tenantId, - DeviceSubType.DeviceType.METER); + "METER"); TestUtils.verifyDeviceSubType(subTypeActual); } @Test(dependsOnMethods = "testAddDeviceSubType") public void testGetAllDeviceTypes() throws SubTypeMgtPluginException { - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.METER; + String deviceType = "METER"; int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); List subTypesActual = deviceSubTypeService.getAllDeviceSubTypes(tenantId, deviceType); log.info(deviceType + " sub types count should be " + subTypesActual.size()); @@ -66,17 +67,17 @@ public class ServiceTest extends BaseDeviceSubTypePluginTest { String subTypeId = "1"; int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); String subTypeName = "TestSubType"; - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.METER; + String deviceType = "METER"; String typeDefinition = TestUtils.createNewDeviceSubType(subTypeId); DeviceSubType deviceSubType = new DeviceSubType() { @Override - public DeviceSubType setDeviceSubType(T objType, String typeDef) { + public DeviceSubType convertToDeviceSubType() { return null; } @Override - public String parseSubTypeToJson(Object objType) { + public String parseSubTypeToJson() throws JsonProcessingException { return null; } }; @@ -96,7 +97,7 @@ public class ServiceTest extends BaseDeviceSubTypePluginTest { public void testUpdateDeviceSubType() throws SubTypeMgtPluginException { String subTypeId = "1"; int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.METER; + String deviceType = "METER"; String subTypeName = "TestSubType"; String subTypeExpected = TestUtils.createUpdateDeviceSubType(subTypeId); @@ -111,7 +112,7 @@ public class ServiceTest extends BaseDeviceSubTypePluginTest { @Test(dependsOnMethods = "testAddDeviceSubType") public void testGetDeviceTypeByProvider() throws SubTypeMgtPluginException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.METER; + String deviceType = "METER"; String subTypeName = "TestSubType"; DeviceSubType subTypeActual = deviceSubTypeService.getDeviceSubTypeByProvider(subTypeName, tenantId, deviceType); @@ -120,7 +121,7 @@ public class ServiceTest extends BaseDeviceSubTypePluginTest { @Test(dependsOnMethods = "testAddDeviceSubType") public void testGetDeviceTypeCount() throws SubTypeMgtPluginException { - DeviceSubType.DeviceType deviceType = DeviceSubType.DeviceType.METER; + String deviceType = "METER"; int subTypeCount = deviceSubTypeService.getDeviceSubTypeCount(deviceType); log.info(deviceType + " Device subtypes count: " + subTypeCount); } diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/TestUtils.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/TestUtils.java index b5b8011e76..24f70a7afd 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/TestUtils.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/TestUtils.java @@ -47,7 +47,7 @@ public class TestUtils { public static void verifyDeviceSubType(DeviceSubType deviceSubType) { String typeDefExpected = TestUtils.createNewDeviceSubType("1"); Assert.assertEquals(deviceSubType.getSubTypeId(), "1"); - Assert.assertEquals(deviceSubType.getDeviceType(), DeviceSubType.DeviceType.valueOf("METER")); + Assert.assertEquals(deviceSubType.getDeviceType(), "METER"); Assert.assertEquals(deviceSubType.getSubTypeName(), "TestSubType"); Assert.assertEquals(deviceSubType.getTypeDefinition(), typeDefExpected); } @@ -55,7 +55,7 @@ public class TestUtils { public static void verifyDeviceSubTypeDAO(DeviceSubType deviceSubType) { String typeDefExpected = TestUtils.createNewDeviceSubType("1"); Assert.assertEquals(deviceSubType.getSubTypeId(), "1"); - Assert.assertEquals(deviceSubType.getDeviceType(), DeviceSubType.DeviceType.valueOf("COM")); + Assert.assertEquals(deviceSubType.getDeviceType(), "COM"); Assert.assertEquals(deviceSubType.getSubTypeName(), "TestSubType"); Assert.assertEquals(deviceSubType.getTypeDefinition(), typeDefExpected); } @@ -63,7 +63,7 @@ public class TestUtils { public static void verifyUpdatedDeviceSubType(DeviceSubType deviceSubType) { String typeDefExpected = TestUtils.createUpdateDeviceSubType("1"); Assert.assertEquals(deviceSubType.getSubTypeId(), "1"); - Assert.assertEquals(deviceSubType.getDeviceType(), DeviceSubType.DeviceType.valueOf("METER")); + Assert.assertEquals(deviceSubType.getDeviceType(), "METER"); Assert.assertEquals(deviceSubType.getSubTypeName(), "TestSubType"); Assert.assertEquals(deviceSubType.getTypeDefinition(), typeDefExpected); } @@ -71,7 +71,7 @@ public class TestUtils { public static void verifyUpdatedDeviceSubTypeDAO(DeviceSubType deviceSubType) { String typeDefExpected = TestUtils.createUpdateDeviceSubType("1"); Assert.assertEquals(deviceSubType.getSubTypeId(), "1"); - Assert.assertEquals(deviceSubType.getDeviceType(), DeviceSubType.DeviceType.valueOf("COM")); + Assert.assertEquals(deviceSubType.getDeviceType(), "COM"); Assert.assertEquals(deviceSubType.getSubTypeName(), "TestSubType"); Assert.assertEquals(deviceSubType.getTypeDefinition(), typeDefExpected); } diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index 4d87dbdcca..f0d43f0fd6 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -804,8 +804,8 @@ CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES ( CREATE TABLE IF NOT EXISTS DM_DEVICE_SUB_TYPE ( TENANT_ID INT DEFAULT 0, SUB_TYPE_ID VARCHAR(45) NOT NULL, - DEVICE_TYPE VARCHAR(25) NOT NULL, - SUB_TYPE_NAME VARCHAR(45) NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, + SUB_TYPE_NAME VARCHAR(100) NOT NULL, TYPE_DEFINITION TEXT NOT NULL, PRIMARY KEY (SUB_TYPE_ID,DEVICE_TYPE) ); diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 4c8c753448..969fc008b4 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -876,8 +876,8 @@ IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[D CREATE TABLE DM_DEVICE_SUB_TYPE ( TENANT_ID INT DEFAULT 0, SUB_TYPE_ID VARCHAR(45) NOT NULL, - DEVICE_TYPE VARCHAR(25) NOT NULL, - SUB_TYPE_NAME VARCHAR(45) NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, + SUB_TYPE_NAME VARCHAR(100) NOT NULL, TYPE_DEFINITION TEXT NOT NULL, PRIMARY KEY (SUB_TYPE_ID,DEVICE_TYPE) ); diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index 1ea355fb81..a6cbeffc47 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -873,8 +873,8 @@ CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES ( CREATE TABLE IF NOT EXISTS DM_DEVICE_SUB_TYPE ( TENANT_ID INT DEFAULT 0, SUB_TYPE_ID VARCHAR(45) NOT NULL, - DEVICE_TYPE VARCHAR(25) NOT NULL, - SUB_TYPE_NAME VARCHAR(45) NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, + SUB_TYPE_NAME VARCHAR(100) NOT NULL, TYPE_DEFINITION TEXT NOT NULL, PRIMARY KEY (SUB_TYPE_ID,DEVICE_TYPE) ) ENGINE=InnoDB; diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index f19645cdb7..4678844a53 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -1148,8 +1148,8 @@ CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES ( CREATE TABLE IF NOT EXISTS DM_DEVICE_SUB_TYPE ( TENANT_ID INT DEFAULT 0, SUB_TYPE_ID VARCHAR(45) NOT NULL, - DEVICE_TYPE VARCHAR(25) NOT NULL, - SUB_TYPE_NAME VARCHAR(45) NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, + SUB_TYPE_NAME VARCHAR(100) NOT NULL, TYPE_DEFINITION TEXT NOT NULL, PRIMARY KEY (SUB_TYPE_ID,DEVICE_TYPE) ) ENGINE=InnoDB; diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 51361a90d3..3e69291e14 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -795,8 +795,8 @@ CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES ( CREATE TABLE IF NOT EXISTS DM_DEVICE_SUB_TYPE ( TENANT_ID INT DEFAULT 0, SUB_TYPE_ID VARCHAR(45) NOT NULL, - DEVICE_TYPE VARCHAR(25) NOT NULL, - SUB_TYPE_NAME VARCHAR(45) NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, + SUB_TYPE_NAME VARCHAR(100) NOT NULL, TYPE_DEFINITION TEXT NOT NULL, PRIMARY KEY (SUB_TYPE_ID,DEVICE_TYPE) ) ENGINE=InnoDB; From d63f2a3f24503229e8b0071a40414de41807bf5d Mon Sep 17 00:00:00 2001 From: Viranga Gunarathna Date: Thu, 12 Oct 2023 15:25:20 +0530 Subject: [PATCH 089/112] mapping permissions with scopes --- .../api/ActivityInfoProviderService.java | 2 +- .../jaxrs/service/api/DeviceAgentService.java | 16 +++++++------- .../api/DeviceEventManagementService.java | 4 ++-- .../service/api/DeviceManagementService.java | 18 +++++++-------- .../service/api/GroupManagementService.java | 12 +++++----- .../api/NotificationManagementService.java | 2 +- .../service/api/PolicyManagementService.java | 18 +++++++-------- .../service/api/RoleManagementService.java | 14 ++++++------ .../service/api/UserManagementService.java | 22 +++++++++---------- .../ApplicationManagementAdminService.java | 4 ++-- .../admin/DeviceManagementAdminService.java | 2 +- .../admin/GroupManagementAdminService.java | 2 +- .../api/admin/UserManagementAdminService.java | 4 ++-- .../mgt/core/DeviceManagementConstants.java | 3 ++- .../modules/business-controllers/device.js | 2 +- .../type-view.hbs | 2 +- 16 files changed, 64 insertions(+), 63 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java index a1846536a1..b1fd4c9791 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java @@ -78,7 +78,7 @@ import java.util.List; description = "Get activities", key = "dm:activity:get", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/activities/view"} ) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java index 50f7c1e465..5e43b5e274 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java @@ -91,21 +91,21 @@ import java.util.Map; description = "Disenroll a device", key = "dm:device:disenroll", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/remove"} + permissions = {"/device-mgt/devices/owning-device/disenroll"} ), @Scope( name = "Publish Event", description = "publish device event", key = "dm:device:event:publish", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/event"} + permissions = {"/device-mgt/devices/owning-device/event/publish"} ), @Scope( name = "Getting Device Operation Details", description = "Getting Device Operation Details", - key = "dm:ops:view", + key = "dm:devices:ops:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/operations/view"} ) } ) @@ -394,7 +394,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "dm:ops:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:ops:view") }) } ) @@ -453,7 +453,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "dm:ops:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:ops:view") }) } ) @@ -511,7 +511,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "dm:ops:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:ops:view") }) } ) @@ -630,7 +630,7 @@ public interface DeviceAgentService { tags = "Device Agent Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "dm:ops:view") + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devices:ops:view") }) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java index 8d8ad05607..ab9bf2aa53 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java @@ -71,14 +71,14 @@ import java.util.List; description = "Add or Delete Event Definition for device type", key = "dm:device-type:event:modify", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/device-type/add"} + permissions = {"/device-mgt/devices/owning-device/event/modify"} ), @Scope( name = "Get Events Details of a Device Type", description = "Get Events Details of a Device Type", key = "dm:device-type:event:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/event/view"} ) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java index f4dd947cc2..eeb7caeeb3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java @@ -99,63 +99,63 @@ import java.util.Map; description = "Getting Details of a Device", key = "dm:devices:details", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/details/view"} ), @Scope( name = "Update the device specified by device id", description = "Update the device specified by device id", key = "dm:devices:update", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/update"} ), @Scope( name = "Delete the device specified by device id", description = "Delete the device specified by device id", key = "dm:devices:delete", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/delete"} ), @Scope( name = "Getting Feature Details of a Device", description = "Getting Feature Details of a Device", key = "dm:devices:features:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/features/view"} ), @Scope( name = "Advanced Search for Devices", description = "Advanced Search for Devices", key = "dm:devices:search", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/search"} ), @Scope( name = "Getting Installed Application Details of a Device", description = "Getting Installed Application Details of a Device", key = "dm:devices:app:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/apps/view"} ), @Scope( name = "Getting Device Operation Details", description = "Getting Device Operation Details", key = "dm:devices:ops:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/operations/view"} ), @Scope( name = "Get the details of the policy that is enforced on a device.", description = "Get the details of the policy that is enforced on a device.", key = "dm:devices:policy:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/policies/view"} ), @Scope( name = "Getting Policy Compliance Details of a Device", description = "Getting Policy Compliance Details of a Device", key = "dm:devices:compliance:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/compliance/view"} ), @Scope( name = "Change device status.", diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java index 63ce185bfa..36c85323c6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java @@ -91,7 +91,7 @@ import java.util.List; description = "Get the count of groups belongs to current user.", key = "gm:groups:count", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/groups/view"} + permissions = {"/device-mgt/groups/count"} ), @Scope( name = "Add new device group to the system.", @@ -105,7 +105,7 @@ import java.util.List; description = "View group specified", key = "gm:groups:groups-view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/groups/view"} + permissions = {"/device-mgt/groups/specified-groups/view"} ), @Scope( name = "Update a group", @@ -147,7 +147,7 @@ import java.util.List; description = "View list of device count in the device group", key = "gm:devices:count", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/groups/devices/view"} + permissions = {"/device-mgt/groups/devices/count"} ), @Scope( name = "Add devices to group", @@ -168,21 +168,21 @@ import java.util.List; description = "Assign devices to groups", key = "gm:devices:assign", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/groups/devices/add"} + permissions = {"/device-mgt/groups/devices/assign"} ), @Scope( name = "List of groups that have the device", description = "List of groups that have the device", key = "gm:groups:device:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/groups/devices/view"} + permissions = {"/device-mgt/groups/device-groups/view"} ), @Scope( name = "View whether the groups has relevant device types", description = "View whether the groups has relevant device types", key = "gm:devices-types:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/groups/device-types"} + permissions = {"/device-mgt/groups/device-types/view"} ) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java index 3dad471bc0..749791619f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java @@ -80,7 +80,7 @@ import javax.ws.rs.core.Response; description = "Updating the Device Notification Status", key = "dm:notif:mark-checked", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/notifications/view"} + permissions = {"/device-mgt/notifications/update"} ) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java index bcdb180e3d..8cce7e92b3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java @@ -79,7 +79,7 @@ import java.util.List; description = "Adding a Policy", key = "pm:policies:add", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/manage"} + permissions = {"/device-mgt/policies/add"} ), @Scope( name = "Getting Details of Policies", @@ -93,56 +93,56 @@ import java.util.List; description = "Getting Details of a Policy", key = "pm:policies:details:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/view"} + permissions = {"/device-mgt/policies/view-details"} ), @Scope( name = "Updating a Policy", description = "Updating a Policy", key = "pm:policies:update", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/manage"} + permissions = {"/device-mgt/policies/update"} ), @Scope( name = "Removing Multiple Policies", description = "Removing Multiple Policies", key = "pm:policies:remove", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/manage"} + permissions = {"/device-mgt/policies/remove"} ), @Scope( name = "Activating Policies", description = "Activating Policies", key = "pm:policies:activate", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/manage"} + permissions = {"/device-mgt/policies/activate"} ), @Scope( name = "Deactivating Policies", description = "Deactivating Policies", key = "pm:policies:deactivate", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/manage"} + permissions = {"/device-mgt/policies/deactivate"} ), @Scope( name = "Applying Changes on Policies", description = "Applying Changes on Policies", key = "pm:policies:change", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/manage"} + permissions = {"/device-mgt/policies/apply-changes"} ), @Scope( name = "Updating the Policy Priorities", description = "Updating the Policy Priorities", key = "pm:policies:priorities:update", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/manage"} + permissions = {"/device-mgt/policies/update-priority"} ), @Scope( name = "Fetching the Effective Policy", description = "Fetching the Effective Policy", key = "pm:policies:effective-policy", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/policies/view"} + permissions = {"/device-mgt/policies/view-effective-policy"} ) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java index d0cee93215..9be614674f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java @@ -60,49 +60,49 @@ import java.util.List; description = "Getting Permission Details of a Role", key = "rm:roles:permissions:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/roles/view"} + permissions = {"/device-mgt/roles/view-permissions"} ), @Scope( name = "Getting the List of Roles", description = "Getting the List of Roles", key = "rm:roles:details:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/roles/view"} + permissions = {"/device-mgt/roles/view-details"} ), @Scope( name = "Adding a Role", description = "Adding a Role", key = "rm:roles:add", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/roles/manage"} + permissions = {"/device-mgt/roles/add"} ), @Scope( name = "Adding a combined Role", description = "Adding a combined Role", key = "rm:roles:combined:add", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/roles/manage"} + permissions = {"/device-mgt/roles/combined-role/add"} ), @Scope( name = "Updating Role Details", description = "Updating Role Details", key = "rm:roles:update", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/roles/manage"} + permissions = {"/device-mgt/roles/update"} ), @Scope( name = "Deleting a Role", description = "Deleting a Role", key = "rm:roles:delete", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/roles/manage"} + permissions = {"/device-mgt/roles/delete"} ), @Scope( name = "Adding Users to a Role", description = "Adding Users to a Role", key = "rm:users:add", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/roles/manage"} + permissions = {"/device-mgt/roles/assign-user"} ) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java index ded3961a62..afa5fdfc08 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java @@ -82,35 +82,35 @@ import javax.ws.rs.core.Response; description = "Adding a User", key = "um:users:add", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/manage"} + permissions = {"/device-mgt/users/add"} ), @Scope( name = "Getting Details of a User", description = "Getting Details of a User", key = "um:users:details:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/view"} + permissions = {"/device-mgt/users/details/view"} ), @Scope( name = "Updating Details of a User", description = "Updating Details of a User", key = "um:users:update", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/manage"} + permissions = {"/device-mgt/users/update"} ), @Scope( name = "Deleting a User", description = "Deleting a User", key = "um:users:delete", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/manage"} + permissions = {"/device-mgt/users/delete"} ), @Scope( name = "Getting the Role Details of a User", description = "Getting the Role Details of a User", key = "um:roles:view", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/view"} + permissions = {"/device-mgt/users/roles/view"} ), @Scope( name = "Getting Details of Users", @@ -124,42 +124,42 @@ import javax.ws.rs.core.Response; description = "Getting the User Count", key = "um:users:count", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/view"} + permissions = {"/device-mgt/users/count"} ), @Scope( name = "Getting the User existence status", description = "Getting the User existence status", key = "um:users:is-exist", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/view"} + permissions = {"/device-mgt/users/existence/view"} ), @Scope( name = "Searching for a User Name", description = "Searching for a User Name", key = "um:users:search", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/view"} + permissions = {"/device-mgt/users/search"} ), @Scope( name = "Changing the User Password", description = "Adding a User", key = "um:users:cred:change", roles = {"Internal/devicemgt-user"}, - permissions = {"/login"} + permissions = {"/login/password/update"} ), @Scope( name = "Sending Enrollment Invitations to Users", description = "Sending Enrollment Invitations to Users", key = "um:users:invite", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/users/manage"} + permissions = {"/device-mgt/users/invite"} ), @Scope( name = "Get activities", description = "Get activities", key = "dm:activity:get", roles = {"Internal/devicemgt-user"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/devices/owning-device/activities/view"} ), @Scope( name = "Getting the Permissions of the User", diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 1cb5325dcc..211390180f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -67,14 +67,14 @@ import javax.ws.rs.core.Response; description = "Installing an Application (Internal API)", key = "am:admin:app:install", roles = {"Internal/devicemgt-admin"}, - permissions = {"/device-mgt/applications/manage"} + permissions = {"/device-mgt/admin/applications/install"} ), @Scope( name = "Uninstalling an Application (Internal API)", description = "Uninstalling an Application (Internal API)", key = "am:admin:app:uninstall", roles = {"Internal/devicemgt-admin"}, - permissions = {"/device-mgt/applications/manage"} + permissions = {"/device-mgt/admin/applications/uninstall"} ) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java index 9ebef18d15..21eae81189 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -79,7 +79,7 @@ import java.util.List; description = "Getting Details of a Device", key = "dm:admin:devices:view", roles = {"Internal/devicemgt-admin"}, - permissions = {"/device-mgt/devices/owning-device/view"} + permissions = {"/device-mgt/admin/devices/view"} ), @Scope( name = "Update the Device Owner", diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java index cec3ce0237..7801afb3e3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -84,7 +84,7 @@ import javax.ws.rs.core.Response; description = "", key = "gm:admin:groups:count", roles = {"Internal/devicemgt-admin"}, - permissions = {"/device-mgt/admin/groups/view"} + permissions = {"/device-mgt/admin/groups/count"} ), @Scope( name = "Add groups", diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java index 7e5e5ce232..a62341756e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java @@ -53,14 +53,14 @@ import javax.ws.rs.core.Response; description = "View Users", key = "um:admin:users:view", roles = {"Internal/devicemgt-admin"}, - permissions = {"/device-mgt/users/manage"} + permissions = {"/device-mgt/admin/users/view"} ), @Scope( name = "Delete Users Device Information", description = "Delete users device details", key = "um:admin:users:remove", roles = {"Internal/devicemgt-admin"}, - permissions = {"/device-mgt/users/manage"} + permissions = {"/device-mgt/admin/users/delete"} ) } ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java index ebf11e54ee..8fc2e2804a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConstants.java @@ -38,7 +38,7 @@ public final class DeviceManagementConstants { private ConfigurationManagement(){ throw new AssertionError(); } - public static final String SCOPES_FOR_TOKEN = "dm:ops:view dm:device:event:publish win:devices:enroll"; + public static final String SCOPES_FOR_TOKEN = "dm:devices:ops:view dm:device:event:publish win:devices:enroll"; public static final String IOT_GATEWAY_HOST = "iot.gateway.host"; public static final String IOT_GATEWAY_HTTPS_PORT = "iot.gateway.https.port"; public static final String IOT_CORE_HOST = "iot.core.host"; @@ -156,6 +156,7 @@ public final class DeviceManagementConstants { new Permission("/permission/admin/device-mgt/devices/enroll", "ui.execute"), new Permission("/permission/admin/device-mgt/devices/disenroll", "ui.execute"), new Permission("/permission/admin/device-mgt/devices/owning-device/view", "ui.execute"), + new Permission("/permission/admin/device-mgt/devices/owning-device/operations/view", "ui.execute"), new Permission("/permission/admin/device-mgt/metadata", "ui.execute"), new Permission("/permission/admin/manage/portal", "ui.execute") }; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index 69995e840b..b01afcbf25 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -409,7 +409,7 @@ deviceModule = function () { var jwtClient = JWTClientManagerService.getJWTClient(); // returning access token by JWT grant type var deviceScope = "device_" + type.replace(" ", "") + "_" + deviceId + " dm:device:enroll " + - "dm:device:disenroll dm:device:modify dm:ops:view dm:device:event:publish"; + "dm:device:disenroll dm:device:modify dm:devices:ops:view dm:device:event:publish"; var tokenInfo = jwtClient.getAccessToken(config.clientId, config.clientSecret, userName, deviceScope); config.accessToken = tokenInfo.getAccessToken(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs index 410693a3b5..b94dd02644 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs @@ -120,7 +120,7 @@ -d '{ "applicationName":"testme", "isAllowedToAllDomains":false, "tags":["device_agent"]}'
  • Generate Token

    - curl -k -d "grant_type=password&username=%username%&password=%password%&scope=dm:device:enroll dm:device:disenroll dm:device:modify dm:ops:view dm:device:event:publish" + curl -k -d "grant_type=password&username=%username%&password=%password%&scope=dm:device:enroll dm:device:disenroll dm:device:modify dm:devices:ops:view dm:device:event:publish" -H "Authorization: Basic Base64(client_id:client_secret)" -H "Content-Type: application/x-www-form-urlencoded" {{httpsGateway}}/token
  • From 49747efa180e5f47bd217d9326b19eaa18a5362e Mon Sep 17 00:00:00 2001 From: tcdlpds Date: Fri, 13 Oct 2023 07:08:35 +0530 Subject: [PATCH 090/112] Add default perm config --- .../pom.xml | 6 ++ .../publisher/APIPublisherServiceImpl.java | 31 +++---- .../APIPublisherLifecycleListener.java | 65 ++++++--------- .../core/config/DeviceManagementConfig.java | 12 +++ .../config/permission/DefaultPermission.java | 47 +++++++++++ .../config/permission/DefaultPermissions.java | 38 +++++++++ .../core/config/permission/ScopeMapping.java | 58 +++++++++++++ .../src/main/resources/conf/cdm-config.xml | 82 +++++++++++++++++++ .../repository/conf/cdm-config.xml.j2 | 82 +++++++++++++++++++ 9 files changed, 361 insertions(+), 60 deletions(-) create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/DefaultPermission.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/DefaultPermissions.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/ScopeMapping.java diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index f40935568f..c6ebef438f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -130,6 +130,10 @@ org.json.wso2 json + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.device.mgt.core + @@ -187,6 +191,8 @@ io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.util, io.entgra.device.mgt.core.device.mgt.common.exceptions, io.entgra.device.mgt.core.device.mgt.common.metadata.mgt, + io.entgra.device.mgt.core.device.mgt.core.config, + io.entgra.device.mgt.core.device.mgt.core.config.permission, org.wso2.carbon.base;version="1.0", org.wso2.carbon.context;version="4.6", org.wso2.carbon;version="4.6", diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index d78de2c901..e76631e0cb 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -17,7 +17,6 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher; -import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl; import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServices; @@ -40,6 +39,11 @@ import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherDataHolder; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; +import io.entgra.device.mgt.core.device.mgt.core.config.permission.DefaultPermission; +import io.entgra.device.mgt.core.device.mgt.core.config.permission.DefaultPermissions; +import io.entgra.device.mgt.core.device.mgt.core.config.permission.ScopeMapping; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -437,18 +441,8 @@ public class APIPublisherServiceImpl implements APIPublisherService { } public void addDefaultScopesIfNotExist() { - ArrayList defaultScopes = new ArrayList<>(); - defaultScopes.add("dm:devices:any:permitted"); - defaultScopes.add("dm:device:api:subscribe"); - defaultScopes.add("am:admin:lc:app:approve"); - defaultScopes.add("am:admin:lc:app:create"); - defaultScopes.add("am:admin:lc:app:reject"); - defaultScopes.add("am:admin:lc:app:block"); - defaultScopes.add("am:admin:lc:app:review"); - defaultScopes.add("am:admin:lc:app:retire"); - defaultScopes.add("am:admin:lc:app:deprecate"); - defaultScopes.add("am:admin:lc:app:publish"); - + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); + DefaultPermissions defaultPermissions = deviceManagementConfig.getDefaultPermissions(); APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); try { APIApplicationKey apiApplicationKey = @@ -460,12 +454,13 @@ public class APIPublisherServiceImpl implements APIPublisherService { PublisherRESTAPIServices publisherRESTAPIServices = new PublisherRESTAPIServicesImpl(); Scope scope = new Scope(); - for (String defaultScope: defaultScopes) { + for (DefaultPermission defaultPermission: defaultPermissions.getDefaultPermissions()) { //todo check whether scope is available or not - scope.setName(defaultScope); - scope.setDescription(defaultScope); - scope.setKey(defaultScope); - scope.setRoles("Internal/devicemgt-user"); + ScopeMapping scopeMapping = defaultPermission.getScopeMapping(); + scope.setName(scopeMapping.getName()); + scope.setDescription(scopeMapping.getName()); + scope.setKey(scopeMapping.getKey()); + scope.setRoles(scopeMapping.getDefaultRoles()); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } } catch (BadRequestException | UnexpectedResponseException | APIServicesException e) { diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java index 544b04637f..bbd2fd952e 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java @@ -18,17 +18,14 @@ package io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.listener; import com.google.gson.Gson; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServices; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServicesImpl; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; +import io.entgra.device.mgt.core.device.mgt.core.config.permission.DefaultPermission; +import io.entgra.device.mgt.core.device.mgt.core.config.permission.DefaultPermissions; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; @@ -47,7 +44,10 @@ import org.wso2.carbon.user.api.UserStoreException; import javax.servlet.ServletContext; import java.io.IOException; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; @SuppressWarnings("unused") public class APIPublisherLifecycleListener implements LifecycleListener { @@ -128,45 +128,26 @@ public class APIPublisherLifecycleListener implements LifecycleListener { "' and version '" + apiConfig.getVersion() + "'", e); } } - apiPublisherDataHolder.setPermScopeMapping(permScopeMap); - Map permScopeMapping = apiPublisherDataHolder.getPermScopeMapping(); - if (!permScopeMapping.isEmpty()) { - Metadata existingMetaData = metadataManagementService.retrieveMetadata("perm-scope" + - "-mapping"); - if (existingMetaData != null) { - existingMetaData.setMetaValue(new Gson().toJson(apiPublisherDataHolder.getPermScopeMapping() - )); - metadataManagementService.updateMetadata(existingMetaData); - } else { - Metadata newMetaData = new Metadata(); - newMetaData.setMetaKey("perm-scope-mapping"); - permScopeMapping = - apiPublisherDataHolder.getPermScopeMapping(); + Metadata existingMetaData = metadataManagementService.retrieveMetadata("perm-scope" + + "-mapping"); + if (existingMetaData != null) { + existingMetaData.setMetaValue(new Gson().toJson(permScopeMap)); + metadataManagementService.updateMetadata(existingMetaData); + } else { + Metadata newMetaData = new Metadata(); + newMetaData.setMetaKey("perm-scope-mapping"); - //Todo fix this properly with a config - Map defaultScopePermMap = new HashMap<>(); - defaultScopePermMap.put("/permission/admin/device-mgt/devices/any-device/permitted-actions-under-owning-device", "dm:devices:any:permitted"); - defaultScopePermMap.put("/permission/admin/device-mgt/device/api/subscribe", "dm:device:api:subscribe"); - defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/approve", "am:admin:lc:app:approve"); - defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/create", "am:admin:lc:app:create"); - defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/reject", "am:admin:lc:app:reject"); - defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/block", "am:admin:lc:app:block"); - defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/review", "am:admin:lc:app:review"); - defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/retire", "am:admin:lc:app:retire"); - defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/deprecate", "am:admin:lc:app:deprecate"); - defaultScopePermMap.put("/permission/admin/app-mgt/life-cycle/application/publish", "am:admin:lc:app:publish"); + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); + DefaultPermissions defaultPermissions = deviceManagementConfig.getDefaultPermissions(); - for (Map.Entry mapElement : defaultScopePermMap.entrySet()) { - String key = mapElement.getKey(); - String value = mapElement.getValue(); - permScopeMapping.put(key,value); - } - apiPublisherDataHolder.setPermScopeMapping(permScopeMapping); - newMetaData.setMetaValue(new Gson().toJson(permScopeMapping)); - metadataManagementService.createMetadata(newMetaData); + for (DefaultPermission defaultPermission : defaultPermissions.getDefaultPermissions()) { + permScopeMap.put(defaultPermission.getName(), defaultPermission.getScopeMapping().getKey()); } + newMetaData.setMetaValue(new Gson().toJson(permScopeMap)); + metadataManagementService.createMetadata(newMetaData); } + apiPublisherDataHolder.setPermScopeMapping(permScopeMap); } catch (IOException e) { log.error("Error encountered while discovering annotated classes", e); } catch (ClassNotFoundException e) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceManagementConfig.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceManagementConfig.java index 08c08df5ed..94d873b192 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceManagementConfig.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceManagementConfig.java @@ -39,6 +39,7 @@ import io.entgra.device.mgt.core.device.mgt.core.config.push.notification.PushNo import io.entgra.device.mgt.core.device.mgt.core.config.remote.session.RemoteSessionConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.status.task.DeviceStatusTaskConfig; import io.entgra.device.mgt.core.device.mgt.core.config.task.TaskConfiguration; +import io.entgra.device.mgt.core.device.mgt.core.config.permission.DefaultPermissions; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -75,6 +76,8 @@ public final class DeviceManagementConfig { private MetaDataConfiguration metaDataConfiguration; private EnrollmentGuideConfiguration enrollmentGuideConfiguration; + private DefaultPermissions defaultPermissions; + @XmlElement(name = "ManagementRepository", required = true) public DeviceManagementConfigRepository getDeviceManagementConfigRepository() { return deviceManagementConfigRepository; @@ -287,5 +290,14 @@ public final class DeviceManagementConfig { public void setEnrollmentGuideConfiguration(EnrollmentGuideConfiguration enrollmentGuideConfiguration) { this.enrollmentGuideConfiguration = enrollmentGuideConfiguration; } + + @XmlElement(name = "DefaultPermissions", required = true) + public DefaultPermissions getDefaultPermissions() { + return defaultPermissions; + } + + public void setDefaultPermissions(DefaultPermissions defaultPermissions) { + this.defaultPermissions = defaultPermissions; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/DefaultPermission.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/DefaultPermission.java new file mode 100644 index 0000000000..d8ee628924 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/DefaultPermission.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.device.mgt.core.config.permission; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "DefaultPermission") +public class DefaultPermission { + + private String name; + private ScopeMapping scopeMapping; + + @XmlElement(name = "Name", required = true) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlElement(name = "MappedScopeDetails", required = true) + public ScopeMapping getScopeMapping() { + return scopeMapping; + } + + public void setScopeMapping(ScopeMapping scopeMapping) { + this.scopeMapping = scopeMapping; + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/DefaultPermissions.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/DefaultPermissions.java new file mode 100644 index 0000000000..c04695b111 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/DefaultPermissions.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.device.mgt.core.config.permission; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "DefaultPermissions") +public class DefaultPermissions { + + private List defaultPermissions; + + @XmlElement(name = "DefaultPermission", required = true) + public List getDefaultPermissions() { + return defaultPermissions; + } + + public void setDefaultPermissions(List defaultPermissions) { + this.defaultPermissions = defaultPermissions; + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/ScopeMapping.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/ScopeMapping.java new file mode 100644 index 0000000000..e745126502 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/ScopeMapping.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.device.mgt.core.config.permission; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "MappedScopeDetails") +public class ScopeMapping { + + private String name; + private String key; + + private String defaultRoles; + + @XmlElement(name = "Name", required = true) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlElement(name = "Key", required = true) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + @XmlElement(name = "DefaultRoles", required = true) + public String getDefaultRoles() { + return defaultRoles; + } + + public void setDefaultRoles(String defaultRoles) { + this.defaultRoles = defaultRoles; + } +} diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml index c40cefc413..97c4ca9a3e 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml @@ -211,5 +211,87 @@ false Replace with mail + + + /permission/admin/device-mgt/devices/any-device/permitted-actions-under-owning-device + + Apply permitted actions on any device + dm:devices:any:permitted + Internal/devicemgt-user + + + + /permission/admin/device-mgt/device/api/subscribe + + Subscribe APIs + dm:device:api:subscribe + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/approve + + Approve Applications + am:admin:lc:app:approve + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/create + + Create Applications + am:admin:lc:app:create + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/reject + + Reject Applications + am:admin:lc:app:reject + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/block + + Block Applications + am:admin:lc:app:block + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/review + + Review Applications + am:admin:lc:app:review + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/retire + + Retire Applications + am:admin:lc:app:retire + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/deprecate + + Deprecate Application + am:admin:lc:app:deprecate + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/publish + + Publish Applications + am:admin:lc:app:publish + Internal/devicemgt-user + + + diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 index 2fe1494e09..bd6961e7d8 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 @@ -383,5 +383,87 @@ Replace with mail {% endif %} + + + /permission/admin/device-mgt/devices/any-device/permitted-actions-under-owning-device + + Apply permitted actions on any device + dm:devices:any:permitted + Internal/devicemgt-user + + + + /permission/admin/device-mgt/device/api/subscribe + + Subscribe APIs + dm:device:api:subscribe + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/approve + + Approve Applications + am:admin:lc:app:approve + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/create + + Create Applications + am:admin:lc:app:create + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/reject + + Reject Applications + am:admin:lc:app:reject + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/block + + Block Applications + am:admin:lc:app:block + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/review + + Review Applications + am:admin:lc:app:review + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/retire + + Retire Applications + am:admin:lc:app:retire + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/deprecate + + Deprecate Application + am:admin:lc:app:deprecate + Internal/devicemgt-user + + + + /permission/admin/app-mgt/life-cycle/application/publish + + Publish Applications + am:admin:lc:app:publish + Internal/devicemgt-user + + + From 3a63f948a02da3b22eba06a582edea2ddc8473a4 Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Sun, 15 Oct 2023 14:25:37 +0530 Subject: [PATCH 091/112] Add admin role when adding shared scopes --- .../apimgt/extension/rest/api/util/ScopeUtils.java | 14 +++++++++++++- .../webapp/publisher/APIPublisherServiceImpl.java | 9 +++++---- .../src/main/resources/dbscripts/cdm/h2.sql | 2 +- .../src/main/resources/dbscripts/cdm/mysql.sql | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java index e8f602f992..58cff08553 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java @@ -18,6 +18,9 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api.util; +import java.util.HashSet; +import java.util.Set; + /** * This class represents the scope data. */ @@ -53,7 +56,7 @@ public class ScopeUtils { } public void setRoles(String roles) { - this.roles = roles; + this.roles = removeDuplicatesFromRoleString(roles); } public String getDescription() { @@ -75,4 +78,13 @@ public class ScopeUtils { "}"; return jsonString; } + + private static String removeDuplicatesFromRoleString(String roleString) { + String[] roles = roleString.split(","); + Set roleSet = new HashSet<>(); + for(String role : roles) { + roleSet.add(role.trim()); + } + return String.join(",", roleSet); + } } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index e76631e0cb..be4def9da6 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -100,6 +100,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { public static final String SUBSCRIPTION_TO_CURRENT_TENANT = "CURRENT_TENANT"; public static final String API_GLOBAL_VISIBILITY = "PUBLIC"; public static final String API_PRIVATE_VISIBILITY = "PRIVATE"; + private static final String ADMIN_ROLE_KEY = ",admin"; private static final Log log = LogFactory.getLog(APIPublisherServiceImpl.class); @@ -186,7 +187,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { scope.setName(apiScope.getName()); scope.setDescription(apiScope.getDescription()); scope.setKey(apiScope.getKey()); - scope.setRoles(apiScope.getRoles()); + scope.setRoles(apiScope.getRoles() + ADMIN_ROLE_KEY); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } } @@ -259,7 +260,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { scope.setName(apiScope.getName()); scope.setDescription(apiScope.getDescription()); scope.setKey(apiScope.getKey()); - scope.setRoles(apiScope.getRoles()); + scope.setRoles(apiScope.getRoles() + ADMIN_ROLE_KEY); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } @@ -280,7 +281,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { scope.setName(apiScope.getName()); scope.setDescription(apiScope.getDescription()); scope.setKey(apiScope.getKey()); - scope.setRoles(apiScope.getRoles()); + scope.setRoles(apiScope.getRoles() + ADMIN_ROLE_KEY); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } } @@ -460,7 +461,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { scope.setName(scopeMapping.getName()); scope.setDescription(scopeMapping.getName()); scope.setKey(scopeMapping.getKey()); - scope.setRoles(scopeMapping.getDefaultRoles()); + scope.setRoles(scopeMapping.getDefaultRoles() + ADMIN_ROLE_KEY); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } } catch (BadRequestException | UnexpectedResponseException | APIServicesException e) { diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index 4d87dbdcca..4f9f9fa5dc 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -594,7 +594,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA ( METADATA_ID INT AUTO_INCREMENT NOT NULL, DATA_TYPE VARCHAR(16) NOT NULL, METADATA_KEY VARCHAR(128) NOT NULL, - METADATA_VALUE VARCHAR(20000) NOT NULL, + METADATA_VALUE VARCHAR(65535) NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (METADATA_ID), CONSTRAINT METADATA_KEY_TENANT_ID UNIQUE (METADATA_KEY, TENANT_ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index 1ea355fb81..2f4bd489f0 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -656,7 +656,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA ( METADATA_ID INTEGER NOT NULL AUTO_INCREMENT, DATA_TYPE VARCHAR(16) NOT NULL, METADATA_KEY VARCHAR(128) NOT NULL, - METADATA_VALUE VARCHAR(8000) NOT NULL, + METADATA_VALUE VARCHAR(65535) NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (METADATA_ID), UNIQUE KEY METADATA_KEY_TENANT_ID (METADATA_KEY,TENANT_ID) From 4418caa631793c9a7a20035e0f4f090d61576505 Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Sun, 15 Oct 2023 16:03:06 +0530 Subject: [PATCH 092/112] Update db scripts --- .../src/main/resources/dbscripts/cdm/oracle.sql | 3 ++- .../src/main/resources/dbscripts/cdm/postgresql.sql | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index f19645cdb7..f85e4349e5 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -998,7 +998,8 @@ CREATE TABLE DM_METADATA ( METADATA_ID NUMBER(10) NOT NULL, DATA_TYPE VARCHAR2(16) NOT NULL, METADATA_KEY VARCHAR2(128) NOT NULL, - METADATA_VALUE VARCHAR2(8000) NOT NULL, + -- Can be upgrade to 32767 bytes if the MAX_STRING_SIZE initialization parameter is set to EXTENDED -- + METADATA_VALUE VARCHAR2(4000) NOT NULL, TENANT_ID INTEGER NOT NULL, CONSTRAINT PK_DM_METADATA PRIMARY KEY (METADATA_ID), CONSTRAINT METADATA_KEY_TENANT_ID UNIQUE (METADATA_KEY, TENANT_ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 51361a90d3..2d72a7b423 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -660,7 +660,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA ( METADATA_ID BIGSERIAL PRIMARY KEY, DATA_TYPE VARCHAR(16) NOT NULL, METADATA_KEY VARCHAR(128) NOT NULL, - METADATA_VALUE VARCHAR(8000) NOT NULL, + METADATA_VALUE VARCHAR(65535) NOT NULL, TENANT_ID INTEGER NOT NULL, CONSTRAINT METADATA_KEY_TENANT_ID UNIQUE(METADATA_KEY, TENANT_ID) ); From 22b9897a4bdac688f2ff3963dacda0ca3567b8e3 Mon Sep 17 00:00:00 2001 From: akeela_azhar Date: Mon, 16 Oct 2023 08:00:42 +0530 Subject: [PATCH 093/112] Add permission updating logic --- .../webapp/publisher/APIPublisherService.java | 2 +- .../publisher/APIPublisherServiceImpl.java | 105 +++++++++++------- .../device/mgt/api/jaxrs/beans/RoleInfo.java | 8 ++ .../impl/RoleManagementServiceImpl.java | 11 +- 4 files changed, 78 insertions(+), 48 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java index 94eae16cb8..2dc95d4f37 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java @@ -38,6 +38,6 @@ public interface APIPublisherService { void addDefaultScopesIfNotExist(); - void updateScopeRoleMapping(String roleName, String[] permissions) throws APIManagerPublisherException; + void updateScopeRoleMapping(String roleName, String[] permissions, String[] removedPermissions) throws APIManagerPublisherException; } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index be4def9da6..6d037525ae 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -626,7 +626,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { } @Override - public void updateScopeRoleMapping(String roleName, String[] permissions) throws APIManagerPublisherException { + public void updateScopeRoleMapping(String roleName, String[] permissions, String[] removedPermissions) throws APIManagerPublisherException { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); APIApplicationKey apiApplicationKey; AccessTokenInfo accessTokenInfo; @@ -643,49 +643,14 @@ public class APIPublisherServiceImpl implements APIPublisherService { try { PublisherRESTAPIServices publisherRESTAPIServices = new PublisherRESTAPIServicesImpl(); JSONObject scopeObject = publisherRESTAPIServices.getScopes(apiApplicationKey, accessTokenInfo); - Map permScopeMap = APIPublisherDataHolder.getInstance().getPermScopeMapping(); - for (String permission : permissions) { - String scopeValue = permScopeMap.get(permission); - if (scopeValue == null) { - String msg = "Found invalid permission: " + permission + ". Hence aborting the scope role " + - "mapping process"; - log.error(msg); - throw new APIManagerPublisherException(msg); - } - - JSONArray scopeList = (JSONArray) scopeObject.get("list"); - for (int i = 0; i < scopeList.length(); i++) { - JSONObject scopeObj = scopeList.getJSONObject(i); - if (scopeObj.getString("name").equals(scopeValue)) { - Scope scope = new Scope(); - scope.setName(scopeObj.getString("name")); - scope.setKey(scopeObj.getString("name")); - scope.setDescription(scopeObj.getString("description")); - scope.setId(scopeObj.getString("id")); - - // Including already existing roles - JSONArray existingRolesArray = (JSONArray) scopeObj.get("bindings"); - List existingRoleList = new ArrayList(); - - for (int j = 0; j < existingRolesArray.length(); j++) { - existingRoleList.add((String) existingRolesArray.get(j)); - } - if (!existingRoleList.contains(roleName)) { - existingRoleList.add(roleName); - } - scope.setRoles(String.join(",", existingRoleList)); - - if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getKey())) { - publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope); - } else { - // todo: come to this level means, that scope is removed from API, but haven't removed from the scope-role-permission-mappings list - log.warn(scope.getKey() + " not available as shared scope"); - } - break; - } - } + if (permissions.length != 0) { + updateScopes(roleName, publisherRESTAPIServices, apiApplicationKey, accessTokenInfo, scopeObject, permissions, permScopeMap, false); } + if (removedPermissions.length != 0) { + updateScopes(roleName, publisherRESTAPIServices, apiApplicationKey, accessTokenInfo, scopeObject, removedPermissions, permScopeMap, true); + } + try { updatePermissions(roleName, Arrays.asList(permissions)); } catch (UserStoreException e) { @@ -708,6 +673,62 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } + private void updateScopes (String roleName, PublisherRESTAPIServices publisherRESTAPIServices, + APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + JSONObject scopeObject, String[] permissions, Map permScopeMap, boolean removingPermissions ) + throws APIManagerPublisherException { + for (String permission : permissions) { + String scopeValue = permScopeMap.get(permission); + if (scopeValue == null) { + String msg = "Found invalid permission: " + permission + ". Hence aborting the scope role " + + "mapping process"; + log.error(msg); + throw new APIManagerPublisherException(msg); + } + + JSONArray scopeList = (JSONArray) scopeObject.get("list"); + for (int i = 0; i < scopeList.length(); i++) { + JSONObject scopeObj = scopeList.getJSONObject(i); + if (scopeObj.getString("name").equals(scopeValue)) { + Scope scope = new Scope(); + scope.setName(scopeObj.getString("name")); + scope.setKey(scopeObj.getString("name")); + scope.setDescription(scopeObj.getString("description")); + scope.setId(scopeObj.getString("id")); + + // Including already existing roles + JSONArray existingRolesArray = (JSONArray) scopeObj.get("bindings"); + List existingRoleList = new ArrayList(); + + for (int j = 0; j < existingRolesArray.length(); j++) { + existingRoleList.add((String) existingRolesArray.get(j)); + } + + if (removingPermissions) { + existingRoleList.remove(roleName); + } else { + if (!existingRoleList.contains(roleName)) { + existingRoleList.add(roleName); + } + } + scope.setRoles(String.join(",", existingRoleList)); + + try { + if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getKey())) { + publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope); + } else { + // todo: come to this level means, that scope is removed from API, but haven't removed from the scope-role-permission-mappings list + log.warn(scope.getKey() + " not available as shared scope"); + } + } catch (APIServicesException | BadRequestException | UnexpectedResponseException e) { + log.error("Error occurred while updating role scope mapping via APIM REST endpoint.", e); + } + break; + } + } + } + } + private void updatePermissions(String role, List permissions) throws UserStoreException { AuthorizationManager authorizationManager = APIPublisherDataHolder.getInstance().getUserRealm() .getAuthorizationManager(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RoleInfo.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RoleInfo.java index 3ad90c07a6..374efeb6e0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RoleInfo.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RoleInfo.java @@ -33,6 +33,11 @@ public class RoleInfo { @ApiModelProperty(name = "permissions", value = "Lists out all the permissions associated with roles.", required = true, dataType = "List[java.lang.String]") private String[] permissions; + + @ApiModelProperty(name = "removedPermissions", value = "Lists out all the permissions unassociated with roles.", + required = true, dataType = "List[java.lang.String]") + private String[] removedPermissions; + @ApiModelProperty(name = "users", value = "The list of users assigned to the selected role.", required = true, dataType = "List[java.lang.String]") private String[] users; @@ -76,4 +81,7 @@ public class RoleInfo { this.permissionList = permissionList; } + public String[] getRemovedPermissions() { return removedPermissions; } + + public void setRemovedPermissions(String[] removedPermissions) { this.removedPermissions = removedPermissions; } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java index a9ea688d05..63a6a71d12 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java @@ -403,8 +403,8 @@ public class RoleManagementServiceImpl implements RoleManagementService { try { if (roleInfo.getPermissions() != null && roleInfo.getPermissions().length > 0) { String[] roleName = roleInfo.getRoleName().split("/"); - addPermissions(roleName[roleName.length - 1], roleInfo.getPermissions(), - DeviceMgtAPIUtils.getUserRealm()); + roleInfo.setRemovedPermissions(new String[0]); + updatePermissions(roleName[roleName.length - 1], roleInfo, DeviceMgtAPIUtils.getUserRealm()); } } catch (UserStoreException e) { String msg = "Error occurred while loading the user store."; @@ -546,7 +546,7 @@ public class RoleManagementServiceImpl implements RoleManagementService { if (roleInfo.getPermissions() != null) { String[] roleDetails = roleName.split("/"); - addPermissions(roleDetails[roleDetails.length - 1], roleInfo.getPermissions(), userRealm); + updatePermissions(roleDetails[roleDetails.length - 1], roleInfo, userRealm); } //TODO: Need to send the updated role information in the entity back to the client return Response.status(Response.Status.OK).entity("Role '" + roleInfo.getRoleName() + "' has " + @@ -697,7 +697,7 @@ public class RoleManagementServiceImpl implements RoleManagementService { return rolePermissions; } - private void addPermissions(String roleName, String[] permissions, UserRealm userRealm) { + private void updatePermissions(String roleName, RoleInfo roleInfo, UserRealm userRealm) { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); Thread thread = new Thread(new Runnable() { @Override @@ -707,7 +707,8 @@ public class RoleManagementServiceImpl implements RoleManagementService { PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); DeviceMgtAPIUtils.getApiPublisher().updateScopeRoleMapping(roleName, RoleManagementServiceImpl.this.getPlatformUIPermissions(roleName, userRealm, - permissions)); + roleInfo.getPermissions()), RoleManagementServiceImpl.this.getPlatformUIPermissions(roleName, userRealm, + roleInfo.getRemovedPermissions())); } catch (APIManagerPublisherException | UserAdminException e) { log.error("Error Occurred while updating role scope mapping. ", e); } finally { From 1b0ad156b2f8476cbeb91bc6ba9e2181af085ba6 Mon Sep 17 00:00:00 2001 From: tcdlpds Date: Mon, 16 Oct 2023 10:30:03 +0530 Subject: [PATCH 094/112] Add Java Doc comments --- .../webapp/publisher/APIPublisherService.java | 13 ++++++++++ .../publisher/APIPublisherServiceImpl.java | 13 ++++++++++ .../impl/RoleManagementServiceImpl.java | 24 +++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java index 2dc95d4f37..eec6cfcab7 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherService.java @@ -36,8 +36,21 @@ public interface APIPublisherService { void updateScopeRoleMapping() throws APIManagerPublisherException; + /** + * Add default scopes defined in the cdm-config.xml + */ void addDefaultScopesIfNotExist(); + /** + * If the permissions are in the permission list, identify the relevant scopes of the supplied permission list + * and put the role there; if the permissions are in the removedPermission list, update the relevant scopes by + * deleting the role from those scopes. + * + * @param roleName Role Name + * @param permissions List of adding permissions + * @param removedPermissions List of removing permissions + * @throws APIManagerPublisherException If error occurred while updating the scope role mapping + */ void updateScopeRoleMapping(String roleName, String[] permissions, String[] removedPermissions) throws APIManagerPublisherException; } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 6d037525ae..69f20fa020 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -673,6 +673,19 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } + /** + * Update Scopes + * + * @param roleName Role Name + * @param publisherRESTAPIServices {@link PublisherRESTAPIServices} + * @param apiApplicationKey {@link APIApplicationKey} + * @param accessTokenInfo {@link AccessTokenInfo} + * @param scopeObject scope object returning from APIM + * @param permissions List of permissions + * @param permScopeMap Permission Scope map + * @param removingPermissions if list of permissions has to be removed from the role send true, otherwise sends false. + * @throws APIManagerPublisherException If the method receives invalid permission to update. + */ private void updateScopes (String roleName, PublisherRESTAPIServices publisherRESTAPIServices, APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, JSONObject scopeObject, String[] permissions, Map permScopeMap, boolean removingPermissions ) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java index 63a6a71d12..bca483f6c0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java @@ -279,6 +279,14 @@ public class RoleManagementServiceImpl implements RoleManagementService { } } + /** + * Retrieve filtered permissions by analyzing all the permission paths. + * + * @param rolePermissions All the permission paths + * @param permissionPaths Permission paths that needs to filter + * @param permissions List of filtered permissions + * @return {@link List} + */ private List processAndFilterPermissions(UIPermissionNode[] rolePermissions, List permissionPaths, List permissions) { for (UIPermissionNode rolePermission : rolePermissions) { @@ -299,6 +307,15 @@ public class RoleManagementServiceImpl implements RoleManagementService { return permissions; } + /** + * Getting platform permissions + * + * @param roleName Role Name + * @param userRealm {@link UserRealm} + * @param permissions list of permissions + * @return {@link List} + * @throws UserAdminException if error occurred when getting {@link UIPermissionNode} + */ private String[] getPlatformUIPermissions(String roleName, UserRealm userRealm, String[] permissions) throws UserAdminException { UIPermissionNode uiPermissionNode = getUIPermissionNode(roleName, userRealm); @@ -697,6 +714,13 @@ public class RoleManagementServiceImpl implements RoleManagementService { return rolePermissions; } + /** + * Update the role's permissions. This will function in the fire and forget pattern and run on a new thread. + * + * @param roleName Role Name + * @param roleInfo {@link RoleInfo} + * @param userRealm {@link UserRealm} + */ private void updatePermissions(String roleName, RoleInfo roleInfo, UserRealm userRealm) { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); Thread thread = new Thread(new Runnable() { From c3cc4fe6d42599c9302d849c6e9955cd5afe4e0f Mon Sep 17 00:00:00 2001 From: Oshani Silva Date: Mon, 16 Oct 2023 05:21:44 +0000 Subject: [PATCH 095/112] Add fix for search operation (#251) fixes https://roadmap.entgra.net/issues/10279 Co-authored-by: osh Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/251 Co-authored-by: Oshani Silva Co-committed-by: Oshani Silva --- .../device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java | 4 ++-- .../mgt/core/service/DeviceManagementProviderServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java index 32bffa5af4..fcb1799568 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java @@ -94,7 +94,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { "t.NAME AS DEVICE_TYPE "; //Filter by serial number or any Custom Property in DM_DEVICE_INFO - if (serial != null || !request.getCustomProperty().isEmpty()) { + if ((serial != null) || (request.getCustomProperty() != null && !request.getCustomProperty().isEmpty())) { sql = sql + "FROM DM_DEVICE d " + "INNER JOIN DM_DEVICE_TYPE t ON d.DEVICE_TYPE_ID = t.ID " + @@ -170,7 +170,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { if (isSerialProvided) { stmt.setString(paramIdx++, "%" + serial + "%"); } - if (!request.getCustomProperty().isEmpty()) { + if (request.getCustomProperty() != null && !request.getCustomProperty().isEmpty()) { for (Map.Entry entry : request.getCustomProperty().entrySet()) { stmt.setString(paramIdx++, "%" + entry.getValue() + "%"); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 8413b1499f..344325ae10 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -652,7 +652,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv Map deviceManagerMap = new HashMap<>(); List deviceCacheKeyList = new ArrayList<>(); List existingDevices; - List validDevices = new ArrayList<>();; + List validDevices = new ArrayList<>(); int tenantId = this.getTenantId(); try { From 9767f7e90f4d8ce33e1247d3c7d38f032280f795 Mon Sep 17 00:00:00 2001 From: Kavin Prathaban Date: Tue, 17 Oct 2023 04:20:12 +0000 Subject: [PATCH 096/112] Add validation for user deletion (#244) ## Purpose * Fixes https://roadmap.entgra.net/issues/10337 ## Description * Add validation to check whether the user has enrolled devices Co-authored-by: prathabanKavin Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/244 Co-authored-by: Kavin Prathaban Co-committed-by: Kavin Prathaban --- .../impl/UserManagementServiceImpl.java | 35 ++++++++++++------- .../impl/UserManagementServiceImplTest.java | 5 +-- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java index 6d24ee6aa3..cdf3fb8342 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import io.entgra.device.mgt.core.device.mgt.common.Device; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -320,32 +321,42 @@ public class UserManagementServiceImpl implements UserManagementService { @Consumes(MediaType.WILDCARD) @Override public Response removeUser(@QueryParam("username") String username, @QueryParam("domain") String domain) { + boolean nameWithDomain = false; if (domain != null && !domain.isEmpty()) { username = domain + '/' + username; + nameWithDomain = true; } try { + int deviceCount; UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); if (!userStoreManager.isExistingUser(username)) { if (log.isDebugEnabled()) { - log.debug("User by username: " + username + " does not exist for removal."); + log.debug("User by user: " + username + " does not exist for removal."); } - String msg = "User by username: " + username + " does not exist for removal."; + String msg = "User by user: " + username + " does not exist for removal."; return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } - // Un-enroll all devices for the user DeviceManagementProviderService deviceManagementService = DeviceMgtAPIUtils.getDeviceManagementService(); - deviceManagementService.setStatus(username, EnrolmentInfo.Status.REMOVED); - - userStoreManager.deleteUser(username); - if (log.isDebugEnabled()) { - log.debug("User '" + username + "' was successfully removed."); + if (nameWithDomain) { + deviceCount = deviceManagementService.getDeviceCount(username.split("/")[1]); + } else { + deviceCount = deviceManagementService.getDeviceCount(username); + } + if (deviceCount == 0) { + userStoreManager.deleteUser(username); + if (log.isDebugEnabled()) { + log.debug("User '" + username + "' was successfully removed."); + } + return Response.status(Response.Status.OK).build(); + } else { + String msg = "There are enrolled devices for user: " + username + ". Please remove them before deleting the user."; + log.error(msg); + return Response.status(400).entity(msg).build(); } - return Response.status(Response.Status.OK).build(); } catch (DeviceManagementException | UserStoreException e) { - String msg = "Exception in trying to remove user by username: " + username; + String msg = "Exception in trying to remove user by user: " + username; log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + return Response.status(400).entity(msg).build(); } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImplTest.java index e517561279..d032194a1f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImplTest.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.common.Device; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -272,7 +273,7 @@ public class UserManagementServiceImplTest { .toReturn(this.userStoreManager); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) .toReturn(this.deviceManagementProviderService); - Mockito.doReturn(true).when(deviceManagementProviderService).setStatus(Mockito.anyString(), Mockito.any()); + Mockito.doReturn(0).when(deviceManagementProviderService).getDeviceCount(TEST_USERNAME); Mockito.doNothing().when(userStoreManager).deleteUser(Mockito.anyString()); Response response = userManagementService.removeUser(TEST_USERNAME, null); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), @@ -337,7 +338,7 @@ public class UserManagementServiceImplTest { Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), "Response returned successful for a user updating request with problematic inputs"); response = userManagementService.removeUser(TEST3_USERNAME, null); - Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), + Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode(), "Response returned successful for a user removal request with problematic inputs"); response = userManagementService.getRolesOfUser(TEST3_USERNAME, null); Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), From 1eda7bd237c2af2e64b52492343bb66cf9010d03 Mon Sep 17 00:00:00 2001 From: pasindu Date: Tue, 3 Oct 2023 09:17:46 +0530 Subject: [PATCH 097/112] Fixes in API publishing flow --- .../api/PublisherRESTAPIServicesImpl.java | 39 ++++---- .../extension/rest/api/dto/APIInfo/Scope.java | 18 ++-- .../extension/rest/api/util/ScopeUtils.java | 90 ------------------- .../publisher/APIPublisherServiceImpl.java | 17 ++-- .../apimgt/webapp/publisher/dto/ApiScope.java | 8 +- .../lifecycle/util/AnnotationProcessor.java | 18 ++-- .../webapp/publisher/utils/TestUtils.java | 2 +- 7 files changed, 59 insertions(+), 133 deletions(-) delete mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java index 40a8e92c61..90724d3cf1 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java @@ -32,7 +32,6 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIService import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.HttpsTrustManagerUtils; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.ScopeUtils; import okhttp3.*; import okhttp3.Request.Builder; import org.apache.commons.httpclient.HttpStatus; @@ -144,14 +143,19 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String addNewSharedScopeEndPoint = endPointPrefix + Constants.SCOPE_API_ENDPOINT; - ScopeUtils scopeUtil = new ScopeUtils(); - scopeUtil.setKey(scope.getKey()); - scopeUtil.setName(scope.getName()); - scopeUtil.setDescription(scope.getDescription()); - scopeUtil.setRoles(scope.getRoles()); - String scopeString = scopeUtil.toJSON(); + JSONArray bindings = new JSONArray(); + for (String str : scope.getRoles()) { + bindings.put(str); + } - RequestBody requestBody = RequestBody.create(JSON, scopeString); + JSONObject payload = new JSONObject(); + payload.put("name", scope.getKey()); + payload.put("displayName", scope.getName()); + payload.put("description", scope.getDescription()); + payload.put("bindings", bindings); + payload.put("usageCount", scope.getUsageCount()); + + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() .url(addNewSharedScopeEndPoint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER @@ -191,14 +195,19 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String updateScopeUrl = endPointPrefix + Constants.SCOPE_API_ENDPOINT + scope.getId(); - ScopeUtils scopeUtil = new ScopeUtils(); - scopeUtil.setKey(scope.getKey()); - scopeUtil.setName(scope.getName()); - scopeUtil.setDescription(scope.getDescription()); - scopeUtil.setRoles(scope.getRoles()); - String scopeString = scopeUtil.toJSON(); + JSONArray bindings = new JSONArray(); + for (String str : scope.getRoles()) { + bindings.put(str); + } - RequestBody requestBody = RequestBody.create(JSON, scopeString); + JSONObject payload = new JSONObject(); + payload.put("name", scope.getKey()); + payload.put("displayName", scope.getName()); + payload.put("description", scope.getDescription()); + payload.put("bindings", bindings); + payload.put("usageCount", scope.getUsageCount()); + + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() .url(updateScopeUrl) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java index 01d3f53d36..1e414675cd 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java @@ -18,7 +18,7 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; import java.io.Serializable; -import java.util.Objects; +import java.util.*; public class Scope implements Serializable{ @@ -26,7 +26,7 @@ public class Scope implements Serializable{ String key; String name; - String roles; + List roles; String description; String id; int usageCount; @@ -47,12 +47,12 @@ public class Scope implements Serializable{ this.name = name; } - public String getRoles() { + public List getRoles() { return roles; } - public void setRoles(String roles) { - this.roles = roles; + public void setRoles(List roles) { + this.roles = removeDuplicatesFromRoleString(roles); } public String getDescription() { @@ -97,4 +97,12 @@ public class Scope implements Serializable{ public int hashCode() { return Objects.hash(key, name, roles, description, id); } + + private static List removeDuplicatesFromRoleString(List roles) { + Set roleSet = new HashSet<>(); + for(String role : roles) { + roleSet.add(role.trim()); + } + return new ArrayList<>(roleSet); + } } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java deleted file mode 100644 index 58cff08553..0000000000 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -package io.entgra.device.mgt.core.apimgt.extension.rest.api.util; - -import java.util.HashSet; -import java.util.Set; - -/** - * This class represents the scope data. - */ -public class ScopeUtils { - - private String key; - private String name; - private String roles; - private String description; - private int id; - - public ScopeUtils() { - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getRoles() { - return roles; - } - - public void setRoles(String roles) { - this.roles = removeDuplicatesFromRoleString(roles); - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String toJSON() { - String jsonString = "{\n" + - " \"name\":\"" + key + "\",\n" + - " \"displayName\":\"" + name + "\",\n" + - " \"description\":\"" + description + "\",\n" + - " \"bindings\":[\n" + - " \"" + roles + "\"\n" + - " ]\n" + - "}"; - return jsonString; - } - - private static String removeDuplicatesFromRoleString(String roleString) { - String[] roles = roleString.split(","); - Set roleSet = new HashSet<>(); - for(String role : roles) { - roleSet.add(role.trim()); - } - return String.join(",", roleSet); - } -} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 69f20fa020..305b542777 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -553,36 +553,33 @@ public class APIPublisherServiceImpl implements APIPublisherService { // scopeMapping[3] != null ? StringUtils.trim(scopeMapping[3]) : StringUtils.EMPTY); String permission = scopeMapping[3] != null ? StringUtils.trim(scopeMapping[3]) : StringUtils.EMPTY; - String roleString = ""; + List rolesList = new ArrayList<>(); for (int i = 4; i < scopeMapping.length; i++) { if (scopeMapping[i] != null && StringUtils.trim(scopeMapping[i]).equals("Yes")) { - roleString = roleString + "," + roles.get(i); + rolesList.add(roles.get(i)); if (rolePermissions.containsKey(roles.get(i)) && StringUtils.isNotEmpty(permission)) { rolePermissions.get(roles.get(i)).add(permission); } } } - if (roleString.length() > 1) { - roleString = roleString.substring(1); // remove first , (comma) - } - scope.setRoles(roleString); + scope.setRoles(rolesList); //Set scope id which related to the scope key JSONArray scopeList = (JSONArray) scopeObject.get("list"); for (int i = 0; i < scopeList.length(); i++) { JSONObject scopeObj = scopeList.getJSONObject(i); - if (scopeObj.getString("name").equals(scopeMapping[2] != null ? - StringUtils.trim(scopeMapping[2]) : StringUtils.EMPTY)) { + if (scopeObj.getString("name").equals(StringUtils.trim(scopeMapping[2]))) { scope.setId(scopeObj.getString("id")); + scope.setUsageCount(scopeObj.getInt("usageCount")); // Including already existing roles JSONArray existingRolesArray = (JSONArray) scopeObj.get("bindings"); for (int j = 0; j < existingRolesArray.length(); j++) { - roleString = roleString + "," + existingRolesArray.get(j); + rolesList.add(existingRolesArray.getString(j)); } } } - scope.setRoles(roleString); + scope.setRoles(rolesList); if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getKey())) { publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/dto/ApiScope.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/dto/ApiScope.java index 5d178a0eb3..ea5f6d3047 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/dto/ApiScope.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/dto/ApiScope.java @@ -18,11 +18,13 @@ package io.entgra.device.mgt.core.apimgt.webapp.publisher.dto; +import java.util.List; + public class ApiScope { String key; String name; - String roles; + List roles; String permissions; String description; int id; @@ -46,11 +48,11 @@ public class ApiScope { this.name = name; } - public String getRoles() { + public List getRoles() { return this.roles; } - public void setRoles(String roles) { + public void setRoles(List roles) { this.roles = roles; } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index 704de6442c..b044c9f72a 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -228,10 +228,9 @@ public class AnnotationProcessor { String permissions[]; StringBuilder aggregatedPermissions; String roles[]; - StringBuilder aggregatedRoles; + List aggregatedRoles; for (int i = 0; i < annotatedScopes.length; i++) { aggregatedPermissions = new StringBuilder(); - aggregatedRoles = new StringBuilder(); methodHandler = Proxy.getInvocationHandler(annotatedScopes[i]); scope = new ApiScope(); scope.setName(invokeMethod(scopeClass @@ -250,11 +249,8 @@ public class AnnotationProcessor { scope.setPermissions(aggregatedPermissions.toString().trim()); roles = (String[]) methodHandler.invoke(annotatedScopes[i], scopeClass .getMethod(SWAGGER_ANNOTATIONS_PROPERTIES_ROLES, null), null); - for (String role : roles) { - aggregatedRoles.append(role); - aggregatedRoles.append(","); - } - scope.setRoles(aggregatedRoles.substring(0, aggregatedRoles.lastIndexOf(","))); + aggregatedRoles = Arrays.asList(roles); + scope.setRoles(aggregatedRoles); scopes.put(scope.getKey(), scope); } return scopes; @@ -305,11 +301,13 @@ public class AnnotationProcessor { // } else { // log.warn("Scope is not defined for '" + makeContextURLReady(resourceRootContext) + // makeContextURLReady(subCtx) + "' endpoint, hence assigning the default scope"); +// List roles = new ArrayList<>(); +// roles.add(DEFAULT_SCOPE_ROLE); // scope = new ApiScope(); // scope.setName(DEFAULT_SCOPE_NAME); // scope.setDescription(DEFAULT_SCOPE_NAME); // scope.setKey(DEFAULT_SCOPE_KEY); -// scope.setRoles(DEFAULT_SCOPE_ROLE); +// scope.setRoles(roles); // scope.setPermissions(DEFAULT_SCOPE_PERMISSION); // resource.setScope(scope); // } @@ -543,11 +541,13 @@ public class AnnotationProcessor { } else { // log.warn("Scope is not defined for '" + makeContextURLReady(resourceRootContext) + // makeContextURLReady(subCtx) + "' endpoint, hence assigning the default scope"); + List roles = new ArrayList<>(); + roles.add(DEFAULT_SCOPE_ROLE); scope = new ApiScope(); scope.setName(DEFAULT_SCOPE_NAME); scope.setDescription(DEFAULT_SCOPE_NAME); scope.setKey(DEFAULT_SCOPE_KEY); - scope.setRoles(DEFAULT_SCOPE_ROLE); + scope.setRoles(roles); scope.setPermissions(DEFAULT_SCOPE_PERMISSION); apiResource.setScope(scope); } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/utils/TestUtils.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/utils/TestUtils.java index 988bd9c5f7..85f0d520f9 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/utils/TestUtils.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/utils/TestUtils.java @@ -39,7 +39,7 @@ public class TestUtils { ApiScope scope = new ApiScope(); scope.setKey("win:ops:reboot"); scope.setName("Reboot"); - scope.setRoles("/permission/admin/device-mgt/devices/owning-device/operations/windows/reboot"); + scope.setPermissions("/permission/admin/device-mgt/devices/owning-device/operations/windows/reboot"); scope.setDescription("Lock reset on Windows devices"); template.setScope(scope); uriTemplates.add(template); From 565a7614ade76bcc56ca012b6b0e2d18f1d0d9df Mon Sep 17 00:00:00 2001 From: pasindu Date: Tue, 3 Oct 2023 13:39:18 +0530 Subject: [PATCH 098/112] Change JSON object return methods:Scopes --- .../rest/api/PublisherRESTAPIServices.java | 4 +- .../api/PublisherRESTAPIServicesImpl.java | 34 ++--- .../extension/rest/api/dto/APIInfo/Scope.java | 36 +++--- .../publisher/APIPublisherServiceImpl.java | 117 +++++++++--------- 4 files changed, 97 insertions(+), 94 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java index 4e7d79403a..868c358f23 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java @@ -35,7 +35,7 @@ import java.util.List; public interface PublisherRESTAPIServices { - JSONObject getScopes(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) + Scope[] getScopes(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean isSharedScopeNameExists(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String key) @@ -107,7 +107,7 @@ public interface PublisherRESTAPIServices { String uuid, String documentID) throws APIServicesException, BadRequestException, UnexpectedResponseException; - io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation addDocumentation(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + Documentation addDocumentation(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, Documentation documentation) throws APIServicesException, BadRequestException, UnexpectedResponseException; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java index 90724d3cf1..65d2af0258 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java @@ -55,7 +55,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { + Constants.COLON + port; @Override - public JSONObject getScopes(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) + public Scope[] getScopes(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) throws APIServicesException, BadRequestException, UnexpectedResponseException { String getAllScopesUrl = endPointPrefix + Constants.GET_ALL_SCOPES; @@ -69,8 +69,8 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { try { Response response = client.newCall(request).execute(); if (HttpStatus.SC_OK == response.code()) { - JSONObject jsonObject = new JSONObject(response.body().string()); - return jsonObject; + JSONArray scopeList = (JSONArray) new JSONObject(response.body().string()).get("list"); + return gson.fromJson(scopeList.toString(), Scope[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. @@ -144,16 +144,16 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String addNewSharedScopeEndPoint = endPointPrefix + Constants.SCOPE_API_ENDPOINT; JSONArray bindings = new JSONArray(); - for (String str : scope.getRoles()) { + for (String str : scope.getBindings()) { bindings.put(str); } JSONObject payload = new JSONObject(); - payload.put("name", scope.getKey()); - payload.put("displayName", scope.getName()); - payload.put("description", scope.getDescription()); - payload.put("bindings", bindings); - payload.put("usageCount", scope.getUsageCount()); + payload.put("name", (scope.getName() != null ? scope.getName() : "")); + payload.put("displayName", (scope.getDisplayName() != null ? scope.getDisplayName() : "")); + payload.put("description", (scope.getDescription() != null ? scope.getDescription() : "")); + payload.put("bindings", (bindings != null ? bindings : "")); + payload.put("usageCount", (scope.getUsageCount() != 0 ? scope.getUsageCount() : 0)); RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() @@ -196,16 +196,16 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String updateScopeUrl = endPointPrefix + Constants.SCOPE_API_ENDPOINT + scope.getId(); JSONArray bindings = new JSONArray(); - for (String str : scope.getRoles()) { + for (String str : scope.getBindings()) { bindings.put(str); } JSONObject payload = new JSONObject(); - payload.put("name", scope.getKey()); - payload.put("displayName", scope.getName()); - payload.put("description", scope.getDescription()); - payload.put("bindings", bindings); - payload.put("usageCount", scope.getUsageCount()); + payload.put("name", (scope.getName() != null ? scope.getName() : "")); + payload.put("displayName", (scope.getDisplayName() != null ? scope.getDisplayName() : "")); + payload.put("description", (scope.getDescription() != null ? scope.getDescription() : "")); + payload.put("bindings", (bindings != null ? bindings : "")); + payload.put("usageCount", (scope.getUsageCount() != 0 ? scope.getUsageCount() : 0)); RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() @@ -453,7 +453,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { " \"endpointConfig\": " + api.getEndpointConfig().toString() + ",\n" + " \"endpointImplementationType\": \"ENDPOINT\",\n" + " \"scopes\": " + api.getScopes().toString() + ",\n" + - " \"operations\": " + (api.getOperations() != null? api.getOperations().toString() : null) + ",\n" + + " \"operations\": " + (api.getOperations() != null ? api.getOperations().toString() : null) + ",\n" + " \"threatProtectionPolicies\": null,\n" + " \"categories\": [],\n" + " \"keyManagers\": " + gson.toJson(api.getKeyManagers()) + ",\n" + @@ -632,7 +632,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { @Override public boolean deleteApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - String uuid, Mediation mediation) + String uuid, Mediation mediation) throws APIServicesException, BadRequestException, UnexpectedResponseException { String deleteApiMediationEndPOint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies/" + mediation.getUuid(); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java index 1e414675cd..53a40e2707 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java @@ -18,25 +18,29 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; import java.io.Serializable; -import java.util.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Objects; +import java.util.Set; +import java.util.HashSet; public class Scope implements Serializable{ private static final long serialVersionUID = 1L; - String key; - String name; - List roles; - String description; String id; + String name; + String displayName; + String description; + List bindings; int usageCount; - public String getKey() { - return key; + public String getDisplayName() { + return displayName; } - public void setKey(String key) { - this.key = key; + public void setDisplayName(String displayName) { + this.displayName = displayName; } public String getName() { @@ -47,12 +51,12 @@ public class Scope implements Serializable{ this.name = name; } - public List getRoles() { - return roles; + public List getBindings() { + return bindings; } - public void setRoles(List roles) { - this.roles = removeDuplicatesFromRoleString(roles); + public void setBindings(List bindings) { + this.bindings = removeDuplicatesFromRoleString(bindings); } public String getDescription() { @@ -87,15 +91,15 @@ public class Scope implements Serializable{ Scope scope = (Scope) o; if (id != null ? !id.equals(scope.id) : scope.id != null) return false; - if (!key.equals(scope.key)) return false; if (!name.equals(scope.name)) return false; - if (roles != null ? !roles.equals(scope.roles) : scope.roles != null) return false; + if (!displayName.equals(scope.displayName)) return false; + if (bindings != null ? !bindings.equals(scope.bindings) : scope.bindings != null) return false; return description != null ? description.equals(scope.description) : scope.description == null; } @Override public int hashCode() { - return Objects.hash(key, name, roles, description, id); + return Objects.hash(name, displayName, bindings, description, id); } private static List removeDuplicatesFromRoleString(List roles) { diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 305b542777..a16e249002 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -100,7 +100,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { public static final String SUBSCRIPTION_TO_CURRENT_TENANT = "CURRENT_TENANT"; public static final String API_GLOBAL_VISIBILITY = "PUBLIC"; public static final String API_PRIVATE_VISIBILITY = "PRIVATE"; - private static final String ADMIN_ROLE_KEY = ",admin"; + private static final String ADMIN_ROLE_KEY = "admin"; private static final Log log = LogFactory.getLog(APIPublisherServiceImpl.class); @@ -184,10 +184,12 @@ public class APIPublisherServiceImpl implements APIPublisherService { if (!publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, apiScope.getKey())) { Scope scope = new Scope(); - scope.setName(apiScope.getName()); + scope.setDisplayName(apiScope.getName()); scope.setDescription(apiScope.getDescription()); - scope.setKey(apiScope.getKey()); - scope.setRoles(apiScope.getRoles() + ADMIN_ROLE_KEY); + scope.setName(apiScope.getKey()); + List bindings = apiScope.getRoles(); + bindings.add(ADMIN_ROLE_KEY); + scope.setBindings(bindings); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } } @@ -257,10 +259,12 @@ public class APIPublisherServiceImpl implements APIPublisherService { } else { // if new scope add as shared scope Scope scope = new Scope(); - scope.setName(apiScope.getName()); + scope.setName(apiScope.getKey()); scope.setDescription(apiScope.getDescription()); - scope.setKey(apiScope.getKey()); - scope.setRoles(apiScope.getRoles() + ADMIN_ROLE_KEY); + scope.setDisplayName(apiScope.getName()); + List bindings = apiScope.getRoles(); + bindings.add(ADMIN_ROLE_KEY); + scope.setBindings(bindings); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } @@ -278,10 +282,12 @@ public class APIPublisherServiceImpl implements APIPublisherService { for (ApiScope apiScope : scopesToMoveAsSharedScopes) { Scope scope = new Scope(); - scope.setName(apiScope.getName()); + scope.setName(apiScope.getKey()); scope.setDescription(apiScope.getDescription()); - scope.setKey(apiScope.getKey()); - scope.setRoles(apiScope.getRoles() + ADMIN_ROLE_KEY); + scope.setDisplayName(apiScope.getName()); + List bindings = apiScope.getRoles(); + bindings.add(ADMIN_ROLE_KEY); + scope.setBindings(bindings); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } } @@ -458,10 +464,15 @@ public class APIPublisherServiceImpl implements APIPublisherService { for (DefaultPermission defaultPermission: defaultPermissions.getDefaultPermissions()) { //todo check whether scope is available or not ScopeMapping scopeMapping = defaultPermission.getScopeMapping(); - scope.setName(scopeMapping.getName()); + + String[] roles = scopeMapping.getDefaultRoles().split(","); + List bindings = Arrays.asList(roles); + bindings.add(ADMIN_ROLE_KEY); + + scope.setName(scopeMapping.getKey()); scope.setDescription(scopeMapping.getName()); - scope.setKey(scopeMapping.getKey()); - scope.setRoles(scopeMapping.getDefaultRoles() + ADMIN_ROLE_KEY); + scope.setDisplayName(scopeMapping.getName()); + scope.setBindings(bindings); publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope); } } catch (BadRequestException | UnexpectedResponseException | APIServicesException e) { @@ -497,7 +508,6 @@ public class APIPublisherServiceImpl implements APIPublisherService { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); PublisherRESTAPIServices publisherRESTAPIServices = new PublisherRESTAPIServicesImpl(); - JSONObject scopeObject = publisherRESTAPIServices.getScopes(apiApplicationKey, accessTokenInfo); try { String fileName = @@ -543,11 +553,11 @@ public class APIPublisherServiceImpl implements APIPublisherService { } Scope scope = new Scope(); - scope.setName( + scope.setDisplayName( scopeMapping[0] != null ? StringUtils.trim(scopeMapping[0]) : StringUtils.EMPTY); scope.setDescription( scopeMapping[1] != null ? StringUtils.trim(scopeMapping[1]) : StringUtils.EMPTY); - scope.setKey( + scope.setName( scopeMapping[2] != null ? StringUtils.trim(scopeMapping[2]) : StringUtils.EMPTY); // scope.setPermissions( // scopeMapping[3] != null ? StringUtils.trim(scopeMapping[3]) : StringUtils.EMPTY); @@ -562,30 +572,24 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } } - scope.setRoles(rolesList); - - //Set scope id which related to the scope key - JSONArray scopeList = (JSONArray) scopeObject.get("list"); - for (int i = 0; i < scopeList.length(); i++) { - JSONObject scopeObj = scopeList.getJSONObject(i); - if (scopeObj.getString("name").equals(StringUtils.trim(scopeMapping[2]))) { - scope.setId(scopeObj.getString("id")); - scope.setUsageCount(scopeObj.getInt("usageCount")); - -// Including already existing roles - JSONArray existingRolesArray = (JSONArray) scopeObj.get("bindings"); - for (int j = 0; j < existingRolesArray.length(); j++) { - rolesList.add(existingRolesArray.getString(j)); - } + //Set scope details which related to the scope key + Scope[] scopes = publisherRESTAPIServices.getScopes(apiApplicationKey, accessTokenInfo); + for (int i = 0; i < scopes.length; i++) { + Scope relatedScope = scopes[i]; + if (relatedScope.getName().equals(scopeMapping[2].toString())) { + scope.setId(relatedScope.getId()); + scope.setUsageCount(relatedScope.getUsageCount()); + //Including already existing roles + rolesList.addAll(relatedScope.getBindings()); } } - scope.setRoles(rolesList); + scope.setBindings(rolesList); - if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getKey())) { + if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getName())) { publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope); } else { // todo: come to this level means, that scope is removed from API, but haven't removed from the scope-role-permission-mappings list - log.warn(scope.getKey() + " not available as shared scope"); + log.warn(scope.getName() + " not available as shared scope"); } } for (String role : rolePermissions.keySet()) { @@ -598,12 +602,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } catch (IOException | DirectoryIteratorException ex) { log.error("failed to read scopes from file.", ex); - } catch (APIServicesException | BadRequestException e) { - String errorMsg = "Error while calling APIs"; - log.error(errorMsg, e); - throw new APIManagerPublisherException(e); } - } } catch (APIServicesException e) { String errorMsg = "Error while processing Publisher REST API response"; @@ -639,13 +638,14 @@ public class APIPublisherServiceImpl implements APIPublisherService { try { PublisherRESTAPIServices publisherRESTAPIServices = new PublisherRESTAPIServicesImpl(); - JSONObject scopeObject = publisherRESTAPIServices.getScopes(apiApplicationKey, accessTokenInfo); + Scope[] scopeList = publisherRESTAPIServices.getScopes(apiApplicationKey, accessTokenInfo); + Map permScopeMap = APIPublisherDataHolder.getInstance().getPermScopeMapping(); if (permissions.length != 0) { - updateScopes(roleName, publisherRESTAPIServices, apiApplicationKey, accessTokenInfo, scopeObject, permissions, permScopeMap, false); + updateScopes(roleName, publisherRESTAPIServices, apiApplicationKey, accessTokenInfo, scopeList, permissions, permScopeMap, false); } if (removedPermissions.length != 0) { - updateScopes(roleName, publisherRESTAPIServices, apiApplicationKey, accessTokenInfo, scopeObject, removedPermissions, permScopeMap, true); + updateScopes(roleName, publisherRESTAPIServices, apiApplicationKey, accessTokenInfo, scopeList, removedPermissions, permScopeMap, true); } try { @@ -677,7 +677,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { * @param publisherRESTAPIServices {@link PublisherRESTAPIServices} * @param apiApplicationKey {@link APIApplicationKey} * @param accessTokenInfo {@link AccessTokenInfo} - * @param scopeObject scope object returning from APIM + * @param scopeList scope list returning from APIM * @param permissions List of permissions * @param permScopeMap Permission Scope map * @param removingPermissions if list of permissions has to be removed from the role send true, otherwise sends false. @@ -685,7 +685,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { */ private void updateScopes (String roleName, PublisherRESTAPIServices publisherRESTAPIServices, APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - JSONObject scopeObject, String[] permissions, Map permScopeMap, boolean removingPermissions ) + Scope[] scopeList, String[] permissions, Map permScopeMap, boolean removingPermissions ) throws APIManagerPublisherException { for (String permission : permissions) { String scopeValue = permScopeMap.get(permission); @@ -696,22 +696,21 @@ public class APIPublisherServiceImpl implements APIPublisherService { throw new APIManagerPublisherException(msg); } - JSONArray scopeList = (JSONArray) scopeObject.get("list"); - for (int i = 0; i < scopeList.length(); i++) { - JSONObject scopeObj = scopeList.getJSONObject(i); - if (scopeObj.getString("name").equals(scopeValue)) { + for (int i = 0; i < scopeList.length; i++) { + Scope scopeObj = scopeList[i]; + if (scopeObj.getName().equals(scopeValue)) { Scope scope = new Scope(); - scope.setName(scopeObj.getString("name")); - scope.setKey(scopeObj.getString("name")); - scope.setDescription(scopeObj.getString("description")); - scope.setId(scopeObj.getString("id")); + scope.setName(scopeObj.getName()); + scope.setDisplayName(scopeObj.getDisplayName()); + scope.setDescription(scopeObj.getDescription()); + scope.setId(scopeObj.getId()); // Including already existing roles - JSONArray existingRolesArray = (JSONArray) scopeObj.get("bindings"); - List existingRoleList = new ArrayList(); + List existingRoleList = new ArrayList<>(); + existingRoleList.addAll(scopeObj.getBindings()); - for (int j = 0; j < existingRolesArray.length(); j++) { - existingRoleList.add((String) existingRolesArray.get(j)); + if (!existingRoleList.contains(roleName)) { + existingRoleList.add(roleName); } if (removingPermissions) { @@ -721,14 +720,14 @@ public class APIPublisherServiceImpl implements APIPublisherService { existingRoleList.add(roleName); } } - scope.setRoles(String.join(",", existingRoleList)); + scope.setBindings(existingRoleList); try { - if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getKey())) { + if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getName())) { publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope); } else { // todo: come to this level means, that scope is removed from API, but haven't removed from the scope-role-permission-mappings list - log.warn(scope.getKey() + " not available as shared scope"); + log.warn(scope.getName() + " not available as shared scope"); } } catch (APIServicesException | BadRequestException | UnexpectedResponseException e) { log.error("Error occurred while updating role scope mapping via APIM REST endpoint.", e); From bdf1e97d847045a1f45e9f96c37e23b05b987e73 Mon Sep 17 00:00:00 2001 From: pasindu Date: Thu, 5 Oct 2023 08:30:49 +0530 Subject: [PATCH 099/112] Map Json object return types to dto classes in Publisher --- .../rest/api/PublisherRESTAPIServices.java | 8 +- .../api/PublisherRESTAPIServicesImpl.java | 330 ++++++++++++------ .../rest/api/dto/APIInfo/APIInfo.java | 183 +++++----- .../rest/api/dto/APIInfo/APIMaxTps.java | 44 +++ .../api/dto/APIInfo/AdditionalProperties.java | 50 +++ .../rest/api/dto/APIInfo/MediationPolicy.java | 59 ++++ .../rest/api/dto/APIInfo/Monetization.java | 42 +++ .../rest/api/dto/APIInfo/Operations.java | 15 +- .../rest/api/dto/APIInfo/ServiceInfo.java | 59 ++++ .../dto/APIInfo/ThreatProtectionPolicies.java | 41 +++ .../WebsubSubscriptionConfiguration.java | 61 ++++ .../publisher/APIPublisherServiceImpl.java | 102 +++--- 12 files changed, 723 insertions(+), 271 deletions(-) create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIMaxTps.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdditionalProperties.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/MediationPolicy.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Monetization.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/ServiceInfo.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/ThreatProtectionPolicies.java create mode 100644 components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/WebsubSubscriptionConfiguration.java diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java index 868c358f23..a191b0ac16 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java @@ -47,13 +47,13 @@ public interface PublisherRESTAPIServices { boolean updateSharedScope(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, Scope scope) throws APIServicesException, BadRequestException, UnexpectedResponseException; - JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid) + APIInfo getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; - JSONObject getApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) + APIInfo[] getApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) throws APIServicesException, BadRequestException, UnexpectedResponseException; - JSONObject addAPI(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIInfo api) + APIInfo addAPI(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIInfo api) throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean updateApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIInfo api) @@ -91,7 +91,7 @@ public interface PublisherRESTAPIServices { String apiRevisionId, List apiRevisionDeploymentList) throws APIServicesException, BadRequestException, UnexpectedResponseException; - abstract boolean undeployAPIRevisionDeployment(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + boolean undeployAPIRevisionDeployment(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, JSONObject apiRevisionDeployment, String uuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java index 65d2af0258..05f0a3fe98 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java @@ -21,12 +21,7 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api; import com.google.gson.Gson; import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.*; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; @@ -123,7 +118,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { log.error(msg); throw new BadRequestException(msg); } else if (HttpStatus.SC_NOT_FOUND == response.code()) { - String msg = "Shared scope key not found"; + String msg = "Shared scope key not found : " + key; log.info(msg); return false; } else { @@ -144,8 +139,10 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String addNewSharedScopeEndPoint = endPointPrefix + Constants.SCOPE_API_ENDPOINT; JSONArray bindings = new JSONArray(); - for (String str : scope.getBindings()) { - bindings.put(str); + if (scope.getBindings() != null) { + for (String str : scope.getBindings()) { + bindings.put(str); + } } JSONObject payload = new JSONObject(); @@ -196,8 +193,10 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String updateScopeUrl = endPointPrefix + Constants.SCOPE_API_ENDPOINT + scope.getId(); JSONArray bindings = new JSONArray(); - for (String str : scope.getBindings()) { - bindings.put(str); + if (scope.getBindings() != null) { + for (String str : scope.getBindings()) { + bindings.put(str); + } } JSONObject payload = new JSONObject(); @@ -242,7 +241,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } @Override - public JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid) + public APIInfo getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException { String getAllApi = endPointPrefix + Constants.API_ENDPOINT + apiUuid; @@ -256,8 +255,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { try { Response response = client.newCall(request).execute(); if (HttpStatus.SC_OK == response.code()) { - JSONObject jsonObject = new JSONObject(response.body().string()); - return jsonObject; + return gson.fromJson(response.body().string(), APIInfo.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. @@ -281,7 +279,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } @Override - public JSONObject getApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) + public APIInfo[] getApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) throws APIServicesException, BadRequestException, UnexpectedResponseException { String getAllApis = endPointPrefix + Constants.GET_ALL_APIS; @@ -295,8 +293,8 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { try { Response response = client.newCall(request).execute(); if (HttpStatus.SC_OK == response.code()) { - JSONObject jsonObject = new JSONObject(response.body().string()); - return jsonObject; + JSONArray apiList = (JSONArray) new JSONObject(response.body().string()).get("list"); + return gson.fromJson(apiList.toString(), APIInfo[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. @@ -320,59 +318,111 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } @Override - public JSONObject addAPI(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIInfo api) + public APIInfo addAPI(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIInfo api) throws APIServicesException, BadRequestException, UnexpectedResponseException { String addAPIEndPoint = endPointPrefix + Constants.API_ENDPOINT; - String apiString = "{\n" + - " \"name\": \"" + api.getName() + "\",\n" + - " \"description\":\"" + api.getDescription() + "\",\n" + - " \"context\":\"" + api.getContext() + "\",\n" + - " \"version\":\"" + api.getVersion() + "\",\n" + - " \"provider\":\"" + api.getProvider() + "\",\n" + - " \"lifeCycleStatus\":\"" + api.getLifeCycleStatus() + "\",\n" + - " \"wsdlInfo\": " + api.getWsdlInfo() + ",\n" + - " \"wsdlUrl\":" + api.getWsdlUrl() + ",\n" + - " \"responseCachingEnabled\": " + api.isResponseCachingEnabled() + ",\n" + - " \"cacheTimeout\": " + api.getCacheTimeout() + ",\n" + - " \"hasThumbnail\": " + api.isHasThumbnail() + ",\n" + - " \"isDefaultVersion\": " + api.isDefaultVersion() + ",\n" + - " \"isRevision\": " + api.isRevision() + ",\n" + - " \"revisionedApiId\": " + api.getRevisionedApiId() + ",\n" + - " \"revisionId\": " + api.getRevisionId() + ",\n" + - " \"enableSchemaValidation\": " + api.isEnableSchemaValidation() + ",\n" + - " \"type\": \"" + api.getType() + "\",\n" + - " \"transport\": " + gson.toJson(api.getTransport()) + ",\n" + - " \"tags\": " + gson.toJson(api.getTags()) + ",\n" + - " \"policies\": " + gson.toJson(api.getPolicies()) + ",\n" + - " \"apiThrottlingPolicy\": " + api.getApiThrottlingPolicy() + ",\n" + - " \"authorizationHeader\": \"" + api.getAuthorizationHeader() + "\",\n" + - " \"visibility\": \"" + api.getVisibility() + "\",\n" + - " \"mediationPolicies\": " + (api.getInSequence() != null ? "[{\"name\": \"" + api.getInSequence() + "\",\"type\": \"in\"}]" : null) + ",\n" + - " \"subscriptionAvailability\": \"" + api.getSubscriptionAvailability() + "\",\n" + - " \"subscriptionAvailableTenants\": [],\n" + - " \"additionalProperties\": [],\n" + - " \"monetization\": " + api.getMonetization() + ",\n" + - " \"corsConfiguration\": " + gson.toJson(api.getCorsConfiguration()) + ",\n" + - " \"websubSubscriptionConfiguration\": {\n" + - " \"enable\": false,\n" + - " \"secret\": \"\",\n" + - " \"signingAlgorithm\": \"SHA1\",\n" + - " \"signatureHeader\": \"x-hub-signature\"\n" + - " },\n" + - " \"workflowStatus\": null,\n" + - " \"endpointConfig\": " + api.getEndpointConfig().toString() + ",\n" + - " \"endpointImplementationType\": \"ENDPOINT\",\n" + - " \"scopes\": " + api.getScopes().toString() + ",\n" + - " \"operations\": " + (api.getOperations() != null ? api.getOperations().toString() : null) + ",\n" + - " \"threatProtectionPolicies\": null,\n" + - " \"categories\": [],\n" + - " \"keyManagers\": " + gson.toJson(api.getKeyManagers()) + ",\n" + - " \"serviceInfo\": " + api.getServiceInfo() + "\n" + - "}"; + JSONObject payload = new JSONObject(); + payload.put("name", api.getName()); + payload.put("description", api.getDescription()); + payload.put("context", api.getContext()); + payload.put("version", api.getVersion()); + payload.put("provider", api.getProvider()); + payload.put("lifeCycleStatus", api.getLifeCycleStatus()); + payload.put("wsdlInfo", (api.getWsdlInfo() != null ? api.getWsdlInfo() : null)); + payload.put("wsdlUrl", (api.getWsdlUrl() != null ? api.getWsdlUrl() : null)); + payload.put("responseCachingEnabled", api.isResponseCachingEnabled()); + payload.put("cacheTimeout", api.getCacheTimeout()); + payload.put("hasThumbnail", api.isHasThumbnail()); + payload.put("isDefaultVersion", api.isDefaultVersion()); + payload.put("isRevision", api.isRevision()); + payload.put("revisionedApiId", (api.getRevisionedApiId() != null ? api.getRevisionedApiId() : null)); + payload.put("revisionId", api.getRevisionId()); + payload.put("enableSchemaValidation", api.isEnableSchemaValidation()); + payload.put("type", api.getType()); + payload.put("apiThrottlingPolicy", api.getApiThrottlingPolicy()); + payload.put("authorizationHeader", api.getAuthorizationHeader()); + payload.put("visibility", api.getVisibility()); + payload.put("subscriptionAvailability", (api.getSubscriptionAvailability() != null ? api.getSubscriptionAvailability() : "")); - RequestBody requestBody = RequestBody.create(JSON, apiString); + //Lists + if (api.getTransport() != null) { + JSONArray transport = new JSONArray(); + for (String str : api.getTransport()) { + transport.put(str); + } + payload.put("transport", transport); + } + if (api.getTags() != null) { + JSONArray tags = new JSONArray(); + for (String str : api.getTags()) { + tags.put(str); + } + payload.put("tags", tags); + } + if (api.getPolicies() != null) { + JSONArray policies = new JSONArray(); + for (String str : api.getPolicies()) { + policies.put(str); + } + payload.put("policies", policies); + } + if (api.getMediationPolicies() != null) { + JSONArray mediationPolicies = new JSONArray(); + for (MediationPolicy object : api.getMediationPolicies()) { + mediationPolicies.put(new JSONObject(gson.toJson(object))); + } + payload.put("mediationPolicies", mediationPolicies); + } + if (api.getSubscriptionAvailableTenants() != null) { + JSONArray subscriptionAvailableTenants = new JSONArray(); + for (String str : api.getSubscriptionAvailableTenants()) { + subscriptionAvailableTenants.put(str); + } + payload.put("subscriptionAvailableTenants", subscriptionAvailableTenants); + } + if (api.getAdditionalProperties() != null) { + JSONArray additionalProperties = new JSONArray(); + for (AdditionalProperties str : api.getAdditionalProperties()) { + additionalProperties.put(str); + } + payload.put("additionalProperties", additionalProperties); + } + if (api.getScopes() != null) { + JSONArray scopes = new JSONArray(); + for (JSONObject object : api.getScopes()) { + scopes.put(object); + } + payload.put("scopes", scopes); + } + if (api.getOperations() != null) { + JSONArray operations = new JSONArray(); + for (Operations operation : api.getOperations()) { + operations.put(new JSONObject(gson.toJson(operation))); + } + payload.put("operations", operations); + } + if (api.getCategories() != null) { + JSONArray categories = new JSONArray(); + for (String str : api.getCategories()) { + categories.put(str); + } + payload.put("categories", categories); + } + + //objects + payload.put("monetization", (api.getMonetization() != null ? new JSONObject(gson.toJson(api.getMonetization())) : null)); + payload.put("corsConfiguration", (api.getCorsConfiguration() != null ? new JSONObject(gson.toJson(api.getCorsConfiguration())) : null)); + payload.put("websubSubscriptionConfiguration", (api.getWebsubSubscriptionConfiguration() != null ? new JSONObject(gson.toJson(api.getWebsubSubscriptionConfiguration())) : null)); + payload.put("workflowStatus", (api.getWorkflowStatus() != null ? api.getWorkflowStatus() : null)); + payload.put("endpointConfig", (api.getEndpointConfig() != null ? api.getEndpointConfig() : null)); + payload.put("endpointImplementationType", (api.getEndpointImplementationType() != null ? api.getEndpointImplementationType() : null)); + payload.put("threatProtectionPolicies", (api.getThreatProtectionPolicies() != null ? api.getThreatProtectionPolicies() : null)); + payload.put("serviceInfo", (api.getServiceInfo() != null ? new JSONObject(gson.toJson(api.getServiceInfo())) : null)); + payload.put("advertiseInfo", (api.getAdvertiseInfo() != null ? new JSONObject(gson.toJson(api.getAdvertiseInfo())) : null)); + + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() .url(addAPIEndPoint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER @@ -383,8 +433,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { try { Response response = client.newCall(request).execute(); if (HttpStatus.SC_CREATED == response.code()) { - JSONObject jsonObject = new JSONObject(response.body().string()); - return jsonObject; + return gson.fromJson(response.body().string(), APIInfo.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. @@ -413,54 +462,106 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String updateAPIEndPoint = endPointPrefix + Constants.API_ENDPOINT + api.getId(); - String apiString = "{\n" + - " \"name\": \"" + api.getName() + "\",\n" + - " \"description\":\"" + api.getDescription() + "\",\n" + - " \"context\":\"" + api.getContext() + "\",\n" + - " \"version\":\"" + api.getVersion() + "\",\n" + - " \"provider\":\"" + api.getProvider() + "\",\n" + - " \"lifeCycleStatus\":\"" + api.getLifeCycleStatus() + "\",\n" + - " \"wsdlInfo\": " + api.getWsdlInfo() + ",\n" + - " \"wsdlUrl\":" + api.getWsdlUrl() + ",\n" + - " \"responseCachingEnabled\": " + api.isResponseCachingEnabled() + ",\n" + - " \"cacheTimeout\": " + api.getCacheTimeout() + ",\n" + - " \"hasThumbnail\": " + api.isHasThumbnail() + ",\n" + - " \"isDefaultVersion\": " + api.isDefaultVersion() + ",\n" + - " \"isRevision\": " + api.isRevision() + ",\n" + - " \"revisionedApiId\": " + api.getRevisionedApiId() + ",\n" + - " \"revisionId\": " + api.getRevisionId() + ",\n" + - " \"enableSchemaValidation\": " + api.isEnableSchemaValidation() + ",\n" + - " \"type\": \"" + api.getType() + "\",\n" + - " \"transport\": " + gson.toJson(api.getTransport()) + ",\n" + - " \"tags\": " + gson.toJson(api.getTags()) + ",\n" + - " \"policies\": " + gson.toJson(api.getPolicies()) + ",\n" + - " \"apiThrottlingPolicy\": " + api.getApiThrottlingPolicy() + ",\n" + - " \"authorizationHeader\": \"" + api.getAuthorizationHeader() + "\",\n" + - " \"visibility\": \"" + api.getVisibility() + "\",\n" + - " \"mediationPolicies\": " + (api.getInSequence() != null ? "[{\"name\": \"" + api.getInSequence() + "\",\"type\": \"in\"}]" : null) + ",\n" + - " \"subscriptionAvailability\": \"" + api.getSubscriptionAvailability() + "\",\n" + - " \"subscriptionAvailableTenants\": [],\n" + - " \"additionalProperties\": [],\n" + - " \"monetization\": " + api.getMonetization() + ",\n" + - " \"corsConfiguration\": " + gson.toJson(api.getCorsConfiguration()) + ",\n" + - " \"websubSubscriptionConfiguration\": {\n" + - " \"enable\": false,\n" + - " \"secret\": \"\",\n" + - " \"signingAlgorithm\": \"SHA1\",\n" + - " \"signatureHeader\": \"x-hub-signature\"\n" + - " },\n" + - " \"workflowStatus\": null,\n" + - " \"endpointConfig\": " + api.getEndpointConfig().toString() + ",\n" + - " \"endpointImplementationType\": \"ENDPOINT\",\n" + - " \"scopes\": " + api.getScopes().toString() + ",\n" + - " \"operations\": " + (api.getOperations() != null ? api.getOperations().toString() : null) + ",\n" + - " \"threatProtectionPolicies\": null,\n" + - " \"categories\": [],\n" + - " \"keyManagers\": " + gson.toJson(api.getKeyManagers()) + ",\n" + - " \"serviceInfo\": " + api.getServiceInfo() + "\n" + - "}"; + JSONObject payload = new JSONObject(); + payload.put("name", api.getName()); + payload.put("description", api.getDescription()); + payload.put("context", api.getContext()); + payload.put("version", api.getVersion()); + payload.put("provider", api.getProvider()); + payload.put("lifeCycleStatus", api.getLifeCycleStatus()); + payload.put("wsdlInfo", (api.getWsdlInfo() != null ? api.getWsdlInfo() : null)); + payload.put("wsdlUrl", (api.getWsdlUrl() != null ? api.getWsdlUrl() : null)); + payload.put("responseCachingEnabled", api.isResponseCachingEnabled()); + payload.put("cacheTimeout", api.getCacheTimeout()); + payload.put("hasThumbnail", api.isHasThumbnail()); + payload.put("isDefaultVersion", api.isDefaultVersion()); + payload.put("isRevision", api.isRevision()); + payload.put("revisionedApiId", (api.getRevisionedApiId() != null ? api.getRevisionedApiId() : null)); + payload.put("revisionId", api.getRevisionId()); + payload.put("enableSchemaValidation", api.isEnableSchemaValidation()); + payload.put("type", api.getType()); + payload.put("apiThrottlingPolicy", api.getApiThrottlingPolicy()); + payload.put("authorizationHeader", api.getAuthorizationHeader()); + payload.put("visibility", api.getVisibility()); + payload.put("subscriptionAvailability", (api.getSubscriptionAvailability() != null ? api.getSubscriptionAvailability() : "")); - RequestBody requestBody = RequestBody.create(JSON, apiString); + //Lists + if (api.getTransport() != null) { + JSONArray transport = new JSONArray(); + for (String str : api.getTransport()) { + transport.put(str); + } + payload.put("transport", transport); + } + if (api.getTags() != null) { + JSONArray tags = new JSONArray(); + for (String str : api.getTags()) { + tags.put(str); + } + payload.put("tags", tags); + } + if (api.getPolicies() != null) { + JSONArray policies = new JSONArray(); + for (String str : api.getPolicies()) { + policies.put(str); + } + payload.put("policies", policies); + } + if (api.getMediationPolicies() != null) { + JSONArray mediationPolicies = new JSONArray(); + for (MediationPolicy object : api.getMediationPolicies()) { + mediationPolicies.put(new JSONObject(gson.toJson(object))); + } + payload.put("mediationPolicies", mediationPolicies); + } + if (api.getSubscriptionAvailableTenants() != null) { + JSONArray subscriptionAvailableTenants = new JSONArray(); + for (String str : api.getSubscriptionAvailableTenants()) { + subscriptionAvailableTenants.put(str); + } + payload.put("subscriptionAvailableTenants", subscriptionAvailableTenants); + } + if (api.getAdditionalProperties() != null) { + JSONArray additionalProperties = new JSONArray(); + for (AdditionalProperties str : api.getAdditionalProperties()) { + additionalProperties.put(str); + } + payload.put("additionalProperties", additionalProperties); + } + if (api.getScopes() != null) { + JSONArray scopes = new JSONArray(); + for (JSONObject object : api.getScopes()) { + scopes.put(object); + } + payload.put("scopes", scopes); + } + if (api.getOperations() != null) { + JSONArray operations = new JSONArray(); + for (Operations operation : api.getOperations()) { + operations.put(new JSONObject(gson.toJson(operation))); + } + payload.put("operations", operations); + } + if (api.getCategories() != null) { + JSONArray categories = new JSONArray(); + for (String str : api.getCategories()) { + categories.put(str); + } + payload.put("categories", categories); + } + + //objects + payload.put("monetization", (api.getMonetization() != null ? new JSONObject(gson.toJson(api.getMonetization())) : null)); + payload.put("corsConfiguration", (api.getCorsConfiguration() != null ? new JSONObject(gson.toJson(api.getCorsConfiguration())) : null)); + payload.put("websubSubscriptionConfiguration", (api.getWebsubSubscriptionConfiguration() != null ? new JSONObject(gson.toJson(api.getWebsubSubscriptionConfiguration())) : null)); + payload.put("workflowStatus", (api.getWorkflowStatus() != null ? api.getWorkflowStatus() : null)); + payload.put("endpointConfig", (api.getEndpointConfig() != null ? api.getEndpointConfig() : null)); + payload.put("endpointImplementationType", (api.getEndpointImplementationType() != null ? api.getEndpointImplementationType() : null)); + payload.put("threatProtectionPolicies", (api.getThreatProtectionPolicies() != null ? api.getThreatProtectionPolicies() : null)); + payload.put("serviceInfo", (api.getServiceInfo() != null ? new JSONObject(gson.toJson(api.getServiceInfo())) : null)); + payload.put("advertiseInfo", (api.getAdvertiseInfo() != null ? new JSONObject(gson.toJson(api.getAdvertiseInfo())) : null)); + + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() .url(updateAPIEndPoint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER @@ -472,7 +573,6 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { Response response = client.newCall(request).execute(); if (HttpStatus.SC_OK == response.code()) { return true; - } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java index b7443b0f53..a48a10c9e3 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java @@ -20,7 +20,7 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; import org.json.JSONObject; -import java.util.*; +import java.util.List; /** * This class represents the API response. @@ -35,69 +35,75 @@ public class APIInfo { private String version; private String provider; private String lifeCycleStatus; - private String wsdlInfo; + private type wsdlInfo; private String wsdlUrl; private boolean responseCachingEnabled; private int cacheTimeout; private boolean hasThumbnail; private boolean isDefaultVersion; private boolean isRevision; - private String revisionedApiId; + private String revisionedApiId; private int revisionId; private boolean enableSchemaValidation; + private boolean enableStore; private String type; - private Set transport; - private Set tags; - private Set policies; + private List transport; + private List tags; + private List policies; private String apiThrottlingPolicy; private String authorizationHeader; - private String securityScheme; - private String maxTps; + private List securityScheme; + private APIMaxTps maxTps; private String visibility; - private String visibleRoles; - private String visibleTenants; - private String mediationPolicies; + private List visibleRoles; + private List visibleTenants; + private List mediationPolicies; private String subscriptionAvailability; - private String subscriptionAvailableTenants; - private String additionalProperties; - private String monetization; + private List subscriptionAvailableTenants; + private List additionalProperties; + private Monetization monetization; private String accessControl; - private String accessControlRoles; + private List accessControlRoles; private BusinessInformation businessInformation; private CORSConfiguration corsConfiguration; + private WebsubSubscriptionConfiguration websubSubscriptionConfiguration; private String workflowStatus; private String createdTime; private String lastUpdatedTime; - private JSONObject endpointConfig = new JSONObject(); + private JSONObject endpointConfig; private String endpointImplementationType; - private List scopes = new ArrayList(); - private List operations; - private String threatProtectionPolicies; - private List keyManagers = new ArrayList(); - private JSONObject serviceInfo = new JSONObject(); + private List scopes; + private List operations; + private JSONObject threatProtectionPolicies; + private List categories; + private List keyManagers; + private ServiceInfo serviceInfo; private AdvertiseInfo advertiseInfo; - private String asyncApiDefinition; + public enum type { + WSDL, ZIP + } - private Set uriTemplates = new LinkedHashSet(); - private String inSequence; - - private Map wsUriMapping; public String getId() { return id; } + public void setId(String id) { this.id = id; } + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } @@ -109,12 +115,15 @@ public class APIInfo { public void setContext(String context) { this.context = context; } + public String getVersion() { return version; } + public void setVersion(String version) { this.version = version; } + public String getProvider() { return provider; } @@ -131,11 +140,11 @@ public class APIInfo { this.lifeCycleStatus = lifeCycleStatus; } - public String getWsdlInfo() { + public APIInfo.type getWsdlInfo() { return wsdlInfo; } - public void setWsdlInfo(String wsdlInfo) { + public void setWsdlInfo(APIInfo.type wsdlInfo) { this.wsdlInfo = wsdlInfo; } @@ -211,6 +220,14 @@ public class APIInfo { this.enableSchemaValidation = enableSchemaValidation; } + public boolean isEnableStore() { + return enableStore; + } + + public void setEnableStore(boolean enableStore) { + this.enableStore = enableStore; + } + public String getType() { return type; } @@ -219,27 +236,27 @@ public class APIInfo { this.type = type; } - public Set getTransport() { + public List getTransport() { return transport; } - public void setTransport(Set transport) { + public void setTransport(List transport) { this.transport = transport; } - public Set getTags() { + public List getTags() { return tags; } - public void setTags(Set tags) { + public void setTags(List tags) { this.tags = tags; } - public Set getPolicies() { + public List getPolicies() { return policies; } - public void setPolicies(Set policies) { + public void setPolicies(List policies) { this.policies = policies; } @@ -259,19 +276,19 @@ public class APIInfo { this.authorizationHeader = authorizationHeader; } - public String getSecurityScheme() { + public List getSecurityScheme() { return securityScheme; } - public void setSecurityScheme(String securityScheme) { + public void setSecurityScheme(List securityScheme) { this.securityScheme = securityScheme; } - public String getMaxTps() { + public APIMaxTps getMaxTps() { return maxTps; } - public void setMaxTps(String maxTps) { + public void setMaxTps(APIMaxTps maxTps) { this.maxTps = maxTps; } @@ -283,27 +300,27 @@ public class APIInfo { this.visibility = visibility; } - public String getVisibleRoles() { + public List getVisibleRoles() { return visibleRoles; } - public void setVisibleRoles(String visibleRoles) { + public void setVisibleRoles(List visibleRoles) { this.visibleRoles = visibleRoles; } - public String getVisibleTenants() { + public List getVisibleTenants() { return visibleTenants; } - public void setVisibleTenants(String visibleTenants) { + public void setVisibleTenants(List visibleTenants) { this.visibleTenants = visibleTenants; } - public String getMediationPolicies() { + public List getMediationPolicies() { return mediationPolicies; } - public void setMediationPolicies(String mediationPolicies) { + public void setMediationPolicies(List mediationPolicies) { this.mediationPolicies = mediationPolicies; } @@ -315,27 +332,27 @@ public class APIInfo { this.subscriptionAvailability = subscriptionAvailability; } - public String getSubscriptionAvailableTenants() { + public List getSubscriptionAvailableTenants() { return subscriptionAvailableTenants; } - public void setSubscriptionAvailableTenants(String subscriptionAvailableTenants) { + public void setSubscriptionAvailableTenants(List subscriptionAvailableTenants) { this.subscriptionAvailableTenants = subscriptionAvailableTenants; } - public String getAdditionalProperties() { + public List getAdditionalProperties() { return additionalProperties; } - public void setAdditionalProperties(String additionalProperties) { + public void setAdditionalProperties(List additionalProperties) { this.additionalProperties = additionalProperties; } - public String getMonetization() { + public Monetization getMonetization() { return monetization; } - public void setMonetization(String monetization) { + public void setMonetization(Monetization monetization) { this.monetization = monetization; } @@ -347,11 +364,11 @@ public class APIInfo { this.accessControl = accessControl; } - public String getAccessControlRoles() { + public List getAccessControlRoles() { return accessControlRoles; } - public void setAccessControlRoles(String accessControlRoles) { + public void setAccessControlRoles(List accessControlRoles) { this.accessControlRoles = accessControlRoles; } @@ -371,6 +388,14 @@ public class APIInfo { this.corsConfiguration = corsConfiguration; } + public WebsubSubscriptionConfiguration getWebsubSubscriptionConfiguration() { + return websubSubscriptionConfiguration; + } + + public void setWebsubSubscriptionConfiguration(WebsubSubscriptionConfiguration websubSubscriptionConfiguration) { + this.websubSubscriptionConfiguration = websubSubscriptionConfiguration; + } + public String getWorkflowStatus() { return workflowStatus; } @@ -411,7 +436,7 @@ public class APIInfo { this.endpointImplementationType = endpointImplementationType; } - public ListgetScopes() { + public List getScopes() { return scopes; } @@ -419,22 +444,30 @@ public class APIInfo { this.scopes = scopes; } - public List getOperations() { + public List getOperations() { return operations; } - public void setOperations(List operations) { + public void setOperations(List operations) { this.operations = operations; } - public String getThreatProtectionPolicies() { + public JSONObject getThreatProtectionPolicies() { return threatProtectionPolicies; } - public void setThreatProtectionPolicies(String threatProtectionPolicies) { + public void setThreatProtectionPolicies(JSONObject threatProtectionPolicies) { this.threatProtectionPolicies = threatProtectionPolicies; } + public List getCategories() { + return categories; + } + + public void setCategories(List categories) { + this.categories = categories; + } + public List getKeyManagers() { return keyManagers; } @@ -443,11 +476,11 @@ public class APIInfo { this.keyManagers = keyManagers; } - public JSONObject getServiceInfo() { + public ServiceInfo getServiceInfo() { return serviceInfo; } - public void setServiceInfo(JSONObject serviceInfo) { + public void setServiceInfo(ServiceInfo serviceInfo) { this.serviceInfo = serviceInfo; } @@ -458,36 +491,4 @@ public class APIInfo { public void setAdvertiseInfo(AdvertiseInfo advertiseInfo) { this.advertiseInfo = advertiseInfo; } - - public String getInSequence() { - return inSequence; - } - - public void setInSequence(String inSequence) { - this.inSequence = inSequence; - } - - public String getAsyncApiDefinition() { - return asyncApiDefinition; - } - - public void setAsyncApiDefinition(String asyncApiDefinition) { - this.asyncApiDefinition = asyncApiDefinition; - } - - public Set getUriTemplates() { - return uriTemplates; - } - - public void setUriTemplates(Set uriTemplates) { - this.uriTemplates = uriTemplates; - } - - public Map getWsUriMapping() { - return wsUriMapping; - } - - public void setWsUriMapping(Map wsUriMapping) { - this.wsUriMapping = wsUriMapping; - } } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIMaxTps.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIMaxTps.java new file mode 100644 index 0000000000..5925b3c79a --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIMaxTps.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +import java.io.Serializable; + +public class APIMaxTps implements Serializable { + + private static final long serialVersionUID = 1L; + + int production; + int sandbox; + + public int getProduction() { + return production; + } + + public void setProduction(int production) { + this.production = production; + } + + public int getSandbox() { + return sandbox; + } + + public void setSandbox(int sandbox) { + this.sandbox = sandbox; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdditionalProperties.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdditionalProperties.java new file mode 100644 index 0000000000..fbb51bc081 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdditionalProperties.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +public class AdditionalProperties { + + private String name; + private String value; + private boolean display; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public boolean isDisplay() { + return display; + } + + public void setDisplay(boolean display) { + this.display = display; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/MediationPolicy.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/MediationPolicy.java new file mode 100644 index 0000000000..9db34dbe38 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/MediationPolicy.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +public class MediationPolicy { + + private String id; + private String name; + private String type; + private boolean shared; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public boolean isShared() { + return shared; + } + + public void setShared(boolean shared) { + this.shared = shared; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Monetization.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Monetization.java new file mode 100644 index 0000000000..5b014fbe58 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Monetization.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +import org.json.JSONObject; + +public class Monetization { + private boolean enabled; + private JSONObject properties; + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public JSONObject getProperties() { + return properties; + } + + public void setProperties(JSONObject properties) { + this.properties = properties; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java index 2dd00c4482..51e5d0c3de 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java @@ -18,7 +18,8 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; -import java.util.Set; +import org.json.JSONObject; +import java.util.List; /** * This hold the api operations information. @@ -29,8 +30,8 @@ public class Operations { private String verb; private String authType; private String throttlingPolicy; - private Set scopes; - private String usedProductIds; + private List scopes; + private List usedProductIds; private String amznResourceName; private String amznResourceTimeout; private String payloadSchema; @@ -78,19 +79,19 @@ public class Operations { this.throttlingPolicy = throttlingPolicy; } - public Set getScopes() { + public List getScopes() { return scopes; } - public void setScopes(Set scopes) { + public void setScopes(List scopes) { this.scopes = scopes; } - public String getUsedProductIds() { + public List getUsedProductIds() { return usedProductIds; } - public void setUsedProductIds(String usedProductIds) { + public void setUsedProductIds(List usedProductIds) { this.usedProductIds = usedProductIds; } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/ServiceInfo.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/ServiceInfo.java new file mode 100644 index 0000000000..cfbcf2ea66 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/ServiceInfo.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +public class ServiceInfo { + + private String key; + private String name; + private String version; + private boolean outdated; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public boolean isOutdated() { + return outdated; + } + + public void setOutdated(boolean outdated) { + this.outdated = outdated; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/ThreatProtectionPolicies.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/ThreatProtectionPolicies.java new file mode 100644 index 0000000000..b9594830f9 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/ThreatProtectionPolicies.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +public class ThreatProtectionPolicies { + + private String policyID; + private int priority; + + public String getPolicyID() { + return policyID; + } + + public void setPolicyID(String policyID) { + this.policyID = policyID; + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/WebsubSubscriptionConfiguration.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/WebsubSubscriptionConfiguration.java new file mode 100644 index 0000000000..a029c69cb0 --- /dev/null +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/WebsubSubscriptionConfiguration.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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. + */ + +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; + +/** + * This hold the Websub Subscription Configuration of an API. + */ +public class WebsubSubscriptionConfiguration { + private boolean enable; + private String secret; + private String signingAlgorithm; + private String signatureHeader; + + public boolean isEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public String getSigningAlgorithm() { + return signingAlgorithm; + } + + public void setSigningAlgorithm(String signingAlgorithm) { + this.signingAlgorithm = signingAlgorithm; + } + + public String getSignatureHeader() { + return signatureHeader; + } + + public void setSignatureHeader(String signatureHeader) { + this.signatureHeader = signatureHeader; + } +} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index a16e249002..d3a43eec02 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -17,19 +17,15 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher; +import com.google.gson.Gson; +import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl; import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServicesImpl; import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.CORSConfiguration; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.*; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; @@ -91,6 +87,7 @@ import java.util.Date; */ public class APIPublisherServiceImpl implements APIPublisherService { public static final APIManagerFactory API_MANAGER_FACTORY = APIManagerFactory.getInstance(); + private static final Gson gson = new Gson(); private static final String UNLIMITED_TIER = "Unlimited"; private static final String WS_UNLIMITED_TIER = "AsyncUnlimited"; private static final String API_PUBLISH_ENVIRONMENT = "Default"; @@ -166,14 +163,14 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiConfig.getName(), apiConfig.getVersion()); PublisherRESTAPIServices publisherRESTAPIServices = new PublisherRESTAPIServicesImpl(); - JSONArray apiList = (JSONArray) publisherRESTAPIServices.getApis(apiApplicationKey, accessTokenInfo).get("list"); + APIInfo[] apiList = publisherRESTAPIServices.getApis(apiApplicationKey, accessTokenInfo); boolean apiFound = false; - for (int i = 0; i < apiList.length(); i++) { - JSONObject apiObj = apiList.getJSONObject(i); - if (apiObj.getString("name").equals(apiIdentifier.getApiName().replace(Constants.SPACE, + for (int i = 0; i < apiList.length; i++) { + APIInfo apiObj = apiList[i]; + if (apiObj.getName().equals(apiIdentifier.getApiName().replace(Constants.SPACE, Constants.EMPTY_STRING))) { apiFound = true; - apiIdentifier.setUuid(apiObj.getString("id")); + apiIdentifier.setUuid(apiObj.getId()); break; } } @@ -194,13 +191,13 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } APIInfo api = getAPI(apiConfig, true); - JSONObject createdAPI = publisherRESTAPIServices.addAPI(apiApplicationKey, accessTokenInfo, api); - apiUuid = createdAPI.getString("id"); + APIInfo createdAPI = publisherRESTAPIServices.addAPI(apiApplicationKey, accessTokenInfo, api); + apiUuid = createdAPI.getId(); if (apiConfig.getEndpointType() != null && "WS".equals(apiConfig.getEndpointType())) { publisherRESTAPIServices.saveAsyncApiDefinition(apiApplicationKey, accessTokenInfo, apiUuid, apiConfig.getAsyncApiDefinition()); } - if (CREATED_STATUS.equals(createdAPI.getString("lifeCycleStatus"))) { + if (CREATED_STATUS.equals(createdAPI.getLifeCycleStatus())) { // if endpoint type "dynamic" and then add in sequence if ("dynamic".equals(apiConfig.getEndpointType())) { Mediation mediation = new Mediation(); @@ -272,12 +269,12 @@ public class APIPublisherServiceImpl implements APIPublisherService { } // Get existing API - JSONObject existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo, + APIInfo existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo, apiUuid); if (scopesToMoveAsSharedScopes.size() > 0) { // update API to remove local scopes APIInfo api = getAPI(apiConfig, false); - api.setLifeCycleStatus(existingAPI.getString("lifeCycleStatus")); + api.setLifeCycleStatus(existingAPI.getLifeCycleStatus()); publisherRESTAPIServices.updateApi(apiApplicationKey, accessTokenInfo, api); for (ApiScope apiScope : scopesToMoveAsSharedScopes) { @@ -294,7 +291,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo, apiUuid); APIInfo api = getAPI(apiConfig, true); - api.setLastUpdatedTime(existingAPI.getString("lifeCycleStatus")); + api.setLifeCycleStatus(existingAPI.getLifeCycleStatus()); api.setId(apiUuid); publisherRESTAPIServices.updateApi(apiApplicationKey, accessTokenInfo, api); @@ -375,7 +372,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { publisherRESTAPIServices.deployAPIRevision(apiApplicationKey, accessTokenInfo, apiUuid, apiRevisionId, apiRevisionDeploymentList); - if (CREATED_STATUS.equals(existingAPI.getString("lifeCycleStatus"))) { + if (CREATED_STATUS.equals(existingAPI.getLifeCycleStatus())) { publisherRESTAPIServices.changeLifeCycleStatus(apiApplicationKey, accessTokenInfo, apiUuid, PUBLISH_ACTION); } @@ -779,55 +776,49 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiInfo.setRevisionedApiId(null); apiInfo.setEnableSchemaValidation(false); - Set tags = new HashSet<>(); + List tags = new ArrayList<>(); tags.addAll(Arrays.asList(config.getTags())); apiInfo.setTags(tags); - Set availableTiers = new HashSet<>(); + List availableTiers = new ArrayList<>(); if (config.getEndpointType() != null && "WS".equals(config.getEndpointType())) { availableTiers.add(WS_UNLIMITED_TIER); } else { availableTiers.add(UNLIMITED_TIER); } apiInfo.setPolicies(availableTiers); - - if (config.getEndpointType() != null && "WS".equals(config.getEndpointType())) { - apiInfo.setAsyncApiDefinition(config.getAsyncApiDefinition()); - } + apiInfo.setApiThrottlingPolicy(UNLIMITED_TIER); //set operations and scopes - List operations = new ArrayList(); + List operations = new ArrayList(); List scopeSet = new ArrayList(); Iterator iterator; + for (iterator = config.getUriTemplates().iterator(); iterator.hasNext(); ) { ApiUriTemplate apiUriTemplate = iterator.next(); - JSONObject operation = new JSONObject(); - operation.put("target", apiUriTemplate.getUriTemplate()); - operation.put("verb", apiUriTemplate.getHttpVerb()); - operation.put("authType", apiUriTemplate.getAuthType()); - operation.put("throttlingPolicy", UNLIMITED_TIER); - operation.put("uriMapping", apiUriTemplate.getUriMapping()); + Operations operation = new Operations(); + operation.setTarget(apiUriTemplate.getUriTemplate()); + operation.setVerb(apiUriTemplate.getHttpVerb()); + operation.setAuthType(apiUriTemplate.getAuthType()); + operation.setThrottlingPolicy(UNLIMITED_TIER); + operation.setUriMapping(apiUriTemplate.getUriMapping()); if (includeScopes) { if (apiUriTemplate.getScope() != null) { - String scopeString = "{\n" + - " \"scope\": {\n" + - " \"id\": null,\n" + - " \"name\": \"" + apiUriTemplate.getScope().getKey() + "\",\n" + - " \"displayName\": \"" + apiUriTemplate.getScope().getName() + "\",\n" + - " \"description\": \"" + apiUriTemplate.getScope().getDescription() + "\",\n" + - " \"bindings\": [\n" + - " \"" + apiUriTemplate.getScope().getRoles() + "\"\n" + - " ],\n" + - " \"usageCount\": null\n" + - " },\n" + - " \"shared\": true\n" + - " }"; - JSONObject scope = new JSONObject(scopeString); - scopeSet.add(scope); + Scope scope = new Scope(); + scope.setName(apiUriTemplate.getScope().getKey()); + scope.setDisplayName(apiUriTemplate.getScope().getName()); + scope.setDescription(apiUriTemplate.getScope().getDescription()); + scope.setBindings(apiUriTemplate.getScope().getRoles()); - Set scopes = new HashSet<>(); - scopes.add(apiUriTemplate.getScope().getKey()); - operation.put("scopes", scopes); + JSONObject scopeObject = new JSONObject(); + scopeObject.put("scope", new JSONObject(gson.toJson(scope))); + scopeObject.put("shared", true); + + scopeSet.add(scopeObject); + + List scopes = new ArrayList<>(); + scopes.addAll(Arrays.asList(apiUriTemplate.getScope().getKey())); + operation.setScopes(scopes); } } operations.add(operation); @@ -855,8 +846,8 @@ public class APIPublisherServiceImpl implements APIPublisherService { " }"; JSONObject endPointConfig = new JSONObject(endpointConfig); - Set transports = new HashSet<>(); - transports.addAll(Arrays.asList(config.getTransports())); + List transports = new ArrayList<>(); + transports.addAll(Arrays.asList(config.getTransports().split(","))); apiInfo.setTransport(transports); apiInfo.setType("HTTP"); @@ -872,7 +863,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { " }\n" + " }"; endPointConfig = new JSONObject(endpointConfig); - apiInfo.setInSequence(config.getInSequenceName()); + apiInfo.setEndpointImplementationType("ENDPOINT"); } // if ws endpoint @@ -888,7 +879,8 @@ public class APIPublisherServiceImpl implements APIPublisherService { " }"; endPointConfig = new JSONObject(endpointConfig); - transports.addAll(Arrays.asList("wss,ws")); + transports.add("wss"); + transports.add("ws"); apiInfo.setTransport(transports); apiInfo.setType("WS"); } @@ -922,6 +914,8 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiInfo.setEnableSchemaValidation(false); apiInfo.setMonetization(null); apiInfo.setServiceInfo(null); + apiInfo.setWebsubSubscriptionConfiguration(null); + apiInfo.setAdvertiseInfo(null); return apiInfo; } From fa37fa33cc1d7b721b2e94e6456d466b770ddd46 Mon Sep 17 00:00:00 2001 From: pasindu Date: Fri, 6 Oct 2023 13:50:55 +0530 Subject: [PATCH 100/112] Map JsonObject to dto classes in publisher API revesion --- .../rest/api/PublisherRESTAPIServices.java | 23 +++---- .../api/PublisherRESTAPIServicesImpl.java | 66 +++++++++---------- .../rest/api/dto/APIInfo/APIRevision.java | 37 ++++++++--- .../dto/APIInfo/APIRevisionDeployment.java | 26 ++++---- .../publisher/APIPublisherServiceImpl.java | 45 ++++++------- 5 files changed, 101 insertions(+), 96 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java index a191b0ac16..6793e06b92 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java @@ -19,16 +19,11 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.*; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment; import org.json.JSONObject; import java.util.List; @@ -63,8 +58,8 @@ public interface PublisherRESTAPIServices { String asyncApiDefinition) throws APIServicesException, BadRequestException, UnexpectedResponseException; - JSONObject getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - String apiUuid) + MediationPolicy[] getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean addApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, @@ -72,18 +67,18 @@ public interface PublisherRESTAPIServices { throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean deleteApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - String uuid, Mediation mediation) + String uuid, Mediation mediation) throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean changeLifeCycleStatus(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, String action) throws APIServicesException, BadRequestException, UnexpectedResponseException; - JSONObject getAPIRevisions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, - Boolean deploymentStatus) + APIRevision[] getAPIRevisions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, + Boolean deploymentStatus) throws APIServicesException, BadRequestException, UnexpectedResponseException; - JSONObject addAPIRevision(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + APIRevision addAPIRevision(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIRevision apiRevision) throws APIServicesException, BadRequestException, UnexpectedResponseException; @@ -92,11 +87,11 @@ public interface PublisherRESTAPIServices { throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean undeployAPIRevisionDeployment(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - JSONObject apiRevisionDeployment, String uuid) + APIRevision apiRevisionDeployment, String uuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; boolean deleteAPIRevision(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - JSONObject apiRevision, String uuid) + APIRevision apiRevision, String uuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; JSONObject getDocumentations(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java index 05f0a3fe98..ac0d2434dc 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java @@ -643,7 +643,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } @Override - public JSONObject getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + public MediationPolicy[] getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException { @@ -658,8 +658,8 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { try { Response response = client.newCall(request).execute(); if (HttpStatus.SC_OK == response.code()) { - JSONObject jsonObject = new JSONObject(response.body().string()); - return jsonObject; + JSONArray mediationPolicyList = (JSONArray) new JSONObject(response.body().string()).get("list"); + return gson.fromJson(mediationPolicyList.toString(), MediationPolicy[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. @@ -814,7 +814,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } @Override - public JSONObject getAPIRevisions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, + public APIRevision[] getAPIRevisions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, Boolean deploymentStatus) throws APIServicesException, BadRequestException, UnexpectedResponseException { @@ -831,8 +831,8 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { try { Response response = client.newCall(request).execute(); if (HttpStatus.SC_OK == response.code()) { - JSONObject jsonObject = new JSONObject(response.body().string()); - return jsonObject; + JSONArray revisionList = (JSONArray) new JSONObject(response.body().string()).get("list"); + return gson.fromJson(revisionList.toString(), APIRevision[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. @@ -856,16 +856,15 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } @Override - public JSONObject addAPIRevision(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIRevision apiRevision) + public APIRevision addAPIRevision(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIRevision apiRevision) throws APIServicesException, BadRequestException, UnexpectedResponseException { String addNewScope = endPointPrefix + Constants.API_ENDPOINT + apiRevision.getApiUUID() + "/revisions"; - String apiRevisionDescription = "{\n" + - " \"description\":\"" + apiRevision.getDescription() + "\"\n" + - "}"; + JSONObject payload = new JSONObject(); + payload.put("description", (apiRevision.getDescription() != null ? apiRevision.getDescription() : null)); - RequestBody requestBody = RequestBody.create(JSON, apiRevisionDescription); + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() .url(addNewScope) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER @@ -876,8 +875,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { try { Response response = client.newCall(request).execute(); if (HttpStatus.SC_CREATED == response.code()) { - JSONObject jsonObject = new JSONObject(response.body().string()); - return jsonObject; + return gson.fromJson(response.body().string(), APIRevision.class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. @@ -908,15 +906,14 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String deployAPIRevisionEndPoint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/deploy-revision?revisionId=" + apiRevisionId; APIRevisionDeployment apiRevisionDeployment = apiRevisionDeploymentList.get(0); - String revision = "[\n" + - " {\n" + - " \"name\": \"" + apiRevisionDeployment.getDeployment() + "\",\n" + - " \"vhost\": \"" + apiRevisionDeployment.getVhost() + "\",\n" + - " \"displayOnDevportal\": " + apiRevisionDeployment.isDisplayOnDevportal() + "\n" + - " }\n" + - "]"; + JSONArray payload = new JSONArray(); + JSONObject revision = new JSONObject(); + revision.put("name", (apiRevisionDeployment.getName() != null ? apiRevisionDeployment.getName() : "")); + revision.put("vhost", (apiRevisionDeployment.getVhost() != null ? apiRevisionDeployment.getVhost() : "")); + revision.put("displayOnDevportal", apiRevisionDeployment.isDisplayOnDevportal()); + payload.put(revision); - RequestBody requestBody = RequestBody.create(JSON, revision); + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() .url(deployAPIRevisionEndPoint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER @@ -953,23 +950,22 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { @Override public boolean undeployAPIRevisionDeployment(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - JSONObject apiRevisionDeployment, String uuid) + APIRevision apiRevisionDeployment, String uuid) throws APIServicesException, BadRequestException, UnexpectedResponseException { String undeployAPIRevisionEndPoint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/undeploy-revision?revisionId=" - + apiRevisionDeployment.getString("id"); - JSONArray array = apiRevisionDeployment.getJSONArray("deploymentInfo"); - JSONObject obj = array.getJSONObject(0); + + apiRevisionDeployment.getId(); + List apiRevisionDeployments = apiRevisionDeployment.getDeploymentInfo(); + APIRevisionDeployment earliestDeployment = apiRevisionDeployments.get(0); - String revision = "[\n" + - " {\n" + - " \"name\": \"" + obj.getString("name") + "\",\n" + - " \"vhost\": \"" + obj.getString("vhost") + "\",\n" + - " \"displayOnDevportal\": " + obj.get("displayOnDevportal") + "\n" + - " }\n" + - "]"; + JSONArray payload = new JSONArray(); + JSONObject revision = new JSONObject(); + revision.put("name", (earliestDeployment.getName() != null ? earliestDeployment.getName() : "")); + revision.put("vhost", (earliestDeployment.getVhost() != null ? earliestDeployment.getVhost() : "")); + revision.put("displayOnDevportal", earliestDeployment.isDisplayOnDevportal()); + payload.put(revision); - RequestBody requestBody = RequestBody.create(JSON, revision); + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() .url(undeployAPIRevisionEndPoint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER @@ -1005,11 +1001,11 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { @Override public boolean deleteAPIRevision(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - JSONObject apiRevision, String uuid) + APIRevision apiRevision, String uuid) throws APIServicesException, BadRequestException, UnexpectedResponseException { String apiRevisionEndPoint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/revisions/" + - apiRevision.getString("id"); + apiRevision.getId(); Request request = new Request.Builder() .url(apiRevisionEndPoint) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java index 581fbb1792..c3f3b5831b 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java @@ -17,26 +17,26 @@ */ package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo; -import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; - import java.io.Serializable; import java.util.List; public class APIRevision implements Serializable { private static final long serialVersionUID = 1L; - private int id; + private String id; private String apiUUID; private String revisionUUID; private String description; + private String displayName; private String createdBy; private String createdTime; - private List apiRevisionDeploymentList; + private APIInfo apiInfo; + private List deploymentInfo; - public int getId() { + public String getId() { return id; } - public void setId(int id) { + public void setId(String id) { this.id = id; } @@ -80,11 +80,28 @@ public class APIRevision implements Serializable { this.createdTime = createdTime; } - public List getApiRevisionDeploymentList() { - return apiRevisionDeploymentList; + public List getDeploymentInfo() { + return deploymentInfo; } - public void setApiRevisionDeploymentList(List apiRevisionDeploymentList) { - this.apiRevisionDeploymentList = apiRevisionDeploymentList; + public void setDeploymentInfo(List deploymentInfo) { + this.deploymentInfo = deploymentInfo; } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public APIInfo getApiInfo() { + return apiInfo; + } + + public void setApiInfo(APIInfo apiInfo) { + this.apiInfo = apiInfo; + } + } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java index 20c84232cc..4be3a64836 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java @@ -23,10 +23,10 @@ import java.io.Serializable; public class APIRevisionDeployment implements Serializable { private static final long serialVersionUID = 1L; private int id; - private String revisionUUID; - private String deployment; + private String revisionUuid; + private String name; private String vhost; - private boolean isDisplayOnDevportal; + private boolean displayOnDevportal; private String deployedTime; public int getId() { @@ -37,20 +37,20 @@ public class APIRevisionDeployment implements Serializable { this.id = id; } - public String getRevisionUUID() { - return revisionUUID; + public String getRevisionUuid() { + return revisionUuid; } - public void setRevisionUUID(String revisionUUID) { - this.revisionUUID = revisionUUID; + public void setRevisionUuid(String revisionUuid) { + this.revisionUuid = revisionUuid; } - public String getDeployment() { - return deployment; + public String getName() { + return name; } - public void setDeployment(String deployment) { - this.deployment = deployment; + public void setName(String name) { + this.name = name; } public String getVhost() { @@ -62,11 +62,11 @@ public class APIRevisionDeployment implements Serializable { } public boolean isDisplayOnDevportal() { - return isDisplayOnDevportal; + return displayOnDevportal; } public void setDisplayOnDevportal(boolean displayOnDevportal) { - isDisplayOnDevportal = displayOnDevportal; + this.displayOnDevportal = displayOnDevportal; } public String getDeployedTime() { diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index d3a43eec02..d32a7d6d30 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -215,10 +215,10 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiRevision.setApiUUID(apiUuid); apiRevision.setDescription("Initial Revision"); String apiRevisionId = publisherRESTAPIServices.addAPIRevision(apiApplicationKey, - accessTokenInfo, apiRevision).getString("id"); + accessTokenInfo, apiRevision).getId(); APIRevisionDeployment apiRevisionDeployment = new APIRevisionDeployment(); - apiRevisionDeployment.setDeployment(API_PUBLISH_ENVIRONMENT); + apiRevisionDeployment.setName(API_PUBLISH_ENVIRONMENT); apiRevisionDeployment.setVhost(System.getProperty("iot.gateway.host")); apiRevisionDeployment.setDisplayOnDevportal(true); @@ -308,15 +308,14 @@ public class APIPublisherServiceImpl implements APIPublisherService { mediation.setType("in"); mediation.setGlobal(false); - JSONArray mediationList = (JSONArray) publisherRESTAPIServices - .getAllApiSpecificMediationPolicies(apiApplicationKey, accessTokenInfo, - apiUuid).get("list"); + MediationPolicy[] mediationList = publisherRESTAPIServices + .getAllApiSpecificMediationPolicies(apiApplicationKey, accessTokenInfo, apiUuid); boolean isMediationPolicyFound = false; - for (int i = 0; i < mediationList.length(); i++) { - JSONObject mediationObj = mediationList.getJSONObject(i); - if (apiConfig.getInSequenceName().equals(mediationObj.getString("name"))) { - mediation.setUuid(mediationObj.getString("id")); + for (int i = 0; i < mediationList.length; i++) { + MediationPolicy mediationPolicy = mediationList[i]; + if (apiConfig.getInSequenceName().equals(mediationPolicy.getName())) { + mediation.setUuid(mediationPolicy.getId()); publisherRESTAPIServices.deleteApiSpecificMediationPolicy(apiApplicationKey, accessTokenInfo, apiUuid, mediation); publisherRESTAPIServices.addApiSpecificMediationPolicy(apiApplicationKey, @@ -331,24 +330,22 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } - int apiRevisionCount = (int) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, - accessTokenInfo, apiUuid, null).get("count"); + int apiRevisionCount = publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, + accessTokenInfo, apiUuid, null).length; if (apiRevisionCount >= 5) { // This will retrieve the deployed revision - JSONArray revisionDeploymentList = (JSONArray) publisherRESTAPIServices.getAPIRevisions( - apiApplicationKey, accessTokenInfo, apiUuid, - true).get("list"); - if (revisionDeploymentList.length() > 0) { - JSONObject latestRevisionDeployment = revisionDeploymentList.getJSONObject(0); + APIRevision[] revisionDeploymentList = publisherRESTAPIServices.getAPIRevisions( + apiApplicationKey, accessTokenInfo, apiUuid, true); + if (revisionDeploymentList.length > 0) { + APIRevision latestRevisionDeployment = revisionDeploymentList[0]; publisherRESTAPIServices.undeployAPIRevisionDeployment(apiApplicationKey, accessTokenInfo, latestRevisionDeployment, apiUuid); } - // This will retrieve the un deployed revision list - JSONArray undeployedRevisionList = (JSONArray) publisherRESTAPIServices.getAPIRevisions( - apiApplicationKey, accessTokenInfo, apiUuid, - false).get("list"); - if (undeployedRevisionList.length() > 0) { - JSONObject earliestUndeployRevision = undeployedRevisionList.getJSONObject(0); + // This will retrieve the undeployed revision list + APIRevision[] undeployedRevisionList = publisherRESTAPIServices.getAPIRevisions(apiApplicationKey, + accessTokenInfo, apiUuid, false); + if (undeployedRevisionList.length > 0) { + APIRevision earliestUndeployRevision = undeployedRevisionList[0]; publisherRESTAPIServices.deleteAPIRevision(apiApplicationKey, accessTokenInfo, earliestUndeployRevision, apiUuid); } @@ -359,10 +356,10 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiRevision.setApiUUID(apiUuid); apiRevision.setDescription("Updated Revision"); String apiRevisionId = publisherRESTAPIServices.addAPIRevision(apiApplicationKey, - accessTokenInfo, apiRevision).getString("id"); + accessTokenInfo, apiRevision).getId(); APIRevisionDeployment apiRevisionDeployment = new APIRevisionDeployment(); - apiRevisionDeployment.setDeployment(API_PUBLISH_ENVIRONMENT); + apiRevisionDeployment.setName(API_PUBLISH_ENVIRONMENT); apiRevisionDeployment.setVhost(System.getProperty("iot.gateway.host")); apiRevisionDeployment.setDisplayOnDevportal(true); From 1325780e3b3f4541536ed7e2b0b738db23dffbf4 Mon Sep 17 00:00:00 2001 From: pasindu Date: Mon, 9 Oct 2023 14:56:45 +0530 Subject: [PATCH 101/112] Map JsonObject to dto classes in publisher API documentation --- .../rest/api/PublisherRESTAPIServices.java | 2 +- .../api/PublisherRESTAPIServicesImpl.java | 29 +++++---- .../rest/api/dto/APIInfo/Documentation.java | 61 ++++++++++++++++--- .../publisher/APIPublisherServiceImpl.java | 20 +++--- 4 files changed, 78 insertions(+), 34 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java index 6793e06b92..b86437b6f3 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java @@ -94,7 +94,7 @@ public interface PublisherRESTAPIServices { APIRevision apiRevision, String uuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; - JSONObject getDocumentations(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, + Documentation[] getDocumentations(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid) throws APIServicesException, BadRequestException, UnexpectedResponseException; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java index ac0d2434dc..8ba8bb12f7 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java @@ -644,7 +644,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { @Override public MediationPolicy[] getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, - String apiUuid) + String apiUuid) throws APIServicesException, BadRequestException, UnexpectedResponseException { String getAPIMediationEndPoint = endPointPrefix + Constants.API_ENDPOINT + apiUuid + "/mediation-policies"; @@ -815,7 +815,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { @Override public APIRevision[] getAPIRevisions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid, - Boolean deploymentStatus) + Boolean deploymentStatus) throws APIServicesException, BadRequestException, UnexpectedResponseException { String getAPIRevisionsEndPoint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/revisions?query=deployed:" @@ -1041,7 +1041,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { } @Override - public JSONObject getDocumentations(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid) + public Documentation[] getDocumentations(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String uuid) throws APIServicesException, BadRequestException, UnexpectedResponseException { String getDocumentationsEndPoint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/documents?limit=1000"; @@ -1056,8 +1056,8 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { try { Response response = client.newCall(request).execute(); if (HttpStatus.SC_OK == response.code()) { - JSONObject jsonObject = new JSONObject(response.body().string()); - return jsonObject; + JSONArray documentList = (JSONArray) new JSONObject(response.body().string()).get("list"); + return gson.fromJson(documentList.toString(), Documentation[].class); } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. @@ -1127,17 +1127,16 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices { String addNewScope = endPointPrefix + Constants.API_ENDPOINT + uuid + "/documents"; - String document = "{\n" + - " \"name\": \"" + documentation.getName() + "\",\n" + - " \"type\": \"" + documentation.getType() + "\",\n" + - " \"summary\": \"" + documentation.getSummary() + "\",\n" + - " \"sourceType\": \"" + documentation.getSourceType() + "\",\n" + - " \"inlineContent\": \"" + documentation.getSourceType() + "\",\n" + - " \"visibility\": \"" + documentation.getVisibility() + "\",\n" + - " \"createdBy\": \"admin\"\n" + - "}"; + JSONObject payload = new JSONObject(); + payload.put("name", documentation.getName()); + payload.put("type", documentation.getType()); + payload.put("summary", documentation.getSummary()); + payload.put("sourceType", documentation.getSourceType()); + payload.put("inlineContent", documentation.getSourceType()); + payload.put("visibility", documentation.getVisibility()); + payload.put("createdBy", documentation.getCreatedBy()); - RequestBody requestBody = RequestBody.create(JSON, document); + RequestBody requestBody = RequestBody.create(JSON, payload.toString()); Request request = new Request.Builder() .url(addNewScope) .addHeader(Constants.HEADER_CONTENT_TYPE, Constants.APPLICATION_JSON) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java index 5d54bc7567..5d4c733b42 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java @@ -24,16 +24,21 @@ public class Documentation { private static final long serialVersionUID = 1L; private String id; private String documentId; - private DocumentationType type; private String name; + private DocumentationType type; private String summary; private DocumentSourceType sourceType; private String sourceUrl; - private DocumentVisibility visibility; - private Date lastUpdated; + private String fileName; private String filePath; - private Date createdDate; + private String inlineContent; private String otherTypeName; + private DocumentVisibility visibility; + private String createdTime; + private Date createdDate; + private String createdBy; + private Date lastUpdatedTime; + private String lastUpdatedBy; public String getOtherTypeName() { return this.otherTypeName; @@ -113,12 +118,12 @@ public class Documentation { return result; } - public Date getLastUpdated() { - return this.lastUpdated; + public Date getLastUpdatedTime() { + return this.lastUpdatedTime; } - public void setLastUpdated(Date lastUpdated) { - this.lastUpdated = lastUpdated; + public void setLastUpdatedTime(Date lastUpdatedTime) { + this.lastUpdatedTime = lastUpdatedTime; } public String getId() { @@ -145,6 +150,46 @@ public class Documentation { this.createdDate = createdDate; } + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getInlineContent() { + return inlineContent; + } + + public void setInlineContent(String inlineContent) { + this.inlineContent = inlineContent; + } + + public String getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(String createdTime) { + this.createdTime = createdTime; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getLastUpdatedBy() { + return lastUpdatedBy; + } + + public void setLastUpdatedBy(String lastUpdatedBy) { + this.lastUpdatedBy = lastUpdatedBy; + } + public static enum DocumentVisibility { OWNER_ONLY("owner_only"), PRIVATE("private"), diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index d32a7d6d30..1691776be5 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -397,27 +397,27 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiDocumentation.setVisibility(Documentation.DocumentVisibility.API_LEVEL); apiDocumentation.setSourceType(Documentation.DocumentSourceType.MARKDOWN); apiDocumentation.setCreatedDate(new Date()); - apiDocumentation.setLastUpdated(new Date()); + apiDocumentation.setLastUpdatedTime(new Date()); apiDocumentation.setSummary(apiConfig.getApiDocumentationSummary()); apiDocumentation.setOtherTypeName(null); - JSONArray documentList = (JSONArray) publisherRESTAPIServices.getDocumentations(apiApplicationKey, - accessTokenInfo, apiUuid).get("list"); + Documentation[] documentList = publisherRESTAPIServices.getDocumentations(apiApplicationKey, + accessTokenInfo, apiUuid); - if (documentList.length() > 0) { - for (int i = 0; i < documentList.length(); i++) { - JSONObject existingDoc = documentList.getJSONObject(i); - if (existingDoc.getString("name").equals(apiConfig.getApiDocumentationName()) - && existingDoc.getString("type").equals(Documentation.DocumentationType.HOWTO.name())) { + if (documentList.length > 0) { + for (int i = 0; i < documentList.length; i++) { + Documentation existingDoc = documentList[i]; + if (existingDoc.getName().equals(apiConfig.getApiDocumentationName()) + && existingDoc.getType().equals(Documentation.DocumentationType.HOWTO.name())) { publisherRESTAPIServices.deleteDocumentations(apiApplicationKey, accessTokenInfo, - apiUuid, existingDoc.getString("documentId")); + apiUuid, existingDoc.getDocumentId()); } } } else { log.info("There is no any existing api documentation."); } - io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation createdDoc = publisherRESTAPIServices.addDocumentation(apiApplicationKey, accessTokenInfo, + Documentation createdDoc = publisherRESTAPIServices.addDocumentation(apiApplicationKey, accessTokenInfo, apiUuid, apiDocumentation); publisherRESTAPIServices.addDocumentationContent(apiApplicationKey, accessTokenInfo, apiUuid, From 3d30ee913503abb29786c38543e0fbf926a81425 Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Tue, 17 Oct 2023 12:35:51 +0530 Subject: [PATCH 102/112] Update db scripts --- .../src/main/resources/dbscripts/cdm/h2.sql | 2 +- .../src/main/resources/dbscripts/cdm/mssql.sql | 2 +- .../src/main/resources/dbscripts/cdm/mysql.sql | 2 +- .../src/main/resources/dbscripts/cdm/oracle.sql | 2 +- .../src/main/resources/dbscripts/cdm/postgresql.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index 4f9f9fa5dc..2d24e0d2ca 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -594,7 +594,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA ( METADATA_ID INT AUTO_INCREMENT NOT NULL, DATA_TYPE VARCHAR(16) NOT NULL, METADATA_KEY VARCHAR(128) NOT NULL, - METADATA_VALUE VARCHAR(65535) NOT NULL, + METADATA_VALUE TEXT NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (METADATA_ID), CONSTRAINT METADATA_KEY_TENANT_ID UNIQUE (METADATA_KEY, TENANT_ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 4c8c753448..7fd88ff852 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -664,7 +664,7 @@ CREATE TABLE DM_METADATA ( METADATA_ID INTEGER IDENTITY(1,1) NOT NULL, DATA_TYPE VARCHAR(16) NOT NULL, METADATA_KEY VARCHAR(128) NOT NULL, - METADATA_VALUE VARCHAR(8000) NOT NULL, + METADATA_VALUE TEXT NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (METADATA_ID), CONSTRAINT METADATA_KEY_TENANT_ID UNIQUE(METADATA_KEY, TENANT_ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index 2f4bd489f0..c59c9c8fd3 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -656,7 +656,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA ( METADATA_ID INTEGER NOT NULL AUTO_INCREMENT, DATA_TYPE VARCHAR(16) NOT NULL, METADATA_KEY VARCHAR(128) NOT NULL, - METADATA_VALUE VARCHAR(65535) NOT NULL, + METADATA_VALUE TEXT NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (METADATA_ID), UNIQUE KEY METADATA_KEY_TENANT_ID (METADATA_KEY,TENANT_ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index f85e4349e5..43b10f0a0d 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -999,7 +999,7 @@ CREATE TABLE DM_METADATA ( DATA_TYPE VARCHAR2(16) NOT NULL, METADATA_KEY VARCHAR2(128) NOT NULL, -- Can be upgrade to 32767 bytes if the MAX_STRING_SIZE initialization parameter is set to EXTENDED -- - METADATA_VALUE VARCHAR2(4000) NOT NULL, + METADATA_VALUE TEXT NOT NULL, TENANT_ID INTEGER NOT NULL, CONSTRAINT PK_DM_METADATA PRIMARY KEY (METADATA_ID), CONSTRAINT METADATA_KEY_TENANT_ID UNIQUE (METADATA_KEY, TENANT_ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 2d72a7b423..61fc60bf91 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -660,7 +660,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA ( METADATA_ID BIGSERIAL PRIMARY KEY, DATA_TYPE VARCHAR(16) NOT NULL, METADATA_KEY VARCHAR(128) NOT NULL, - METADATA_VALUE VARCHAR(65535) NOT NULL, + METADATA_VALUE TEXT NOT NULL, TENANT_ID INTEGER NOT NULL, CONSTRAINT METADATA_KEY_TENANT_ID UNIQUE(METADATA_KEY, TENANT_ID) ); From ead5f2dfc4a56d4ef1452d8f9161d8f89ee11bda Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Tue, 17 Oct 2023 15:49:46 +0530 Subject: [PATCH 103/112] Fix errors with cdm tables --- .../src/main/resources/dbscripts/cdm/mssql.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 969fc008b4..253e050a11 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -672,6 +672,7 @@ CREATE TABLE DM_METADATA ( -- END OF METADATA TABLE -- -- DM_OTP_DATA TABLE -- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_OTP_DATA]') AND TYPE IN (N'U')) CREATE TABLE DM_OTP_DATA ( ID INT IDENTITY NOT NULL, OTP_TOKEN VARCHAR(100) NOT NULL, @@ -721,7 +722,7 @@ DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID ORDER BY DEVICE_INFO.DEVICE_ID'); -IF NOT EXISTS (SELECT * FROM SYS.VIEWS WHERE NAME = 'CREATE VIEW FEATURE_NON_COMPLIANCE_INFO') +IF NOT EXISTS (SELECT * FROM SYS.VIEWS WHERE NAME = 'FEATURE_NON_COMPLIANCE_INFO') exec('CREATE VIEW FEATURE_NON_COMPLIANCE_INFO AS SELECT TOP 100 PERCENT DM_DEVICE.ID AS DEVICE_ID, @@ -904,7 +905,7 @@ CREATE TABLE SUB_OPERATION_TEMPLATE ( OPERATION_DEFINITION VARCHAR(MAX) NOT NULL, OPERATION_CODE varchar(100) NOT NULL, SUB_TYPE_ID VARCHAR(45) NOT NULL, - DEVICE_TYPE VARCHAR(25) NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, CREATE_TIMESTAMP BIGINT NULL DEFAULT NULL, UPDATE_TIMESTAMP BIGINT NULL DEFAULT NULL, PRIMARY KEY (SUB_OPERATION_TEMPLATE_ID), @@ -912,4 +913,4 @@ CREATE TABLE SUB_OPERATION_TEMPLATE ( CONSTRAINT fk_SUB_OPERATION_TEMPLATE_DM_DEVICE_SUB_TYPE FOREIGN KEY (SUB_TYPE_ID, DEVICE_TYPE) REFERENCES DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, DEVICE_TYPE) ); --- END SUB_OPERATION_TEMPLATE TABLE-- \ No newline at end of file +-- END SUB_OPERATION_TEMPLATE TABLE-- From 8fa8cca776c614f823c6ad44218b63998d7cf28e Mon Sep 17 00:00:00 2001 From: tcdlpds Date: Wed, 18 Oct 2023 08:26:09 +0530 Subject: [PATCH 104/112] Remove jaggery modules --- .../org.wso2.carbon.device.mgt.ui/pom.xml | 61 - .../src/assembly/src.xml | 48 - .../jaggery-modules/utils/module.xml | 56 - .../utils/scripts/exception/exception.js | 64 - .../utils/scripts/file/file.js | 166 - .../utils/scripts/patterns/patterns.js | 127 - .../utils/scripts/reflection/reflection.js | 229 - .../utils/scripts/request/request.js | 56 - .../utils/scripts/response/response.js | 98 - .../utils/scripts/time/time.js | 34 - .../jaggery-modules/utils/scripts/url/url.js | 46 - .../jaggery-modules/utils/scripts/xml/xml.js | 137 - .../devicemgt/api/data-tables-invoker-api.jag | 113 - .../jaggeryapps/devicemgt/api/device-api.jag | 227 - .../jaggeryapps/devicemgt/api/enterprise.jag | 138 - .../jaggeryapps/devicemgt/api/group-api.jag | 87 - .../jaggeryapps/devicemgt/api/invoker-api.jag | 119 - .../devicemgt/api/operation-api.jag | 68 - .../jaggeryapps/devicemgt/api/policy-api.jag | 52 - .../jaggeryapps/devicemgt/api/stats-api.jag | 77 - .../jaggeryapps/devicemgt/api/user-api.jag | 211 - .../devicemgt/app/conf/app-conf.json | 47 - .../devicemgt/app/conf/config.json | 174 - .../devicemgt/app/conf/toplink-menu.json | 138 - .../app/layouts/cdmf.layout.default.hbs | 82 - .../app/layouts/cdmf.layout.error.hbs | 48 - .../app/layouts/cdmf.layout.loading.hbs | 57 - .../app/modules/batch-provider-api.js | 149 - .../modules/business-controllers/device.js | 467 - .../app/modules/business-controllers/group.js | 143 - .../modules/business-controllers/operation.js | 168 - .../modules/business-controllers/policy.js | 282 - .../app/modules/business-controllers/user.js | 760 - .../app/modules/conf-reader/cloud.js | 62 - .../devicemgt/app/modules/conf-reader/main.js | 64 - .../app/modules/conf-reader/pinch.min.js | 26 - .../devicemgt/app/modules/constants.js | 87 - .../jaggeryapps/devicemgt/app/modules/init.js | 51 - .../devicemgt/app/modules/login.js | 61 - .../app/modules/oauth/token-handler-utils.js | 406 - .../app/modules/oauth/token-handlers.js | 282 - .../oauth/token-protected-service-invokers.js | 503 - .../devicemgt/app/modules/utility.js | 396 - .../cdmf.page.certificate.create/create.hbs | 111 - .../cdmf.page.certificate.create/create.js | 46 - .../cdmf.page.certificate.create/create.json | 5 - .../public/js/certificate-create.js | 129 - .../cdmf.page.certificates/certificates.hbs | 122 - .../cdmf.page.certificates/certificates.js | 34 - .../cdmf.page.certificates/certificates.json | 5 - .../public/js/certificate-listing.js | 201 - .../public/templates/certificate-listing.hbs | 30 - .../cdmf.page.cookie-policy/cookie-policy.hbs | 172 - .../cookie-policy.json | 6 - .../pages/cdmf.page.dashboard/dashboard.hbs | 234 - .../pages/cdmf.page.dashboard/dashboard.js | 55 - .../pages/cdmf.page.dashboard/dashboard.json | 5 - .../cdmf.page.device.analytics/analytics.hbs | 67 - .../cdmf.page.device.analytics/analytics.js | 34 - .../cdmf.page.device.analytics/analytics.json | 5 - .../public/css/analytics.css | 56 - .../pages/cdmf.page.device.enroll/enroll.hbs | 66 - .../pages/cdmf.page.device.enroll/enroll.js | 31 - .../pages/cdmf.page.device.enroll/enroll.json | 5 - .../public/js/bottomJs.js | 227 - .../public/templates/device-listing.hbs | 44 - .../pages/cdmf.page.device.search/search.hbs | 164 - .../pages/cdmf.page.device.search/search.json | 5 - .../pages/cdmf.page.device.type.view/view.hbs | 58 - .../pages/cdmf.page.device.type.view/view.js | 49 - .../cdmf.page.device.type.view/view.json | 5 - .../app/pages/cdmf.page.device.view/view.hbs | 46 - .../app/pages/cdmf.page.device.view/view.js | 37 - .../app/pages/cdmf.page.device.view/view.json | 5 - .../devicelocations.hbs | 35 - .../devicelocations.json | 5 - .../app/pages/cdmf.page.devices/devices.hbs | 760 - .../app/pages/cdmf.page.devices/devices.js | 109 - .../app/pages/cdmf.page.devices/devices.json | 5 - .../cdmf.page.devices/public/js/listing.js | 1310 -- .../cdmf.page.devicetype.create/create.hbs | 264 - .../cdmf.page.devicetype.create/create.js | 29 - .../cdmf.page.devicetype.create/create.json | 5 - .../public/css/devicetype.css | 37 - .../public/js/bottomJs.js | 243 - .../pages/cdmf.page.devicetype.edit/edit.hbs | 272 - .../pages/cdmf.page.devicetype.edit/edit.js | 52 - .../pages/cdmf.page.devicetype.edit/edit.json | 5 - .../public/css/devicetype.css | 43 - .../public/js/bottomJs.js | 257 - .../cdmf.page.devicetype.event.edit/edit.hbs | 181 - .../cdmf.page.devicetype.event.edit/edit.js | 51 - .../cdmf.page.devicetype.event.edit/edit.json | 5 - .../public/css/devicetype.css | 43 - .../public/js/bottomJs.js | 181 - .../cdmf.page.devicetypes/devicetypes.hbs | 114 - .../cdmf.page.devicetypes/devicetypes.js | 36 - .../cdmf.page.devicetypes/devicetypes.json | 5 - .../public/css/custom.css | 21 - .../public/js/devicetype-listing.js | 207 - .../public/templates/devicetype-listing.hbs | 44 - .../cdmf.page.effective-policy.view/view.hbs | 44 - .../cdmf.page.effective-policy.view/view.js | 24 - .../cdmf.page.effective-policy.view/view.json | 5 - .../app/pages/cdmf.page.error/error.hbs | 22 - .../app/pages/cdmf.page.error/error.json | 5 - .../cdmf.page.group.analytics/analytics.hbs | 84 - .../cdmf.page.group.analytics/analytics.js | 61 - .../cdmf.page.group.analytics/analytics.json | 5 - .../public/css/analytics.css | 63 - .../pages/cdmf.page.group.create/create.hbs | 84 - .../pages/cdmf.page.group.create/create.js | 33 - .../pages/cdmf.page.group.create/create.json | 5 - .../public/js/group-add.js | 133 - .../app/pages/cdmf.page.groups/groups.hbs | 428 - .../app/pages/cdmf.page.groups/groups.js | 37 - .../app/pages/cdmf.page.groups/groups.json | 5 - .../cdmf.page.groups/public/css/groups.css | 21 - .../public/images/group-icon.png | Bin 7027 -> 0 bytes .../cdmf.page.groups/public/js/listing.js | 646 - .../listing.hbs | 34 - .../listing.json | 5 - .../configuration.hbs | 35 - .../configuration.json | 5 - .../app/pages/cdmf.page.policies/policies.hbs | 278 - .../app/pages/cdmf.page.policies/policies.js | 65 - .../pages/cdmf.page.policies/policies.json | 5 - .../public/js/policy-list.js | 391 - .../cdmf.page.policy.create.wizard/wizard.hbs | 40 - .../cdmf.page.policy.create.wizard/wizard.js | 34 - .../wizard.json | 5 - .../pages/cdmf.page.policy.create/create.hbs | 61 - .../pages/cdmf.page.policy.create/create.js | 29 - .../pages/cdmf.page.policy.create/create.json | 5 - .../app/pages/cdmf.page.policy.edit/edit.hbs | 61 - .../app/pages/cdmf.page.policy.edit/edit.js | 23 - .../app/pages/cdmf.page.policy.edit/edit.json | 5 - .../cdmf.page.policy.priority/priority.hbs | 51 - .../cdmf.page.policy.priority/priority.js | 32 - .../cdmf.page.policy.priority/priority.json | 5 - .../app/pages/cdmf.page.policy.view/view.hbs | 69 - .../app/pages/cdmf.page.policy.view/view.js | 30 - .../app/pages/cdmf.page.policy.view/view.json | 5 - .../privacy-policy.hbs | 195 - .../privacy-policy.json | 6 - .../pages/cdmf.page.processing/processing.hbs | 57 - .../pages/cdmf.page.processing/processing.js | 27 - .../cdmf.page.processing/processing.json | 5 - .../cdmf.page.processing/public/js/script.js | 48 - .../public/js/validate-register.js | 168 - .../app/pages/cdmf.page.register/register.hbs | 98 - .../app/pages/cdmf.page.register/register.js | 38 - .../pages/cdmf.page.register/register.json | 6 - .../pages/cdmf.page.role.create/create.hbs | 161 - .../app/pages/cdmf.page.role.create/create.js | 44 - .../pages/cdmf.page.role.create/create.json | 5 - .../public/js/bottomJs.js | 249 - .../permission.hbs | 44 - .../permission.json | 5 - .../app/pages/cdmf.page.role.edit/edit.hbs | 43 - .../app/pages/cdmf.page.role.edit/edit.json | 5 - .../cdmf.page.roles/public/js/role-listing.js | 286 - .../public/templates/role-listing.hbs | 56 - .../app/pages/cdmf.page.roles/roles.hbs | 120 - .../app/pages/cdmf.page.roles/roles.js | 48 - .../app/pages/cdmf.page.roles/roles.json | 5 - .../consent-do.hbs | 75 - .../consent-do.js | 72 - .../consent-do.json | 6 - .../public/js/script.js | 57 - .../cdmf.page.sign-in.login-do/login-do.hbs | 68 - .../cdmf.page.sign-in.login-do/login-do.js | 50 - .../cdmf.page.sign-in.login-do/login-do.json | 6 - .../cdmf.page.sign-in.retry-do/retry-do.hbs | 32 - .../cdmf.page.sign-in.retry-do/retry-do.js | 35 - .../cdmf.page.sign-in.retry-do/retry-do.json | 6 - .../app/pages/cdmf.page.sign-in/sign-in.hbs | 23 - .../app/pages/cdmf.page.sign-in/sign-in.js | 21 - .../app/pages/cdmf.page.sign-in/sign-in.json | 6 - .../pages/cdmf.page.sign-out/sign-out.json | 5 - .../public/js/topic-listing.js | 283 - .../app/pages/cdmf.page.topic/topic.hbs | 131 - .../app/pages/cdmf.page.topic/topic.js | 44 - .../app/pages/cdmf.page.topic/topic.json | 5 - .../pages/cdmf.page.user.create/create.hbs | 154 - .../app/pages/cdmf.page.user.create/create.js | 54 - .../pages/cdmf.page.user.create/create.json | 5 - .../public/js/bottomJs.js | 350 - .../app/pages/cdmf.page.user.edit/edit.hbs | 146 - .../app/pages/cdmf.page.user.edit/edit.js | 78 - .../app/pages/cdmf.page.user.edit/edit.json | 5 - .../cdmf.page.user.edit/public/js/bottomJs.js | 294 - .../app/pages/cdmf.page.user.view/view.hbs | 218 - .../app/pages/cdmf.page.user.view/view.js | 59 - .../app/pages/cdmf.page.user.view/view.json | 5 - .../cdmf.page.users/public/js/listing.js | 460 - .../public/templates/listing.hbs | 67 - .../app/pages/cdmf.page.users/users.hbs | 158 - .../app/pages/cdmf.page.users/users.js | 46 - .../app/pages/cdmf.page.users/users.json | 5 - .../date-range-picker.hbs | 48 - .../date-range-picker.js | 32 - .../date-range-picker.json | 3 - .../public/css/daterangepicker.css | 361 - .../public/js/date-picker.js | 125 - .../public/js/jquery-ui-timepicker-addon.js | 2238 --- .../public/js/jquery.daterangepicker.js | 1450 -- .../public/js/moment.js | 4058 ---- .../data-tables-extended.hbs | 29 - .../data-tables-extended.js | 18 - .../data-tables-extended.json | 3 - .../public/css/dataTables.bootstrap.css | 390 - .../public/css/dataTables.responsive.css | 124 - .../public/js/dataTables.bootstrap.js | 224 - .../public/js/dataTables.extended.js | 350 - .../dataTables.extended.serversidepaging.js | 418 - .../js/dataTables.fnSetFilteringDelay.js | 67 - .../public/js/dataTables.responsive.min.js | 19 - .../public/js/jquery.dataTables.min.js | 163 - .../operation-bar.hbs | 114 - .../operation-bar.js | 29 - .../operation-bar.json | 3 - .../public/js/operation-bar.js | 114 - .../overview-section.hbs | 27 - .../overview-section.js | 23 - .../overview-section.json | 3 - .../analytics-view.hbs | 47 - .../analytics-view.js | 71 - .../analytics-view.json | 3 - .../public/js/device.js | 81 - .../device-view.hbs | 204 - .../device-view.js | 153 - .../device-view.json | 3 - .../public/images/deviceType.png | Bin 42033 -> 0 bytes .../analytics-view.hbs | 48 - .../analytics-view.js | 96 - .../analytics-view.json | 3 - .../public/js/device-stats.js | 68 - .../public/js/moment.min.js | 7 - .../public/js/socket.io.min.js | 2 - .../private/config.json | 49 - .../public/css/styles.css | 63 - .../public/images/deviceType.png | Bin 42033 -> 0 bytes .../public/images/schematicsGuide.png | Bin 128984 -> 0 bytes .../public/images/thumb.png | Bin 26701 -> 0 bytes .../public/js/type-view.js | 474 - .../type-view.hbs | 222 - .../type-view.js | 105 - .../type-view.json | 3 - .../cdmf.unit.device.details/details.hbs | 80 - .../units/cdmf.unit.device.details/details.js | 23 - .../cdmf.unit.device.details/details.json | 3 - .../operation-bar.hbs | 130 - .../operation-bar.js | 64 - .../operation-bar.json | 3 - .../public/js/operation-bar.js | 151 - .../operation-mod.hbs | 20 - .../operation-mod.json | 3 - .../public/js/operation-mod.js | 1760 -- .../overview-section.hbs | 91 - .../overview-section.js | 23 - .../overview-section.json | 3 - .../invite-modal.hbs | 53 - .../invite-modal.json | 4 - .../public/css/invite-modal-styles.css | 21 - .../public/js/invite-modal.js | 104 - .../policy-edit.hbs | 10 - .../policy-edit.json | 3 - .../public/js/policy-edit.js | 60 - .../policy-view.hbs | 10 - .../policy-view.json | 3 - .../public/js/policy-view.js | 42 - .../policy-wizard.hbs | 10 - .../policy-wizard.json | 3 - .../public/js/policy-wizard.js | 49 - .../qr-modal.hbs | 64 - .../qr-modal.json | 3 - .../units/cdmf.unit.device.type.view/view.hbs | 189 - .../units/cdmf.unit.device.type.view/view.js | 38 - .../cdmf.unit.device.type.view/view.json | 3 - .../listing.hbs | 95 - .../cdmf.unit.device.types.listing/listing.js | 97 - .../listing.json | 4 - .../public/css/listing-grid.css | 43 - .../public/js/listing.js | 246 - .../public/templates/listing.hbs | 21 - .../cdmf.unit.device.view/public/css/main.css | 368 - .../public/js/device-view.js | 330 - .../public/templates/applications-list.hbs | 12 - .../public/templates/policy-compliance.hbs | 72 - .../public/templates/policy-list.hbs | 51 - .../app/units/cdmf.unit.device.view/view.hbs | 151 - .../app/units/cdmf.unit.device.view/view.js | 77 - .../app/units/cdmf.unit.device.view/view.json | 3 - .../configuration.hbs | 34 - .../configuration.json | 3 - .../public/js/view.js | 141 - .../cdmf.unit.effective-policy.view/view.hbs | 83 - .../cdmf.unit.effective-policy.view/view.js | 27 - .../cdmf.unit.effective-policy.view/view.json | 3 - .../app/units/cdmf.unit.footer/footer.hbs | 25 - .../app/units/cdmf.unit.footer/footer.js | 24 - .../app/units/cdmf.unit.footer/footer.json | 4 - .../cdmf.unit.geo-dashboard/geo-dashboard.hbs | 780 - .../cdmf.unit.geo-dashboard/geo-dashboard.js | 64 - .../geo-dashboard.json | 3 - .../html_templates/modal/exit_alert.html | 65 - .../html_templates/modal/proximity_alert.html | 97 - .../html_templates/modal/speed_alert.html | 51 - .../modal/stationery_alert.html | 82 - .../html_templates/modal/traffic_point.html | 106 - .../html_templates/modal/within_alert.html | 65 - .../html_templates/view_fence_popup.html | 54 - .../Geo-ExecutionPlan-Exit_alert.siddhiql | 20 - ...Geo-ExecutionPlan-Proximity_alert.siddhiql | 140 - .../Geo-ExecutionPlan-Speed_alert.siddhiql | 20 - ...eo-ExecutionPlan-Stationery_alert.siddhiql | 89 - .../Geo-ExecutionPlan-Traffic_alert.siddhiql | 17 - .../Geo-ExecutionPlan-Within_alert.siddhiql | 20 - .../public/css/L.Control.Locate.css | 49 - .../public/css/L.Control.Locate.ie.css | 32 - .../public/css/MarkerCluster.Default.css | 78 - .../public/css/MarkerCluster.css | 24 - .../public/css/app.css | 169 - .../public/css/bootstrap-datepicker.min.css | 8 - .../public/css/bootstrap-wizard-lib/LICENSE | 19 - .../bootstrap-wizard-lib/bootstrap-wizard.css | 200 - .../public/css/bootstrap.min.css | 5 - .../public/css/css/animation.css | 103 - .../public/css/css/locate-fa-codes.css | 22 - .../public/css/css/locate-fa-embedded.css | 75 - .../public/css/css/locate-fa-ie7-codes.css | 22 - .../public/css/css/locate-fa-ie7.css | 33 - .../public/css/css/locate-fa.css | 90 - .../public/css/d3/c3.css | 221 - .../public/css/font-awesome.min.css | 4 - .../public/css/font/LICENSE.txt | 10 - .../public/css/font/README.txt | 75 - .../public/css/font/config.json | 28 - .../public/css/font/locate-fa.eot | Bin 4944 -> 0 bytes .../public/css/font/locate-fa.svg | 32 - .../public/css/font/locate-fa.ttf | Bin 4772 -> 0 bytes .../public/css/font/locate-fa.woff | Bin 2924 -> 0 bytes .../public/css/fonts/FontAwesome.otf | Bin 75188 -> 0 bytes .../public/css/fonts/fontawesome-webfont.eot | Bin 72449 -> 0 bytes .../public/css/fonts/fontawesome-webfont.svg | 522 - .../public/css/fonts/fontawesome-webfont.ttf | Bin 141564 -> 0 bytes .../public/css/fonts/fontawesome-webfont.woff | Bin 83760 -> 0 bytes ...O.Move_this_images_to_assets_images_folder | 0 .../public/css/images/layers-2x.png | Bin 2898 -> 0 bytes .../public/css/images/layers.png | Bin 1502 -> 0 bytes .../public/css/images/marker-icon-2x.png | Bin 4033 -> 0 bytes .../public/css/images/marker-icon.png | Bin 1747 -> 0 bytes .../public/css/images/marker-shadow.png | Bin 797 -> 0 bytes .../css/images/ui-bg_flat_0_aaaaaa_40x100.png | Bin 86 -> 0 bytes .../ui-bg_gloss-wave_35_f6a828_500x100.png | Bin 5815 -> 0 bytes .../ui-bg_highlight-soft_100_eeeeee_1x100.png | Bin 90 -> 0 bytes .../css/images/ui-icons_222222_256x240.png | 1405 -- .../css/images/ui-icons_444444_256x240.png | Bin 3266 -> 0 bytes .../css/images/ui-icons_555555_256x240.png | Bin 3274 -> 0 bytes .../css/images/ui-icons_777620_256x240.png | Bin 3262 -> 0 bytes .../css/images/ui-icons_777777_256x240.png | Bin 3266 -> 0 bytes .../css/images/ui-icons_cc0000_256x240.png | Bin 3262 -> 0 bytes .../css/images/ui-icons_ffffff_256x240.png | Bin 3264 -> 0 bytes .../public/css/jquery-ui-timepicker-addon.css | 45 - .../css/jquery-ui-timepicker-addon.min.css | 5 - .../public/css/jquery-ui.min.css | 7 - .../public/css/jquery-ui.theme.min.css | 5 - .../public/css/leaflet.css | 496 - .../public/css/leaflet/L.Grid.css | 28 - .../css/leaflet/images/spritesheet-2x.png | Bin 2078 -> 0 bytes .../public/css/leaflet/images/spritesheet.png | Bin 1056 -> 0 bytes .../public/css/leaflet/leaflet.draw.css | 320 - .../css/leaflet_fullscreen/fullscreen.png | Bin 142 -> 0 bytes .../css/leaflet_fullscreen/fullscreen@2x.png | Bin 155 -> 0 bytes .../leaflet_fullscreen/leaflet.fullscreen.css | 52 - .../public/css/login.css | 84 - .../public/css/map.css | 67 - .../public/css/style.css | 34 - .../public/img/fav/wso2_fav.png | Bin 5343 -> 0 bytes .../public/img/favicon-120.png | Bin 8604 -> 0 bytes .../public/img/favicon-152.png | Bin 9625 -> 0 bytes .../public/img/favicon-196.png | Bin 12410 -> 0 bytes .../public/img/favicon-76.png | Bin 6063 -> 0 bytes .../public/img/favicon.ico | Bin 1150 -> 0 bytes .../public/img/layers-2x.png | Bin 2898 -> 0 bytes .../public/img/layers.png | Bin 1502 -> 0 bytes .../public/img/marker-icon-2x.png | Bin 4033 -> 0 bytes .../public/img/marker-icon.png | Bin 1747 -> 0 bytes .../public/img/marker-shadow.png | Bin 797 -> 0 bytes .../public/img/markers/STOP.png | Bin 1274 -> 0 bytes .../public/img/markers/VEHICLE.png | Bin 3009 -> 0 bytes .../public/img/markers/arrow_alerted.png | Bin 3499 -> 0 bytes .../public/img/markers/arrow_normal.png | Bin 3009 -> 0 bytes .../public/img/markers/arrow_offline.png | Bin 2970 -> 0 bytes .../public/img/markers/arrow_warning.png | Bin 3815 -> 0 bytes .../public/img/markers/danger.png | Bin 1747 -> 0 bytes .../img/markers/default_icons/greenMarker.png | Bin 2298 -> 0 bytes .../img/markers/default_icons/marker-icon.png | Bin 1747 -> 0 bytes .../markers/default_icons/marker-shadow.png | Bin 797 -> 0 bytes .../img/markers/default_icons/pinkMarker.png | Bin 2260 -> 0 bytes .../img/markers/default_icons/redMarker.png | Bin 4894 -> 0 bytes .../public/img/markers/info.png | Bin 1747 -> 0 bytes .../img/markers/moving/device-alerted.png | Bin 3499 -> 0 bytes .../img/markers/moving/device-normal.png | Bin 3009 -> 0 bytes .../img/markers/moving/device-offline.png | Bin 2970 -> 0 bytes .../img/markers/moving/device-warning.png | Bin 3815 -> 0 bytes .../img/markers/non_moving/device-alerted.png | Bin 3295 -> 0 bytes .../img/markers/non_moving/device-normal.png | Bin 3219 -> 0 bytes .../img/markers/non_moving/device-offline.png | Bin 3079 -> 0 bytes .../img/markers/non_moving/device-warning.png | Bin 4542 -> 0 bytes .../markers/non_moving/stationary-alerted.png | Bin 4894 -> 0 bytes .../markers/non_moving/stationary-normal.png | Bin 1747 -> 0 bytes .../markers/non_moving/stationary-normal2.png | Bin 2298 -> 0 bytes .../markers/non_moving/stationary-offline.png | Bin 2862 -> 0 bytes .../markers/non_moving/stationary-warning.png | Bin 2260 -> 0 bytes .../object-types/default/moving/alerted.png | Bin 3499 -> 0 bytes .../object-types/default/moving/normal.png | Bin 3009 -> 0 bytes .../object-types/default/moving/offline.png | Bin 2970 -> 0 bytes .../object-types/default/moving/warning.png | Bin 3815 -> 0 bytes .../default/non-moving/alerted.png | Bin 3295 -> 0 bytes .../default/non-moving/normal.png | Bin 3219 -> 0 bytes .../default/non-moving/offline.png | Bin 3079 -> 0 bytes .../default/non-moving/warning.png | Bin 4542 -> 0 bytes .../stationary/non-moving/alerted.png | Bin 4894 -> 0 bytes .../stationary/non-moving/normal.png | Bin 1747 -> 0 bytes .../stationary/non-moving/normal2.png | Bin 2298 -> 0 bytes .../stationary/non-moving/offline.png | Bin 2862 -> 0 bytes .../stationary/non-moving/warning.png | Bin 2260 -> 0 bytes .../object-types/stop/non-moving/alerted.png | Bin 4894 -> 0 bytes .../object-types/stop/non-moving/normal.png | Bin 1747 -> 0 bytes .../object-types/stop/non-moving/normal2.png | Bin 2298 -> 0 bytes .../object-types/stop/non-moving/offline.png | Bin 2862 -> 0 bytes .../object-types/stop/non-moving/warning.png | Bin 2260 -> 0 bytes .../object-types/vehicle/moving/alerted.png | Bin 3499 -> 0 bytes .../object-types/vehicle/moving/normal.png | Bin 3009 -> 0 bytes .../object-types/vehicle/moving/offline.png | Bin 2970 -> 0 bytes .../object-types/vehicle/moving/warning.png | Bin 3815 -> 0 bytes .../vehicle/non-moving/alerted.png | Bin 3295 -> 0 bytes .../vehicle/non-moving/normal.png | Bin 3219 -> 0 bytes .../vehicle/non-moving/offline.png | Bin 3079 -> 0 bytes .../vehicle/non-moving/warning.png | Bin 4542 -> 0 bytes .../public/img/markers/offline.png | Bin 1747 -> 0 bytes .../public/img/markers/resize.png | Bin 651 -> 0 bytes .../public/img/markers/resize_2.png | Bin 445 -> 0 bytes .../public/img/markers/stopIcon.png | Bin 1274 -> 0 bytes .../public/img/markers/warn.png | Bin 1747 -> 0 bytes .../public/img/thumbnail.png | Bin 9816 -> 0 bytes .../public/img/wso2-logo.png | Bin 20857 -> 0 bytes .../cdmf.unit.geo-dashboard/public/js/app.js | 558 - .../public/js/application_options.js | 77 - .../public/js/bootstrap-wizard-lib/LICENSE | 19 - .../bootstrap-wizard-lib/bootstrap-wizard.js | 1167 -- .../bootstrap-wizard.min.js | 1 - .../public/js/bootstrap/BOOTSTRAP_LICENSE | 21 - .../public/js/bootstrap/bootstrap.min.js | 655 - .../public/js/d3/C3_LICENSE | 20 - .../public/js/d3/D3_LICENSE | 26 - .../public/js/d3/c3.min.js | 4 - .../public/js/d3/d3.min.js | 5 - .../public/js/firstTemp.js | 26 - .../public/js/geo_exit_fence.js | 44 - .../public/js/geo_fencing.js | 495 - .../public/js/geo_proximity.js | 90 - .../public/js/geo_remote.js | 640 - .../public/js/geo_speed.js | 29 - .../public/js/geo_stationary.js | 48 - .../public/js/geo_within.js | 44 - .../js/jquery/bootstrap-datepicker.min.js | 8 - .../public/js/jquery/jquery-2.1.1.min.js | 2066 -- .../js/jquery/jquery-ui-timepicker-addon.js | 2259 --- .../jquery/jquery-ui-timepicker-addon.min.js | 5 - .../public/js/jquery/jquery-ui.min.js | 3205 --- .../public/js/leaflet/L.CircleEditor.js | 179 - .../public/js/leaflet/L.Control.Focus.js | 62 - .../public/js/leaflet/L.Control.GeoAlerts.js | 186 - .../public/js/leaflet/L.Control.Locate.js | 365 - .../public/js/leaflet/L.Grid.js | 259 - .../public/js/leaflet/L.MeasuringTool.js | 343 - .../public/js/leaflet/L.PolySideLabel.js | 233 - .../public/js/leaflet/LICENSE_RaphaelLayer | 7 - .../js/leaflet/Leaflet.fullscreen.min.js | 98 - .../public/js/leaflet/MIT-LICENSE.txt | 20 - .../public/js/leaflet/Marker.Rotate.js | 69 - .../public/js/leaflet/images/marker-icon.png | Bin 4033 -> 0 bytes .../js/leaflet/images/marker-shadow.png | Bin 11428 -> 0 bytes .../public/js/leaflet/leaflet.draw.js | 10 - .../js/leaflet/leaflet.groupedlayercontrol.js | 305 - .../public/js/leaflet/leaflet.js | 2250 --- .../js/leaflet/leaflet.markercluster.js | 459 - .../public/js/leaflet/raphael-min.js | 11 - .../public/js/leaflet/rlayer.js | 8 - .../public/js/moment.min.js | 25 - .../public/js/secondTemp.js | 28 - .../public/js/show_alert_in_map.js | 55 - .../public/js/socket.io.min.js | 2 - .../public/js/typeahead.bundle.min.js | 7 - .../public/js/websocket.js | 637 - .../cdmf.unit.geo-devices/geo-devices.hbs | 899 - .../cdmf.unit.geo-devices/geo-devices.js | 58 - .../cdmf.unit.geo-devices/geo-devices.json | 3 - .../html_templates/modal/proximity_alert.html | 97 - .../html_templates/modal/traffic_point.html | 108 - .../html_templates/view_fence_popup.html | 54 - .../Geo-ExecutionPlan-Exit_alert.siddhiql | 20 - ...Geo-ExecutionPlan-Proximity_alert.siddhiql | 140 - .../Geo-ExecutionPlan-Speed_alert.siddhiql | 20 - ...eo-ExecutionPlan-Stationery_alert.siddhiql | 89 - .../Geo-ExecutionPlan-Traffic_alert.siddhiql | 17 - .../Geo-ExecutionPlan-Within_alert.siddhiql | 20 - .../public/css/L.Control.Locate.css | 49 - .../public/css/L.Control.Locate.ie.css | 32 - .../public/css/MarkerCluster.Default.css | 78 - .../public/css/MarkerCluster.css | 24 - .../cdmf.unit.geo-devices/public/css/app.css | 188 - .../public/css/bootstrap-datepicker.min.css | 8 - .../public/css/bootstrap-wizard-lib/LICENSE | 19 - .../bootstrap-wizard-lib/bootstrap-wizard.css | 200 - .../public/css/bootstrap.min.css | 5 - .../public/css/css/animation.css | 103 - .../public/css/css/locate-fa-codes.css | 22 - .../public/css/css/locate-fa-embedded.css | 75 - .../public/css/css/locate-fa-ie7-codes.css | 22 - .../public/css/css/locate-fa-ie7.css | 33 - .../public/css/css/locate-fa.css | 90 - .../public/css/font-awesome.min.css | 4 - .../public/css/font/LICENSE.txt | 10 - .../public/css/font/README.txt | 75 - .../public/css/font/config.json | 28 - .../public/css/font/locate-fa.eot | Bin 4944 -> 0 bytes .../public/css/font/locate-fa.svg | 32 - .../public/css/font/locate-fa.ttf | Bin 4772 -> 0 bytes .../public/css/font/locate-fa.woff | Bin 2924 -> 0 bytes .../public/css/fonts/FontAwesome.otf | Bin 75188 -> 0 bytes .../public/css/fonts/fontawesome-webfont.eot | Bin 72449 -> 0 bytes .../public/css/fonts/fontawesome-webfont.svg | 522 - .../public/css/fonts/fontawesome-webfont.ttf | Bin 141564 -> 0 bytes .../public/css/fonts/fontawesome-webfont.woff | Bin 83760 -> 0 bytes ...O.Move_this_images_to_assets_images_folder | 0 .../public/css/images/layers-2x.png | Bin 2898 -> 0 bytes .../public/css/images/layers.png | Bin 1502 -> 0 bytes .../public/css/images/marker-icon-2x.png | Bin 4033 -> 0 bytes .../public/css/images/marker-icon.png | Bin 1747 -> 0 bytes .../public/css/images/marker-shadow.png | Bin 797 -> 0 bytes .../public/css/images/markers-matte.png | Bin 14323 -> 0 bytes .../public/css/images/markers-matte@2x.png | Bin 31113 -> 0 bytes .../public/css/images/markers-plain.png | Bin 7946 -> 0 bytes .../public/css/images/markers-shadow.png | Bin 535 -> 0 bytes .../public/css/images/markers-shadow@2x.png | Bin 1469 -> 0 bytes .../public/css/images/markers-soft.png | Bin 41226 -> 0 bytes .../public/css/images/markers-soft@2x.png | Bin 66408 -> 0 bytes .../css/images/ui-bg_flat_0_aaaaaa_40x100.png | Bin 86 -> 0 bytes .../ui-bg_gloss-wave_35_f6a828_500x100.png | Bin 5815 -> 0 bytes .../ui-bg_highlight-soft_100_eeeeee_1x100.png | Bin 90 -> 0 bytes .../css/images/ui-icons_222222_256x240.png | 1405 -- .../css/images/ui-icons_444444_256x240.png | Bin 3266 -> 0 bytes .../css/images/ui-icons_555555_256x240.png | Bin 3274 -> 0 bytes .../css/images/ui-icons_777620_256x240.png | Bin 3262 -> 0 bytes .../css/images/ui-icons_777777_256x240.png | Bin 3266 -> 0 bytes .../css/images/ui-icons_cc0000_256x240.png | Bin 3262 -> 0 bytes .../css/images/ui-icons_ffffff_256x240.png | Bin 3264 -> 0 bytes .../public/css/jquery-ui-timepicker-addon.css | 45 - .../css/jquery-ui-timepicker-addon.min.css | 5 - .../public/css/jquery-ui.min.css | 7 - .../public/css/jquery-ui.theme.min.css | 5 - .../public/css/leaflet.awesome-markers.css | 142 - .../public/css/leaflet.css | 502 - .../public/css/leaflet/L.Grid.css | 28 - .../css/leaflet/images/spritesheet-2x.png | Bin 2078 -> 0 bytes .../public/css/leaflet/images/spritesheet.png | Bin 1056 -> 0 bytes .../public/css/leaflet/leaflet.draw.css | 320 - .../css/leaflet_fullscreen/fullscreen.png | Bin 142 -> 0 bytes .../css/leaflet_fullscreen/fullscreen@2x.png | Bin 155 -> 0 bytes .../leaflet_fullscreen/leaflet.fullscreen.css | 52 - .../public/css/login.css | 84 - .../cdmf.unit.geo-devices/public/css/map.css | 67 - .../public/css/style.css | 34 - .../public/img/fav/wso2_fav.png | Bin 5343 -> 0 bytes .../public/img/favicon-120.png | Bin 8604 -> 0 bytes .../public/img/favicon-152.png | Bin 9625 -> 0 bytes .../public/img/favicon-196.png | Bin 12410 -> 0 bytes .../public/img/favicon-76.png | Bin 6063 -> 0 bytes .../public/img/favicon.ico | Bin 1150 -> 0 bytes .../public/img/layers-2x.png | Bin 2898 -> 0 bytes .../public/img/layers.png | Bin 1502 -> 0 bytes .../public/img/marker-icon-2x.png | Bin 4033 -> 0 bytes .../public/img/marker-icon.png | Bin 1747 -> 0 bytes .../public/img/marker-shadow.png | Bin 797 -> 0 bytes .../public/img/markers/STOP.png | Bin 1274 -> 0 bytes .../public/img/markers/VEHICLE.png | Bin 3009 -> 0 bytes .../public/img/markers/arrow_alerted.png | Bin 3499 -> 0 bytes .../public/img/markers/arrow_normal.png | Bin 3009 -> 0 bytes .../public/img/markers/arrow_offline.png | Bin 2970 -> 0 bytes .../public/img/markers/arrow_warning.png | Bin 3815 -> 0 bytes .../public/img/markers/danger.png | Bin 1747 -> 0 bytes .../img/markers/default_icons/greenMarker.png | Bin 2298 -> 0 bytes .../img/markers/default_icons/marker-icon.png | Bin 1747 -> 0 bytes .../markers/default_icons/marker-shadow.png | Bin 797 -> 0 bytes .../img/markers/default_icons/pinkMarker.png | Bin 2260 -> 0 bytes .../img/markers/default_icons/redMarker.png | Bin 4894 -> 0 bytes .../public/img/markers/info.png | Bin 1747 -> 0 bytes .../img/markers/moving/device-alerted.png | Bin 3499 -> 0 bytes .../img/markers/moving/device-normal.png | Bin 3009 -> 0 bytes .../img/markers/moving/device-offline.png | Bin 2970 -> 0 bytes .../img/markers/moving/device-warning.png | Bin 3815 -> 0 bytes .../img/markers/non_moving/device-alerted.png | Bin 3295 -> 0 bytes .../img/markers/non_moving/device-normal.png | Bin 3219 -> 0 bytes .../img/markers/non_moving/device-offline.png | Bin 3079 -> 0 bytes .../img/markers/non_moving/device-warning.png | Bin 4542 -> 0 bytes .../markers/non_moving/stationary-alerted.png | Bin 4894 -> 0 bytes .../markers/non_moving/stationary-normal.png | Bin 1747 -> 0 bytes .../markers/non_moving/stationary-normal2.png | Bin 2298 -> 0 bytes .../markers/non_moving/stationary-offline.png | Bin 2862 -> 0 bytes .../markers/non_moving/stationary-warning.png | Bin 2260 -> 0 bytes .../object-types/default/moving/alerted.png | Bin 3499 -> 0 bytes .../object-types/default/moving/normal.png | Bin 3009 -> 0 bytes .../object-types/default/moving/offline.png | Bin 2970 -> 0 bytes .../object-types/default/moving/warning.png | Bin 3815 -> 0 bytes .../default/non-moving/alerted.png | Bin 3295 -> 0 bytes .../default/non-moving/normal.png | Bin 3219 -> 0 bytes .../default/non-moving/offline.png | Bin 3079 -> 0 bytes .../default/non-moving/warning.png | Bin 4542 -> 0 bytes .../stationary/non-moving/alerted.png | Bin 4894 -> 0 bytes .../stationary/non-moving/normal.png | Bin 1747 -> 0 bytes .../stationary/non-moving/normal2.png | Bin 2298 -> 0 bytes .../stationary/non-moving/offline.png | Bin 2862 -> 0 bytes .../stationary/non-moving/warning.png | Bin 2260 -> 0 bytes .../object-types/stop/non-moving/alerted.png | Bin 4894 -> 0 bytes .../object-types/stop/non-moving/normal.png | Bin 1747 -> 0 bytes .../object-types/stop/non-moving/normal2.png | Bin 2298 -> 0 bytes .../object-types/stop/non-moving/offline.png | Bin 2862 -> 0 bytes .../object-types/stop/non-moving/warning.png | Bin 2260 -> 0 bytes .../object-types/vehicle/moving/alerted.png | Bin 3499 -> 0 bytes .../object-types/vehicle/moving/normal.png | Bin 3009 -> 0 bytes .../object-types/vehicle/moving/offline.png | Bin 2970 -> 0 bytes .../object-types/vehicle/moving/warning.png | Bin 3815 -> 0 bytes .../vehicle/non-moving/alerted.png | Bin 3295 -> 0 bytes .../vehicle/non-moving/normal.png | Bin 3219 -> 0 bytes .../vehicle/non-moving/offline.png | Bin 3079 -> 0 bytes .../vehicle/non-moving/warning.png | Bin 4542 -> 0 bytes .../public/img/markers/offline.png | Bin 1747 -> 0 bytes .../public/img/markers/resize.png | Bin 651 -> 0 bytes .../public/img/markers/resize_2.png | Bin 445 -> 0 bytes .../public/img/markers/stopIcon.png | Bin 1274 -> 0 bytes .../public/img/markers/warn.png | Bin 1747 -> 0 bytes .../public/img/thumbnail.png | Bin 9816 -> 0 bytes .../public/img/wso2-logo.png | Bin 20857 -> 0 bytes .../cdmf.unit.geo-devices/public/js/app.js | 465 - .../public/js/application_options.js | 77 - .../public/js/bootstrap-wizard-lib/LICENSE | 19 - .../bootstrap-wizard-lib/bootstrap-wizard.js | 1167 -- .../bootstrap-wizard.min.js | 1 - .../public/js/bootstrap/BOOTSTRAP_LICENSE | 21 - .../public/js/bootstrap/bootstrap.min.js | 655 - .../public/js/d3/C3_LICENSE | 20 - .../public/js/d3/D3_LICENSE | 26 - .../public/js/d3/c3.min.js | 4 - .../public/js/d3/d3.min.js | 5 - .../public/js/firstTemp.js | 26 - .../public/js/geo_exit_fence.js | 48 - .../public/js/geo_fencing.js | 570 - .../public/js/geo_proximity.js | 88 - .../public/js/geo_remote.js | 577 - .../public/js/geo_speed.js | 29 - .../public/js/geo_stationary.js | 52 - .../public/js/geo_within.js | 48 - .../js/jquery/bootstrap-datepicker.min.js | 8 - .../public/js/jquery/jquery-2.1.1.min.js | 2066 -- .../js/jquery/jquery-ui-timepicker-addon.js | 2259 --- .../jquery/jquery-ui-timepicker-addon.min.js | 5 - .../public/js/jquery/jquery-ui.min.js | 3205 --- .../public/js/leaflet.awesome-markers.js | 143 - .../public/js/leaflet/L.CircleEditor.js | 179 - .../public/js/leaflet/L.Control.Focus.js | 62 - .../public/js/leaflet/L.Control.GeoAlerts.js | 186 - .../public/js/leaflet/L.Control.Locate.js | 365 - .../public/js/leaflet/L.Grid.js | 259 - .../public/js/leaflet/L.MeasuringTool.js | 343 - .../public/js/leaflet/L.PolySideLabel.js | 233 - .../public/js/leaflet/LICENSE_RaphaelLayer | 7 - .../js/leaflet/Leaflet.fullscreen.min.js | 98 - .../public/js/leaflet/MIT-LICENSE.txt | 20 - .../public/js/leaflet/Marker.Rotate.js | 69 - .../public/js/leaflet/images/marker-icon.png | Bin 4033 -> 0 bytes .../js/leaflet/images/marker-shadow.png | Bin 11428 -> 0 bytes .../public/js/leaflet/leaflet.draw.js | 10 - .../js/leaflet/leaflet.groupedlayercontrol.js | 305 - .../public/js/leaflet/leaflet.js | 2250 --- .../js/leaflet/leaflet.markercluster.js | 459 - .../public/js/leaflet/raphael-min.js | 11 - .../public/js/leaflet/rlayer.js | 8 - .../public/js/moment.min.js | 25 - .../public/js/secondTemp.js | 27 - .../public/js/show_alert_in_map.js | 42 - .../public/js/socket.io.min.js | 2 - .../public/js/typeahead.bundle.min.js | 7 - .../public/js/websocket.js | 273 - .../cdmf.unit.lib.codemirror/codemirror.hbs | 25 - .../cdmf.unit.lib.codemirror/codemirror.json | 4 - .../public/css/codemirror.css | 342 - .../public/js/codemirror.js | 8720 -------- .../public/js/javascript.js | 799 - .../cdmf.unit.lib.data-table/data-table.json | 4 - .../units/cdmf.unit.lib.editable/editable.hbs | 8 - .../cdmf.unit.lib.editable/editable.json | 4 - .../public/css/editable.css | 668 - .../public/img/clear.png | Bin 509 -> 0 bytes .../public/img/loading.gif | Bin 1849 -> 0 bytes .../public/js/editable.js | 6820 ------- .../public/js/editable.min.js | 7 - .../cdmf.unit.lib.handlebars/handlebars.hbs | 21 - .../cdmf.unit.lib.handlebars/handlebars.json | 8 - .../public/js/handlebars-v2.0.0.js | 3070 --- .../public/js/utils.js | 77 - .../public/js/jquery.qrcode.min.js | 49 - .../app/units/cdmf.unit.lib.qrcode/qrcode.hbs | 70 - .../units/cdmf.unit.lib.qrcode/qrcode.json | 8 - .../public/css/graph.css | 470 - .../public/js/d3.min.js | 9470 --------- .../public/js/rickshaw.min.js | 3 - .../rickshaw-graph.hbs | 25 - .../rickshaw-graph.json | 4 - .../units/cdmf.unit.lib.select2/select2.json | 8 - .../public/js/invoker-lib.js | 89 - .../public/js/js.cookie.js | 157 - .../service-invoker-utility.hbs | 46 - .../service-invoker-utility.json | 8 - .../public/js/langs/readme.md | 3 - .../public/js/plugins/advlist/plugin.min.js | 19 - .../public/js/plugins/anchor/plugin.min.js | 19 - .../public/js/plugins/autolink/plugin.min.js | 19 - .../js/plugins/autoresize/plugin.min.js | 19 - .../public/js/plugins/autosave/plugin.min.js | 19 - .../public/js/plugins/bbcode/plugin.min.js | 19 - .../public/js/plugins/charmap/plugin.min.js | 19 - .../public/js/plugins/code/plugin.min.js | 19 - .../js/plugins/colorpicker/plugin.min.js | 19 - .../js/plugins/contextmenu/plugin.min.js | 19 - .../js/plugins/directionality/plugin.min.js | 19 - .../js/plugins/emoticons/img/smiley-cool.gif | Bin 354 -> 0 bytes .../js/plugins/emoticons/img/smiley-cry.gif | Bin 329 -> 0 bytes .../emoticons/img/smiley-embarassed.gif | Bin 331 -> 0 bytes .../emoticons/img/smiley-foot-in-mouth.gif | Bin 342 -> 0 bytes .../js/plugins/emoticons/img/smiley-frown.gif | Bin 340 -> 0 bytes .../plugins/emoticons/img/smiley-innocent.gif | Bin 336 -> 0 bytes .../js/plugins/emoticons/img/smiley-kiss.gif | Bin 338 -> 0 bytes .../plugins/emoticons/img/smiley-laughing.gif | Bin 343 -> 0 bytes .../emoticons/img/smiley-money-mouth.gif | Bin 321 -> 0 bytes .../plugins/emoticons/img/smiley-sealed.gif | Bin 323 -> 0 bytes .../js/plugins/emoticons/img/smiley-smile.gif | Bin 344 -> 0 bytes .../emoticons/img/smiley-surprised.gif | Bin 338 -> 0 bytes .../emoticons/img/smiley-tongue-out.gif | Bin 328 -> 0 bytes .../emoticons/img/smiley-undecided.gif | Bin 337 -> 0 bytes .../js/plugins/emoticons/img/smiley-wink.gif | Bin 350 -> 0 bytes .../js/plugins/emoticons/img/smiley-yell.gif | Bin 336 -> 0 bytes .../public/js/plugins/emoticons/plugin.min.js | 19 - .../public/js/plugins/example/dialog.html | 27 - .../public/js/plugins/example/plugin.min.js | 19 - .../plugins/example_dependency/plugin.min.js | 19 - .../public/js/plugins/fullpage/plugin.min.js | 19 - .../js/plugins/fullscreen/plugin.min.js | 19 - .../public/js/plugins/hr/plugin.min.js | 19 - .../public/js/plugins/image/plugin.min.js | 19 - .../js/plugins/imagetools/plugin.min.js | 19 - .../public/js/plugins/importcss/plugin.min.js | 19 - .../js/plugins/insertdatetime/plugin.min.js | 19 - .../public/js/plugins/layer/plugin.min.js | 19 - .../js/plugins/legacyoutput/plugin.min.js | 19 - .../public/js/plugins/link/plugin.min.js | 19 - .../public/js/plugins/lists/plugin.min.js | 19 - .../public/js/plugins/media/moxieplayer.swf | Bin 20017 -> 0 bytes .../public/js/plugins/media/plugin.min.js | 19 - .../js/plugins/nonbreaking/plugin.min.js | 19 - .../js/plugins/noneditable/plugin.min.js | 19 - .../public/js/plugins/pagebreak/plugin.min.js | 19 - .../public/js/plugins/paste/plugin.min.js | 19 - .../public/js/plugins/preview/plugin.min.js | 19 - .../public/js/plugins/print/plugin.min.js | 19 - .../public/js/plugins/save/plugin.min.js | 19 - .../js/plugins/searchreplace/plugin.min.js | 19 - .../js/plugins/spellchecker/plugin.min.js | 19 - .../public/js/plugins/tabfocus/plugin.min.js | 19 - .../public/js/plugins/table/plugin.min.js | 19 - .../public/js/plugins/template/plugin.min.js | 19 - .../public/js/plugins/textcolor/plugin.min.js | 19 - .../js/plugins/textpattern/plugin.min.js | 19 - .../plugins/visualblocks/css/visualblocks.css | 153 - .../js/plugins/visualblocks/plugin.min.js | 19 - .../js/plugins/visualchars/plugin.min.js | 19 - .../public/js/plugins/wordcount/plugin.min.js | 19 - .../js/skins/lightgray/content.inline.min.css | 19 - .../public/js/skins/lightgray/content.min.css | 19 - .../skins/lightgray/fonts/tinymce-small.eot | Bin 9112 -> 0 bytes .../skins/lightgray/fonts/tinymce-small.svg | 80 - .../skins/lightgray/fonts/tinymce-small.ttf | Bin 8924 -> 0 bytes .../skins/lightgray/fonts/tinymce-small.woff | Bin 9000 -> 0 bytes .../js/skins/lightgray/fonts/tinymce.eot | Bin 12044 -> 0 bytes .../js/skins/lightgray/fonts/tinymce.svg | 101 - .../js/skins/lightgray/fonts/tinymce.ttf | Bin 11880 -> 0 bytes .../js/skins/lightgray/fonts/tinymce.woff | Bin 11956 -> 0 bytes .../public/js/skins/lightgray/img/anchor.gif | Bin 53 -> 0 bytes .../public/js/skins/lightgray/img/loader.gif | Bin 2608 -> 0 bytes .../public/js/skins/lightgray/img/object.gif | Bin 152 -> 0 bytes .../public/js/skins/lightgray/img/trans.gif | Bin 43 -> 0 bytes .../js/skins/lightgray/skin.ie7.min.css | 19 - .../public/js/skins/lightgray/skin.min.css | 19 - .../public/js/themes/modern/theme.min.js | 19 - .../public/js/tinymce.min.js | 30 - .../units/cdmf.unit.lib.tinymce/tinymce.hbs | 20 - .../units/cdmf.unit.lib.tinymce/tinymce.json | 7 - .../public/js/permissions-lib.js | 32 - .../ui-permissions-utility.hbs | 33 - .../ui-permissions-utility.js | 25 - .../ui-permissions-utility.json | 8 - .../listing.hbs | 65 - .../cdmf.unit.notification.listing/listing.js | 31 - .../listing.json | 3 - .../public/js/notification-listing.js | 197 - .../templates/notification-listing-all.hbs | 42 - .../templates/notification-listing-new.hbs | 44 - .../configuration.hbs | 206 - .../configuration.js | 59 - .../configuration.json | 3 - .../public/js/platform-configuration.js | 299 - .../corrective-action.json | 3 - .../public/js/policy-corrective-action.js | 24 - .../templates/policy-corrective-action.hbs | 35 - .../units/cdmf.unit.policy.create/create.hbs | 312 - .../units/cdmf.unit.policy.create/create.js | 107 - .../units/cdmf.unit.policy.create/create.json | 3 - .../public/js/policy-create.js | 657 - .../app/units/cdmf.unit.policy.edit/edit.hbs | 265 - .../app/units/cdmf.unit.policy.edit/edit.js | 72 - .../app/units/cdmf.unit.policy.edit/edit.json | 3 - .../public/js/policy-edit.js | 759 - .../cdmf.unit.policy.priority/priority.hbs | 98 - .../cdmf.unit.policy.priority/priority.js | 58 - .../cdmf.unit.policy.priority/priority.json | 3 - .../public/js/policy-priority.js | 159 - .../public/js/sortable-list.js | 146 - .../cdmf.unit.policy.view/public/js/view.js | 166 - .../app/units/cdmf.unit.policy.view/view.hbs | 94 - .../app/units/cdmf.unit.policy.view/view.js | 49 - .../app/units/cdmf.unit.policy.view/view.json | 3 - .../permission.hbs | 87 - .../permission.js | 29 - .../permission.json | 3 - .../public/js/bottomJs.js | 203 - .../public/templates/list-partial.hbs | 14 - .../public/templates/tree-template.hbs | 3 - .../app/units/cdmf.unit.role.edit/edit.hbs | 98 - .../app/units/cdmf.unit.role.edit/edit.js | 60 - .../app/units/cdmf.unit.role.edit/edit.json | 3 - .../cdmf.unit.role.edit/public/js/bottomJs.js | 242 - .../cdmf.unit.ui.content.title/title.hbs | 24 - .../cdmf.unit.ui.content.title/title.json | 3 - .../public/js/monetize.js | 24 - .../public/js/user-menu.js | 56 - .../user-menu.hbs | 190 - .../user-menu.js | 225 - .../user-menu.json | 3 - .../public/js/user-menu.js | 112 - .../user-menu.hbs | 123 - .../user-menu.js | 30 - .../user-menu.json | 3 - .../units/cdmf.unit.ui.header.logo/logo.hbs | 25 - .../units/cdmf.unit.ui.header.logo/logo.js | 24 - .../units/cdmf.unit.ui.header.logo/logo.json | 4 - .../user-menu.hbs | 25 - .../user-menu.js | 24 - .../user-menu.json | 4 - .../app/units/cdmf.unit.ui.modal/modal.hbs | 48 - .../app/units/cdmf.unit.ui.modal/modal.json | 4 - .../cdmf.unit.ui.modal/public/js/modal.js | 82 - .../cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs | 171 - .../cdmf.unit.ui.navbar.nav-menu/nav-menu.js | 66 - .../nav-menu.json | 8 - .../public/js/jquery.qrcode.min.js | 47 - .../public/js/nav-menu.js | 548 - .../public/templates/notifications.hbs | 27 - .../notifications.json | 5 - .../cdmf.unit.ui.navbar.popover/popover.json | 5 - .../left.json | 5 - .../right.json | 5 - .../public/css/custom-common.css | 312 - .../public/css/custom-desktop.css | 7036 ------- .../public/css/custom-theme.css | 596 - .../public/css/docs.min.css | 38 - .../cdmf.unit.ui.theme/public/css/modal.css | 20 - .../public/js/responsive-text.js | 75 - .../public/less/theme-variables.less | 66 - .../app/units/cdmf.unit.ui.theme/theme.hbs | 67 - .../app/units/cdmf.unit.ui.theme/theme.json | 5 - .../app/units/cdmf.unit.ui.title/title.hbs | 21 - .../app/units/cdmf.unit.ui.title/title.js | 26 - .../app/units/cdmf.unit.ui.title/title.json | 4 - .../devicemgt/error-pages/error400-cloud.html | 48 - .../devicemgt/error-pages/error400.html | 35 - .../devicemgt/error-pages/error401-cloud.html | 48 - .../devicemgt/error-pages/error401.html | 35 - .../devicemgt/error-pages/error403-cloud.html | 48 - .../devicemgt/error-pages/error403.html | 36 - .../devicemgt/error-pages/error404-cloud.html | 48 - .../devicemgt/error-pages/error404.html | 35 - .../devicemgt/error-pages/error405-cloud.html | 48 - .../devicemgt/error-pages/error405.html | 35 - .../devicemgt/error-pages/error500-cloud.html | 48 - .../devicemgt/error-pages/error500.html | 34 - .../jaggeryapps/devicemgt/jaggery.conf | 137 - .../uuf-template-app/app/conf/app-conf.json | 45 - .../uuf-template-app/app/conf/uuf-conf.json | 4 - .../app/layouts/uuf.layout.default.hbs | 67 - .../app/layouts/uuf.layout.sign-in.hbs | 56 - .../app/pages/uuf.page.error/error.hbs | 38 - .../app/pages/uuf.page.error/error.json | 6 - .../public/js/sign-in-validations.js | 42 - .../app/pages/uuf.page.sign-in/sign-in.hbs | 63 - .../app/pages/uuf.page.sign-in/sign-in.js | 48 - .../app/pages/uuf.page.sign-in/sign-in.json | 6 - .../app/pages/uuf.page.sign-out/sign-out.hbs | 18 - .../app/pages/uuf.page.sign-out/sign-out.js | 34 - .../app/pages/uuf.page.sign-out/sign-out.json | 5 - .../sso-intermediate.hbs | 45 - .../sso-intermediate.json | 6 - .../app/units/uuf.unit.alert/alert.hbs | 27 - .../app/units/uuf.unit.alert/alert.js | 33 - .../app/units/uuf.unit.alert/alert.json | 4 - .../app/units/uuf.unit.favicon/favicon.hbs | 24 - .../app/units/uuf.unit.favicon/favicon.js | 26 - .../app/units/uuf.unit.favicon/favicon.json | 8 - .../public/img/cloud-favicon.png | Bin 882 -> 0 bytes .../uuf.unit.favicon/public/img/favicon.png | Bin 18171 -> 0 bytes .../app/units/uuf.unit.footer/footer.hbs | 25 - .../app/units/uuf.unit.footer/footer.json | 8 - .../app/units/uuf.unit.header.logo/logo.hbs | 27 - .../app/units/uuf.unit.header.logo/logo.json | 9 - .../public/img/logo-inverse.png | Bin 33023 -> 0 bytes .../uuf.unit.header.logo/public/img/logo.png | Bin 33023 -> 0 bytes .../uuf.unit.header.user-menu/user-menu.hbs | 39 - .../uuf.unit.header.user-menu/user-menu.json | 8 - .../app/units/uuf.unit.header/header.hbs | 32 - .../app/units/uuf.unit.header/header.json | 9 - .../uuf.unit.lib.data-table/data-table.hbs | 27 - .../uuf.unit.lib.data-table/data-table.json | 4 - .../AutoFill/css/dataTables.autoFill.css | 42 - .../AutoFill/css/dataTables.autoFill.min.css | 1 - .../extensions/AutoFill/images/filler.png | Bin 1040 -> 0 bytes .../AutoFill/js/dataTables.autoFill.js | 854 - .../AutoFill/js/dataTables.autoFill.min.js | 22 - .../Bootstrap/css/dataTables.bootstrap.css | 390 - .../Bootstrap/js/dataTables.bootstrap.js | 224 - .../ColReorder/css/dataTables.colReorder.css | 32 - .../css/dataTables.colReorder.min.css | 1 - .../extensions/ColReorder/images/insert.png | Bin 1885 -> 0 bytes .../ColReorder/js/dataTables.colReorder.js | 1371 -- .../js/dataTables.colReorder.min.js | 26 - .../ColVis/css/dataTables.colVis.css | 203 - .../ColVis/css/dataTables.colVis.min.css | 1 - .../ColVis/css/dataTables.colvis.jqueryui.css | 59 - .../extensions/ColVis/js/dataTables.colVis.js | 1122 -- .../ColVis/js/dataTables.colVis.min.js | 24 - .../css/dataTables.fixedColumns.css | 43 - .../css/dataTables.fixedColumns.min.css | 1 - .../js/dataTables.fixedColumns.js | 1421 -- .../js/dataTables.fixedColumns.min.js | 30 - .../css/dataTables.fixedHeader.css | 25 - .../css/dataTables.fixedHeader.min.css | 1 - .../FixedHeader/js/dataTables.fixedHeader.js | 1026 - .../js/dataTables.fixedHeader.min.js | 30 - .../KeyTable/css/dataTables.keyTable.css | 25 - .../KeyTable/css/dataTables.keyTable.min.css | 1 - .../KeyTable/js/dataTables.keyTable.js | 1193 -- .../KeyTable/js/dataTables.keyTable.min.js | 18 - .../Responsive/css/dataTables.responsive.css | 124 - .../Responsive/css/dataTables.responsive.scss | 167 - .../Responsive/js/dataTables.responsive.js | 872 - .../js/dataTables.responsive.min.js | 19 - .../Scroller/css/dataTables.scroller.css | 62 - .../Scroller/css/dataTables.scroller.min.css | 1 - .../Scroller/images/loading-background.png | Bin 1013 -> 0 bytes .../Scroller/js/dataTables.scroller.js | 1261 -- .../Scroller/js/dataTables.scroller.min.js | 25 - .../TableTools/css/dataTables.tableTools.css | 356 - .../css/dataTables.tableTools.min.css | 1 - .../TableTools/images/collection.png | Bin 1166 -> 0 bytes .../TableTools/images/collection_hover.png | Bin 1194 -> 0 bytes .../extensions/TableTools/images/copy.png | Bin 2184 -> 0 bytes .../TableTools/images/copy_hover.png | Bin 2797 -> 0 bytes .../extensions/TableTools/images/csv.png | Bin 1607 -> 0 bytes .../TableTools/images/csv_hover.png | Bin 1854 -> 0 bytes .../extensions/TableTools/images/pdf.png | Bin 4325 -> 0 bytes .../TableTools/images/pdf_hover.png | Bin 2786 -> 0 bytes .../extensions/TableTools/images/print.png | Bin 2123 -> 0 bytes .../TableTools/images/print_hover.png | Bin 2230 -> 0 bytes .../TableTools/images/psd/collection.psd | Bin 25792 -> 0 bytes .../TableTools/images/psd/copy document.psd | Bin 104729 -> 0 bytes .../TableTools/images/psd/file_types.psd | Bin 1090645 -> 0 bytes .../TableTools/images/psd/printer.psd | Bin 119952 -> 0 bytes .../extensions/TableTools/images/xls.png | Bin 1641 -> 0 bytes .../TableTools/images/xls_hover.png | Bin 2061 -> 0 bytes .../TableTools/js/dataTables.tableTools.js | 3228 --- .../js/dataTables.tableTools.min.js | 70 - .../TableTools/swf/copy_csv_xls.swf | Bin 2232 -> 0 bytes .../TableTools/swf/copy_csv_xls_pdf.swf | Bin 58846 -> 0 bytes .../media/css/jquery.dataTables.css | 473 - .../media/css/jquery.dataTables.min.css | 1 - .../css/jquery.dataTables_themeroller.css | 434 - .../media/images/sort_asc.png | Bin 160 -> 0 bytes .../media/images/sort_asc_disabled.png | Bin 148 -> 0 bytes .../media/images/sort_both.png | Bin 201 -> 0 bytes .../media/images/sort_desc.png | Bin 158 -> 0 bytes .../media/images/sort_desc_disabled.png | Bin 146 -> 0 bytes .../media/js/jquery.dataTables.js | 14950 -------------- .../media/js/jquery.dataTables.min.js | 160 - .../data-tables_1.10.7/media/js/jquery.js | 5 - .../units/uuf.unit.lib.dropdown/dropdown.hbs | 26 - .../units/uuf.unit.lib.dropdown/dropdown.json | 4 - .../public/select2_4.0.0/css/select2.css | 449 - .../public/select2_4.0.0/css/select2.min.css | 1 - .../public/select2_4.0.0/js/i18n/az.js | 3 - .../public/select2_4.0.0/js/i18n/bg.js | 3 - .../public/select2_4.0.0/js/i18n/ca.js | 3 - .../public/select2_4.0.0/js/i18n/cs.js | 3 - .../public/select2_4.0.0/js/i18n/da.js | 3 - .../public/select2_4.0.0/js/i18n/de.js | 3 - .../public/select2_4.0.0/js/i18n/en.js | 3 - .../public/select2_4.0.0/js/i18n/es.js | 3 - .../public/select2_4.0.0/js/i18n/et.js | 3 - .../public/select2_4.0.0/js/i18n/eu.js | 3 - .../public/select2_4.0.0/js/i18n/fa.js | 3 - .../public/select2_4.0.0/js/i18n/fi.js | 3 - .../public/select2_4.0.0/js/i18n/fr.js | 3 - .../public/select2_4.0.0/js/i18n/gl.js | 3 - .../public/select2_4.0.0/js/i18n/he.js | 3 - .../public/select2_4.0.0/js/i18n/hi.js | 3 - .../public/select2_4.0.0/js/i18n/hr.js | 3 - .../public/select2_4.0.0/js/i18n/hu.js | 3 - .../public/select2_4.0.0/js/i18n/id.js | 3 - .../public/select2_4.0.0/js/i18n/is.js | 3 - .../public/select2_4.0.0/js/i18n/it.js | 3 - .../public/select2_4.0.0/js/i18n/ko.js | 3 - .../public/select2_4.0.0/js/i18n/lt.js | 3 - .../public/select2_4.0.0/js/i18n/lv.js | 3 - .../public/select2_4.0.0/js/i18n/mk.js | 3 - .../public/select2_4.0.0/js/i18n/nb.js | 3 - .../public/select2_4.0.0/js/i18n/nl.js | 3 - .../public/select2_4.0.0/js/i18n/pl.js | 3 - .../public/select2_4.0.0/js/i18n/pt-BR.js | 3 - .../public/select2_4.0.0/js/i18n/pt.js | 3 - .../public/select2_4.0.0/js/i18n/ro.js | 3 - .../public/select2_4.0.0/js/i18n/ru.js | 3 - .../public/select2_4.0.0/js/i18n/sk.js | 3 - .../public/select2_4.0.0/js/i18n/sr.js | 3 - .../public/select2_4.0.0/js/i18n/sv.js | 3 - .../public/select2_4.0.0/js/i18n/th.js | 3 - .../public/select2_4.0.0/js/i18n/tr.js | 3 - .../public/select2_4.0.0/js/i18n/uk.js | 3 - .../public/select2_4.0.0/js/i18n/vi.js | 3 - .../public/select2_4.0.0/js/i18n/zh-CN.js | 3 - .../public/select2_4.0.0/js/i18n/zh-TW.js | 3 - .../public/select2_4.0.0/js/select2.full.js | 6132 ------ .../select2_4.0.0/js/select2.full.min.js | 3 - .../public/select2_4.0.0/js/select2.js | 5421 ----- .../public/select2_4.0.0/js/select2.min.js | 2 - .../form-validation.hbs | 24 - .../form-validation.json | 4 - .../public/css/validation-style.css | 27 - .../additional-methods.js | 1007 - .../additional-methods.min.js | 4 - .../jquery.validate.js | 1407 -- .../jquery.validate.min.js | 4 - .../localization/messages_ar.js | 51 - .../localization/messages_ar.min.js | 4 - .../localization/messages_bg.js | 51 - .../localization/messages_bg.min.js | 4 - .../localization/messages_bn_BD.js | 51 - .../localization/messages_bn_BD.min.js | 4 - .../localization/messages_ca.js | 51 - .../localization/messages_ca.min.js | 4 - .../localization/messages_cs.js | 51 - .../localization/messages_cs.min.js | 4 - .../localization/messages_da.js | 48 - .../localization/messages_da.min.js | 4 - .../localization/messages_de.js | 48 - .../localization/messages_de.min.js | 4 - .../localization/messages_el.js | 51 - .../localization/messages_el.min.js | 4 - .../localization/messages_es.js | 54 - .../localization/messages_es.min.js | 4 - .../localization/messages_es_AR.js | 55 - .../localization/messages_es_AR.min.js | 4 - .../localization/messages_es_PE.js | 55 - .../localization/messages_es_PE.min.js | 4 - .../localization/messages_et.js | 49 - .../localization/messages_et.min.js | 4 - .../localization/messages_eu.js | 51 - .../localization/messages_eu.min.js | 4 - .../localization/messages_fa.js | 54 - .../localization/messages_fa.min.js | 4 - .../localization/messages_fi.js | 49 - .../localization/messages_fi.min.js | 4 - .../localization/messages_fr.js | 77 - .../localization/messages_fr.min.js | 4 - .../localization/messages_ge.js | 51 - .../localization/messages_ge.min.js | 4 - .../localization/messages_gl.js | 56 - .../localization/messages_gl.min.js | 4 - .../localization/messages_he.js | 51 - .../localization/messages_he.min.js | 4 - .../localization/messages_hr.js | 51 - .../localization/messages_hr.min.js | 4 - .../localization/messages_hu.js | 50 - .../localization/messages_hu.min.js | 4 - .../localization/messages_hy_AM.js | 51 - .../localization/messages_hy_AM.min.js | 4 - .../localization/messages_id.js | 50 - .../localization/messages_id.min.js | 4 - .../localization/messages_is.js | 49 - .../localization/messages_is.min.js | 4 - .../localization/messages_it.js | 55 - .../localization/messages_it.min.js | 4 - .../localization/messages_ja.js | 51 - .../localization/messages_ja.min.js | 4 - .../localization/messages_ka.js | 51 - .../localization/messages_ka.min.js | 4 - .../localization/messages_kk.js | 51 - .../localization/messages_kk.min.js | 4 - .../localization/messages_ko.js | 51 - .../localization/messages_ko.min.js | 4 - .../localization/messages_lt.js | 51 - .../localization/messages_lt.min.js | 4 - .../localization/messages_lv.js | 51 - .../localization/messages_lv.min.js | 4 - .../localization/messages_my.js | 51 - .../localization/messages_my.min.js | 4 - .../localization/messages_nl.js | 61 - .../localization/messages_nl.min.js | 4 - .../localization/messages_no.js | 51 - .../localization/messages_no.min.js | 4 - .../localization/messages_pl.js | 51 - .../localization/messages_pl.min.js | 4 - .../localization/messages_pt_BR.js | 57 - .../localization/messages_pt_BR.min.js | 4 - .../localization/messages_pt_PT.js | 55 - .../localization/messages_pt_PT.min.js | 4 - .../localization/messages_ro.js | 51 - .../localization/messages_ro.min.js | 4 - .../localization/messages_ru.js | 51 - .../localization/messages_ru.min.js | 4 - .../localization/messages_si.js | 51 - .../localization/messages_si.min.js | 4 - .../localization/messages_sk.js | 48 - .../localization/messages_sk.min.js | 4 - .../localization/messages_sl.js | 51 - .../localization/messages_sl.min.js | 4 - .../localization/messages_sr.js | 51 - .../localization/messages_sr.min.js | 4 - .../localization/messages_sr_lat.js | 51 - .../localization/messages_sr_lat.min.js | 4 - .../localization/messages_sv.js | 49 - .../localization/messages_sv.min.js | 4 - .../localization/messages_th.js | 51 - .../localization/messages_th.min.js | 4 - .../localization/messages_tj.js | 51 - .../localization/messages_tj.min.js | 4 - .../localization/messages_tr.js | 52 - .../localization/messages_tr.min.js | 4 - .../localization/messages_uk.js | 51 - .../localization/messages_uk.min.js | 4 - .../localization/messages_vi.js | 51 - .../localization/messages_vi.min.js | 4 - .../localization/messages_zh.js | 51 - .../localization/messages_zh.min.js | 4 - .../localization/messages_zh_TW.js | 52 - .../localization/messages_zh_TW.min.js | 4 - .../localization/methods_de.js | 40 - .../localization/methods_de.min.js | 4 - .../localization/methods_es_CL.js | 40 - .../localization/methods_es_CL.min.js | 4 - .../localization/methods_fi.js | 40 - .../localization/methods_fi.min.js | 4 - .../localization/methods_nl.js | 37 - .../localization/methods_nl.min.js | 4 - .../localization/methods_pt.js | 37 - .../localization/methods_pt.min.js | 4 - .../public/select2_4.0.0/css/select2.css | 449 - .../public/select2_4.0.0/css/select2.min.css | 1 - .../public/select2_4.0.0/js/i18n/az.js | 3 - .../public/select2_4.0.0/js/i18n/bg.js | 3 - .../public/select2_4.0.0/js/i18n/ca.js | 3 - .../public/select2_4.0.0/js/i18n/cs.js | 3 - .../public/select2_4.0.0/js/i18n/da.js | 3 - .../public/select2_4.0.0/js/i18n/de.js | 3 - .../public/select2_4.0.0/js/i18n/en.js | 3 - .../public/select2_4.0.0/js/i18n/es.js | 3 - .../public/select2_4.0.0/js/i18n/et.js | 3 - .../public/select2_4.0.0/js/i18n/eu.js | 3 - .../public/select2_4.0.0/js/i18n/fa.js | 3 - .../public/select2_4.0.0/js/i18n/fi.js | 3 - .../public/select2_4.0.0/js/i18n/fr.js | 3 - .../public/select2_4.0.0/js/i18n/gl.js | 3 - .../public/select2_4.0.0/js/i18n/he.js | 3 - .../public/select2_4.0.0/js/i18n/hi.js | 3 - .../public/select2_4.0.0/js/i18n/hr.js | 3 - .../public/select2_4.0.0/js/i18n/hu.js | 3 - .../public/select2_4.0.0/js/i18n/id.js | 3 - .../public/select2_4.0.0/js/i18n/is.js | 3 - .../public/select2_4.0.0/js/i18n/it.js | 3 - .../public/select2_4.0.0/js/i18n/ko.js | 3 - .../public/select2_4.0.0/js/i18n/lt.js | 3 - .../public/select2_4.0.0/js/i18n/lv.js | 3 - .../public/select2_4.0.0/js/i18n/mk.js | 3 - .../public/select2_4.0.0/js/i18n/nb.js | 3 - .../public/select2_4.0.0/js/i18n/nl.js | 3 - .../public/select2_4.0.0/js/i18n/pl.js | 3 - .../public/select2_4.0.0/js/i18n/pt-BR.js | 3 - .../public/select2_4.0.0/js/i18n/pt.js | 3 - .../public/select2_4.0.0/js/i18n/ro.js | 3 - .../public/select2_4.0.0/js/i18n/ru.js | 3 - .../public/select2_4.0.0/js/i18n/sk.js | 3 - .../public/select2_4.0.0/js/i18n/sr.js | 3 - .../public/select2_4.0.0/js/i18n/sv.js | 3 - .../public/select2_4.0.0/js/i18n/th.js | 3 - .../public/select2_4.0.0/js/i18n/tr.js | 3 - .../public/select2_4.0.0/js/i18n/uk.js | 3 - .../public/select2_4.0.0/js/i18n/vi.js | 3 - .../public/select2_4.0.0/js/i18n/zh-CN.js | 3 - .../public/select2_4.0.0/js/i18n/zh-TW.js | 3 - .../public/select2_4.0.0/js/select2.full.js | 6132 ------ .../select2_4.0.0/js/select2.full.min.js | 3 - .../public/select2_4.0.0/js/select2.js | 5421 ----- .../public/select2_4.0.0/js/select2.min.js | 2 - .../units/uuf.unit.lib.select2/select2.hbs | 24 - .../units/uuf.unit.lib.select2/select2.json | 4 - .../jquery-resize_0.5.3/jquery.resize.js | 182 - .../uuf.unit.lib.thumbnail/thumbnail.hbs | 21 - .../uuf.unit.lib.thumbnail/thumbnail.json | 4 - .../notification.hbs | 22 - .../notification.js | 33 - .../notification.json | 3 - .../app/units/uuf.unit.message/message.hbs | 22 - .../app/units/uuf.unit.message/message.js | 33 - .../app/units/uuf.unit.message/message.json | 4 - .../units/uuf.unit.navbar.actions/actions.hbs | 20 - .../uuf.unit.navbar.actions/actions.json | 8 - .../breadcrumbs.hbs | 25 - .../breadcrumbs.json | 8 - .../uuf.unit.navbar.nav-menu/nav-menu.hbs | 35 - .../uuf.unit.navbar.nav-menu/nav-menu.json | 8 - .../notifications.hbs | 36 - .../notifications.json | 8 - .../units/uuf.unit.navbar.popover/popover.hbs | 27 - .../uuf.unit.navbar.popover/popover.json | 8 - .../uuf.unit.navbar.toggle-menu.left/left.hbs | 33 - .../left.json | 9 - .../right.hbs | 37 - .../right.json | 9 - .../app/units/uuf.unit.navbar/navbar.hbs | 42 - .../app/units/uuf.unit.navbar/navbar.json | 8 - .../units/uuf.unit.side-pane/side-pane.hbs | 22 - .../units/uuf.unit.side-pane/side-pane.json | 3 - .../uuf.unit.theme/public/css/theme-wso2.css | 8974 --------- .../public/less/theme-variables.less | 22 - .../uuf.unit.theme/public/less/theme.less | 21 - .../bootstrap_3.3.5/css/bootstrap-theme.css | 599 - .../css/bootstrap-theme.css.map | 1 - .../css/bootstrap-theme.min.css | 5 - .../lib/bootstrap_3.3.5/css/bootstrap.css | 6812 ------- .../lib/bootstrap_3.3.5/css/bootstrap.css.map | 1 - .../lib/bootstrap_3.3.5/css/bootstrap.min.css | 5 - .../fonts/glyphicons-halflings-regular.eot | Bin 20127 -> 0 bytes .../fonts/glyphicons-halflings-regular.svg | 306 - .../fonts/glyphicons-halflings-regular.ttf | Bin 45404 -> 0 bytes .../fonts/glyphicons-halflings-regular.woff | Bin 23424 -> 0 bytes .../fonts/glyphicons-halflings-regular.woff2 | Bin 18028 -> 0 bytes .../lib/bootstrap_3.3.5/js/bootstrap.js | 2375 --- .../lib/bootstrap_3.3.5/js/bootstrap.min.js | 7 - .../public/lib/bootstrap_3.3.5/js/npm.js | 31 - .../font-awesome_4.3.0/css/font-awesome.css | 1819 -- .../css/font-awesome.min.css | 4 - .../font-awesome_4.3.0/fonts/FontAwesome.otf | Bin 93888 -> 0 bytes .../fonts/fontawesome-webfont.eot | Bin 60767 -> 0 bytes .../fonts/fontawesome-webfont.svg | 583 - .../fonts/fontawesome-webfont.ttf | Bin 122092 -> 0 bytes .../fonts/fontawesome-webfont.woff | Bin 71508 -> 0 bytes .../fonts/fontawesome-webfont.woff2 | Bin 56780 -> 0 bytes .../lib/font-entgra-1.4.0/css/font-entgra.css | 1592 -- .../font-entgra-1.4.0/css/font-entgra.min.css | 15 - .../font-entgra-1.4.0/fonts/font-entgra.eot | Bin 120940 -> 0 bytes .../font-entgra-1.4.0/fonts/font-entgra.svg | 1180 -- .../font-entgra-1.4.0/fonts/font-entgra.ttf | Bin 120752 -> 0 bytes .../font-entgra-1.4.0/fonts/font-entgra.woff | Bin 77332 -> 0 bytes .../font-entgra-1.4.0/fonts/font-entgra.woff2 | Bin 65052 -> 0 bytes .../public/lib/font-entgra-1.4.0/icons.json | 327 - .../lib/font-entgra-1.4.0/scss/_mixin.scss | 1338 -- .../lib/html5shiv_3.7.2/html5shiv.min.js | 4 - .../ui-bg_diagonals-thick_18_b81900_40x40.png | Bin 418 -> 0 bytes .../ui-bg_diagonals-thick_20_666666_40x40.png | Bin 312 -> 0 bytes .../images/ui-bg_flat_10_000000_40x100.png | Bin 205 -> 0 bytes .../images/ui-bg_glass_100_f6f6f6_1x400.png | Bin 262 -> 0 bytes .../images/ui-bg_glass_100_fdf5ce_1x400.png | Bin 348 -> 0 bytes .../images/ui-bg_glass_65_ffffff_1x400.png | Bin 207 -> 0 bytes .../ui-bg_gloss-wave_35_f6a828_500x100.png | Bin 5815 -> 0 bytes .../ui-bg_highlight-soft_100_eeeeee_1x100.png | Bin 278 -> 0 bytes .../ui-bg_highlight-soft_75_ffe45c_1x100.png | Bin 328 -> 0 bytes .../images/ui-icons_222222_256x240.png | Bin 6922 -> 0 bytes .../images/ui-icons_228ef1_256x240.png | Bin 4549 -> 0 bytes .../images/ui-icons_ef8c08_256x240.png | Bin 4549 -> 0 bytes .../images/ui-icons_ffd27a_256x240.png | Bin 4549 -> 0 bytes .../images/ui-icons_ffffff_256x240.png | Bin 6299 -> 0 bytes .../public/lib/jquery-ui_1.11.4/jquery-ui.css | 1237 -- .../public/lib/jquery-ui_1.11.4/jquery-ui.js | 16630 ---------------- .../lib/jquery-ui_1.11.4/jquery-ui.min.css | 7 - .../lib/jquery-ui_1.11.4/jquery-ui.min.js | 13 - .../jquery-ui_1.11.4/jquery-ui.structure.css | 840 - .../jquery-ui.structure.min.css | 5 - .../lib/jquery-ui_1.11.4/jquery-ui.theme.css | 415 - .../jquery-ui_1.11.4/jquery-ui.theme.min.css | 5 - .../lib/jquery_1.11.0/jquery-1.11.3.min.js | 5 - .../public/lib/noty_2.3.5/jquery.noty.js | 552 - .../public/lib/noty_2.3.5/layouts/bottom.js | 48 - .../lib/noty_2.3.5/layouts/bottomCenter.js | 56 - .../lib/noty_2.3.5/layouts/bottomLeft.js | 57 - .../lib/noty_2.3.5/layouts/bottomRight.js | 57 - .../public/lib/noty_2.3.5/layouts/center.js | 71 - .../lib/noty_2.3.5/layouts/centerLeft.js | 76 - .../lib/noty_2.3.5/layouts/centerRight.js | 76 - .../public/lib/noty_2.3.5/layouts/inline.js | 45 - .../public/lib/noty_2.3.5/layouts/top.js | 48 - .../lib/noty_2.3.5/layouts/topCenter.js | 55 - .../public/lib/noty_2.3.5/layouts/topLeft.js | 57 - .../public/lib/noty_2.3.5/layouts/topRight.js | 57 - .../packaged/jquery.noty.packaged.js | 1454 -- .../packaged/jquery.noty.packaged.min.js | 1 - .../public/lib/noty_2.3.5/promise.js | 431 - .../public/lib/noty_2.3.5/themes/bootstrap.js | 76 - .../public/lib/noty_2.3.5/themes/default.js | 202 - .../public/lib/noty_2.3.5/themes/relax.js | 169 - .../public/lib/respond_1.4.2/respond.min.js | 5 - .../fonts/OpenSans/OpenSans-Bold-webfont.eot | Bin 30858 -> 0 bytes .../fonts/OpenSans/OpenSans-Bold-webfont.svg | 269 - .../fonts/OpenSans/OpenSans-Bold-webfont.ttf | Bin 30680 -> 0 bytes .../fonts/OpenSans/OpenSans-Bold-webfont.woff | Bin 19788 -> 0 bytes .../OpenSans/OpenSans-BoldItalic-webfont.eot | Bin 34166 -> 0 bytes .../OpenSans/OpenSans-BoldItalic-webfont.svg | 269 - .../OpenSans/OpenSans-BoldItalic-webfont.ttf | Bin 33960 -> 0 bytes .../OpenSans/OpenSans-BoldItalic-webfont.woff | Bin 21940 -> 0 bytes .../OpenSans/OpenSans-ExtraBold-webfont.eot | Bin 30602 -> 0 bytes .../OpenSans/OpenSans-ExtraBold-webfont.svg | 269 - .../OpenSans/OpenSans-ExtraBold-webfont.ttf | Bin 30404 -> 0 bytes .../OpenSans/OpenSans-ExtraBold-webfont.woff | Bin 19972 -> 0 bytes .../OpenSans-ExtraBoldItalic-webfont.eot | Bin 33758 -> 0 bytes .../OpenSans-ExtraBoldItalic-webfont.svg | 269 - .../OpenSans-ExtraBoldItalic-webfont.ttf | Bin 33532 -> 0 bytes .../OpenSans-ExtraBoldItalic-webfont.woff | Bin 21824 -> 0 bytes .../OpenSans/OpenSans-Italic-webfont.eot | Bin 34798 -> 0 bytes .../OpenSans/OpenSans-Italic-webfont.svg | 269 - .../OpenSans/OpenSans-Italic-webfont.ttf | Bin 34612 -> 0 bytes .../OpenSans/OpenSans-Italic-webfont.woff | Bin 22416 -> 0 bytes .../fonts/OpenSans/OpenSans-Light-webfont.eot | Bin 29794 -> 0 bytes .../fonts/OpenSans/OpenSans-Light-webfont.svg | 270 - .../fonts/OpenSans/OpenSans-Light-webfont.ttf | Bin 29612 -> 0 bytes .../OpenSans/OpenSans-Light-webfont.woff | Bin 19396 -> 0 bytes .../OpenSans/OpenSans-LightItalic-webfont.eot | Bin 34578 -> 0 bytes .../OpenSans/OpenSans-LightItalic-webfont.svg | 270 - .../OpenSans/OpenSans-LightItalic-webfont.ttf | Bin 34368 -> 0 bytes .../OpenSans-LightItalic-webfont.woff | Bin 22444 -> 0 bytes .../OpenSans/OpenSans-Regular-webfont.eot | Bin 29934 -> 0 bytes .../OpenSans/OpenSans-Regular-webfont.svg | 270 - .../OpenSans/OpenSans-Regular-webfont.ttf | Bin 29744 -> 0 bytes .../OpenSans/OpenSans-Regular-webfont.woff | Bin 19624 -> 0 bytes .../OpenSans/OpenSans-Semibold-webfont.eot | Bin 30350 -> 0 bytes .../OpenSans/OpenSans-Semibold-webfont.svg | 269 - .../OpenSans/OpenSans-Semibold-webfont.ttf | Bin 30156 -> 0 bytes .../OpenSans/OpenSans-Semibold-webfont.woff | Bin 19736 -> 0 bytes .../OpenSans-SemiboldItalic-webfont.eot | Bin 34866 -> 0 bytes .../OpenSans-SemiboldItalic-webfont.svg | 269 - .../OpenSans-SemiboldItalic-webfont.ttf | Bin 34644 -> 0 bytes .../OpenSans-SemiboldItalic-webfont.woff | Bin 22332 -> 0 bytes .../fonts/Roboto/Roboto-Black-webfont.eot | Bin 20698 -> 0 bytes .../fonts/Roboto/Roboto-Black-webfont.svg | 660 - .../fonts/Roboto/Roboto-Black-webfont.ttf | Bin 44652 -> 0 bytes .../fonts/Roboto/Roboto-Black-webfont.woff | Bin 24484 -> 0 bytes .../fonts/Roboto/Roboto-Black-webfont.woff2 | Bin 14540 -> 0 bytes .../Roboto/Roboto-BlackItalic-webfont.eot | Bin 23849 -> 0 bytes .../Roboto/Roboto-BlackItalic-webfont.svg | 660 - .../Roboto/Roboto-BlackItalic-webfont.ttf | Bin 51536 -> 0 bytes .../Roboto/Roboto-BlackItalic-webfont.woff | Bin 27892 -> 0 bytes .../Roboto/Roboto-BlackItalic-webfont.woff2 | Bin 15972 -> 0 bytes .../fonts/Roboto/Roboto-Bold-webfont.eot | Bin 20966 -> 0 bytes .../fonts/Roboto/Roboto-Bold-webfont.svg | 611 - .../fonts/Roboto/Roboto-Bold-webfont.ttf | Bin 45008 -> 0 bytes .../fonts/Roboto/Roboto-Bold-webfont.woff | Bin 24808 -> 0 bytes .../fonts/Roboto/Roboto-Bold-webfont.woff2 | Bin 14552 -> 0 bytes .../Roboto/Roboto-BoldItalic-webfont.eot | Bin 24778 -> 0 bytes .../Roboto/Roboto-BoldItalic-webfont.svg | 660 - .../Roboto/Roboto-BoldItalic-webfont.ttf | Bin 53400 -> 0 bytes .../Roboto/Roboto-BoldItalic-webfont.woff | Bin 28824 -> 0 bytes .../Roboto/Roboto-BoldItalic-webfont.woff2 | Bin 15340 -> 0 bytes .../fonts/Roboto/Roboto-Italic-webfont.eot | Bin 25062 -> 0 bytes .../fonts/Roboto/Roboto-Italic-webfont.svg | 660 - .../fonts/Roboto/Roboto-Italic-webfont.ttf | Bin 54124 -> 0 bytes .../fonts/Roboto/Roboto-Italic-webfont.woff | Bin 29080 -> 0 bytes .../fonts/Roboto/Roboto-Italic-webfont.woff2 | Bin 15736 -> 0 bytes .../fonts/Roboto/Roboto-Light-webfont.eot | Bin 20940 -> 0 bytes .../fonts/Roboto/Roboto-Light-webfont.svg | 659 - .../fonts/Roboto/Roboto-Light-webfont.ttf | Bin 45880 -> 0 bytes .../fonts/Roboto/Roboto-Light-webfont.woff | Bin 24576 -> 0 bytes .../fonts/Roboto/Roboto-Light-webfont.woff2 | Bin 14524 -> 0 bytes .../Roboto/Roboto-LightItalic-webfont.eot | Bin 25458 -> 0 bytes .../Roboto/Roboto-LightItalic-webfont.svg | 659 - .../Roboto/Roboto-LightItalic-webfont.ttf | Bin 56008 -> 0 bytes .../Roboto/Roboto-LightItalic-webfont.woff | Bin 29480 -> 0 bytes .../Roboto/Roboto-LightItalic-webfont.woff2 | Bin 16064 -> 0 bytes .../fonts/Roboto/Roboto-Medium-webfont.eot | Bin 21364 -> 0 bytes .../fonts/Roboto/Roboto-Medium-webfont.svg | 611 - .../fonts/Roboto/Roboto-Medium-webfont.ttf | Bin 45304 -> 0 bytes .../fonts/Roboto/Roboto-Medium-webfont.woff | Bin 25048 -> 0 bytes .../fonts/Roboto/Roboto-Medium-webfont.woff2 | Bin 14596 -> 0 bytes .../Roboto/Roboto-MediumItalic-webfont.eot | Bin 24908 -> 0 bytes .../Roboto/Roboto-MediumItalic-webfont.svg | 660 - .../Roboto/Roboto-MediumItalic-webfont.ttf | Bin 53884 -> 0 bytes .../Roboto/Roboto-MediumItalic-webfont.woff | Bin 28860 -> 0 bytes .../Roboto/Roboto-MediumItalic-webfont.woff2 | Bin 15804 -> 0 bytes .../fonts/Roboto/Roboto-Regular-webfont.eot | Bin 21320 -> 0 bytes .../fonts/Roboto/Roboto-Regular-webfont.svg | 639 - .../fonts/Roboto/Roboto-Regular-webfont.ttf | Bin 45376 -> 0 bytes .../fonts/Roboto/Roboto-Regular-webfont.woff | Bin 25020 -> 0 bytes .../fonts/Roboto/Roboto-Regular-webfont.woff2 | Bin 14584 -> 0 bytes .../fonts/Roboto/Roboto-Thin-webfont.eot | Bin 21659 -> 0 bytes .../fonts/Roboto/Roboto-Thin-webfont.svg | 649 - .../fonts/Roboto/Roboto-Thin-webfont.ttf | Bin 47700 -> 0 bytes .../fonts/Roboto/Roboto-Thin-webfont.woff | Bin 24944 -> 0 bytes .../fonts/Roboto/Roboto-Thin-webfont.woff2 | Bin 14556 -> 0 bytes .../Roboto/Roboto-ThinItalic-webfont.eot | Bin 26645 -> 0 bytes .../Roboto/Roboto-ThinItalic-webfont.svg | 649 - .../Roboto/Roboto-ThinItalic-webfont.ttf | Bin 60668 -> 0 bytes .../Roboto/Roboto-ThinItalic-webfont.woff | Bin 30468 -> 0 bytes .../Roboto/Roboto-ThinItalic-webfont.woff2 | Bin 15788 -> 0 bytes .../Roboto/RobotoCondensed-Bold-webfont.eot | Bin 21457 -> 0 bytes .../Roboto/RobotoCondensed-Bold-webfont.svg | 661 - .../Roboto/RobotoCondensed-Bold-webfont.ttf | Bin 45452 -> 0 bytes .../Roboto/RobotoCondensed-Bold-webfont.woff | Bin 25144 -> 0 bytes .../RobotoCondensed-BoldItalic-webfont.eot | Bin 25204 -> 0 bytes .../RobotoCondensed-BoldItalic-webfont.svg | 661 - .../RobotoCondensed-BoldItalic-webfont.ttf | Bin 53660 -> 0 bytes .../RobotoCondensed-BoldItalic-webfont.woff | Bin 29136 -> 0 bytes .../Roboto/RobotoCondensed-Italic-webfont.eot | Bin 25217 -> 0 bytes .../Roboto/RobotoCondensed-Italic-webfont.svg | 662 - .../Roboto/RobotoCondensed-Italic-webfont.ttf | Bin 54528 -> 0 bytes .../RobotoCondensed-Italic-webfont.woff | Bin 29104 -> 0 bytes .../Roboto/RobotoCondensed-Light-webfont.eot | Bin 21661 -> 0 bytes .../Roboto/RobotoCondensed-Light-webfont.svg | 661 - .../Roboto/RobotoCondensed-Light-webfont.ttf | Bin 47108 -> 0 bytes .../Roboto/RobotoCondensed-Light-webfont.woff | Bin 25204 -> 0 bytes .../RobotoCondensed-LightItalic-webfont.eot | Bin 25892 -> 0 bytes .../RobotoCondensed-LightItalic-webfont.svg | 661 - .../RobotoCondensed-LightItalic-webfont.ttf | Bin 56592 -> 0 bytes .../RobotoCondensed-LightItalic-webfont.woff | Bin 29796 -> 0 bytes .../RobotoCondensed-Regular-webfont.eot | Bin 21712 -> 0 bytes .../RobotoCondensed-Regular-webfont.svg | 662 - .../RobotoCondensed-Regular-webfont.ttf | Bin 45668 -> 0 bytes .../RobotoCondensed-Regular-webfont.woff | Bin 25268 -> 0 bytes .../lib/theme-wso2_1.0/images/favicon.png | Bin 18171 -> 0 bytes .../lib/theme-wso2_1.0/images/loading.svg | 25 - .../theme-wso2_1.0/images/logo-inverse.png | Bin 33023 -> 0 bytes .../public/lib/theme-wso2_1.0/images/logo.png | Bin 33023 -> 0 bytes .../lib/theme-wso2_1.0/js/noty-theme-wso2.js | 169 - .../lib/theme-wso2_1.0/js/theme-wso2.js | 618 - .../lib/theme-wso2_1.0/less/theme-wso2.less | 2375 --- .../app/units/uuf.unit.theme/theme.hbs | 51 - .../app/units/uuf.unit.theme/theme.json | 9 - .../uuf-template-app/cache/.gitignore | 3 - .../uuf-template-app/cache/README.txt | 1 - .../jaggeryapps/uuf-template-app/jaggery.conf | 77 - .../uuf-template-app/lib/constants.js | 114 - .../lib/dynamic-files-renderer.js | 125 - .../lib/error-pages-router.js | 123 - .../uuf-template-app/lib/models.js | 93 - .../uuf-template-app/lib/modules/auth/acs.jag | 41 - .../uuf-template-app/lib/modules/auth/auth.js | 734 - .../auth/default-sso-intermediate-page.hbs | 43 - .../lib/modules/auth/login.jag | 51 - .../lib/modules/auth/logout.jag | 51 - .../lib/modules/handlebars/data-structures.js | 241 - .../modules/handlebars/handlebars-v2.0.0.js | 3070 --- .../lib/modules/handlebars/handlebars.js | 707 - .../lib/modules/less/less-rhino-1.7.5.js | 9399 --------- .../uuf-template-app/lib/modules/less/less.js | 254 - .../uuf-template-app/lib/pages-router.js | 182 - .../uuf-template-app/lib/pages.jag | 24 - .../lib/static-files-router.js | 422 - .../uuf-template-app/lib/static-files.jag | 22 - .../uuf-template-app/lib/units-router.js | 67 - .../uuf-template-app/lib/units.jag | 22 - .../jaggeryapps/uuf-template-app/lib/utils.js | 656 - .../pom.xml | 120 - .../src/main/resources/build.properties | 19 - .../src/main/resources/p2.inf | 6 - pom.xml | 7 - 1500 files changed, 276533 deletions(-) delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/assembly/src.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/device-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/enterprise.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/group-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/stats-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.default.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.error.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.loading.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/group.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/operation.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/cloud.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/pinch.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handler-utils.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/utility.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/public/js/certificate-create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/public/js/certificate-listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/public/templates/certificate-listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/public/css/analytics.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/templates/device-listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicelocations/devicelocations.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicelocations/devicelocations.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/public/css/devicetype.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/public/css/devicetype.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/public/css/devicetype.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/css/custom.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/js/devicetype-listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/templates/devicetype-listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/public/css/analytics.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/images/group-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.notification.listing/listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.notification.listing/listing.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/public/js/script.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/public/js/validate-register.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit.permission/permission.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit.permission/permission.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit/edit.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit/edit.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/templates/role-listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-out/sign-out.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/public/js/topic-listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/templates/listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.json delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.hbs delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.js delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/css/daterangepicker.css delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/date-picker.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/jquery-ui-timepicker-addon.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/jquery.daterangepicker.js delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/moment.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/css/dataTables.bootstrap.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/css/dataTables.responsive.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.bootstrap.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.fnSetFilteringDelay.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.responsive.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/jquery.dataTables.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/operation-bar.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/operation-bar.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/operation-bar.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/public/js/operation-bar.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.overview-section/overview-section.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.overview-section/overview-section.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.overview-section/overview-section.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.analytics-view/analytics-view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.analytics-view/analytics-view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.analytics-view/analytics-view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.analytics-view/public/js/device.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/public/images/deviceType.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/public/js/device-stats.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/public/js/moment.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/public/js/socket.io.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/private/config.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/css/styles.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/deviceType.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/schematicsGuide.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/thumb.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/js/type-view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.details/details.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.details/details.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.details/details.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/public/js/operation-bar.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/operation-mod.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/operation-mod.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.overview-section/overview-section.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.overview-section/overview-section.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.overview-section/overview-section.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.email.invite-modal/invite-modal.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.email.invite-modal/invite-modal.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.email.invite-modal/public/css/invite-modal-styles.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.email.invite-modal/public/js/invite-modal.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-edit/policy-edit.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-edit/policy-edit.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-edit/public/js/policy-edit.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-view/policy-view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-view/policy-view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-view/public/js/policy-view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-wizard/policy-wizard.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-wizard/policy-wizard.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.generic.policy-wizard/public/js/policy-wizard.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.qr-modal/qr-modal.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.qr-modal/qr-modal.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/public/css/listing-grid.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/public/js/listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/public/templates/listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/templates/applications-list.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/templates/policy-compliance.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/templates/policy-list.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.dynamic.platform.configuration/configuration.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.dynamic.platform.configuration/configuration.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/exit_alert.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/proximity_alert.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/speed_alert.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/stationery_alert.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/traffic_point.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/within_alert.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/view_fence_popup.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/conf/alerts/Geo-ExecutionPlan-Exit_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/conf/alerts/Geo-ExecutionPlan-Proximity_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/conf/alerts/Geo-ExecutionPlan-Speed_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/conf/alerts/Geo-ExecutionPlan-Stationery_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/conf/alerts/Geo-ExecutionPlan-Traffic_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/conf/alerts/Geo-ExecutionPlan-Within_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/L.Control.Locate.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/L.Control.Locate.ie.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/MarkerCluster.Default.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/MarkerCluster.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/app.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/bootstrap-datepicker.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/bootstrap-wizard-lib/LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/bootstrap-wizard-lib/bootstrap-wizard.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/bootstrap.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/css/animation.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/css/locate-fa-codes.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/css/locate-fa-embedded.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/css/locate-fa-ie7-codes.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/css/locate-fa-ie7.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/css/locate-fa.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/d3/c3.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/font-awesome.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/font/LICENSE.txt delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/font/README.txt delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/font/config.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/font/locate-fa.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/font/locate-fa.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/font/locate-fa.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/font/locate-fa.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/fonts/FontAwesome.otf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/fonts/fontawesome-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/fonts/fontawesome-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/fonts/fontawesome-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/fonts/fontawesome-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/TODO.Move_this_images_to_assets_images_folder delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/layers-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/layers.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/marker-icon-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/marker-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/marker-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-bg_flat_0_aaaaaa_40x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-icons_222222_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-icons_444444_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-icons_555555_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-icons_777620_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-icons_777777_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-icons_cc0000_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/images/ui-icons_ffffff_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/jquery-ui-timepicker-addon.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/jquery-ui-timepicker-addon.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/jquery-ui.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/jquery-ui.theme.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet/L.Grid.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet/images/spritesheet-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet/images/spritesheet.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet/leaflet.draw.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet_fullscreen/fullscreen.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet_fullscreen/fullscreen@2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet_fullscreen/leaflet.fullscreen.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/login.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/map.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/style.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/fav/wso2_fav.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/favicon-120.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/favicon-152.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/favicon-196.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/favicon-76.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/favicon.ico delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/layers-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/layers.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/marker-icon-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/marker-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/marker-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/STOP.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/VEHICLE.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/arrow_alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/arrow_normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/arrow_offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/arrow_warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/danger.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/default_icons/greenMarker.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/default_icons/marker-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/default_icons/marker-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/default_icons/pinkMarker.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/default_icons/redMarker.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/info.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/moving/device-alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/moving/device-normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/moving/device-offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/moving/device-warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/device-alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/device-normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/device-offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/device-warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/stationary-alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/stationary-normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/stationary-normal2.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/stationary-offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/non_moving/stationary-warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/default/moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/default/moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/default/moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/default/moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/default/non-moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/default/non-moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/default/non-moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/default/non-moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stationary/non-moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stationary/non-moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stationary/non-moving/normal2.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stationary/non-moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stationary/non-moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stop/non-moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stop/non-moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stop/non-moving/normal2.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stop/non-moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/stop/non-moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/vehicle/moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/vehicle/moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/vehicle/moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/vehicle/moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/vehicle/non-moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/vehicle/non-moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/vehicle/non-moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/object-types/vehicle/non-moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/resize.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/resize_2.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/stopIcon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/markers/warn.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/thumbnail.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/img/wso2-logo.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/application_options.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/bootstrap-wizard-lib/LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/bootstrap-wizard-lib/bootstrap-wizard.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/bootstrap-wizard-lib/bootstrap-wizard.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/bootstrap/BOOTSTRAP_LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/bootstrap/bootstrap.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/d3/C3_LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/d3/D3_LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/d3/c3.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/d3/d3.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/firstTemp.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_exit_fence.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_proximity.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_speed.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_stationary.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_within.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/jquery/bootstrap-datepicker.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/jquery/jquery-2.1.1.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/jquery/jquery-ui-timepicker-addon.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/jquery/jquery-ui-timepicker-addon.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/jquery/jquery-ui.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/L.CircleEditor.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/L.Control.Focus.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/L.Control.GeoAlerts.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/L.Control.Locate.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/L.Grid.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/L.MeasuringTool.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/L.PolySideLabel.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/LICENSE_RaphaelLayer delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/Leaflet.fullscreen.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/MIT-LICENSE.txt delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/Marker.Rotate.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/images/marker-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/images/marker-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/leaflet.draw.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/leaflet.groupedlayercontrol.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/leaflet.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/leaflet.markercluster.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/raphael-min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/leaflet/rlayer.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/moment.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/secondTemp.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/show_alert_in_map.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/socket.io.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/typeahead.bundle.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/geo-devices.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/geo-devices.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/geo-devices.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/assets/html_templates/modal/proximity_alert.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/assets/html_templates/modal/traffic_point.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/assets/html_templates/view_fence_popup.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/conf/alerts/Geo-ExecutionPlan-Exit_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/conf/alerts/Geo-ExecutionPlan-Proximity_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/conf/alerts/Geo-ExecutionPlan-Speed_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/conf/alerts/Geo-ExecutionPlan-Stationery_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/conf/alerts/Geo-ExecutionPlan-Traffic_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/conf/alerts/Geo-ExecutionPlan-Within_alert.siddhiql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/L.Control.Locate.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/L.Control.Locate.ie.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/MarkerCluster.Default.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/MarkerCluster.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/app.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/bootstrap-datepicker.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/bootstrap-wizard-lib/LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/bootstrap-wizard-lib/bootstrap-wizard.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/bootstrap.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/css/animation.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/css/locate-fa-codes.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/css/locate-fa-embedded.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/css/locate-fa-ie7-codes.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/css/locate-fa-ie7.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/css/locate-fa.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/font-awesome.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/font/LICENSE.txt delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/font/README.txt delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/font/config.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/font/locate-fa.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/font/locate-fa.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/font/locate-fa.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/font/locate-fa.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/fonts/FontAwesome.otf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/fonts/fontawesome-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/fonts/fontawesome-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/fonts/fontawesome-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/fonts/fontawesome-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/TODO.Move_this_images_to_assets_images_folder delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/layers-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/layers.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/marker-icon-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/marker-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/marker-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/markers-matte.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/markers-matte@2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/markers-plain.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/markers-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/markers-shadow@2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/markers-soft.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/markers-soft@2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-bg_flat_0_aaaaaa_40x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-icons_222222_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-icons_444444_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-icons_555555_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-icons_777620_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-icons_777777_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-icons_cc0000_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/images/ui-icons_ffffff_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/jquery-ui-timepicker-addon.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/jquery-ui-timepicker-addon.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/jquery-ui.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/jquery-ui.theme.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet.awesome-markers.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet/L.Grid.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet/images/spritesheet-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet/images/spritesheet.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet/leaflet.draw.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet_fullscreen/fullscreen.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet_fullscreen/fullscreen@2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/leaflet_fullscreen/leaflet.fullscreen.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/login.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/map.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/css/style.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/fav/wso2_fav.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/favicon-120.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/favicon-152.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/favicon-196.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/favicon-76.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/favicon.ico delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/layers-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/layers.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/marker-icon-2x.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/marker-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/marker-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/STOP.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/VEHICLE.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/arrow_alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/arrow_normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/arrow_offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/arrow_warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/danger.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/default_icons/greenMarker.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/default_icons/marker-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/default_icons/marker-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/default_icons/pinkMarker.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/default_icons/redMarker.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/info.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/moving/device-alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/moving/device-normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/moving/device-offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/moving/device-warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/device-alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/device-normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/device-offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/device-warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/stationary-alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/stationary-normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/stationary-normal2.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/stationary-offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/non_moving/stationary-warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/default/moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/default/moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/default/moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/default/moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/default/non-moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/default/non-moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/default/non-moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/default/non-moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stationary/non-moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stationary/non-moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stationary/non-moving/normal2.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stationary/non-moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stationary/non-moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stop/non-moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stop/non-moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stop/non-moving/normal2.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stop/non-moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/stop/non-moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/vehicle/moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/vehicle/moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/vehicle/moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/vehicle/moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/vehicle/non-moving/alerted.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/vehicle/non-moving/normal.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/vehicle/non-moving/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/object-types/vehicle/non-moving/warning.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/offline.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/resize.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/resize_2.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/stopIcon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/markers/warn.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/thumbnail.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/img/wso2-logo.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/app.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/application_options.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/bootstrap-wizard-lib/LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/bootstrap-wizard-lib/bootstrap-wizard.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/bootstrap-wizard-lib/bootstrap-wizard.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/bootstrap/BOOTSTRAP_LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/bootstrap/bootstrap.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/d3/C3_LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/d3/D3_LICENSE delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/d3/c3.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/d3/d3.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/firstTemp.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/geo_exit_fence.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/geo_fencing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/geo_proximity.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/geo_remote.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/geo_speed.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/geo_stationary.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/geo_within.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/jquery/bootstrap-datepicker.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/jquery/jquery-2.1.1.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/jquery/jquery-ui-timepicker-addon.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/jquery/jquery-ui-timepicker-addon.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/jquery/jquery-ui.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet.awesome-markers.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/L.CircleEditor.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/L.Control.Focus.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/L.Control.GeoAlerts.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/L.Control.Locate.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/L.Grid.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/L.MeasuringTool.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/L.PolySideLabel.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/LICENSE_RaphaelLayer delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/Leaflet.fullscreen.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/MIT-LICENSE.txt delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/Marker.Rotate.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/images/marker-icon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/images/marker-shadow.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/leaflet.draw.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/leaflet.groupedlayercontrol.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/leaflet.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/leaflet.markercluster.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/raphael-min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/leaflet/rlayer.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/moment.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/secondTemp.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/show_alert_in_map.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/socket.io.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/typeahead.bundle.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/websocket.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.codemirror/codemirror.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.codemirror/codemirror.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.codemirror/public/css/codemirror.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.codemirror/public/js/codemirror.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.codemirror/public/js/javascript.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.data-table/data-table.json delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/editable.hbs delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/editable.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/public/css/editable.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/public/img/clear.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/public/img/loading.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/public/js/editable.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/public/js/editable.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.handlebars/handlebars.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.handlebars/handlebars.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.handlebars/public/js/handlebars-v2.0.0.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.handlebars/public/js/utils.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.qrcode/public/js/jquery.qrcode.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.qrcode/qrcode.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.qrcode/qrcode.json delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.rickshaw-graph/public/css/graph.css delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.rickshaw-graph/public/js/d3.min.js delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.rickshaw-graph/public/js/rickshaw.min.js delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.rickshaw-graph/rickshaw-graph.hbs delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.rickshaw-graph/rickshaw-graph.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.select2/select2.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/js.cookie.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/service-invoker-utility.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/service-invoker-utility.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/langs/readme.md delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/advlist/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/anchor/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/autolink/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/autoresize/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/autosave/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/bbcode/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/charmap/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/code/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/colorpicker/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/contextmenu/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/directionality/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-cool.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-cry.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-embarassed.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-foot-in-mouth.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-frown.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-innocent.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-kiss.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-laughing.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-money-mouth.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-sealed.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-smile.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-surprised.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-tongue-out.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-undecided.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-wink.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/img/smiley-yell.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/emoticons/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/example/dialog.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/example/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/example_dependency/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/fullpage/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/fullscreen/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/hr/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/image/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/imagetools/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/importcss/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/insertdatetime/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/layer/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/legacyoutput/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/link/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/lists/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/media/moxieplayer.swf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/media/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/nonbreaking/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/noneditable/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/pagebreak/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/paste/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/preview/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/print/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/save/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/searchreplace/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/spellchecker/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/tabfocus/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/table/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/template/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/textcolor/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/textpattern/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/visualblocks/css/visualblocks.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/visualblocks/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/visualchars/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/plugins/wordcount/plugin.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/content.inline.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/content.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/fonts/tinymce-small.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/fonts/tinymce-small.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/fonts/tinymce-small.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/fonts/tinymce-small.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/fonts/tinymce.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/fonts/tinymce.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/fonts/tinymce.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/fonts/tinymce.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/img/anchor.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/img/loader.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/img/object.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/img/trans.gif delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/skin.ie7.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/skins/lightgray/skin.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/themes/modern/theme.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/public/js/tinymce.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/tinymce.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.tinymce/tinymce.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.ui-permissions-utility/public/js/permissions-lib.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.ui-permissions-utility/ui-permissions-utility.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.ui-permissions-utility/ui-permissions-utility.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.ui-permissions-utility/ui-permissions-utility.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/js/notification-listing.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/templates/notification-listing-all.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/templates/notification-listing-new.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.platform.configuration/configuration.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.platform.configuration/configuration.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.platform.configuration/configuration.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.platform.configuration/public/js/platform-configuration.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.corrective-action/corrective-action.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.corrective-action/public/js/policy-corrective-action.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.corrective-action/public/templates/policy-corrective-action.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/priority.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/priority.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/priority.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/policy-priority.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/sortable-list.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/permission.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/permission.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/permission.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/public/templates/list-partial.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/public/templates/tree-template.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/public/js/bottomJs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.content.title/title.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.content.title/title.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/public/js/monetize.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/public/js/user-menu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/public/js/user-menu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/user-menu.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/user-menu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/user-menu.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.logo/logo.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.logo/logo.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.logo/logo.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.modal/modal.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.modal/modal.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.modal/public/js/modal.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/jquery.qrcode.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/templates/notifications.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.notifications/notifications.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.popover/popover.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.toggle-menu.left/left.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.toggle-menu.right/right.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-theme.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/docs.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/modal.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/js/responsive-text.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/less/theme-variables.less delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/theme.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/theme.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.title/title.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.title/title.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.title/title.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error400-cloud.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error400.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error401-cloud.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error401.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error403-cloud.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error403.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error404-cloud.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error404.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error405-cloud.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error405.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error500-cloud.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error500.html delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/cloud-favicon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo-inverse.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/images/filler.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/js/dataTables.autoFill.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/js/dataTables.autoFill.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/images/insert.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/js/dataTables.colReorder.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/js/dataTables.colReorder.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColVis/css/dataTables.colVis.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColVis/css/dataTables.colVis.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColVis/css/dataTables.colvis.jqueryui.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColVis/js/dataTables.colVis.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColVis/js/dataTables.colVis.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/FixedColumns/css/dataTables.fixedColumns.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/FixedColumns/css/dataTables.fixedColumns.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/FixedColumns/js/dataTables.fixedColumns.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/FixedColumns/js/dataTables.fixedColumns.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/FixedHeader/css/dataTables.fixedHeader.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/FixedHeader/css/dataTables.fixedHeader.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/FixedHeader/js/dataTables.fixedHeader.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/FixedHeader/js/dataTables.fixedHeader.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/KeyTable/css/dataTables.keyTable.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/KeyTable/css/dataTables.keyTable.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/KeyTable/js/dataTables.keyTable.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/KeyTable/js/dataTables.keyTable.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Responsive/css/dataTables.responsive.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Responsive/css/dataTables.responsive.scss delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Responsive/js/dataTables.responsive.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Responsive/js/dataTables.responsive.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Scroller/css/dataTables.scroller.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Scroller/css/dataTables.scroller.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Scroller/images/loading-background.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Scroller/js/dataTables.scroller.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Scroller/js/dataTables.scroller.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/css/dataTables.tableTools.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/css/dataTables.tableTools.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/collection.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/collection_hover.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/copy.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/copy_hover.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/csv.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/csv_hover.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/pdf.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/pdf_hover.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/print.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/print_hover.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/psd/collection.psd delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/psd/copy document.psd delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/psd/file_types.psd delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/psd/printer.psd delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/xls.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/images/xls_hover.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/js/dataTables.tableTools.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/js/dataTables.tableTools.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/swf/copy_csv_xls.swf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/TableTools/swf/copy_csv_xls_pdf.swf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/css/jquery.dataTables.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/css/jquery.dataTables.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/css/jquery.dataTables_themeroller.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/images/sort_asc.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/images/sort_asc_disabled.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/images/sort_both.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/images/sort_desc.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/images/sort_desc_disabled.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/js/jquery.dataTables.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/js/jquery.dataTables.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/media/js/jquery.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/dropdown.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/dropdown.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/css/select2.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/css/select2.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/az.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/bg.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/ca.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/cs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/da.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/de.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/en.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/es.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/et.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/eu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/fa.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/fi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/fr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/gl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/he.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/hi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/hr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/hu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/id.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/is.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/it.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/ko.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/lt.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/lv.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/mk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/nb.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/nl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/pl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/pt-BR.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/pt.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/ro.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/ru.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/sk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/sr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/sv.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/th.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/tr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/uk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/vi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/zh-CN.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/i18n/zh-TW.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/select2.full.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/select2.full.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/select2.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.dropdown/public/select2_4.0.0/js/select2.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/form-validation.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/form-validation.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/css/validation-style.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/additional-methods.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/additional-methods.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/jquery.validate.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/jquery.validate.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ar.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ar.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_bg.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_bg.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_bn_BD.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_bn_BD.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ca.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ca.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_cs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_cs.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_da.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_da.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_de.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_de.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_el.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_el.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_es.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_es.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_es_AR.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_es_AR.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_es_PE.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_es_PE.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_et.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_et.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_eu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_eu.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_fa.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_fa.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_fi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_fi.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_fr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_fr.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ge.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ge.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_gl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_gl.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_he.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_he.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_hr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_hr.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_hu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_hu.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_hy_AM.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_hy_AM.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_id.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_id.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_is.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_is.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_it.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_it.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ja.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ja.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ka.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ka.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_kk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_kk.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ko.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ko.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_lt.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_lt.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_lv.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_lv.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_my.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_my.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_nl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_nl.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_no.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_no.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_pl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_pl.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_pt_BR.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_pt_BR.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_pt_PT.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_pt_PT.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ro.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ro.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ru.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_ru.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_si.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_si.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sk.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sl.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sr.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sr_lat.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sr_lat.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sv.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_sv.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_th.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_th.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_tj.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_tj.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_tr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_tr.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_uk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_uk.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_vi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_vi.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_zh.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_zh.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_zh_TW.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/messages_zh_TW.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_de.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_de.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_es_CL.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_es_CL.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_fi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_fi.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_nl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_nl.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_pt.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.form-validation/public/lib/jquery-validation_1.14.0/localization/methods_pt.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/css/select2.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/css/select2.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/az.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/bg.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/ca.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/cs.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/da.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/de.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/en.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/es.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/et.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/eu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/fa.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/fi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/fr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/gl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/he.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/hi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/hr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/hu.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/id.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/is.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/it.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/ko.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/lt.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/lv.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/mk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/nb.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/nl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/pl.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/pt-BR.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/pt.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/ro.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/ru.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/sk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/sr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/sv.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/th.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/tr.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/uk.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/vi.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/zh-CN.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/i18n/zh-TW.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/select2.full.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/select2.full.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/select2.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/public/select2_4.0.0/js/select2.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/select2.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.select2/select2.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.thumbnail/public/jquery-resize_0.5.3/jquery.resize.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.thumbnail/thumbnail.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.thumbnail/thumbnail.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.message.notification/notification.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.message.notification/notification.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.message.notification/notification.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.message/message.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.message/message.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.message/message.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.actions/actions.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.actions/actions.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.breadcrumbs/breadcrumbs.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.breadcrumbs/breadcrumbs.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.nav-menu/nav-menu.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.nav-menu/nav-menu.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.notifications/notifications.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.notifications/notifications.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.popover/popover.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.popover/popover.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.toggle-menu.left/left.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.toggle-menu.left/left.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.toggle-menu.right/right.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.toggle-menu.right/right.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar/navbar.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar/navbar.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.side-pane/side-pane.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.side-pane/side-pane.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/less/theme-variables.less delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/less/theme.less delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/css/bootstrap-theme.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/css/bootstrap-theme.css.map delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/css/bootstrap-theme.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/css/bootstrap.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/css/bootstrap.css.map delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/css/bootstrap.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/fonts/glyphicons-halflings-regular.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/fonts/glyphicons-halflings-regular.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/fonts/glyphicons-halflings-regular.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/fonts/glyphicons-halflings-regular.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/fonts/glyphicons-halflings-regular.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/js/bootstrap.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/js/bootstrap.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/bootstrap_3.3.5/js/npm.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-awesome_4.3.0/css/font-awesome.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-awesome_4.3.0/css/font-awesome.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-awesome_4.3.0/fonts/FontAwesome.otf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-awesome_4.3.0/fonts/fontawesome-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-awesome_4.3.0/fonts/fontawesome-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-awesome_4.3.0/fonts/fontawesome-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-awesome_4.3.0/fonts/fontawesome-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-awesome_4.3.0/fonts/fontawesome-webfont.woff2 delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/css/font-entgra.css delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/css/font-entgra.min.css delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.eot delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.svg delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.ttf delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.woff delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.woff2 delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/icons.json delete mode 100755 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/scss/_mixin.scss delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/html5shiv_3.7.2/html5shiv.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_diagonals-thick_18_b81900_40x40.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_diagonals-thick_20_666666_40x40.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_flat_10_000000_40x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_glass_100_f6f6f6_1x400.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_glass_100_fdf5ce_1x400.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_glass_65_ffffff_1x400.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_gloss-wave_35_f6a828_500x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_highlight-soft_100_eeeeee_1x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-bg_highlight-soft_75_ffe45c_1x100.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-icons_222222_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-icons_228ef1_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-icons_ef8c08_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-icons_ffd27a_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/images/ui-icons_ffffff_256x240.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/jquery-ui.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/jquery-ui.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/jquery-ui.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/jquery-ui.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/jquery-ui.structure.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/jquery-ui.structure.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/jquery-ui.theme.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery-ui_1.11.4/jquery-ui.theme.min.css delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/jquery_1.11.0/jquery-1.11.3.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/jquery.noty.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/bottom.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/bottomCenter.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/bottomLeft.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/bottomRight.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/center.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/centerLeft.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/centerRight.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/inline.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/top.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/topCenter.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/topLeft.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/layouts/topRight.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/packaged/jquery.noty.packaged.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/packaged/jquery.noty.packaged.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/promise.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/themes/bootstrap.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/themes/default.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/noty_2.3.5/themes/relax.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/respond_1.4.2/respond.min.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Bold-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-BoldItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBold-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-ExtraBoldItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Italic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Italic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Italic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Italic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Light-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-LightItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Regular-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-Semibold-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/OpenSans/OpenSans-SemiboldItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Black-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BlackItalic-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Bold-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-BoldItalic-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Italic-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Light-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-LightItalic-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Medium-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-MediumItalic-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Regular-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-Thin-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/Roboto-ThinItalic-webfont.woff2 delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Bold-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Bold-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Bold-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Bold-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-BoldItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-BoldItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-BoldItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-BoldItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Italic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Italic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Italic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Italic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Light-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Light-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Light-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Light-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-LightItalic-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-LightItalic-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-LightItalic-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-LightItalic-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Regular-webfont.eot delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Regular-webfont.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Regular-webfont.ttf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/fonts/Roboto/RobotoCondensed-Regular-webfont.woff delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/images/favicon.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/images/loading.svg delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/images/logo-inverse.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/images/logo.png delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/js/noty-theme-wso2.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/js/theme-wso2.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.json delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/cache/.gitignore delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/cache/README.txt delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/jaggery.conf delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/dynamic-files-renderer.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/error-pages-router.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/models.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/acs.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/default-sso-intermediate-page.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/login.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/logout.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/handlebars/data-structures.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/handlebars/handlebars-v2.0.0.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/handlebars/handlebars.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/less/less-rhino-1.7.5.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/less/less.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/pages-router.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/pages.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/static-files-router.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/static-files.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/units-router.js delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/units.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/utils.js delete mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml delete mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/build.properties delete mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml deleted file mode 100644 index 5cb1195826..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - device-mgt - io.entgra.device.mgt.core - 5.0.0-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.mgt.ui - pom - WSO2 Carbon - Device Management Base UI - WSO2 Carbon - Device Management Base UI - http://wso2.org - - - - - maven-assembly-plugin - 2.5.5 - - ${project.artifactId}-${io.entgra.device.mgt.core.version} - false - - src/assembly/src.xml - - - - - create-archive - package - - single - - - - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/assembly/src.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/assembly/src.xml deleted file mode 100644 index 065aacf774..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/assembly/src.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - src - - zip - - false - ${basedir}/src - - - - ${basedir}/src/main/resources/jaggeryapps/devicemgt - /jaggeryapps/devicemgt-cdmf/ - true - - - - ${basedir}/src/main/resources/jaggeryapps/uuf-template-app - /jaggeryapps/uuf-template-app/ - true - - - ${basedir}/src/main/resources/jaggery-modules - /jaggery-modules/ - true - - - \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml deleted file mode 100644 index 14f93c74aa..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js deleted file mode 100644 index 2ee810e3aa..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Description: The response of the currently invoked api enpoint is organized - */ - -var exception = {}; -var log = new Log('exception_module'); - -(function(exception) { - /** - * - * @param message The exception description - * @param code HTTP STATUS CODE related to the exception - * @return The error object - */ - exception.buildExceptionObject = function(message, code) { - var error = {}; - error.message = message; - error.code = code; - return error; - }; - - exception.handleError = function (exception, type, code){ - var constants = require('rxt').constants; - - if (type == constants.THROW_EXCEPTION_TO_CLIENT) { - log.debug(exception); - var e = exceptionModule.buildExceptionObject(exception, code); - throw e; - } else if (type == constants.LOG_AND_THROW_EXCEPTION) { - log.error(exception); - throw exception; - } else if (type == constants.LOG_EXCEPTION_AND_TERMINATE) { - log.error(exception); - var msg = 'An error occurred while serving the request!'; - var e = exceptionModule.buildExceptionObject(msg, constants.STATUS_CODES.INTERNAL_SERVER_ERROR); - throw e; - } else if (type == constants.LOG_EXCEPTION_AND_CONTINUE) { - log.debug(exception); - } - else { - log.error(exception); - throw e; - } - }; -}(exception)) - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js deleted file mode 100644 index 94d0141bbf..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var file = {}; -(function() { - var log = new Log('utils-file'); - var CONTENT_MAP = { - 'js': 'application/javascript', - 'css': 'text/css', - 'csv': 'text/csv', - 'html': 'text/html', - 'json': 'application/json', - 'png': 'image/png', - 'jpeg': 'image/jpeg', - 'gif': 'image/gif', - 'svg': 'image/svg+xml', - 'ttf': 'application/x-font-ttf', - 'eot': 'application/vnd.ms-fontobject', - 'woff': 'application/font-woff', - 'otf': 'application/x-font-otf', - 'zip': 'application/zip', - 'xml': 'text/xml', - 'xhtml': 'application/xhtml+xml', - 'pdf': 'application/pdf' - }; - /** - * The function checks whether a directory contains a particular file - * @param dir The directory in which the file must be checked - * @param file A File object if the file exists,else null - */ - file.getFileInDir = function(dir, fileName) { - var isFilePresent = false; - var files = dir.listFiles(); - for (var index in files) { - if (files[index].getName() == fileName) { - return files[index]; - } - } - return null; - }; - /** - * The function returns the file extension of a filename - * @param file - * @return: The extension of the file - */ - file.getExtension = function(file) { - var baseFileName = file.getName(); - //Break up the name by . - var baseNameComponents = baseFileName.split('.'); - var extension = baseNameComponents[baseNameComponents.length - 1]; - return extension; - }; - /** - * The function obtains the MIME type based on the extension - * @param The extension - * @return The mime type - */ - file.getMimeType = function(extension) { - return CONTENT_MAP[extension]; - }; - /** - * The function returns the name of the file without the file extension - * @param file A file object - * @return: The name of the file without the extension - */ - file.getFileName = function(file) { - //Get the name of the file - var baseFileName = file.getName(); - //Break up the name by . - var baseNameComponents = baseFileName.split('.'); - //Get all of the components except the last one - baseNameComponents.splice(baseNameComponents.length - 1, 1); - return baseNameComponents.join('.'); - }; - /** - * The function returns the contents of a directory as a JSON object.The name of the - * file is used as the property names without the extensions. - * NOTE: The method will not traverse sub folders. - * @param The directory to be inspected - * @return A JSON object which contains the files in the directory - */ - file.getDirectoryContents = function(dir) { - var dirContents = {}; - //Check if it is a directory - if (!dir.isDirectory()) { - log.info('Not a directory'); - return dirContents; - } - //Obtain a list of all files - var files = this.getAllFiles(dir); - var name; - log.info('Files: ' + files); - //Create the directory object with each file been a property - for (var index in files) { - dirContents[this.getFileName(files[index])] = files[index]; - } - return dirContents; - }; - /** - * The function obtains a list of files that are not directories - * @param dir The directory to be inspected - * @return An array with all of the files in the directory - */ - file.getAllFiles = function(dir) { - var filesInDir = []; - if (!dir.isDirectory()) { - return filesInDir; - } - //Obtain a list of all files - var files = dir.listFiles(); - for (var index in files) { - log.info('Checking file: ' + files[index].getName()); - //Check if the file is a directory - if (!files[index].isDirectory()) { - filesInDir.push(files[index]); - } - } - return filesInDir; - }; - /** - * The function returns a list of all file names in a directory - * @param dir The directory to be inspected - * @return {An array containing the name of all files in a directory - */ - file.getAllFileNames = function(dir) { - var files = dir.listFiles(); - var list = []; - var fileName; - for (var index in files) { - if (files[index].isDirectory()) { - fileName=this.getFileName(files[index].getName()); - list.push(fileName); - } - } - return list; - }; - /** - * The function returns a list of all sub directories in a given directory - * @param dir The root directory - * @return: An array containing all sub directories - */ - file.getAllSubDirs = function(dir) { - var files = dir.listFiles(); - var subDirs = []; - for (var index in files) { - if (files[index].isDirectory()) { - subDirs.push(files[index]); - } - } - return subDirs; - }; -}()); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js deleted file mode 100644 index 635be4a5fd..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var patterns = {}; - -(function () { - - var DEF_ERR_ARITY = 3; - var DEF_HANDLE_ARITY = 2; - var log = new Log('utils.patterns.GenericPipe'); - - function GenericPipe(options) { - this.errHandlerArity = DEF_ERR_ARITY || options.errArity; - this.handlerArity = DEF_HANDLE_ARITY || options.handlerArity; - this.plugins = []; - this.finalHandler = function () { - }; - } - - - /** - *The function registers the provided plugin - */ - GenericPipe.prototype.plug = function (plugin, options) { - var options = options || {}; - //Only a function - if (plugin instanceof Function) { - this.plugins.push({ - handle: plugin, - options: options - }); - } - //Is it a plugin object - else if (plugin instanceof Object) { - plugin.options = options; - this.plugins.push(plugin); - } - - return this; - }; - - GenericPipe.prototype.finally = function (plugin) { - this.finalHandler = plugin; - return this; - }; - - GenericPipe.prototype.resolve = function (data, req, res, session) { - var context = {}; - context.req = req; - context.res = res; - context.session = session; - context.data = data; - handle(context, this.plugins, this.errHandlerArity, this.handlerArity, this.finalHandler); - }; - - var handle = function (context, plugins, errArity, handlerArity, finallyHandler) { - var index = 0; - var currentPlugin; - - var recursiveHandle = function (err) { - - currentPlugin = plugins[index]; - - index++; - - //Check if there is a plugin - if (!currentPlugin) { - //log.warn('No plugin found at index: ' + index); - return; - } - - //Populate the options object for the plugin - context.options=currentPlugin.options;; - - //Check if an error has been provided - if (err) { - //Can the current plugin handle the err - if (currentPlugin.handle.length == errArity) { - try { - currentPlugin.handle(err, context,recursiveHandle); - } - catch (e) { - recursiveHandle(e); - } - } - else { - recursiveHandle(err); - } - } - //There is no error so try to invoke the current plugin - else { - if (currentPlugin.handle.length == handlerArity) { - try { - - - currentPlugin.handle(context,recursiveHandle); - } catch (e) { - recursiveHandle(e); - } - } - else { - recursiveHandle(); - } - } - }; - - recursiveHandle(); - finallyHandler(context); - }; - - patterns.GenericPipe = GenericPipe; - -}()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js deleted file mode 100644 index 5f290ddae9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var reflection = {}; -/** - * Description: The script encapsulates any reflection related utility functions - */ -(function() { - var log = new Log('utils-reflection'); - reflection.copyPropKeys = function(from, to) { - for (var key in from) { - if (from.hasOwnProperty(key)) { - to[key] = ''; - } - } - return to; - }; - /** - * The function recursively copies all property keys in an object - * @param from - * @param to - */ - reflection.copyAllPropKeys = function(from, to) { - recurse(from, to, function(from, to, key) { - if (from[key] instanceof Object) { - to[key] = from[key]; - } else { - to[key] = null; - } - }); - }; - reflection.copyAllPropValues = function(from, to) { - recurse(from, to, function(from, to, key) { - //Create an instance if the property does not exist - if (!to[key]) { - to[key] = {}; - } - //Copy the values over - if (!(from[key] instanceof Object)) { - to[key] = from[key]; - } else { - log.debug('Not copying values of key: ' + key); - } - }); - }; - /** - * The function will only copy public properties - * @param from - * @param to - */ - reflection.copyPublicPropValues = function(from, to) { - recurse(from, to, function(from, to, key) { - //Ignore any hidden properties - if (key.charAt(0) == '_') { - log.warn('Drop key: ' + key); - return; - } - //Create an instance if the property does not exist - if (!to[key]) { - to[key] = {}; - } - //Copy the values over - if (!(from[key] instanceof Object)) { - to[key] = from[key]; - } else { - log.warn('Not copying values of key: ' + key); - } - }); - }; - reflection.inspect = function(from, to, cb) { - recurse(from, to, cb); - }; - /** - * The function recursively traverses an object and then invokes the provided - * callback - * @param root - * @param clone - * @param cb - */ - var recurse = function(root, clone, cb) { - var key; - //Check if the root is an object - if (!(root instanceof Object)) { - return; - } else { - var keys = Object.keys(root); - //Go through all the other keys in the current root - for (var index in keys) { - key = keys[index]; - cb(root, clone, key); - recurse(root[key], clone[key], cb); - } - } - }; - reflection.copyProps = function(from, to) { - for (var key in from) { - if (from.hasOwnProperty(key)) { - to[key] = from[key]; - } - } - return to; - }; - reflection.getProps = function(obj) { - var props = {}; - for (var key in obj) { - if (!(obj[key] instanceof Function)) { - props[key] = obj[key]; - } - } - return props; - }; - reflection.printProps = function(obj) { - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - log.info('key: ' + key); - } - } - }; - /** - * The function determines if a property is hidden based on _ - * @param key - * @returns {boolean} - */ - reflection.isHiddenProp = function(key) { - if (key == '') { - return false; - } - return (key.charAt(0) == '_') ? true : false; - }; - var getDiff = function(a, b, diff) {}; - /** - * The function calculates the differences between two simple JSON objects - * @param a The object with which b is compared - * @param b The target of the comparison - * @return An object which records the differences between the two objects - */ - reflection.diff = function(a, b) {}; - /** - * The function merges the two provided objects to create a new - * object.In the case where b has the same property as a; the property of b - * will have precedence - * @param {[type]} a [description] - * @param {[type]} b [description] - * @return A new object having the properties of both object a and b - */ - reflection.merge = function(a, b) { - var newObj = {}; - //Copy the properties of a first - for (var key in a) { - newObj[key] = b[key]; - } - //Override with the properties of b - for (var key in b) { - newObj[key] = b[key]; - } - return newObj; - }; - /** - * The function allows a child class to override a select set of methods of - * a parent class.The original methods of the parent can be accessed - * using the this._super keyword - * @param {[type]} parent The parent class instance to be overriden - * @param {[type]} child The child class instance containing methods which will override the parent - */ - reflection.override = function(parent, child) { - //Make a clone of the parent - var super = parse(stringify(parent)); - for (var childKey in child) { - for (var parentKey in parent) { - //Only override those methods that are common - if (childKey === parentKey) { - var parentPtr = parent[parentKey]; - var childPtr = child[childKey]; - //Update the clone with the old parent method - super[parentKey] = parentPtr; - parent[parentKey] = childPtr; - /*parent[parentKey] = function() { - var result=childPtr.apply(this, arguments)||null; - return result; - };*/ - } - } - } - //Allow the child object to call methods of the parent - parent._super = super; - }; - reflection.overrideAll=function(parent,child){ - //Make a clone of the parent - var super = parse(stringify(parent)); - for (var childKey in child) { - for (var parentKey in parent) { - //Only override those methods that are common - if ( (child.hasOwnProperty(childKey))&&(parent.hasOwnProperty(parentKey)) ) { - var parentPtr = parent[parentKey]; - var childPtr = child[childKey]; - //Update the clone with the old parent method - super[parentKey] = parentPtr; - parent[parentKey] = childPtr; - /*parent[parentKey] = function() { - var result=childPtr.apply(this, arguments)||null; - return result; - };*/ - } - } - } - //Allow the child object to call methods of the parent - parent._super = super; - }; - reflection.isArray = function(object) { - if (Object.prototype.toString.call(object) === '[object Array]') { - return true; - } - return false; - }; -}()); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js deleted file mode 100644 index dd8aba4a59..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var request = {}; -(function(request) { - var hasOwnProperty = function(obj, element) { - return Object.prototype.hasOwnProperty.call(obj, element); - }; - var isObject = function(object) {; - return typeof object === 'object'; - }; - /* - * ECMA Standard (ECMA-262 : 5.1 Edition)*/ - var decodes = function(encodedURI) { - return decodeURIComponent(encodedURI); - }; - request.getQueryOptions = function(queryString) { - var opt={}; - var sep = opt.sep || '&', - assign = opt.assign || '=', - compoArray = []; - var obj = {}; - var decodedURI = decodes(queryString); - decodedURI.split(sep).forEach(function(comp) { - comp.split(assign).some(function(element, index, array) { - if (hasOwnProperty(obj, element.toString())) { - compoArray.push(obj[element]); - compoArray.push(array[1]); - obj[element] = compoArray; - } else { - Object.defineProperty(obj, element, { - enumerable: true, - writable: true, - value: array[1] - }); - } - return true; - }); - }); - return obj; - }; -}(request)) \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js deleted file mode 100644 index 0887f9b8cf..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Description: The response of the currently invoked api endpoint is organized - */ - -var response = {}; -var log = new Log("response"); - -(function(response) { - - /** - * Build Error response - * @param resp jaggery-response object to retrieve to client - * @param code status code - * @param message message to the client side - * @return return response - */ - response.buildErrorResponse = function(resp,code,message) { - var content={}; - content.error = message; - resp = processResponse(resp,code,content); - return resp; - }; - - /** - * Build success response - * @param resp jaggery response object - * @param code status code - * @param data the result to client - * @return return response - */ - response.buildSuccessResponse= function(resp, code, data){ - var content={}; - content.data = data; - resp = processResponse(resp,code,content); - return resp; - }; - - /** - * process General response - * @param resp jaggery response - * @param code status code - * @param data success result - * @return resp jaggery response - */ - response.buildSuccessResponseForRxt= function(resp, code, data){ - resp.status = code; - resp.content = data; - return resp; - }; - - /** - * General response builder - * @param resp jaggery response - * @param code status code - * @param content what ever the content to be sent as response - * @return resp jaggery response - */ - function processResponse(resp, code, content){ - resp.status = code; - resp.contentType = 'application/json'; - resp.content = content; - return resp; - - }; - - /** - * - * @param resp - * @param code - * @param data - * @return The http response - */ - response.buildSuccessResponseForRxt= function(resp, code, data){ - resp.contentType = 'application/json'; - resp.status = code; - resp.content = data; - return resp; - }; - -}(response)) \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js deleted file mode 100644 index e696ba3dd3..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var time = {}; -(function(time) { - time.getCurrentTime = function(dateLength) { - var dateLength=dateLength||20; - var now = new String(new Date().valueOf()); - var length = now.length; - var prefix = dateLength; - var onsetVal = ''; - if (length != prefix) { - var onset = prefix - length; - for (var i = 0; i < onset; i++) { - onsetVal += '0'; - } - } - return onsetVal + now; - }; -}(time)); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js deleted file mode 100644 index a725a15aca..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var url = {}; -(function() { - var log=new Log('utils-url'); - url.popServerDetails = function(obj) { - var process = require('process'); - var localIP = process.getProperty('server.host'); - var httpPort = process.getProperty('http.port'); - var httpsPort = process.getProperty('https.port'); - var value = ''; - var carbonLocalIP = process.getProperty('carbon.local.ip'); - - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - value = obj[key]; - if ((typeof value === 'string') && value.indexOf('%https.host%') > -1) { - value=value.replace('%https.host%', 'https://' + localIP + ':' + httpsPort); - } else if ((typeof value === 'string') && value.indexOf('%http.host%') > -1) { - value=value.replace('%http.host%', 'http://' + localIP + ':' + httpPort); - } else if ((typeof value === 'string') && value.indexOf('%https.carbon.local.ip%') > -1) { - value=value.replace('%https.carbon.local.ip%', 'https://' + carbonLocalIP + ':' + httpsPort); - } else if ((typeof value === 'string') && value.indexOf('%http.carbon.local.ip%') > -1) { - value=value.replace('%http.carbon.local.ip%', 'http://' + carbonLocalIP + ':' + httpPort); - } - obj[key] = value; - } - } - return obj; - }; -}(url)); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js deleted file mode 100644 index 19c3f52892..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var xml = {}; - -(function () { - - var log=new Log('util.xml') - - /* - The method is used to create a JSON object using - an xml object. - @xmlElement: An xml element object to be processed - @return: A pseudo object containing the properties of the - xml element. - */ - var createJSONObject = function (xmlElement) { - - var pseudo = {}; - - //Extract all attributes - var attributes = xmlElement.@*; - - //Fill the pseudo object with the attributes of the element - for (var attributeKey in attributes) { - var attribute = attributes[attributeKey]; - pseudo[attribute.localName()] = attribute.toString(); - } - - return pseudo; - }; - - /* - The function converts an E4X Xml object to a JSON object - This function has been adapted from the work of Oleg Podsechin available at - https://gist.github.com/olegp/642667 - It uses a slightly modified version of his algorithm , therefore - all credit should be attributed to Oleg Podsechin. - IMPORTANT: - 1. It does not create a 1..1 mapping due to the differences - between Xml and JSON.It is IMPORTANT that you verify the structure - of the object generated before using it. - 2. The input xml object must not contain the xml header information - This is a known bug 336551 (Mozilla Developer Network) - Source: https://developer.mozilla.org/en/docs/E4X - Please remove the header prior to sending the xml object for processing. - @root: A starting element in an E4X Xml object - @return: A JSON object mirroring the provided Xml object - */ - var recursiveConvertE4XtoJSON = function (root) { - - log.debug('Root: ' + root.localName()); - - //Obtain child nodes - var children = root.*; - - //The number of children - var numChildren = children.length(); - - //No children - if (numChildren == 0) { - - //Extract contents - return createJSONObject(root); - } - else { - - //Create an empty object - var rootObject = createJSONObject(root); - - //Could be multiple children - for (var childElementKey in children) { - - var child = children[childElementKey]; - - log.debug('Examining child: ' + child.localName()); - - //If the child just contains a single value then stop - if (child.localName() == undefined) { - - log.debug('Child is undefined: ' + child.toString()); - - //Change the object to just a key value pair - rootObject[root.localName()] = child.toString(); - return rootObject; - } - - //Make a recursive call to construct the child element - var createdObject = recursiveConvertE4XtoJSON(child); - - log.debug('Converted object: ' + stringify(createdObject)); - - //Check if the root object has the property - if (rootObject.hasOwnProperty(child.localName())) { - - log.debug('key: ' + child.localName() + ' already present.'); - rootObject[child.localName()].push(createdObject); - } - else { - - log.debug('key: ' + child.localName() + ' not present.'); - rootObject[child.localName()] = []; - rootObject[child.localName()].push(createdObject); - - } - } - - log.debug('root: ' + root.localName()); - - return rootObject; - } - }; - - /** - * The function is used to convert an E4X xml to JSON - * @param root - */ - xml.convertE4XtoJSON = function (root) { - return recursiveConvertE4XtoJSON(root); - }; - - -}()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag deleted file mode 100644 index 58e5099007..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag +++ /dev/null @@ -1,113 +0,0 @@ -<% -/* - * 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. - */ - -var log = new Log("api/data-tables-invoker-api.jag"); - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; -var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; -var utility = require("/app/modules/utility.js")["utility"]; -var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; -var EnrolmentInfo = Packages.io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; - -var DTYPE_CONF_DEVICE_TYPE_KEY = "deviceType"; -var DTYPE_CONF_DEVICE_TYPE_LABEL_KEY = "label"; - -function appendQueryParam (url, queryParam , value) { - if (url.indexOf("?") > 0) { - return url + "&" + queryParam + "=" + value; - } - return url + "?" + queryParam + "=" + value; -} - -if (uriMatcher.match("/{context}/api/data-tables/invoker/filters")) { - var result = {}; - var i; - //Fetching Status types - var status = EnrolmentInfo.Status.values(); - var statusArr = []; - for(i = 0; i < status.length; i++){ - statusArr.push(status[i].name()); - } - result.status = statusArr; - //Fetching Ownership types - var ownership = EnrolmentInfo.OwnerShip.values(); - var ownershipArr = []; - for(i = 0; i < ownership.length; i++){ - ownershipArr.push(ownership[i].name()); - } - result.ownership = ownershipArr; - //Fetching Device Types - result.deviceTypes = []; - var deviceTypesRes = deviceModule.getDeviceTypes(); - if (deviceTypesRes.status === "success") { - var deviceTypes = deviceTypesRes["content"]; - for (i = 0; i < deviceTypes.length; i++) { - var deviceTypeName = deviceTypes[i].name; - var deviceTypeLabel = deviceTypeName.charAt(0).toUpperCase() + deviceTypeName.slice(1); - var configs = utility.getDeviceTypeConfig(deviceTypeLabel); - if (configs) { - if (configs[DTYPE_CONF_DEVICE_TYPE_KEY][DTYPE_CONF_DEVICE_TYPE_LABEL_KEY]) { - deviceTypeLabel = configs[DTYPE_CONF_DEVICE_TYPE_KEY][DTYPE_CONF_DEVICE_TYPE_LABEL_KEY]; - } - } - result.deviceTypes.push({"name": deviceTypeLabel, "value": deviceTypeName}); - } - } - //Adding policy compliance - result.compliance = ["MONITOR", "ENFORCE", "WARN", "BLOCK"]; - result.depStatus = ["Empty", "Assigned", "Pushed", "Removed"]; - response["status"] = 200; - response["content"] = result; - response["contentType"] = "application/json"; -} else if (uriMatcher.match("/{context}/api/data-tables/invoker")) { - var url = request.getParameter("url"); - var targetURL = devicemgtProps["httpsURL"] + request.getParameter("url"); - //noinspection JSUnresolvedFunction getAllParameters - var allParams = request.getAllParameters(); - - for (var allParamsKey in allParams) { - if (allParams.hasOwnProperty(allParamsKey)) { - if (allParamsKey == "limit" || allParamsKey == "offset") { - targetURL = appendQueryParam(targetURL, allParamsKey, allParams[allParamsKey]); - } else if (allParamsKey == "filter") { - if (allParams[allParamsKey]) { - var searchPayload = JSON.parse(allParams[allParamsKey]); - for (var searchPayloadKey in searchPayload) { - if (searchPayload.hasOwnProperty(searchPayloadKey)) { - targetURL = appendQueryParam(targetURL, searchPayloadKey, searchPayload[searchPayloadKey]); - } - } - } - } - } - } - - serviceInvokers.XMLHttp.get( - targetURL, - // response callback - function (backendResponse) { - response["status"] = backendResponse["status"]; - response["content"] = utility.encodeJson(backendResponse["responseText"]); - response["contentType"] = "application/json"; - } - ); -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/device-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/device-api.jag deleted file mode 100644 index a214f536e9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/device-api.jag +++ /dev/null @@ -1,227 +0,0 @@ -<% -/* - * Copyright (c) 2016, 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. - */ - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var log = new Log("api/device-api.jag"); -var constants = require("/app/modules/constants.js"); -var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; -var utility = require("/app/modules/utility.js").utility; -var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; -var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; -var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - -var user = session.get(constants.USER_SESSION_KEY); -var result; - -response.contentType = 'application/json'; - -if (!user) { - response.sendRedirect("/devicemgt/login?#login-required"); - exit(); -} else { - if (uriMatcher.match("/{context}/api/devices/sketch/download")) { - // works as a proxy to pass the relavant query string to back end api. - var queryString = request.getQueryString(); - if (!queryString) { - queryString = ""; - } else { - queryString = "?" + queryString; - } - - var deviceType = request.getParameter("deviceType"); // need a better solution here - deviceTypeConfig = utility.getDeviceTypeConfig(deviceType); - if (deviceTypeConfig && deviceTypeConfig.deviceType.downloadAgentUri) { - hearders = [{"name": constants["ACCEPT_IDENTIFIER"], "value": constants["APPLICATION_ZIP"]}]; - sketchDownloadEndPoint = devicemgtProps["httpsURL"] + "/" + deviceTypeConfig.deviceType.downloadAgentUri; - serviceInvokers.HttpClient.get(sketchDownloadEndPoint + queryString, function (responsePayload, responseHeaders) { - if (responseHeaders) { - for (var i = 0; i < responseHeaders.length; i++) { - var header = responseHeaders[i]; - var headerName = String(header.getName()); - var headerValue = String(header.getValue()); - response.addHeader(headerName, headerValue); - } - var streamObject = new Stream(responsePayload); - print(streamObject); - } else { - return responsePayload; - } - }, function (responsePayload) { - log.error(responsePayload); - var response = {}; - response["status"] = "error"; - return response; - } - , hearders); - } else { - result = 400; - } - } else if (uriMatcher.match("/{context}/api/devices/sketch/generate_link")) { - - if (!request.getContent()){ - log.error("Request Payload Is Empty"); - // HTTP status code 400 refers to - Bad request. - result = 400; - } else{ - deviceType = request.getContent()["deviceType"]; - queryString = "?deviceName=" + request.getContent()["deviceName"] +"&deviceType="+ - request.getContent()["deviceType"]+"&sketchType="+request.getContent()["sketchType"]; - deviceTypeConfig = utility.getDeviceTypeConfig(deviceType); - if (deviceTypeConfig && deviceTypeConfig.deviceType.downloadAgentUri) { - - sketchDownloadEndPoint = devicemgtProps["httpsURL"] + "/" + deviceTypeConfig.deviceType.downloadAgentUri; - - var requestUrl = sketchDownloadEndPoint + queryString - result = "curl -k -o "+request.getContent()["deviceName"]+".zip -H \"Authorization: Bearer " - +JSON.parse(session.get(constants["TOKEN_PAIR"])).accessToken+"\" " +"'"+requestUrl+"'"; - - } else { - // HTTP status code 400 refers to - Bad request. - result = 400; - } - } - - } else if (uriMatcher.match("/{context}/api/devices/all")) { - result = deviceModule.getOwnDevices(); - - } else if (uriMatcher.match("/{context}/api/devices/count")) { - var count = deviceModule.getOwnDevicesCount().data; - result = count.toString(); - - } else if (uriMatcher.match("/{context}/api/devices/types")) { - result = deviceModule.listDeviceTypes(); - - } else if (uriMatcher.match("/{context}/api/devices/{deviceType}/{deviceId}/remove")) { - var elements = uriMatcher.elements(); - var deviceId = elements.deviceId; - var deviceType = elements.deviceType; - result = deviceModule.removeDevice(deviceType, deviceId); - - } else if (uriMatcher.match("/{context}/api/devices/{deviceType}/{deviceId}/update")) { - var elements = uriMatcher.elements(); - var deviceId = elements.deviceId; - var deviceType = elements.deviceType; - var deviceName = request.getParameter("name"); - result = deviceModule.updateDevice(deviceType, deviceId, deviceName); - } else if (uriMatcher.match("/{context}/api/devices")) { - var url = request.getParameter("url"); - var draw = request.getParameter("draw"); - var length = request.getParameter("length"); - var start = request.getParameter("start"); - var search = request.getParameter("search[value]"); - var deviceName = request.getParameter("columns[1][search][value]"); - var owner = request.getParameter("columns[2][search][value]"); - var status = request.getParameter("columns[3][search][value]"); - var platform = request.getParameter("columns[4][search][value]"); - var ownership = request.getParameter("columns[5][search][value]"); - var targetURL; - - function appendQueryParam (url, queryParam , value) { - if (url.indexOf("?") > 0) { - return url + "&" + queryParam + "=" + value; - } - return url + "?" + queryParam + "=" + value; - } - targetURL = devicemgtProps.httpsURL + request.getParameter("url"); - targetURL = appendQueryParam(targetURL, "draw", draw); - targetURL = appendQueryParam(targetURL, "start", start); - targetURL = appendQueryParam(targetURL, "length", length); - - if (search && search !== "") { - targetURL = appendQueryParam(targetURL, "search", search); - } - - if (deviceName && deviceName !== "") { - targetURL = appendQueryParam(targetURL, "device-name", deviceName); - } - - if (owner && owner !== "") { - targetURL = appendQueryParam(targetURL, "user", owner); - } - - if (status && status !== "") { - targetURL = appendQueryParam(targetURL, "status", status); - } - - if (platform && platform !== "") { - targetURL = appendQueryParam(targetURL, "type", platform); - } - - if (ownership && ownership !== "") { - targetURL = appendQueryParam(targetURL, "ownership", ownership); - } - - serviceInvokers.XMLHttp.get( - targetURL, function (responsePayload) { - response.status = 200; - result = responsePayload; - }, - function (responsePayload) { - response.status = responsePayload.status; - result = responsePayload.responseText; - }); - } else if (uriMatcher.match("/{context}/api/devices/")) { - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/list")) { - result = deviceModule.listDevices(); - } else { - response.sendError(403); - } - } else if (uriMatcher.match("/{context}/api/devices/{type}/{deviceId}")) { - elements = uriMatcher.elements(); - deviceId = elements.deviceId; - type = elements.type; - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/list")) { - result = deviceModule.viewDevice(type, deviceId); - }else { - response.sendError(403); - } - } else if (uriMatcher.match("/{context}/api/devices/agent/{type}/{deviceId}/config")) { - elements = uriMatcher.elements(); - deviceId = elements.deviceId; - type = elements.type; - operation = elements.operation; - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device")) { - result = deviceModule.getDeviceAgentConfig(type, deviceId); - if (!result) { - response.sendError(500); - } - } else { - response.sendError(403); - } - } else if (uriMatcher.match("{context}/api/devices/{type}/{deviceId}/{operation}")) { - elements = uriMatcher.elements(); - deviceId = elements.deviceId; - type = elements.type; - operation = elements.operation; - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/operation")) { - result = deviceModule.performOperation(deviceId, operation, [], type); - } else { - response.sendError(403); - } - } -} - -// Returning the result. -if (result) { - print(result); -} - -%> \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/enterprise.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/enterprise.jag deleted file mode 100644 index b131ac6ab3..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/enterprise.jag +++ /dev/null @@ -1,138 +0,0 @@ -<% -var log = new Log("api/enterprise.jag"); - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var constants = require("/app/modules/constants.js"); -var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; -var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; -var restAPIRequestDetails = request.getContent(); -var result; -var user = session.get(constants.USER_SESSION_KEY); - -// This checks if the session is valid -getAccessToken = function() { - if (session) { - var tokenPair = session.get(constants["TOKEN_PAIR"]); - if (tokenPair) { - return parse(tokenPair)["accessToken"]; - } - } - return null; -}; - -callBackend = function(url, token, method, payload) { - var xmlHttpRequest = new XMLHttpRequest(); - xmlHttpRequest.open(method, url); - xmlHttpRequest.setRequestHeader(constants["AUTHORIZATION_HEADER"], constants["BEARER_PREFIX"] + token); - xmlHttpRequest.setRequestHeader(constants["CONTENT_TYPE_IDENTIFIER"], constants["APPLICATION_JSON"]); - xmlHttpRequest.setRequestHeader(constants["ACCEPT_IDENTIFIER"], constants["APPLICATION_JSON"]); - if (payload) { - xmlHttpRequest.send(payload); - } else { - xmlHttpRequest.send(); - } - response["status"] = xmlHttpRequest["status"]; - if (xmlHttpRequest["responseText"]) { - result = xmlHttpRequest["responseText"]; - response["content"] = xmlHttpRequest["responseText"]; - } -}; - -var accessToken = getAccessToken(); -if (!user || accessToken == null) { - response.sendRedirect("/devicemgt/login?#login-required"); - exit(); -} else { - response.contentType = 'application/json'; - if (uriMatcher.match("/{context}/api/enterprise/token")) { - session.put("externalEndpoint", restAPIRequestDetails["endpoint"]); - session.put("externalToken", restAPIRequestDetails["externalToken"]); - log.info("Calling get token"); - callBackend(restAPIRequestDetails["endpoint"], session.get("externalToken"), "POST", restAPIRequestDetails); - if (response["status"] && response["status"] == 200) { - var completionToken = parse(result)["completionToken"]; - if (completionToken) { - log.info("Token received"); - session.put("completionToken", completionToken) - } - } - } else if (uriMatcher.match("/{context}/api/enterprise/enroll-complete")) { - var tokenEndpoint = session.get("externalEndpoint") - var enterpriseEndpoint = tokenEndpoint.replace("signup-url", "complete-signup"); - - var completionToken = session.get("completionToken"); - var enterpriseToken = request.getParameter("enterpriseToken"); - - log.debug("completionToken" + completionToken + ", enterpriseEndpoint" + enterpriseEndpoint + - ", enterpriseToken" + enterpriseToken); - - var requestPayload = {} - requestPayload.completionToken = completionToken; - requestPayload.enterpriseToken = enterpriseToken; - log.info("Calling complete-signup"); - callBackend(enterpriseEndpoint, session.get("externalToken"), "POST", requestPayload); - - var enterpriseId = parse(result)["id"]; - if (enterpriseId) { - log.info("Calling complete-signup success"); - var serviceAccountRequest = {}; - serviceAccountRequest.enterpriseId = enterpriseId; - serviceAccountRequest.keyType = "googleCredentials" - - var enterpriseEndpoint = tokenEndpoint.replace("signup-url", "create-esa"); - - log.info("Calling create-esa"); - callBackend(enterpriseEndpoint, session.get("externalToken"), "POST", serviceAccountRequest); - var data = parse(result)["data"]; - log.info("Calling create-esa success" + data); - - var androidConfigAPI = devicemgtProps["httpsURL"] + "/api/device-mgt/android/v1.0/configuration"; - log.info("fetching platform configs"); - callBackend(androidConfigAPI, accessToken, "GET"); - - var configurationsList = parse(result); - - for (var x = 0; x < configurationsList.configuration.length; x++) { - if (configurationsList.configuration[x].name == "esa" || configurationsList.configuration[x].name == "enterpriseId") { - configurationsList.configuration.splice(x, 1); - } - } - log.info("fetching platform configs success"); - var payloadToAdd = {}; - payloadToAdd.contentType = "text"; - payloadToAdd.name = "esa"; - payloadToAdd.value = data; - - var enterpriseIdPayload = {}; - enterpriseIdPayload.contentType = "text"; - enterpriseIdPayload.name = "enterpriseId"; - enterpriseIdPayload.value = enterpriseId; - - configurationsList.configuration[configurationsList.configuration.length] = payloadToAdd; - configurationsList.configuration[configurationsList.configuration.length] = enterpriseIdPayload; - - log.info("saving platform configs"); - callBackend(androidConfigAPI, accessToken, "PUT", configurationsList); - log.info("saving platform configs success"); - if (response["status"] == 200) { - log.info("Process successful!! Redirecting..."); - response.sendRedirect("/devicemgt/platform-configuration?enterprise-success=true"); - } - } - } else if (uriMatcher.match("/{context}/api/enterprise/unenroll")) { - session.put("externalEndpoint", restAPIRequestDetails["endpoint"]); - session.put("externalToken", restAPIRequestDetails["externalToken"]); - callBackend(restAPIRequestDetails["endpoint"], session.get("externalToken"), "GET", restAPIRequestDetails); - log.info("Calling unenroll"); - if (response["status"] == 200) { - log.info("Unenroll success, wiping devices."); - var wipeURL = devicemgtProps["httpsURL"] + "/api/device-mgt/android/v1.0/enterprise/wipe-device" - callBackend(wipeURL, accessToken, "GET"); - } - } - -} - -%> diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/group-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/group-api.jag deleted file mode 100644 index 2ba4ebba9e..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/group-api.jag +++ /dev/null @@ -1,87 +0,0 @@ -<% -/* - * Copyright (c) 2016, 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. - */ - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var log = new Log("api/device-api.jag"); -var constants = require("/app/modules/constants.js"); -var utility = require("/app/modules/utility.js").utility; -var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; -var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - -var user = session.get(constants.USER_SESSION_KEY); -var result; - -response.contentType = 'application/json'; - -if (!user) { - response.sendRedirect("/devicemgt/login?#login-required"); - exit(); -} else { - if (uriMatcher.match("/{context}/api/groups")) { - var url = request.getParameter("url"); - var draw = request.getParameter("draw"); - var length = request.getParameter("length"); - var start = request.getParameter("start"); - var search = request.getParameter("search[value]"); - var groupName = request.getParameter("columns[1][search][value]"); - var owner = request.getParameter("columns[2][search][value]"); - var targetURL; - - function appendQueryParam(url, queryParam, value) { - if (url.indexOf("?") > 0) { - return url + "&" + queryParam + "=" + value; - } - return url + "?" + queryParam + "=" + value; - } - - targetURL = devicemgtProps.httpsURL + request.getParameter("url"); - targetURL = appendQueryParam(targetURL, "start", start); - targetURL = appendQueryParam(targetURL, "length", length); - - if (search && search !== "") { - targetURL = appendQueryParam(targetURL, "search", search); - } - - if (groupName && groupName !== "") { - targetURL = appendQueryParam(targetURL, "group-name", groupName); - } - - if (owner && owner !== "") { - targetURL = appendQueryParam(targetURL, "user", owner); - } - - serviceInvokers.XMLHttp.get( - targetURL, function (responsePayload) { - response.status = 200; - result = responsePayload; - }, - function (responsePayload) { - response.status = responsePayload.status; - result = responsePayload.responseText; - }); - } -} - -if (result) { - print(result); -} - -%> \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag deleted file mode 100644 index 8ac28da95f..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag +++ /dev/null @@ -1,119 +0,0 @@ -<% -/* - * 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. - */ - -var log = new Log("api/invoker-api.jag"); - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var constants = require("/app/modules/constants.js"); -var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; -var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - -if (uriMatcher.match("/{context}/api/invoker/execute/")) { - //NOTE: We are only interested in Content-Type headers. Appending all request headers to the back-end call - // will cause unforeseen security issues. - var contentType = request.getHeader(constants.CONTENT_TYPE_IDENTIFIER); - var acceptType = request.getHeader(constants.ACCEPT_IDENTIFIER); - var requestHeaders = []; - requestHeaders.push({"name": constants.CONTENT_TYPE_IDENTIFIER, "value" : contentType}); - requestHeaders.push({"name": constants.ACCEPT_IDENTIFIER, "value" : acceptType}); - - var restAPIRequestDetails = request.getContent(); - - var requestMethod = restAPIRequestDetails["requestMethod"]; - var requestURL = restAPIRequestDetails["requestURL"]; - var requestPayload = restAPIRequestDetails["requestPayload"]; - - if (!requestMethod) { - requestMethod = parse(restAPIRequestDetails)["requestMethod"]; - } - - if (!requestURL) { - requestURL = parse(restAPIRequestDetails)["requestURL"]; - } - - if (!requestPayload) { - requestPayload = parse(restAPIRequestDetails)["requestPayload"]; - } - - var restAPIEndpoint = devicemgtProps["httpsURL"] + requestURL; - - try { - switch (requestMethod) { - case constants["HTTP_GET"]: - serviceInvokers.XMLHttp.get( - restAPIEndpoint, - function (restAPIResponse) { - response["status"] = restAPIResponse["status"]; - if (restAPIResponse["responseText"]) { - response["content"] = restAPIResponse["responseText"]; - } - }, - requestHeaders - ); - break; - case constants["HTTP_POST"]: - serviceInvokers.XMLHttp.post( - restAPIEndpoint, - requestPayload, - function (restAPIResponse) { - response["status"] = restAPIResponse["status"]; - if (restAPIResponse["responseText"]) { - response["content"] = restAPIResponse["responseText"]; - } - }, - requestHeaders - ); - break; - case constants["HTTP_PUT"]: - serviceInvokers.XMLHttp.put( - restAPIEndpoint, - requestPayload, - function (restAPIResponse) { - response["status"] = restAPIResponse["status"]; - if (restAPIResponse["responseText"]) { - response["content"] = restAPIResponse["responseText"]; - } - }, - requestHeaders - ); - break; - case constants["HTTP_DELETE"]: - serviceInvokers.XMLHttp.delete( - restAPIEndpoint, - function (restAPIResponse) { - response["status"] = restAPIResponse["status"]; - if (restAPIResponse["responseText"]) { - response["content"] = restAPIResponse["responseText"]; - } - }, - requestHeaders - ); - break; - } - } catch (e) { - //Since this is an API we'll log the error message. - log.error(e.message); // JavaScript error message - log.error(e.stack); // Executed JavaScript file stack - throw new Error("Exception occurred while trying to access " + - "backend REST API services from Jaggery API invoker layer", e); - } -} -%> diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag deleted file mode 100644 index 9fa2a37353..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag +++ /dev/null @@ -1,68 +0,0 @@ -<% -/* - * 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. - */ - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var log = new Log("api/operation-api.jag"); - -var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; -var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - -if (uriMatcher.match("/{context}/api/operation/paginate")) { - var deviceType = request.getParameter("deviceType"); - var deviceId = request.getParameter("deviceId"); - var owner = request.getParameter("owner"); - var ownership = request.getParameter("ownership"); - var index = request.getParameter("start"); - var length = request.getParameter("length"); - var search = request.getParameter("search[value]"); - - var restAPIEndpoint = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/devices/" + deviceType + "/" + deviceId + "/operations?owner=" + owner + "&ownership=" + ownership + - "&offset=" + index + "&limit=" + length; - - serviceInvokers.XMLHttp.get( - restAPIEndpoint, - function (restAPIResponse) { - if (restAPIResponse["status"] == 200 && restAPIResponse["responseText"]) { - var responsePayload = parse(restAPIResponse["responseText"]); - - var paginatedResult = {}; - paginatedResult["recordsTotal"] = responsePayload["count"]; - paginatedResult["recordsFiltered"] = responsePayload["count"]; - paginatedResult["data"] = responsePayload["operations"]; - - response["status"] = restAPIResponse["status"]; - response["content"] = paginatedResult; - } else { - response["status"] = restAPIResponse["status"]; - if (restAPIResponse["responseText"]) { - var responseText = ""; - try { - response["content"] = parse(restAPIResponse["responseText"]); - } catch (e) { - responseText = restAPIResponse["responseText"]; - } - } - } - } - ); -} -%> \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag deleted file mode 100644 index 5ae93fdde7..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag +++ /dev/null @@ -1,52 +0,0 @@ -<% -/* - * 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. - */ - -/* - @Deprecated - */ - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var log = new Log("api/policy-api.jag"); - -var constants = require("/modules/constants.js"); -var policyModule = require("/app/modules/business-controllers/group.js")["groupModule"]; - -var result; -if (uriMatcher.match("/{context}/api/policies/update")) { - payload = request.getContent(); - policyModule.updatePolicyPriorities(payload); -} else if (uriMatcher.match("/{context}/api/policies/{id}/delete")) { - elements = uriMatcher.elements(); - policyId = elements.id; - try { - result = policyModule.deletePolicy(policyId); - } catch (e) { - log.error("Exception occurred while trying to delete policy for id:" + policyId, e); - // http status code 500 refers to - Internal Server Error. - result = 500; - } -} - -// returning the result. -if (result) { - response.content = result; -} -%> \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/stats-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/stats-api.jag deleted file mode 100644 index 6919a492a3..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/stats-api.jag +++ /dev/null @@ -1,77 +0,0 @@ -<% -/* - * 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. - */ - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var log = new Log("api/stats-api.jag"); - -var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; -var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - -if (uriMatcher.match("/{context}/api/stats/paginate")) { - var deviceType = request.getParameter("deviceType"); - var deviceId = request.getParameter("deviceId"); - var from = request.getParameter("from"); - var to = request.getParameter("to"); - var index = request.getParameter("start"); - var length = request.getParameter("length"); - var keys = request.getParameter("attributes"); - keys = JSON.parse(keys); - var restAPIEndpoint = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/events/" - + deviceType + "/" + deviceId + "?offset=" + index +"&limit=" + length + "&from="+ from + "&to=" + to; - serviceInvokers.XMLHttp.get( - restAPIEndpoint, - function (restAPIResponse) { - if (restAPIResponse["status"] == 200 && restAPIResponse["responseText"]) { - var responsePayload = parse(restAPIResponse["responseText"]); - - var paginatedResult = {}; - paginatedResult["recordsTotal"] = responsePayload["count"]; - paginatedResult["recordsFiltered"] = responsePayload["count"]; - var records = responsePayload["records"]; - var dataSet = []; - for (var i = 0; i < records.length; i++){ - var record = records[i]; - var timestamp = record["timestamp"]; - var dataRow = []; - dataRow.push(timestamp); - for (var j = 0; j < keys.length; j++) { - var key = keys[j]; - dataRow.push(record.values[key]); - } - //dataSet.push(dataRow); - dataSet.push(dataRow); - } - paginatedResult["data"] = dataSet; - response["status"] = restAPIResponse["status"]; - response["content"] = paginatedResult; - } else { - response["status"] = 204; - var paginatedResult = {}; - var dataSet = []; - paginatedResult["recordsTotal"] = 0; - paginatedResult["recordsFiltered"] = 0; - paginatedResult["data"] = dataSet; - response["content"] = paginatedResult; - } - } - ); -} -%> \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag deleted file mode 100644 index 60076acf83..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag +++ /dev/null @@ -1,211 +0,0 @@ -<% -/* - * 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. - */ - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var log = new Log("api/user-api.jag"); - -var constants = require("/app/modules/constants.js"); -var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; -var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; -var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; -var utility = require("/app/modules/utility.js")["utility"]; -var apiWrapperUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; -var util = require("/app/modules/oauth/token-handler-utils.js")["utils"]; - -var responseProcessor = require("utils").response; - -var result; -if (uriMatcher.match("/{context}/api/user/clearBilling")) { - - carbonUser = session.get(constants.USER_SESSION_KEY); - session.put('BILLING_INFO_' + carbonUser.domain, null); - log.info("billing info cleared for " + carbonUser.domain); - -} else if (uriMatcher.match("/{context}/api/user/authenticate")) { - var username = request.getParameter("username"); - var password = request.getParameter("password"); - //Check if a username and password is provided - if ((!username) || (!password)) { - response = responseProcessor.buildErrorResponse(response, 400, 'Username and Password must be provided'); - } else { - try { - userModule.login(username, password, function (user) { - if (log.isDebugEnabled()) { - log.debug("User Logged In : " + user); - } - apiWrapperUtil.setupTokenPairByPasswordGrantType(username, password); - }, function () { - response = responseProcessor.buildSuccessResponse(response, 200, {'sessionId': session.getId()}); - }); - } catch (e) { - log.error("Exception occurred while a user tried to login to MDM", e); - response = responseProcessor.buildErrorResponse(response, 401, 'username/password is incorrect'); - } - } -} else if (uriMatcher.match("/{context}/api/user/login/")) { - username = request.getParameter("username"); - password = request.getParameter("password"); - username = util.decode(username); - password = util.decode(password); - try { - userModule.login(username, password, function (user) { - if (log.isDebugEnabled()) { - log.debug("User Logged In : " + user); - } - - apiWrapperUtil.setupTokenPairByPasswordGrantType(username, password); - var permissions = userModule.getUIPermissions(); - if (permissions.VIEW_DASHBOARD) { - response.sendRedirect(devicemgtProps["appContext"]); - } else { - response.sendRedirect(devicemgtProps["appContext"] + "devices"); - } - }, function () { - response.sendRedirect(devicemgtProps.appContext + "login?#auth-failed"); - }); - } catch (e) { - log.error("Exception occurred while a user tried to login to MDM", e); - response.sendRedirect(devicemgtProps.appContext + "login?#error"); - } -} else if (uriMatcher.match("/{context}/api/user/logout/")) { - userModule.logout(function () { - response.sendRedirect(devicemgtProps.appContext + "login"); - }); -} else if (uriMatcher.match("/{context}/api/user/devices/")) { - /* - @Deprecated - */ - if (userModule.isAuthorized("/permission/admin/device-mgt/user/devices/list")) { - carbonUser = session.get(constants.USER_SESSION_KEY); - result = deviceModule.listDevicesForUser(carbonUser.username); - } else { - response.sendError(403); - } -} else if (uriMatcher.match("/{context}/api/user/{username}/invite")) { - /* - @Deprecated - */ - if (userModule.isAuthorized("/permission/admin/device-mgt/user/invite")) { - elements = uriMatcher.elements(); - username = elements.username; - userModule.inviteUser(username); - } else { - response.sendError(403); - } -} else if (uriMatcher.match("/{context}/api/user/add")) { - /* - @Deprecated - */ - if (userModule.isAuthorized("/permission/admin/device-mgt/user/add")) { - addUserFormData = request.getContent(); - username = addUserFormData.username; - firstname = addUserFormData.firstname; - lastname = addUserFormData.lastname; - emailAddress = addUserFormData.emailAddress; - - if (!addUserFormData.userRoles) { - userRoles = null; - } else { - userRoles = String(addUserFormData.userRoles).split(","); - } - if (username.length < devicemgtProps.userValidationConfig.usernameLength) { - log.error("Username Must be between 1 and " + devicemgtProps.userValidationConfig.usernameLength + " characters long"); - result = "Username Must be between 1 and " + devicemgtProps.userValidationConfig.usernameLength + " characters long"; - } else { - try { - result = userModule.addUser(username, firstname, lastname, emailAddress, userRoles); - } catch (e) { - log.error("Exception occurred while trying to add a user to MDM User Store", e); - // http status code 400 refers to - Bad request. - result = 400; - } - } - } else { - // http status code 403 refers to - forbidden. - result = 403; - } -} else if (uriMatcher.match("/{context}/api/user/register")) { - - addUserFormData = request.getContent(); - username = addUserFormData.username; - firstname = addUserFormData.firstname; - lastname = addUserFormData.lastname; - emailAddress = addUserFormData.emailAddress; - password = addUserFormData.password; - userRoles = ["internal/devicemgt-user"]; - - try { - result = userModule.registerUser(username, firstname, lastname, emailAddress, password, - userRoles); - } catch (e) { - log.error("Exception occurred while trying to registering a new user to DC User Store", e); - // http status code 400 refers to - Bad request. - result = 400; - } - -} else if (uriMatcher.match("/{context}/api/user/{username}/remove")) { - /* - @Deprecated - */ - if (userModule.isAuthorized("/permission/admin/device-mgt/user/remove")) { - elements = uriMatcher.elements(); - username = elements.username; - try { - result = userModule.removeUser(username); - } catch (e) { - log.error("Exception occurred while trying to remove a user from MDM User Store", e); - // http status code 400 refers to - Bad request. - result = 400; - } - } else { - // http status code 403 refers to - forbidden. - result = 403; - } -} else if (uriMatcher.match("/{context}/api/user/all")) { - result = userModule.getUsers(); -} else if (uriMatcher.match("/{context}/api/user/environment-loaded")) { - try { - var carbonUser = session.get(constants.USER_SESSION_KEY); - if (!carbonUser) { - response.sendRedirect("/devicemgt/login?#login-required"); - exit(); - } - utility.startTenantFlow(carbonUser); - var APIManagementProviderService = utility.getAPIManagementProviderService(); - var isLoaded = APIManagementProviderService.isTierLoaded(); - result = {"isLoaded": isLoaded}; - if (isLoaded) { - var samlToken = session.get(constants.SAML_TOKEN_KEY); - if (samlToken) { - apiWrapperUtil.setupTokenPairByJWTGrantType(carbonUser.username + '@' + carbonUser.domain, samlToken); - } - } - response.contentType = 'application/json'; - } finally { - utility.endTenantFlow(); - } -} - -// returning the result. -if (result) { - print(result); -} -%> diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json deleted file mode 100644 index 6367533b95..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "appName": "Entgra IoT Server", - "cachingEnabled": false, - "debuggingEnabled": false, - "permissionRoot": "/", - "portalURL": "https://${server.ip}:9445", - "loginPage": "cdmf.page.sign-in.login-do", - "adminServicesUrl": "https://${server.ip}:${server.https_port}/admin/services/", - "authModule": { - "enabled": true, - "login": { - "onSuccess": { - "script": "/app/modules/login.js", - "page": "cdmf.page.processing" - }, - "onFail": { - "script": "/app/modules/login.js", - "page": "cdmf.page.sign-in.login-do" - } - }, - "logout": { - "onSuccess": { - "page": "cdmf.page.sign-in.login-do" - }, - "onFail": { - "page": "cdmf.page.dashboard" - } - }, - "sso": { - "enabled": true, - "issuer" : "devicemgt", - "appName" : "devicemgt", - "identityProviderUrl" : "https://%iot.keymanager.host%:%iot.keymanager.https.port%/samlsso", - "acs": "https://%iot.manager.host%:%iot.manager.https.port%/devicemgt/uuf/sso/acs", - "identityAlias": "wso2carbon", - "defaultNameIDPolicy": "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", - "isPassive":false, - "responseSigningEnabled" : true, - "validateAssertionValidityPeriod": true, - "validateAudienceRestriction": true, - "assertionSigningEnabled": true - } - }, - "errorPages": { - "default": "uuf.page.error" - } -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json deleted file mode 100644 index 0d6874aa66..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "appContext": "/devicemgt/", - "isCloud": false, - "isDeviceOwnerEnabled": false, - "managerHTTPSURL": "https://%iot.manager.host%:%iot.manager.https.port%", - "httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%", - "httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port%", - "wssURL": "https://%iot.core.host%:%iot.core.https.port%", - "remoteSessionWSURL": "https://%iot.manager.host%:%iot.manager.https.port%", - "portalURL": "https://%iot.analytics.host%:%iot.analytics.https.port%", - "dashboardServerURL": "%https.ip%", - "androidAgentDownloadURL": "https://%iot.manager.host%:%iot.manager.https.port%/devicemgt/public/cdmf.unit.device.type.android.type-view/assets/android-agent.apk", - "windowsEnrollmentDir": "/windows-web-agent/enrollment", - "iOSEnrollmentDir": "/ios-web-agent/enrollment", - "iOSConfigRoot": "https://%iot.manager.host%:%iot.manager.https.port%/ios-enrollment/", - "iOSAPIRoot": "https://%iot.manager.host%:%iot.manager.https.port%/ios/", - "adminService": "https://%iot.manager.host%:%iot.manager.https.port%", - "deviceInfoServiceAPI" : "/api/device-mgt/%device-type%/v1.0/admin/devices/info", - "deviceLocationServiceAPI" : "/api/device-mgt/%device-type%/v1.0/admin/devices/location", - "iOSDeviceInfoServiceAPI" : "/api/device-mgt/%device-type%/v1.0/admin/devices/info", - "gatewayEnabled": true, - "oauthProvider": { - "appRegistration": { - "appType": "webapp", - "clientName": "iot_ui", - "owner": "admin@carbon.super", - "dynamicClientAppRegistrationServiceURL": "https://%iot.gateway.host%:%iot.gateway.https.port%/dynamic-client-web/register", - "apiManagerClientAppRegistrationServiceURL": "https://%iot.gateway.host%:%iot.gateway.https.port%/api-application-registration/register/tenants", - "grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer urn:ietf:params:oauth:grant-type:jwt-bearer", - "tokenScope": "admin", - "callbackUrl": "https://%iot.gateway.host%:%iot.gateway.https.port%/api/device-mgt/v1.0", - "samlGrantTypeName": "urn:ietf:params:oauth:grant-type:saml2-bearer" - }, - "tokenServiceURL": "https://%iot.gateway.host%:%iot.gateway.https.port%/token" - }, - "adminUser": "admin@carbon.super", - "adminUserTenantId": "-1234", - "adminRole": "admin", - "userValidationConfig": { - "usernameLength": 30, - "usernameJSRegEx": "^[\\S]{3,30}$", - "usernameRegExViolationErrorMsg": "Provided username is invalid.", - "usernameHelpMsg": "Should be in minimum 3 characters long and do not include any whitespaces.", - "firstnameJSRegEx": "^.{3,30}$", - "firstnameRegExViolationErrorMsg": "Provided first name is invalid.", - "lastnameJSRegEx": "^.{3,30}$", - "lastnameRegExViolationErrorMsg": "Provided last name is invalid.", - "emailJSRegEx": "/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/", - "emailRegExViolationErrorMsg": "Provided email is invalid." - }, - "groupValidationConfig": { - "groupNameJSRegEx": "^[\\S]{3,30}$", - "groupNameRegExViolationErrorMsg": "Group name should be in minimum 3 characters long and should not include any whitespaces.", - "groupNameHelpMsg": "Should be in minimum 3 characters long and should not include any whitespaces." - }, - "roleValidationConfig": { - "roleNameJSRegEx": "^[\\S]{3,30}$", - "roleNameRegExViolationErrorMsg": "Provided role name is invalid.", - "roleNameHelpMsg": "should be in minimum 3 characters long and do not include any whitespaces." - }, - "generalConfig": { - "host": "https://%iot.manager.host%:%iot.manager.https.port%", - "companyName": "Entgra Carbon Device Manager", - "browserTitle": "Entgra Device Manager", - "copyrightPrefix": "\u00A9 %date-year%, ", - "copyrightOwner": "Entgra", - "copyrightOwnersSite": "https://www.entgra.io/", - "copyrightSuffix": " All Rights Reserved." - }, - "scopes": [ - "dm:sign-csr", - "dm:admin:devices:view", - "dm:admin:topics:view", - "rm:roles:add", - "rm:users:add", - "rm:roles:update", - "rm:roles:permissions:view", - "rm:roles:details:view", - "rm:roles:view", - "rm:roles:combined:add", - "rm:roles:delete", - "an:db:vulnerabilities", - "an:db:non-compliant:count", - "an:db:non-compliant", - "an:db:by-groups", - "an:db:device:count", - "an:db:feature-non-compliant", - "an:db:overview:count", - "an:db:filtered-count", - "an:db:details", - "dm:activity:get", - "dm:devices:delete", - "dm:devices:app:view", - "dm:devices:policy:view", - "dm:devices:compliance:view", - "dm:devices:features:view", - "dm:devices:ops:view", - "dm:devices:search", - "dm:devices:details", - "dm:devices:update", - "dm:devices:view", - "dm:conf:view", - "dm:conf:manage", - "pm:policies:remove", - "pm:policies:priorities:update", - "pm:policies:deactivate", - "pm:policies:details:view", - "pm:policies:add", - "pm:policies:activate", - "pm:policies:update", - "pm:policies:change", - "dm:policies:view", - "um:users:add", - "um:users:details:view", - "um:users:count", - "um:users:delete", - "um:roles:view", - "um:users:user-details:view", - "um:users:cred:change", - "um:users:search", - "um:users:is-exist", - "um:users:update", - "um:users:invite", - "um:admin:users:view", - "dm:admin:enrollment:update", - "gm:devices:view", - "gm:groups:update", - "gm:groups:add", - "gm:groups:device:view", - "gm:devices:count", - "gm:groups:remove", - "gm:groups:view", - "gm:groups:groups-view", - "gm:roles:share", - "gm:groups:count", - "gm:roles:view", - "gm:devices:remove", - "gm:devices:add", - "gm:devices:assign", - "dm:device-type:conf:view", - "dm:device-type:features:view", - "dm:device-type:view", - "am:admin:app:install", - "am:admin:app:uninstall", - "gm:admin:groups:count", - "gm:admin:groups:view", - "dm:notif:mark-checked", - "dm:notifications:view", - "cm:cert:delete", - "cm:cert:details:get", - "cm:cert:view", - "cm:cert:add", - "cm:cert:verify", - "dm:admin", - "dm:device-type:deploy", - "dm:device-type:event:modify", - "dm:device-type:event:view", - "dm:admin:device-type:modify", - "dm:admin:device-type:view", - "dm:admin:device-type:conf:add", - "dm:device:enroll", - "dm:geo:an:view", - "dm:geo:alerts:manage", - "dm:admin:devices:permanent-delete", - "appm:read", - "and:enterprise:modify", - "and:enterprise:view" - ], - "isOAuthEnabled": true, - "backendRestEndpoints": { - "deviceMgt": "/api/device-mgt/v1.0", - "appMgt": "/api/application-mgt-store/v1.0" - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json deleted file mode 100644 index aaac58445a..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "Logo": { - "name": "Cloud", - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt", - "target": "_parent" - }, - "Main": { - "Domain": { - "url": "#", - "icon": "fw fw-organization", - "isAdminOnly": false, - "target": "_parent", - "dropDown": { - "Organization": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag", - "icon": "fw fw-organization", - "dropDown": "false", - "target": "_self" - }, - "Members": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag", - "icon": "fa fa-users", - "dropDown": "false", - "target": "_self" - } - } - }, - "Account": { - "url": "#", - "icon": "fw fw-resource", - "isAdminOnly": false, - "billingEnabled": true, - "billingApi": { - "username": "admin", - "password": "admin" - }, - "cloudMgtHost" : "https://cloudmgt.cloudstaging.wso2.com", - "cloudMgtIndexPage": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag", - "dropDown": { - "Upgrade Now": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/payment-plans.jag?cloud-type=device_cloud", - "icon": "fw fw-export", - "dropDown": "true", - "target": "_self" - }, - "Request Extension": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag?cloud-type=device_cloud&request-extension=true", - "icon": "fa fa-mail", - "dropDown": "true", - "target": "_self" - } - } - }, - "Support": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag?cloud-type=device_cloud", - "icon": "fw fw-mail", - "isAdminOnly": false, - "target": "_self", - "dropDown": "false" - }, - "Documentation": { - "url": "#", - "icon": "fw fw-document", - "isAdminOnly": false, - "dropDown": { - "Device Cloud": { - "id": "device_cloud", - "url": "https://docs.wso2.com/display/DeviceCloud/WSO2+Device+Cloud+Documentation", - "icon": "fw fw-mobile", - "target": "_blank" - } - } - } - }, - "User": { - "url": "#", - "icon": "fw fw-user", - "dropDown": { - "Profile": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user-profile.jag", - "icon": "fw fw-user", - "dropDown": "true", - "target": "_self" - }, - "Change Password": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/change-password.jag", - "icon": "fw fw-lock", - "dropDown": "true", - "target": "_self" - }, - "Logout": { - "url": "https://device.cloud.wso2.com/devicemgt/logout", - "icon": "fw fw-sign-out", - "dropDown": "true", - "target": "_self" - } - } - }, - "Expand": { - "Clouds": { - "API Cloud": { - "id": "api_cloud", - "url": "https://api.cloud.wso2.com/publisher", - "icon": "fw fw-api fw-3x", - "dropDown": "true", - "target": "_self" - }, - "Integration Cloud": { - "id": "integration_cloud", - "url": "https://integration.cloud.wso2.com/appmgt", - "icon": "fw fw-service fw-3x", - "dropDown": "true", - "target": "_self" - }, - "Identity Cloud": { - "id": "integration_cloud", - "url": "https://identity.cloud.wso2.com/admin", - "icon": "fw fw-security fw-3x", - "dropDown": "true", - "target": "_self" - } - }, - "Actions": { - "Organization": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag", - "icon": "fw fw-organization fw-3x", - "dropDown": "true", - "target": "_self" - }, - "Members": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag", - "icon": "fa fa-users fa-3x", - "dropDown": "true", - "target": "_self" - } - } - } -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.default.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.default.hbs deleted file mode 100644 index cf5837c383..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.default.hbs +++ /dev/null @@ -1,82 +0,0 @@ -{{!-- 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. --}} - - - - - - - - {{defineZone "favicon"}} - - {{defineZone "title"}} - - {{defineZone "topLibCss"}} - {{defineZone "topCss"}} - {{defineZone "topJs"}} - - - - - - - - {{defineZone "header"}} - - {{defineZone "sidePanes"}} - - -
    - - - - {{!defineZone "contentTitle"}} - -
    -
    - {{defineZone "content"}} -
    -
    -
    - - -
    -
    - {{defineZone "footer"}} -
    -
    - - {{defineZone "bottomModalContent"}} - {{defineZone "bottomLibJs"}} - {{defineZone "bottomJs"}} - - \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.error.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.error.hbs deleted file mode 100644 index d14f195c32..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.error.hbs +++ /dev/null @@ -1,48 +0,0 @@ -{{!-- 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. --}} - - - - - - - - {{defineZone "title"}} - - - -
    -
    -
    - -
    -
    -

    {{#defineZone "messageTitle"}}Oops something went wrong{{/defineZone}}

    -

    {{defineZone "messageDescription"}}

    -
    - -
    -
    - -
    -
    -
    -
    - - \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.loading.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.loading.hbs deleted file mode 100644 index ab70bdc1cf..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.loading.hbs +++ /dev/null @@ -1,57 +0,0 @@ -{{!-- 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. --}} - - - - - - - - {{defineZone "favicon"}} - - {{defineZone "title"}} - - {{defineZone "topLibCss"}} - {{defineZone "topCss"}} - {{defineZone "topJs"}} - - - - - - - - {{defineZone "content"}} - - {{defineZone "bottomModalContent"}} - {{defineZone "bottomLibJs"}} - {{defineZone "bottomJs"}} - - \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js deleted file mode 100644 index 2c56bde07d..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var batchProviders; - -batchProviders = function () { - var operations = {}; - var CONTENT_TYPE_JSON = "application/json"; - var JS_MAX_VALUE = "9007199254740992"; - var JS_MIN_VALUE = "-9007199254740992"; - - var TABLENAME_ANDROID = "ORG_WSO2_GEO_FUSEDSPATIALEVENT"; - var TABLENAME_ANDROID_SENSE = "ORG_WSO2_IOT_ANDROID_LOCATION"; - - var tableName = function (deviceType) { - switch (deviceType) { - case "android" : - return TABLENAME_ANDROID; - break; - case "android_sense" : - return TABLENAME_ANDROID_SENSE; - break; - default: - return null; - - } - }; - - var typeMap = { - "bool": "string", - "boolean": "string", - "string": "string", - "int": "number", - "integer": "number", - "long": "number", - "double": "number", - "float": "number", - "time": "time" - }; - - var log = new Log(); - var carbon = require('carbon'); - var JSUtils = Packages.org.wso2.carbon.analytics.jsservice.Utils; - var AnalyticsCachedJSServiceConnector = Packages.org.wso2.carbon.analytics.jsservice.AnalyticsCachedJSServiceConnector; - var AnalyticsCache = Packages.org.wso2.carbon.analytics.jsservice.AnalyticsCachedJSServiceConnector.AnalyticsCache; - var cacheTimeoutSeconds = 5; - - var cacheSizeBytes = 1024 * 1024 * 1024; // 1GB - response.contentType = CONTENT_TYPE_JSON; - - - var cache = application.get("AnalyticsWebServiceCache"); - if (cache == null) { - cache = new AnalyticsCache(cacheTimeoutSeconds, cacheSizeBytes); - application.put("AnalyticsWebServiceCache", cache); - } - var connector = new AnalyticsCachedJSServiceConnector(cache); - - - /** - * returns an array of column names & types - * @param providerConfig - */ - operations.getSchema = function (loggedInUser) { - var tablename = tableName(deviceType); - if (tablename == null) { - return []; - } - var schema = []; - var result = connector.getTableSchema(loggedInUser, tablename).getMessage(); - result = JSON.parse(result); - - var columns = result.columns; - Object.getOwnPropertyNames(columns).forEach(function (name, idx, array) { - var type = "ordinal"; - if (columns[name]['type']) { - type = columns[name]['type']; - } - schema.push({ - fieldName: name, - fieldType: typeMap[type.toLowerCase()] - }); - }); - // log.info(schema); - return schema; - }; - - /** - * returns the actual data - * @param providerConfig - * @param limit - */ - operations.getData = function (loggedInUser, deviceId, deviceType) { - var luceneQuery = ""; - var limit = 100; - var result; - var tablename = tableName(deviceType); - if (tablename == null) { - return []; - } - //if there's a filter present, we should perform a Lucene search instead of reading the table - if (luceneQuery) { - luceneQuery = 'id:"' + deviceId + '" AND type:"' + deviceType + '"'; - var filter = { - "query": luceneQuery, - "start": 0, - "count": limit - }; - result = connector.search(loggedInUser, tablename, stringify(filter)).getMessage(); - } else { - var from = JS_MIN_VALUE; - var to = JS_MAX_VALUE; - result = connector.getRecordsByRange(loggedInUser, tablename, from, to, 0, limit, null).getMessage(); - - } - - // error handling ---- - var resultString = result.toString(); - if (resultString.contains("Failed to get records from table")) { - return null; - } - - result = JSON.parse(result); - var data = []; - for (var i = 0; i < result.length; i++) { - var values = result[i].values; - data.push(values); - } - return data; - }; - - - - return operations; -}(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js deleted file mode 100644 index b01afcbf25..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var deviceModule; -deviceModule = function () { - var log = new Log("/app/modules/business-controllers/device.js"); - - var utility = require('/app/modules/utility.js')["utility"]; - var constants = require('/app/modules/constants.js'); - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - var batchProvider = require("/app/modules/batch-provider-api.js")["batchProviders"]; - var process = require("process"); - var carbon = require("carbon"); - var publicMethods = {}; - var privateMethods = {}; - - /** - * Only GET method is implemented for now since there are no other type of methods used this method. - * @param url - URL to call the backend without the host - * @param method - HTTP Method (GET, POST) - * @returns An object with 'status': 'success'|'error', 'content': {} - */ - privateMethods.callBackend = function (url, method) { - if (constants["HTTP_GET"] == method) { - return serviceInvokers.XMLHttp.get(url, - function (backendResponse) { - var response = {}; - response.content = backendResponse.responseText; - if (backendResponse.status == 200) { - response.status = "success"; - } else if (backendResponse.status == 400 || backendResponse.status == 401 || - backendResponse.status == 404 || backendResponse.status == 500) { - response.status = "error"; - } - return response; - } - ); - } else { - log.error("Runtime error : This method only support HTTP GET requests."); - } - }; - - privateMethods.validateAndReturn = function (value) { - return (value == undefined || value == null) ? constants["UNSPECIFIED"] : value; - }; - - /* - @Updated - */ - publicMethods.viewDevice = function (deviceType, deviceId, owner, ownership) { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - if (!carbonUser) { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - var userName = carbonUser.username + "@" + carbonUser.domain; - var locationHistory = []; - var geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.enabled; - if (geoServicesEnabled) { - try { - var fromDate = new Date(); - fromDate.setHours(fromDate.getHours() - 2); - var toDate = new Date(); - var serviceUrl = devicemgtProps["httpsURL"] + '/api/device-mgt/v1.0/geo-services/stats/' + deviceType + '/' + deviceId + '?from=' + fromDate.getTime() + '&to=' + toDate.getTime(); - serviceInvokers.XMLHttp.get(serviceUrl, - function (backendResponse) { - if (backendResponse.status === 200 && backendResponse.responseText) { - locationHistory = JSON.parse(backendResponse.responseText); - } - }); - } catch (e) { - log.error(e.message, e); - } - } - - var locationInfo = {}; - try { - var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/location"; - serviceInvokers.XMLHttp.get( - url, - function (backendResponse) { - - if (backendResponse.status == 200 && backendResponse.responseText) { - var device = parse(backendResponse.responseText); - locationInfo.latitude = device.latitude; - locationInfo.longitude = device.longitude; - locationInfo.updatedOn = device.updatedTime; - } - }); - } catch (e) { - log.error(e.message, e); - } - - var utility = require('/app/modules/utility.js')["utility"]; - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId; - if (owner) { - url = url + "?owner=" + owner; - if (ownership){ - url = url + "&ownership=" + ownership; - } - } else if (ownership){ - url = url + "?ownership=" + ownership; - } - return serviceInvokers.XMLHttp.get( - url, - function (backendResponse) { - var response = {}; - if (backendResponse.status == 200 && backendResponse.responseText) { - var device = parse(backendResponse.responseText); - - var filteredDeviceData = {}; - if (device["deviceIdentifier"]) { - filteredDeviceData["deviceIdentifier"] = device["deviceIdentifier"]; - } - if (device["type"]) { - filteredDeviceData["type"] = device["type"]; - } - if (device["name"]) { - filteredDeviceData["name"] = device["name"]; - } - if (device["enrolmentInfo"]) { - var enrolmentInfo = {}; - if (device["enrolmentInfo"]["status"]) { - enrolmentInfo["status"] = device["enrolmentInfo"]["status"]; - } - if (device["enrolmentInfo"]["owner"]) { - enrolmentInfo["owner"] = device["enrolmentInfo"]["owner"]; - } - if (device["enrolmentInfo"]["ownership"]) { - enrolmentInfo["ownership"] = device["enrolmentInfo"]["ownership"]; - } - filteredDeviceData["enrolmentInfo"] = enrolmentInfo; - } - if (device["properties"] && device["properties"].length > 0) { - var propertiesList = device["properties"]; - var properties = {}; - if (propertiesList) { - for (var i = 0; i < propertiesList.length; i++) { - if (propertiesList[i]["value"]) { - properties[propertiesList[i]["name"]] = - propertiesList[i]["value"]; - } - } - } - - filteredDeviceData["initialDeviceInfo"] = properties; - - if (properties["DEVICE_INFO"]) { - var initialDeviceInfoList = parse(properties["DEVICE_INFO"]); - var initialDeviceInfo = {}; - if (Array.isArray(initialDeviceInfoList)) { - for (var j = 0; j < initialDeviceInfoList.length; j++) { - if (initialDeviceInfoList[j]["value"]) { - initialDeviceInfo[initialDeviceInfoList[j]["name"]] = - initialDeviceInfoList[j]["value"]; - } - } - } else { - initialDeviceInfo = initialDeviceInfoList; - } - - - filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"] = initialDeviceInfo; - } - } - - if (filteredDeviceData["type"]) { - if (filteredDeviceData["type"] == constants["PLATFORM_IOS"]) { - if (filteredDeviceData["properties"]) { - filteredDeviceData["properties"]["VENDOR"] = "Apple"; - } - } - } - - if (device["deviceInfo"]) { - filteredDeviceData["latestDeviceInfo"] = device["deviceInfo"]; - } else { - filteredDeviceData["latestDeviceInfo"] = {}; - filteredDeviceData["latestDeviceInfo"]["location"] = {}; - } - - //location related verification and modifications - // adding the location histry for the movement path. - filteredDeviceData["locationHistory"] = locationHistory; - - //checking for the latest location information based on historical data. - if (locationHistory) { - var infoDate; - var locationDate; - var historicalLatestLoc = locationHistory[locationHistory.length - 1]; - if (historicalLatestLoc && filteredDeviceData.latestDeviceInfo && filteredDeviceData.latestDeviceInfo.location) { - infoDate = new Date(filteredDeviceData.latestDeviceInfo.location.updatedTime); - locationDate = new Date(historicalLatestLoc.values.timeStamp); - } - if (infoDate < locationDate || filteredDeviceData.latestDeviceInfo.length === 0) { - filteredDeviceData.latestDeviceInfo.location = {}; - filteredDeviceData.latestDeviceInfo.location.longitude = historicalLatestLoc.values.longitude; - filteredDeviceData.latestDeviceInfo.location.latitude = historicalLatestLoc.values.latitude; - filteredDeviceData.latestDeviceInfo.location.updatedTime = historicalLatestLoc.values.timeStamp; - } - } - - //checking for the latest location information. - if (filteredDeviceData.latestDeviceInfo.location && locationInfo) { - var infoDate = new Date(filteredDeviceData.latestDeviceInfo.location.updatedTime); - var locationDate = new Date(locationInfo.updatedOn); - if (infoDate < locationDate) { - filteredDeviceData.latestDeviceInfo.location.longitude = locationInfo.longitude; - filteredDeviceData.latestDeviceInfo.location.latitude = locationInfo.latitude; - filteredDeviceData.latestDeviceInfo.location.updatedTime = locationInfo.updatedOn; - } - } - - response["content"] = filteredDeviceData; - response["status"] = "success"; - return response; - } else if (backendResponse.status == 401) { - response["status"] = "unauthorized"; - return response; - } else if (backendResponse.status == 404) { - response["status"] = "notFound"; - return response; - } else { - response["status"] = "error"; - return response; - } - } - ); - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - // Refactored methods - publicMethods.getDevicesCount = function () { - var carbonUser = session.get(constants.USER_SESSION_KEY); - if (carbonUser) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var uiPermissions = userModule.getUIPermissions(); - var url; - if (uiPermissions.LIST_DEVICES) { - url = devicemgtProps["httpsURL"] + - devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices?offset=0&limit=1"; - } else if (uiPermissions.LIST_OWN_DEVICES) { - url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/devices?offset=0&limit=1&user=" + carbonUser.username; - } else { - log.error("Access denied for user: " + carbonUser.username); - return -1; - } - return serviceInvokers.XMLHttp.get( - url, function (responsePayload) { - if(!responsePayload["responseText"]){ - log.error("Error while fetching device count. API `" + url + "` returns HTTP: " + responsePayload["status"]); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - return parse(responsePayload["responseText"])["count"]; - }, - function (responsePayload) { - log.error(responsePayload["responseText"]); - return -1; - } - ); - } else { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - }; - - publicMethods.getDeviceTypeCount = function () { - var carbonUser = session.get(constants.USER_SESSION_KEY); - if (carbonUser) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var uiPermissions = userModule.getUIPermissions(); - var url; - if (uiPermissions.LIST_OWN_DEVICES) { - url = devicemgtProps["httpsURL"] + - devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/device-types"; - } else { - log.error("Access denied for user: " + carbonUser.username); - return -1; - } - return serviceInvokers.XMLHttp.get( - url, function (responsePayload) { - return parse(responsePayload["responseText"]).length; - }, - function (responsePayload) { - log.error(responsePayload["responseText"]); - return -1; - } - ); - } else { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - }; - - publicMethods.getDeviceTypes = function () { - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/device-types"; - var response = privateMethods.callBackend(url, constants["HTTP_GET"]); - if (response.status == "success") { - response.content = parse(response.content); - } - return response; - }; - - /* - @Updated - */ - // publicMethods.getLicense = function (deviceType) { - // var url; - // var license; - // if (deviceType == "windows") { - // url = mdmProps["httpURL"] + "/mdm-windows-agent/services/device/license"; - // } else if (deviceType == "ios") { - // url = mdmProps["httpsURL"] + "/ios-enrollment/license/"; - // } - - // if (url != null && url != undefined) { - // serviceInvokers.XMLHttp.get(url, function (responsePayload) { - // license = responsePayload.text; - // }, function (responsePayload) { - // return null; - // }); - // } - // return license; - // }; - - publicMethods.getDevices = function (userName) { - var url = devicemgtProps["httpsURL"] + - devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices"; - if (userName && userName !== "") { - url = url + "?user=" + userName; - } - return serviceInvokers.XMLHttp.get( - url, function (responsePayload) { - var devices = JSON.parse(responsePayload.responseText).devices; - for (var i = 0; i < devices.length; i++) { - devices[i].thumb = utility.getDeviceThumb(devices[i].type); - } - return devices; - }, - function (responsePayload) { - log.error(responsePayload); - return -1; - } - ); - }; - - publicMethods.getDeviceAgentConfig = function (type, deviceId) { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - if (!carbonUser) { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - var userName = carbonUser.username + "@" + carbonUser.domain; - var config = {}; - config.type = type; - config.deviceId = deviceId; - // register a tenant based app at API Manager - var applicationName = type.replace(" ", "") + "_" + carbonUser.domain; - var requestURL = (devicemgtProps["oauthProvider"]["appRegistration"] - ["apiManagerClientAppRegistrationServiceURL"]).replace("/tenants",""); - var payload = {applicationName:applicationName, tags:["device_agent"], - isAllowedToAllDomains:false, validityPeriod: 3600}; - - serviceInvokers.XMLHttp.post( - requestURL, payload, function (responsePayload) { - var app = JSON.parse(responsePayload.responseText); - - config.clientId = app["client_id"]; - config.clientSecret = app["client_secret"]; - if (config.clientId && config.clientSecret) { - var JWTClientManagerServicePackagePath = - "io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService"; - //noinspection JSUnresolvedFunction, JSUnresolvedVariable - var JWTClientManagerService = carbon.server.osgiService(JWTClientManagerServicePackagePath); - //noinspection JSUnresolvedFunction - var jwtClient = JWTClientManagerService.getJWTClient(); - // returning access token by JWT grant type - var deviceScope = "device_" + type.replace(" ", "") + "_" + deviceId + " dm:device:enroll " + - "dm:device:disenroll dm:device:modify dm:devices:ops:view dm:device:event:publish"; - var tokenInfo = jwtClient.getAccessToken(config.clientId, config.clientSecret, - userName, deviceScope); - config.accessToken = tokenInfo.getAccessToken(); - config.refreshToken = tokenInfo.getRefreshToken(); - if (config.accessToken == null) { - return null; - } - config.mqttGateway = "tcp://" + process.getProperty("mqtt.broker.host") + ":" + process.getProperty("mqtt.broker.port"); - config.httpsGateway = "https://" + process.getProperty("iot.gateway.host") + ":" + process.getProperty("iot.gateway.https.port"); - config.httpGateway = "http://" + process.getProperty("iot.gateway.host") + ":" + process.getProperty("iot.gateway.http.port"); - return config; - } else { - return null; - } - return config; - }, - function (responsePayload) { - log.error(responsePayload); - return null; - } - ); - return config; - - }; - - /** - * Retrieve device info details of a device - * @param deviceType - Type of the device i.e ios, android - * @param deviceId - Device ID of te device - */ - publicMethods.getDeviceInfo = function (deviceType, deviceId) { - try { - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] - + "/devices/" + deviceType + "/" + deviceId + "/info"; - var response = {}; - return serviceInvokers.XMLHttp.get( - url, - function (backendResponse) { - if (backendResponse.status === 200 && backendResponse.responseText) { - response["status"] = "success"; - response["content"] = parse(backendResponse.responseText); - } else { - log.error("Error occurred while retrieving device info via " + url + ". Error code: " - + backendResponse.status + ". Reason: " + backendResponse.responseText); - response["status"] = "error"; - } - return response; - }); - } catch (e) { - log.error("Error occurred while retrieving device info via " + url, e); - } - }; - - return publicMethods; -}(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/group.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/group.js deleted file mode 100644 index 9868f9d867..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/group.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var groupModule = {}; -(function (groupModule) { - var log = new Log("/app/modules/business-controllers/group.js"); - - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var constants = require('/app/modules/constants.js'); - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var utility = require("/app/modules/utility.js").utility; - var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - - var deviceServiceEndpoint = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0"; - - var user = session.get(constants.USER_SESSION_KEY); - - var endPoint; - - groupModule.getGroupCount = function () { - var permissions = userModule.getUIPermissions(); - if (permissions.LIST_ALL_GROUPS) { - endPoint = deviceServiceEndpoint + "/admin/groups/count"; - } else if (permissions.LIST_GROUPS) { - endPoint = deviceServiceEndpoint + "/groups/count"; - } else { - if (!user) { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - log.error("Access denied for user: " + user.username); - return -1; - } - return serviceInvokers.XMLHttp.get( - endPoint, function (responsePayload) { - return parse(responsePayload["responseText"]); - }, - function (responsePayload) { - log.error(responsePayload["responseText"]); - return -1; - } - ); - }; - - groupModule.getGroupDeviceCount = function (groupId) { - endPoint = deviceServiceEndpoint + "/groups/id/" + groupId + "/devices/count"; - return serviceInvokers.XMLHttp.get( - endPoint, function (responsePayload) { - return responsePayload["responseText"]; - }, - function (responsePayload) { - log.error(responsePayload); - return -1; - } - ); - }; - - groupModule.getGroupDevices = function (groupId) { - endPoint = deviceServiceEndpoint + "/groups/id/" + groupId + "/devices?limit=10"; - return serviceInvokers.XMLHttp.get( - endPoint, function (responsePayload) { - return responsePayload; - }, - function (responsePayload) { - log.error(responsePayload); - return responsePayload; - } - ); - }; - - groupModule.getGroups = function () { - var permissions = userModule.getUIPermissions(); - if (permissions.LIST_ALL_GROUPS) { - endPoint = deviceServiceEndpoint + "/admin/groups"; - } else if (permissions.LIST_GROUPS) { - endPoint = deviceServiceEndpoint + "/groups"; - } else { - log.error("Access denied for user: " + carbonUser.username); - return -1; - } - return serviceInvokers.XMLHttp.get( - endPoint, function (responsePayload) { - var data = JSON.parse(responsePayload.responseText); - if(data) { - return data.deviceGroups; - } else { - return []; - } - }, - function (responsePayload) { - log.error(responsePayload); - return -1; - } - ); - }; - - groupModule.getGroup = function (groupId) { - return serviceInvokers.XMLHttp.get( - deviceServiceEndpoint + "/groups/id/" + groupId, function (responsePayload) { - return JSON.parse(responsePayload.responseText); - }, - function (responsePayload) { - log.error(responsePayload); - return -1; - } - ); - }; - - groupModule.getRolesOfGroup = function (groupId) { - return serviceInvokers.XMLHttp.get( - deviceServiceEndpoint + "/groups/id/" + groupId + "/roles", function (responsePayload) { - var data = JSON.parse(responsePayload.responseText); - if(data) { - return data.roles; - } else { - return []; - } - }, - function (responsePayload) { - log.error(responsePayload); - return -1; - } - ); - }; - -}(groupModule)); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/operation.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/operation.js deleted file mode 100644 index d2401d86f0..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/operation.js +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var operationModule = function () { - var log = new Log("/app/modules/business-controllers/operation.js"); - var utility = require('/app/modules/utility.js').utility; - var constants = require('/app/modules/constants.js'); - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - - var publicMethods = {}; - var privateMethods = {}; - - /** - * This method reads the token from the Token client and return the access token. - * If the token pair s not set in the session this will send a redirect to the login page. - */ - function getAccessToken(deviceType, owner, deviceId) { - var TokenClient = Packages.org.wso2.carbon.device.mgt.iot.apimgt.TokenClient; - var accessTokenClient = new TokenClient(deviceType); - var accessTokenInfo = accessTokenClient.getAccessToken(owner, deviceId); - return accessTokenInfo.getAccess_token(); - } - - privateMethods.getOperationsFromFeatures = function (deviceType, operationType) { - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/device-types/" - + deviceType + "/features?featureType=" + operationType + "&hidden=false"; - return serviceInvokers.XMLHttp.get(url, function (responsePayload) { - var features = JSON.parse(responsePayload.responseText); - var featureList = []; - var feature; - for (var i = 0; i < features.length; i++) { - feature = {}; - feature["operation"] = features[i].code; - feature["name"] = features[i].name; - feature["description"] = features[i].description; - feature["contentType"] = features[i].contentType; - feature["deviceType"] = deviceType; - feature["params"] = []; - var metaData = features[i].metadataEntries; - if (metaData) { - for (var j = 0; j < metaData.length; j++) { - if (metaData[j].name === "operationMeta") { - var operationMeta = metaData[j].value; - var params = {}; - params["method"] = operationMeta.method; - params["pathParams"] = operationMeta.pathParams; - params["queryParams"] = operationMeta.queryParams; - params["formParams"] = operationMeta.formParams ? operationMeta.formParams : []; - params["uri"] = operationMeta.uri; - params["contentType"] = operationMeta.contentType; - feature["params"].push(params); - feature["permission"] = operationMeta.permission; - if (operationMeta.icon) { - //Check if icon is a path or font - if (operationMeta.icon.indexOf("path:") === 0) { - feature["icon"] = operationMeta.icon.replace("path:", ""); - } else { - feature["iconFont"] = operationMeta.icon; - } - } - if (operationMeta.uiParams && operationMeta.uiParams.length > 0) { - feature["uiParams"] = operationMeta.uiParams; - } - if (operationMeta.filters) { - feature["filters"] = operationMeta.filters; - } - if (operationMeta.ownershipDescription) { - feature["ownershipDescription"] = operationMeta.ownershipDescription; - } - continue; - } - feature["metadata"].push(metaData[j].value); - } - featureList.push(feature); - } - } - return featureList; - }, function (responsePayload) { - var response = {}; - response["status"] = "error"; - return response; - } - ); - }; - - publicMethods.getControlOperations = function (device) { - var deviceType = device.type; - var operations = privateMethods.getOperationsFromFeatures(deviceType, "operation"); - for (var op in operations) { - if (operations.hasOwnProperty(op)) { - operations[op]["isDisabled"] = false; - if (device && operations[op].filters && operations[op].filters.length > 0) { - var filters = operations[op].filters; - for (var filter in filters) { - if (filters.hasOwnProperty(filter)) { - if (device[filters[filter].property] !== filters[filter].value) { - operations[op]["isDisabled"] = true; - operations[op]["disabledText"] = operations[op]["disabledText"] ? - operations[op]["disabledText"] + ", " + filters[filter].description : - filters[filter].description; - } - } - } - } - } - } - return operations; - }; - - publicMethods.getMonitorOperations = function (deviceType) { - return privateMethods.getOperationsFromFeatures(deviceType, "monitor"); - }; - - publicMethods.handlePOSTOperation = function (deviceType, operation, deviceId, params) { - var user = session.get(constants.USER_SESSION_KEY); - var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation; - var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId + - '","protocol":"mqtt", "sessionId":"' + session.getId() + '", "' + - constants.AUTHORIZATION_HEADER + '":"' + constants.BEARER_PREFIX + - getAccessToken(deviceType, user.username, deviceId) + '"}'; - return post(endPoint, params, JSON.parse(header), "json"); - }; - - publicMethods.handleGETOperation = function (deviceType, operation, operationName, deviceId) { - var user = session.get(constants.USER_SESSION_KEY); - var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation; - var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId + - '","protocol":"mqtt", "' + constants.AUTHORIZATION_HEADER + '":"' + - constants.BEARER_PREFIX + getAccessToken(deviceType, user.username, deviceId) + - '"}'; - var result = get(endPoint, {}, JSON.parse(header), "json"); - if (result.data) { - var values = result.data.sensorValue.split(','); - if (operationName == 'gps') { - result.data.map = { - lat: parseFloat(values[0]), - lng: parseFloat(values[1]) - } - } else { - var sqSum = 0; - for (var v in values) { - sqSum += Math.pow(values[v], 2); - } - result.data[operationName] = Math.sqrt(sqSum); - } - delete result.data['sensorValue']; - } - return result; - }; - - return publicMethods; -}(); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js deleted file mode 100644 index b16dabac5e..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var policyModule; -policyModule = function () { - var log = new Log("/app/modules/business-controllers/policy.js"); - - var constants = require('/app/modules/constants.js'); - var utility = require("/app/modules/utility.js")["utility"]; - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - - var publicMethods = {}; - var privateMethods = {}; - - privateMethods.handleGetAllPoliciesResponse = function (backendResponse) { - var response = {}; - if (backendResponse.status == 200 && backendResponse.responseText) { - var isUpdated = false; - var policyListFromRestEndpoint = parse(backendResponse.responseText)["policies"]; - - var policyListToView = []; - var i, policyObjectFromRestEndpoint, policyObjectToView; - for (i = 0; i < policyListFromRestEndpoint.length; i++) { - // get list object - policyObjectFromRestEndpoint = policyListFromRestEndpoint[i]; - // populate list object values to view-object - policyObjectToView = {}; - policyObjectToView["id"] = policyObjectFromRestEndpoint["id"]; - policyObjectToView["priorityId"] = policyObjectFromRestEndpoint["priorityId"]; - policyObjectToView["name"] = policyObjectFromRestEndpoint["policyName"]; - policyObjectToView["platform"] = policyObjectFromRestEndpoint["profile"]["deviceType"]; - policyObjectFromRestEndpoint["policyType"] = policyListFromRestEndpoint["policyType"]; - var payloadVersion = policyObjectFromRestEndpoint["policyPayloadVersion"]; - if (!parseFloat(payloadVersion) >= 2.0) { - policyObjectFromRestEndpoint["correctiveActions"] = policyListFromRestEndpoint["correctiveActions"]; - } - if (policyObjectToView["platform"] == "ios") { - policyObjectToView["deviceTypeIcon"] = "apple"; - } else { - policyObjectToView["deviceTypeIcon"] = policyObjectToView["platform"]; - } - var ownershipType = "None"; - var deviceGroups = policyObjectFromRestEndpoint["deviceGroups"]; - if (deviceGroups) { - for (var j = 0; j < deviceGroups.length; j++) { - var deviceGroup = deviceGroups[j]; - if (deviceGroup.name === "COPE") { - ownershipType = (ownershipType === "BYOD") ? "BYOD & COPE" : "COPE"; - } else if (deviceGroup.name === "BYOD") { - ownershipType = (ownershipType === "COPE") ? "BYOD & COPE" : "BYOD"; - } - } - } - policyObjectToView["ownershipType"] = ownershipType; - - var assignedRoleCount = policyObjectFromRestEndpoint["roles"].length; - var assignedUserCount = policyObjectFromRestEndpoint["users"].length; - - if (assignedRoleCount == 0) { - policyObjectToView["roles"] = "None"; - } else if (assignedRoleCount == 1) { - policyObjectToView["roles"] = policyObjectFromRestEndpoint["roles"][0]; - } else if (assignedRoleCount > 1) { - policyObjectToView["roles"] = policyObjectFromRestEndpoint["roles"][0] + ", ..."; - } - - if (assignedUserCount == 0) { - policyObjectToView["users"] = "None"; - } else if (assignedUserCount == 1) { - policyObjectToView["users"] = policyObjectFromRestEndpoint["users"][0]; - } else if (assignedUserCount > 1) { - policyObjectToView["users"] = policyObjectFromRestEndpoint["users"][0] + ", ..."; - } - - policyObjectToView["compliance"] = policyObjectFromRestEndpoint["compliance"]; - - if (policyObjectFromRestEndpoint["active"] == true && - policyObjectFromRestEndpoint["updated"] == true) { - policyObjectToView["status"] = "Active/Updated"; - isUpdated = true; - } else if (policyObjectFromRestEndpoint["active"] == true && - policyObjectFromRestEndpoint["updated"] == false) { - policyObjectToView["status"] = "Active"; - } else if (policyObjectFromRestEndpoint["active"] == false && - policyObjectFromRestEndpoint["updated"] == true) { - policyObjectToView["status"] = "Inactive/Updated"; - isUpdated = true; - } else if (policyObjectFromRestEndpoint["active"] == false && - policyObjectFromRestEndpoint["updated"] == false) { - policyObjectToView["status"] = "Inactive"; - } - // push view-objects to list - policyListToView.push(policyObjectToView); - } - // generate response - response.updated = isUpdated; - response.status = "success"; - response.content = policyListToView; - - return response; - } else { - response.status = "error"; - /* backendResponse.responseText == "Scope validation failed" - Here the response.context("Scope validation failed") is used other then response.status(401). - Reason for this is IDP return 401 as the status in 4 different situations such as, - 1. UnAuthorized. - 2. Scope Validation Failed. - 3. Permission Denied. - 4. Access Token Expired. - 5. Access Token Invalid. - In these cases in order to identify the correct situation we have to compare the unique value from status and - context which is context. - */ - if (backendResponse.responseText == "Scope validation failed") { - response.content = "Permission Denied"; - } else { - response.content = backendResponse.responseText; - } - return response; - } - }; - - /* - @Updated - */ - publicMethods.getAllPolicies = function () { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - if (!carbonUser) { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - try { - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/policies?offset=0&limit=100"; - return serviceInvokers.XMLHttp.get(url, privateMethods.handleGetAllPoliciesResponse); - } catch (e) { - throw e; - } - }; - - /** - * Retrieve all policies based on policy type - */ - publicMethods.getAllPoliciesByType = function (policyType) { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - if (!carbonUser) { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - try { - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/policies/type/" + policyType + "?offset=0&limit=100"; - return serviceInvokers.XMLHttp.get(url, privateMethods.handleGetAllPoliciesResponse); - } catch (e) { - log.error("Error occurred while retrieving policies by policy type " + policyType); - throw e; - } - }; - - /* - Get policies count from backend services. - */ - publicMethods.getPoliciesCount = function () { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - if (!carbonUser) { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - try { - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/policies?offset=0&limit=1"; - return serviceInvokers.XMLHttp.get( - url, function (responsePayload) { - return parse(responsePayload["responseText"])["count"]; - }, - function (responsePayload) { - log.error(responsePayload["responseText"]); - return -1; - } - ); - } catch (e) { - throw e; - } - }; - - /* - Get apps available in the store from backend service. - */ - publicMethods.getStoreAppsForPolicy = function () { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - if (!carbonUser) { - log.error("User object was not found in the session"); - userModule.logout(function () { - response.sendRedirect(devicemgtProps["appContext"] + "login"); - }); - } - try { - var url = devicemgtProps["managerHTTPSURL"] + devicemgtProps["backendRestEndpoints"]["appMgt"] + - "/applications"; - var data = { - limit: -1 - }; - return serviceInvokers.XMLHttp.post(url, data, - function (backendResponse) { - var response = {}; - if (backendResponse.status === 200 && backendResponse.responseText) { - var appListFromRestEndpoint = parse(backendResponse.responseText)["applications"]; - var storeApps = []; - var i, appObjectFromRestEndpoint, appObjectToView; - for (i=0; i 0) { - domain = username.substr(0, username.indexOf('/')); - username = username.substr(username.indexOf('/') + 1); - } - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/users/" + - encodeURIComponent(username); - if (domain) { - url += '?domain=' + encodeURIComponent(domain); - } - var response = privateMethods.callBackend(url, constants["HTTP_GET"]); - response["content"] = parse(response.content); - response["userDomain"] = carbonUser.domain; - return response; - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /** - * Returns a set of roles assigned to a particular user - * @param username - * @returns {object} a response object with status and content on success. - */ - publicMethods.getRolesByUsername = function (username) { - var carbonUser = publicMethods.getCarbonUser(); - var domain; - if (username.indexOf('/') > 0) { - domain = username.substr(0, username.indexOf('/')); - username = username.substr(username.indexOf('/') + 1); - } - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/users/" + - encodeURIComponent(username) + "/roles"; - if (domain) { - url += '?domain=' + encodeURIComponent(domain); - } - var response = privateMethods.callBackend(url, constants["HTTP_GET"]); - if (response.status == "success") { - response.content = parse(response.content).roles; - } - return response; - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /* - @NewlyAdded - */ - publicMethods.getUsersByUsername = function () { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - var utility = require("/app/modules/utility.js")["utility"]; - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants["ERRORS"]["USER_NOT_FOUND"]; - } - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + "/mdm-admin/users/users-by-username"; - return privateMethods.callBackend(url, constants["HTTP_GET"]); - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /* - @Updated - */ - /** - * Get User Roles from user store (Internal roles not included). - */ - publicMethods.getRoles = function () { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - var utility = require("/app/modules/utility.js")["utility"]; - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants["ERRORS"]["USER_NOT_FOUND"]; - } - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/roles?offset=0&limit=100&user-store=all"; - var response = privateMethods.callBackend(url, constants["HTTP_GET"]); - if (response.status == "success") { - response.content = parse(response.content).roles; - } - return response; - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /** - * Get User Roles from user store (Internal roles not included). - */ - publicMethods.getFilteredRoles = function (prefix) { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - var utility = require("/app/modules/utility.js")["utility"]; - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants["ERRORS"]["USER_NOT_FOUND"]; - } - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/roles/filter/" + prefix + "?offset=0&limit=100&user-store=all"; - var response = privateMethods.callBackend(url, constants["HTTP_GET"]); - if (response.status == "success") { - response.content = parse(response.content); - } - return response; - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /** - * Get User Roles count from user store (Internal roles not included). - */ - publicMethods.getRolesCount = function () { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - var utility = require("/app/modules/utility.js")["utility"]; - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants["ERRORS"]["USER_NOT_FOUND"]; - } - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/roles?offset=0&limit=1&user-store=all"; - return serviceInvokers.XMLHttp.get( - url, function (responsePayload) { - return parse(responsePayload["responseText"])["count"]; - }, - function (responsePayload) { - log.error(responsePayload["responseText"]); - return -1; - } - ); - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /* - @Updated - */ - /** - * Get User Roles from user store (Internal roles not included). - * @returns {object} a response object with status and content on success. - */ - publicMethods.getRolesByUserStore = function (userStore) { - userStore = userStore ? userStore : "all"; - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - var utility = require("/app/modules/utility.js")["utility"]; - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants["ERRORS"]["USER_NOT_FOUND"]; - } - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/roles?user-store=" + encodeURIComponent(userStore) + "&limit=100"; - var response = privateMethods.callBackend(url, constants["HTTP_GET"]); - if (response.status == "success") { - response.content = parse(response.content).roles; - } - return response; - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /** - * Get Platforms. - * @deprecated moved this device module under getDeviceTypes. - */ - //TODO Move this piece of logic out of user.js to somewhere else appropriate. - publicMethods.getPlatforms = function () { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - var utility = require("/app/modules/utility.js")["utility"]; - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants["ERRORS"]["USER_NOT_FOUND"]; - } - try { - utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/device-types"; - var response = privateMethods.callBackend(url, constants["HTTP_GET"]); - if (response.status == "success") { - response.content = parse(response.content); - } - return response; - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /** - * Get role - */ - publicMethods.getRole = function (roleName) { - var carbonUser = session.get(constants["USER_SESSION_KEY"]); - var utility = require("/app/modules/utility.js")["utility"]; - var userStore; - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants["ERRORS"]["USER_NOT_FOUND"]; - } - try { - utility.startTenantFlow(carbonUser); - if (roleName.indexOf('/') > 0) { - userStore = roleName.substr(0, roleName.indexOf('/')); - roleName = roleName.substr(roleName.indexOf('/') + 1); - } - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/roles/" + encodeURIComponent(roleName); - if (userStore) { - url += "?user-store=" + encodeURIComponent(userStore); - } - var response = privateMethods.callBackend(url, constants["HTTP_GET"]); - if (response.status == "success") { - response.content = parse(response.content); - } - return response; - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - /** - * Authenticate a user when he or she attempts to login to MDM. - * - * @param username Username of the user - * @param password Password of the user - * @param successCallback Function to be called at the event of successful authentication - * @param failureCallback Function to be called at the event of failed authentication - */ - publicMethods.login = function (username, password, successCallback, failureCallback) { - var carbonModule = require("carbon"); - var carbonServer = application.get("carbonServer"); - try { - // check if the user is an authenticated user. - var isAuthenticated = carbonServer.authenticate(username, password); - if (!isAuthenticated) { - failureCallback("authentication"); - return; - } - var tenantUser = carbonModule.server.tenantUser(username); - var isAuthorizedToLogin = privateMethods.isAuthorizedToLogin(tenantUser); - if (!isAuthorizedToLogin) { - failureCallback("authorization"); - return; - } - session.put(constants.USER_SESSION_KEY, tenantUser); - successCallback(tenantUser); - } catch (e) { - throw e; - } - }; - - publicMethods.logout = function (successCallback) { - session.invalidate(); - successCallback(); - }; - - publicMethods.isAuthorized = function (permission) { - var carbon = require("carbon"); - var carbonServer = application.get("carbonServer"); - 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; - if (!carbonUser) { - log.error("User object was not found in the session"); - response.sendError(401, constants.ERRORS.USER_NOT_FOUND); - exit(); - } - - try { - utility.startTenantFlow(carbonUser); - var tenantId = carbon.server.tenantId(); - var userManager = new carbon.user.UserManager(server, tenantId); - var user = new carbon.user.User(userManager, carbonUser.username); - return user.isAuthorized(permission, "ui.execute"); - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - privateMethods.isAuthorizedToLogin = function(carbonUser) { - var utility = require('/app/modules/utility.js').utility; - try { - utility.startTenantFlow(carbonUser); - var tenantId = carbon.server.tenantId(); - var userManager = new carbon.user.UserManager(server, tenantId); - var user = new carbon.user.User(userManager, carbonUser.username); - return user.isAuthorized("/permission/admin/login", "ui.execute"); - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - }; - - publicMethods.getUIPermissions = function () { - var permissions = {}; - if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/any-device")) { - permissions["LIST_DEVICES"] = true; - permissions["LIST_OWN_DEVICES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view")) { - permissions["LIST_OWN_DEVICES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/groups/view")) { - permissions["LIST_ALL_GROUPS"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/view")) { - permissions["LIST_GROUPS"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/users/list")) { - permissions["LIST_USERS"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/roles/list")) { - permissions["LIST_ROLES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/policies/list")) { - permissions["LIST_ALL_POLICIES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/policies/list")) { - permissions["LIST_POLICIES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/enroll")) { - permissions["ADD_DEVICE"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/add")) { - permissions["ADD_GROUP"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/users/add")) { - permissions["ADD_USER"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/devices/add")) { - permissions["ADD_GROUP_DEVICES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/devices/remove")) { - permissions["REMOVE_GROUP_DEVICES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/devices/view")) { - permissions["VIEW_GROUP_DEVICES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/roles/view")) { - permissions["VIEW_GROUP_ROLES"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/update")) { - permissions["UPDATE_GROUP"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/share")) { - permissions["SHARE_GROUP"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/users/remove")) { - permissions["REMOVE_USER"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/remove")) { - permissions["REMOVE_GROUP"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/roles/add")) { - permissions["ADD_ROLE"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/policies/add")) { - permissions["ADD_ADMIN_POLICY"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/policies/add")) { - permissions["ADD_POLICY"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/policies/priority")) { - permissions["CHANGE_POLICY_PRIORITY"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/dashboard/view")) { - permissions["VIEW_DASHBOARD"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/platform-configurations/view")) { - permissions["TENANT_CONFIGURATION"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/certificates/manage")) { - permissions["CERTIFICATE_MANAGEMENT"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/change-status")) { - permissions["CHANGE_DEVICE_STATUS"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt")) { - permissions["IS_ADMIN"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/topics/view")) { - permissions["VIEW_TOPICS"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/devices/update-enrollment")) { - permissions["UPDATE_ENROLLMENT"] = true; - } - if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/devices/permanent-delete")) { - permissions["PERMANENT_DELETE"] = true; - } - - return permissions; - }; - - /** - * Add new role with permissions. - * - * @param roleName Name of the role - * @param users List of users to assign the role - * @param permissions List of permissions - */ - publicMethods.addRole = function (roleName, users, permissions) { - var carbon = require('carbon'); - var tenantId = carbon.server.tenantId(); - var url = carbon.server.address('https') + "/admin/services"; - var server = new carbon.server.Server(url); - var userManager = new carbon.user.UserManager(server, tenantId); - - try { - if (!userManager.roleExists(roleName)) { - userManager.addRole(roleName, users, permissions); - } else { - var array = Object.keys(permissions); - var i, permission; - for (i = 0; i < array.length; i++) { - permission = array[i]; - userManager.authorizeRole(roleName, permission, "ui.execute"); - } - } - } catch (e) { - throw e; - } - }; - - publicMethods.addPermissions = function (permissionList, path, init) { - var registry, carbon = require("carbon"); - var carbonServer = application.get("carbonServer"); - var utility = require('/app/modules/utility.js').utility; - var options = {system: true}; - if (init == "login") { - try { - var carbonUser = session.get(constants.USER_SESSION_KEY); - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants.ERRORS.USER_NOT_FOUND; - } - utility.startTenantFlow(carbonUser); - var tenantId = carbon.server.tenantId(); - if (carbonUser) { - options.tenantId = tenantId; - } - registry = new carbon.registry.Registry(carbonServer, options); - var i, permission, resource; - for (i = 0; i < permissionList.length; i++) { - permission = permissionList[i]; - resource = { - collection: true, - name: permission.name, - properties: { - name: permission.name - } - }; - if (path != "") { - registry.put("/_system/governance/permission/admin/" + path + "/" + permission.key, resource); - } else { - registry.put("/_system/governance/permission/admin/" + permission.key, resource); - } - } - } catch (e) { - throw e; - } finally { - utility.endTenantFlow(); - } - } else { - registry = new carbon.registry.Registry(carbonServer, options); - var i, permission, resource; - for (i = 0; i < permissionList.length; i++) { - permission = permissionList[i]; - resource = { - collection: true, - name: permission.name, - properties: { - name: permission.name - } - }; - if (path != "") { - registry.put("/_system/governance/permission/admin/" + path + "/" + permission.key, resource); - } else { - registry.put("/_system/governance/permission/admin/" + permission.key, resource); - } - } - } - }; - - /** - * Private method to be used by addUser() to - * retrieve secondary user stores. - * This needs Authentication since the method access admin services. - * - * @returns Array of secondary user stores. - */ - publicMethods.getSecondaryUserStores = function () { - var returnVal = []; - // To call the userstore admin service, user needs to have admin permission - if (publicMethods.isAuthorized("/permission/admin")) { - var endpoint = devicemgtProps["adminService"] + constants["USER_STORE_CONFIG_ADMIN_SERVICE_END_POINT"]; - var wsPayload = ""; - serviceInvokers.WS.soapRequest( - "urn:getSecondaryRealmConfigurations", - wsPayload, - endpoint, - function (wsResponse) { - var domainIDs = stringify(wsResponse. * ::['return']. * ::domainId.text()); - if (domainIDs != "\"\"") { - var regExpForSearch = new RegExp(constants["USER_STORES_NOISY_CHAR"], "g"); - domainIDs = domainIDs.replace(regExpForSearch, ""); - returnVal = domainIDs.split(constants["USER_STORES_SPLITTING_CHAR"]); - } - }, function (e) { - log.error("Error retrieving secondary user stores", e); - }, - constants["SOAP_VERSION"]); - } else { - if (log.isDebugEnabled()) { - log.debug("User does not have admin permission to get the secondary user store details."); - } - } - return returnVal; - }; - - return publicMethods; -}(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/cloud.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/cloud.js deleted file mode 100644 index 9427ed8b95..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/cloud.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var conf = function () { - var cloudConf = application.get("CLOUD_CONF"); - if (!cloudConf) { - cloudConf = require("/app/conf/toplink-menu.json"); - var pinch = require("/app/modules/conf-reader/pinch.min.js")["pinch"]; - var server = require("carbon")["server"]; - var process = require("process"); - pinch(cloudConf, /^/, - function (path, key, value) { - if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) { - //noinspection JSUnresolvedFunction - return value.replace("%https.ip%", server.address("https")); - } else if ((typeof value === "string") && value.indexOf("%http.ip%") > -1) { - //noinspection JSUnresolvedFunction - return value.replace("%http.ip%", server.address("http")); - } else if ((typeof value === "string") && value.indexOf("%date-year%") > -1) { - var year = new Date().getFullYear(); - return value.replace("%date-year%", year); - } else if ((typeof value === "string") && value.indexOf("%server.ip%") > -1) { - var getProperty = require("process").getProperty; - return value.replace("%server.ip%", getProperty("carbon.local.ip")); - } else { - var paramPattern = new RegExp("%(.*?)%", "g"); - var out = value; - while ((matches = paramPattern.exec(value)) !== null) { - // This is necessary to avoid infinite loops with zero-width matches - if (matches.index === paramPattern.lastIndex) { - paramPattern.lastIndex++; - } - if (matches.length == 2) { - var property = process.getProperty(matches[1]); - if (property) { - out = out.replace(new RegExp("%" + matches[1] + "%", "g"), property); - } - } - } - return out; - } - } - ); - application.put("CLOUD_CONF", cloudConf); - } - return cloudConf; -}(); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js deleted file mode 100644 index 4ff8c8ce77..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var conf = function () { - var conf = application.get("CONF"); - if (!conf) { - conf = require("/app/conf/config.json"); - var pinch = require("/app/modules/conf-reader/pinch.min.js")["pinch"]; - var server = require("carbon")["server"]; - var process = require("process"); - pinch(conf, /^/, - function (path, key, value) { - if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) { - //noinspection JSUnresolvedFunction - return value.replace("%https.ip%", server.address("https")); - } else if ((typeof value === "string") && value.indexOf("%http.ip%") > -1) { - //noinspection JSUnresolvedFunction - return value.replace("%http.ip%", server.address("http")); - } else if ((typeof value === "string") && value.indexOf("%date-year%") > -1) { - var year = new Date().getFullYear(); - return value.replace("%date-year%", year); - } else if ((typeof value === "string") && value.indexOf("%server.ip%") > -1) { - var getProperty = require("process").getProperty; - return value.replace("%server.ip%", getProperty("carbon.local.ip")); - } else { - var paramPattern = new RegExp("%(.*?)%", "g"); - var out = value; - while ((matches = paramPattern.exec(value)) !== null) { - // This is necessary to avoid infinite loops with zero-width matches - if (matches.index === paramPattern.lastIndex) { - paramPattern.lastIndex++; - } - if (matches.length == 2) { - var property = process.getProperty(matches[1]); - if (property) { - out = out.replace(new RegExp("%" + matches[1] + "%", "g"), property); - } - } - } - return out; - } - } - ); - var DeviceConfigurationManager = Packages.io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; - conf["serverConfig"] = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); - application.put("CONF", conf); - } - return conf; -}(); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/pinch.min.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/pinch.min.js deleted file mode 100644 index 5d22ca0eb7..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/pinch.min.js +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2011 František Hába -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of -* this software and associated documentation files (the 'Software'), to deal in -* the Software without restriction, including without limitation the rights to use, -* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -* Software, and to permit persons to whom the Software is furnished to do so, -* subject to the following conditions: -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. - -* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Reference:- https://github.com/Baggz/Pinch -* */ -(function(){var k=function(a,c){return a.length!==c.length?!1:a.every(function(a,b){return c[b]===a})},j=function(a,c,d){var b,e;if("[object Array]"===Object.prototype.toString.call(a)){b=0;for(e=a.length;b= 200 && status < 300) { - if (constants["STREAMING_FILES_ACCEPT_HEADERS"].indexOf(acceptTypeValue) > -1) { - return successCallback(httpMethodObject.getResponseBodyAsStream(), - httpMethodObject.getResponseHeaders()); - } else { - return successCallback(httpMethodObject.getResponseBodyAsString(), - httpMethodObject.getResponseHeaders()); - } - } else { - return errorCallback(httpMethodObject.getResponseBodyAsString(), - httpMethodObject.getResponseHeaders()); - } - } catch (e) { - return errorCallback(response); - } finally { - //noinspection JSUnresolvedFunction - if (method != constants["HTTP_GET"]) { - method.releaseConnection(); - } - } - }; - - /** - * This method invokes return initiateHTTPClientRequest for get calls. - * @param url target url. - * @param successCallback a function to be called if the respond if successful. - * @param errorCallback a function to be called if en error is reserved. - * @param headers a list of name value pairs for additional http headers. - */ - publicHTTPClientInvokers["get"] = function (url, successCallback, errorCallback, headers) { - var requestPayload = null; - return privateMethods.initiateHTTPClientRequest(constants["HTTP_GET"], url, successCallback, errorCallback, - requestPayload, headers); - }; - - /** - * This method invokes return initiateHTTPClientRequest for post calls. - * @param url target url. - * @param payload payload/data which need to be send. - * @param successCallback a function to be called if the respond if successful. - * @param errorCallback a function to be called if en error is reserved. - * @param headers a list of name value pairs for additional http headers. - */ - publicHTTPClientInvokers["post"] = function (url, payload, successCallback, errorCallback, headers) { - return privateMethods.initiateHTTPClientRequest(constants["HTTP_POST"], url, successCallback, errorCallback, - payload, headers); - }; - - /** - * This method invokes return initiateHTTPClientRequest for put calls. - * @param url target url. - * @param payload payload/data which need to be send. - * @param successCallback a function to be called if the respond if successful. - * @param errorCallback a function to be called if en error is reserved. - * @param headers a list of name value pairs for additional http headers. - */ - publicHTTPClientInvokers["put"] = function (url, payload, successCallback, errorCallback, headers) { - return privateMethods.initiateHTTPClientRequest(constants["HTTP_PUT"], url, successCallback, errorCallback, - payload, headers); - }; - - /** - * This method invokes return initiateHTTPClientRequest for delete calls. - * @param url target url. - * @param successCallback a function to be called if the respond if successful. - * @param errorCallback a function to be called if en error is reserved. - * @param headers a list of name value pairs for additional http headers. - */ - publicHTTPClientInvokers["delete"] = function (url, successCallback, errorCallback, headers) { - var requestPayload = null; - return privateMethods.initiateHTTPClientRequest(constants["HTTP_DELETE"], url, successCallback, errorCallback, - requestPayload, headers); - }; - - var publicMethods = {}; - publicMethods.XMLHttp = publicXMLHTTPInvokers; - publicMethods.WS = publicWSInvokers; - publicMethods.HttpClient = publicHTTPClientInvokers; - - return publicMethods; -}(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/utility.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/utility.js deleted file mode 100644 index 452c9f5df5..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/utility.js +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var utility; -utility = function () { - - var constants = require('/app/modules/constants.js'); - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var log = new Log("/app/modules/utility.js"); - var JavaClass = Packages.java.lang.Class; - var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext; - var server = require("carbon")["server"]; - - var getOsgiService = function (className) { - return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(JavaClass.forName(className)); - }; - - var deviceTypeConfigMap = {}; - - var publicMethods = {}; - - publicMethods.startTenantFlow = function (userInfo) { - var context, carbon = require('carbon'); - PrivilegedCarbonContext.startTenantFlow(); - context = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - context.setTenantDomain(carbon.server.tenantDomain({ - tenantId: userInfo.tenantId - })); - context.setTenantId(userInfo.tenantId); - context.setUsername(userInfo.username || null); - }; - - publicMethods.endTenantFlow = function () { - PrivilegedCarbonContext.endTenantFlow(); - }; - - publicMethods.getDeviceManagementService = function () { - return getOsgiService('io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService'); - }; - - publicMethods.getAPIManagementProviderService = function () { - return getOsgiService('io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderService'); - }; - - publicMethods.getUserManagementService = function () { - return getOsgiService("org.wso2.carbon.device.mgt.user.core.UserManager"); - }; - - publicMethods.getPolicyManagementService = function () { - return getOsgiService("io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService"); - }; - - publicMethods.getDeviceTypeConfig = function (deviceType) { - var unitName = publicMethods.getTenantedDeviceUnitName(deviceType, "type-view"); - if (!unitName) { - return null; - } - - if (deviceType in deviceTypeConfigMap) { - return deviceTypeConfigMap[deviceType]; - } - var deviceTypeConfig; - var deviceTypeConfigFile = new File("/app/units/" + unitName + "/private/config.json"); - if (deviceTypeConfigFile.isExists()) { - try { - deviceTypeConfigFile.open("r"); - var config = deviceTypeConfigFile.readAll(); - config = config.replace("%https.ip%", server.address("https")); - config = config.replace("%http.ip%", server.address("http")); - deviceTypeConfig = parse(config); - } catch (err) { - log.error("Error while reading device config file for `" + deviceType + "`: " + err); - } finally { - deviceTypeConfigFile.close(); - } - } - deviceTypeConfigMap[deviceType] = deviceTypeConfig; - return deviceTypeConfig; - }; - - publicMethods.getOperationIcon = function (deviceType, operation) { - var unitName = publicMethods.getTenantedDeviceUnitName(deviceType, "type-view"); - var iconPath = "/app/units/" + unitName + "/public/images/operations/" + operation + ".png"; - var icon = new File(iconPath); - if (icon.isExists()) { - return devicemgtProps["appContext"] + "public/" + unitName + "/images/operations/" + operation + ".png"; - } else { - return null; - } - }; - - publicMethods.getDeviceThumb = function (deviceType) { - var unitName = publicMethods.getTenantedDeviceUnitName(deviceType, "type-view"); - if (!unitName) { - unitName = "cdmf.unit.default.device.type.type-view"; - } - var iconPath = "/app/units/" + unitName + "/public/images/thumb.png"; - var icon = new File(iconPath); - if (icon.isExists()) { - return devicemgtProps["appContext"] + "public/" + unitName + "/images/thumb.png"; - } else { - return null; - } - }; - - publicMethods.getTenantedDeviceUnitName = function (deviceType, unitPostfix) { - var user = session.get(constants.USER_SESSION_KEY); - if (!user) { - log.error("User object was not found in the session"); - throw constants.ERRORS.USER_NOT_FOUND; - } - var unitName = user.domain + ".cdmf.unit.device.type." + deviceType + "." + unitPostfix; - if (new File("/app/units/" + unitName).isExists()) { - return unitName; - } - unitName = "cdmf.unit.device.type." + deviceType + "." + unitPostfix; - if (new File("/app/units/" + unitName).isExists()) { - return unitName; - } - return null; - }; - - publicMethods.getDeviceTypesScopesList = function () { - var dirs = new File("/app/units/").listFiles(); - var scopesList = []; - for (var i = 0; i < dirs.length; i++) { - var unitName = dirs[i].getName(); - if (unitName.match(/^cdmf\.unit\.device\.type\..*\.type-view$/g)) { - var deviceTypeConfigFile = new File("/app/units/" + unitName + "/private/config.json"); - if (deviceTypeConfigFile.isExists()) { - try { - deviceTypeConfigFile.open("r"); - var config = deviceTypeConfigFile.readAll(); - config = config.replace("%https.ip%", server.address("https")); - config = config.replace("%http.ip%", server.address("http")); - var deviceTypeConfig = parse(config); - if (deviceTypeConfig.deviceType && deviceTypeConfig.deviceType.scopes) { - scopesList = scopesList.concat(deviceTypeConfig.deviceType.scopes); - } - } catch (err) { - log.error("Error while reading device config file for `" + deviceType + "`: " + err); - } finally { - deviceTypeConfigFile.close(); - } - } - } - } - return scopesList; - }; - - - /** - * Escapes special characters such as <,>,',",...etc - * This will prevent XSS attacks upon JSON. - * @param text - * @returns {*} - */ - publicMethods.encodeJson = function (text) { - if (text) { - return text - .replace(/\\u003c/g, "<") - .replace(//g, ">") - .replace(/\\u0027/g, "'") - .replace(/'/g, "'") - .replace(/\\"/g, """) - .replace(/\\u0022/g, """); - } else { - return ""; - } - }; - - publicMethods.md5 = function (s) { - function L(k, d) { - return (k << d) | (k >>> (32 - d)) - } - - function K(G, k) { - var I, d, F, H, x; - F = (G & 2147483648); - H = (k & 2147483648); - I = (G & 1073741824); - d = (k & 1073741824); - x = (G & 1073741823) + (k & 1073741823); - if (I & d) { - return (x ^ 2147483648 ^ F ^ H) - } - if (I | d) { - if (x & 1073741824) { - return (x ^ 3221225472 ^ F ^ H) - } else { - return (x ^ 1073741824 ^ F ^ H) - } - } else { - return (x ^ F ^ H) - } - } - - function r(d, F, k) { - return (d & F) | ((~d) & k) - } - - function q(d, F, k) { - return (d & k) | (F & (~k)) - } - - function p(d, F, k) { - return (d ^ F ^ k) - } - - function n(d, F, k) { - return (F ^ (d | (~k))) - } - - function u(G, F, aa, Z, k, H, I) { - G = K(G, K(K(r(F, aa, Z), k), I)); - return K(L(G, H), F) - } - - function f(G, F, aa, Z, k, H, I) { - G = K(G, K(K(q(F, aa, Z), k), I)); - return K(L(G, H), F) - } - - function D(G, F, aa, Z, k, H, I) { - G = K(G, K(K(p(F, aa, Z), k), I)); - return K(L(G, H), F) - } - - function t(G, F, aa, Z, k, H, I) { - G = K(G, K(K(n(F, aa, Z), k), I)); - return K(L(G, H), F) - } - - function e(G) { - var Z; - var F = G.length; - var x = F + 8; - var k = (x - (x % 64)) / 64; - var I = (k + 1) * 16; - var aa = Array(I - 1); - var d = 0; - var H = 0; - while (H < F) { - Z = (H - (H % 4)) / 4; - d = (H % 4) * 8; - aa[Z] = (aa[Z] | (G.charCodeAt(H) << d)); - H++ - } - Z = (H - (H % 4)) / 4; - d = (H % 4) * 8; - aa[Z] = aa[Z] | (128 << d); - aa[I - 2] = F << 3; - aa[I - 1] = F >>> 29; - return aa - } - - function B(x) { - var k = "", F = "", G, d; - for (d = 0; d <= 3; d++) { - G = (x >>> (d * 8)) & 255; - F = "0" + G.toString(16); - k = k + F.substr(F.length - 2, 2) - } - return k - } - - function J(k) { - k = k.replace(/rn/g, "n"); - var d = ""; - for (var F = 0; F < k.length; F++) { - var x = k.charCodeAt(F); - if (x < 128) { - d += String.fromCharCode(x) - } else { - if ((x > 127) && (x < 2048)) { - d += String.fromCharCode((x >> 6) | 192); - d += String.fromCharCode((x & 63) | 128) - } else { - d += String.fromCharCode((x >> 12) | 224); - d += String.fromCharCode(((x >> 6) & 63) | 128); - d += String.fromCharCode((x & 63) | 128) - } - } - } - return d - } - - var C = Array(); - var P, h, E, v, g, Y, X, W, V; - var S = 7, Q = 12, N = 17, M = 22; - var A = 5, z = 9, y = 14, w = 20; - var o = 4, m = 11, l = 16, j = 23; - var U = 6, T = 10, R = 15, O = 21; - s = J(s); - C = e(s); - Y = 1732584193; - X = 4023233417; - W = 2562383102; - V = 271733878; - for (P = 0; P < C.length; P += 16) { - h = Y; - E = X; - v = W; - g = V; - Y = u(Y, X, W, V, C[P + 0], S, 3614090360); - V = u(V, Y, X, W, C[P + 1], Q, 3905402710); - W = u(W, V, Y, X, C[P + 2], N, 606105819); - X = u(X, W, V, Y, C[P + 3], M, 3250441966); - Y = u(Y, X, W, V, C[P + 4], S, 4118548399); - V = u(V, Y, X, W, C[P + 5], Q, 1200080426); - W = u(W, V, Y, X, C[P + 6], N, 2821735955); - X = u(X, W, V, Y, C[P + 7], M, 4249261313); - Y = u(Y, X, W, V, C[P + 8], S, 1770035416); - V = u(V, Y, X, W, C[P + 9], Q, 2336552879); - W = u(W, V, Y, X, C[P + 10], N, 4294925233); - X = u(X, W, V, Y, C[P + 11], M, 2304563134); - Y = u(Y, X, W, V, C[P + 12], S, 1804603682); - V = u(V, Y, X, W, C[P + 13], Q, 4254626195); - W = u(W, V, Y, X, C[P + 14], N, 2792965006); - X = u(X, W, V, Y, C[P + 15], M, 1236535329); - Y = f(Y, X, W, V, C[P + 1], A, 4129170786); - V = f(V, Y, X, W, C[P + 6], z, 3225465664); - W = f(W, V, Y, X, C[P + 11], y, 643717713); - X = f(X, W, V, Y, C[P + 0], w, 3921069994); - Y = f(Y, X, W, V, C[P + 5], A, 3593408605); - V = f(V, Y, X, W, C[P + 10], z, 38016083); - W = f(W, V, Y, X, C[P + 15], y, 3634488961); - X = f(X, W, V, Y, C[P + 4], w, 3889429448); - Y = f(Y, X, W, V, C[P + 9], A, 568446438); - V = f(V, Y, X, W, C[P + 14], z, 3275163606); - W = f(W, V, Y, X, C[P + 3], y, 4107603335); - X = f(X, W, V, Y, C[P + 8], w, 1163531501); - Y = f(Y, X, W, V, C[P + 13], A, 2850285829); - V = f(V, Y, X, W, C[P + 2], z, 4243563512); - W = f(W, V, Y, X, C[P + 7], y, 1735328473); - X = f(X, W, V, Y, C[P + 12], w, 2368359562); - Y = D(Y, X, W, V, C[P + 5], o, 4294588738); - V = D(V, Y, X, W, C[P + 8], m, 2272392833); - W = D(W, V, Y, X, C[P + 11], l, 1839030562); - X = D(X, W, V, Y, C[P + 14], j, 4259657740); - Y = D(Y, X, W, V, C[P + 1], o, 2763975236); - V = D(V, Y, X, W, C[P + 4], m, 1272893353); - W = D(W, V, Y, X, C[P + 7], l, 4139469664); - X = D(X, W, V, Y, C[P + 10], j, 3200236656); - Y = D(Y, X, W, V, C[P + 13], o, 681279174); - V = D(V, Y, X, W, C[P + 0], m, 3936430074); - W = D(W, V, Y, X, C[P + 3], l, 3572445317); - X = D(X, W, V, Y, C[P + 6], j, 76029189); - Y = D(Y, X, W, V, C[P + 9], o, 3654602809); - V = D(V, Y, X, W, C[P + 12], m, 3873151461); - W = D(W, V, Y, X, C[P + 15], l, 530742520); - X = D(X, W, V, Y, C[P + 2], j, 3299628645); - Y = t(Y, X, W, V, C[P + 0], U, 4096336452); - V = t(V, Y, X, W, C[P + 7], T, 1126891415); - W = t(W, V, Y, X, C[P + 14], R, 2878612391); - X = t(X, W, V, Y, C[P + 5], O, 4237533241); - Y = t(Y, X, W, V, C[P + 12], U, 1700485571); - V = t(V, Y, X, W, C[P + 3], T, 2399980690); - W = t(W, V, Y, X, C[P + 10], R, 4293915773); - X = t(X, W, V, Y, C[P + 1], O, 2240044497); - Y = t(Y, X, W, V, C[P + 8], U, 1873313359); - V = t(V, Y, X, W, C[P + 15], T, 4264355552); - W = t(W, V, Y, X, C[P + 6], R, 2734768916); - X = t(X, W, V, Y, C[P + 13], O, 1309151649); - Y = t(Y, X, W, V, C[P + 4], U, 4149444226); - V = t(V, Y, X, W, C[P + 11], T, 3174756917); - W = t(W, V, Y, X, C[P + 2], R, 718787259); - X = t(X, W, V, Y, C[P + 9], O, 3951481745); - Y = K(Y, h); - X = K(X, E); - W = K(W, v); - V = K(V, g) - } - var i = B(Y) + B(X) + B(W) + B(V); - return i.toLowerCase() - }; - - return publicMethods; -}(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs deleted file mode 100644 index b128ceaf92..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs +++ /dev/null @@ -1,111 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Add Certificate"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Certificates - -
  • -
  • - - Add - -
  • -{{/zone}} - -{{#zone "content"}} - {{#if isAuthorized}} - -
    -
    - -
    -
    -

    Add Certificate

    -

    Please note that * sign represents required fields of data.

    -
    -
    -
    - - - -
    -
    - -
    - -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - - -
    -
    - - {{else}} -

    - Permission Denied -

    -
    - You not authorized to enter Certificate Management Section. -
    - {{/if}} -{{/zone}} - -{{#zone "bottomJs"}} - {{js "/js/certificate-create.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.js deleted file mode 100644 index c9a7ab5d00..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Returns the dynamic state to be populated by add-user page. - * - * @param viewModel Object that gets updated with the dynamic state of this page to be presented - * @returns {*} A viewModel object that returns the dynamic state of this page to be presented - */ -function onRequest(context) { - // var log = new Log("units/user-create/create.js"); - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; - var viewModel = {}; - viewModel.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/certificates/manage"); - var response = userModule.getRolesByUserStore(); - if (response["status"] == "success") { - viewModel["roles"] = response["content"]; - } - - viewModel["charLimit"] = mdmProps["userValidationConfig"]["usernameLength"]; - viewModel["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"]; - viewModel["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"]; - viewModel["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"]; - viewModel["firstnameJSRegEx"] = mdmProps["userValidationConfig"]["firstnameJSRegEx"]; - viewModel["firstnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"]; - viewModel["lastnameJSRegEx"] = mdmProps["userValidationConfig"]["lastnameJSRegEx"]; - viewModel["lastnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"]; - - return viewModel; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.json deleted file mode 100644 index db293d5ab1..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/certificates/add", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/public/js/certificate-create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/public/js/certificate-create.js deleted file mode 100644 index e9a4a53641..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/public/js/certificate-create.js +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ -var pemContent = ""; -var errorMsgWrapper = "#certificate-create-error-msg"; -var errorMsg = "#certificate-create-error-msg span"; -var validateInline = {}; -var clearInline = {}; - -var base_api_url = "/api/certificate-mgt/v1.0"; - -var enableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).addClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).removeClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).removeClass(" hidden"); - } -}; - -var disableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).removeClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).addClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).addClass(" hidden"); - } -}; - -function readSingleFile(evt) { - var f = evt.target.files[0]; - if (f) { - var r = new FileReader(); - r.onload = function (e) { - var contents = e.target.result; - if (f.type == "application/x-x509-ca-cert") { - pemContent = contents; - console.log(contents); - console.log(pemContent); - pemContent = pemContent.substring(28, pemContent.length - 27); - console.log(pemContent); - $(errorMsgWrapper).addClass("hidden"); - } else { - $(errorMsg).text("Certificate must be a .pem file containing a valid certificate data."); - $(errorMsgWrapper).removeClass("hidden"); - } - } - r.readAsText(f); - } else { - //inline error - } -} - -$(document).ready(function () { - pemContent = ""; - document.getElementById('certificate').addEventListener('change', readSingleFile, false); - - /** - * Following click function would execute - * when a user clicks on "Add Certificate" button. - */ - $("button#add-certificate-btn").click(function () { - var serialNoInput = $("input#serialNo"); - var serialNo = serialNoInput.val(); - if (!serialNo) { - $(errorMsg).text("Serial Number is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!pemContent) { - $(errorMsg).text(" .pem file must contains certificate information."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - var addCertificateFormData = {}; - addCertificateFormData.serial = serialNo; - addCertificateFormData.pem = pemContent; - var certificateList = []; - certificateList.push(addCertificateFormData); - - var serviceUrl = base_api_url + "/admin/certificates"; - invokerUtil.post( - serviceUrl, - certificateList, - function (data) { - // Refreshing with success message - $("#certificate-create-form").addClass("hidden"); - $("#certificate-created-msg").removeClass("hidden"); - }, function (data) { - if (data["status"] == 500) { - $(errorMsg).text("An unexpected error occurred at backend server. Please try again later."); - } else { - $(errorMsg).text(data); - } - $(errorMsgWrapper).removeClass("hidden"); - } - ); - } - }); -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs deleted file mode 100644 index 276bc83048..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs +++ /dev/null @@ -1,122 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Add Certificate"}} -{{unit "cdmf.unit.ui.modal"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Certificate - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#if removePermitted}} -
  • - - - - - - Add Certificate - -
  • - {{/if}} -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.data-tables-extended"}} - - -
    - {{#if removePermitted}} - - {{/if}} - {{#if viewPermitted}} - - {{/if}} - - Loading Certificates . . . -
    -
    - - - - -
    - -{{/zone}} - -{{#zone "bottomJs"}} - - - {{js "/js/certificate-listing.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.js deleted file mode 100644 index 4cb1e4099f..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; - var viewModel = {}; - - - if (userModule.isAuthorized("/permission/admin/device-mgt/certificates/manage")) { - viewModel["removePermitted"] = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/certificates/view")) { - viewModel["viewPermitted"] = true; - } - - viewModel.adminUser = mdmProps.adminUser; - return viewModel; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.json deleted file mode 100644 index 39fb7ff01b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/certificates", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/public/js/certificate-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/public/js/certificate-listing.js deleted file mode 100644 index 3e73a11999..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/public/js/certificate-listing.js +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/* - * Sorting function of certificates - * listed on Certificate Management page in WSO2 MDM Console. - */ -$(function () { - var sortableElem = '.wr-sortable'; - $(sortableElem).sortable({ - beforeStop: function () { - var sortedIDs = $(this).sortable('toArray'); - } - }); - $(sortableElem).disableSelection(); -}); - -var modalPopup = ".modal"; -var modalPopupContainer = modalPopup + " .modal-content"; -var modalPopupContent = modalPopup + " .modal-content"; -var body = "body"; -var isInit = true; - -var base_api_url = "/api/certificate-mgt/v1.0"; - -$(".icon .text").res_text(0.2); - -/* - * set popup maximum height function. - */ -function setPopupMaxHeight() { - $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30))); - $(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2))); -} - -/* - * show popup function. - */ -function showPopup() { - $(modalPopup).modal('show'); -} - -/* - * hide popup function. - */ -function hidePopup() { - $(modalPopupContent).html(''); - $(modalPopup).modal('hide'); - $('body').removeClass('modal-open').css('padding-right','0px'); - $('.modal-backdrop').remove(); -} - -/** - * Following click function would execute - * when a user clicks on "Remove" link - * on Certificate Listing page in WSO2 MDM Console. - */ -function removeCertificate(serialNumber) { - var serviceUrl = base_api_url + "/admin/certificates/" + serialNumber; - modalDialog.header('Do you really want to remove this certificate ?'); - modalDialog.footer(''); - modalDialog.show(); - - $("a#remove-certificate-yes-link").click(function () { - invokerUtil.delete( - serviceUrl, - function () { - $("#" + serialNumber).remove(); - var newCertificateListCount = $(".user-list > span").length; - $("#certificate-listing-status-msg").text("Total number of Certificates found : " + - newCertificateListCount); - modalDialog.header('Done. Certificate was successfully removed.'); - modalDialog.footer(''); - $("a#remove-certificate-success-link").click(function () { - modalDialog.hide(); - }); - }, - function () { - modalDialog.header('An unexpected error occurred. Please try again later.'); - modalDialog.footer(''); - modalDialog.showAsError(); - $("a#remove-certificate-error-link").click(function () { - modalDialog.hide(); - }); - } - ); - }); - - $("a#remove-certificate-cancel-link").click(function () { - modalDialog.hide(); - }); -} - -/** - * Following on click function would execute - * when a user type on the search field on certificate Listing page in - * WSO2 MDM Console then click on the search button. - */ -$("#search-btn").click(function () { - var searchQuery = $("#search-by-certificate").val(); - $("#ast-container").empty(); - loadCertificates(searchQuery); -}); - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption() { - if ($("#can-view").val()) { - $(location).attr('href', $(this).data("url")); - } else { - modalDialog.header('Unauthorized action!'); - modalDialog.content('You do not have permission to view this certificate.'); - modalDialog.showAsAWarning(); - } -} - -function loadCertificates(searchParam) { - $("#loading-content").show(); - var certificateListing = $("#certificate-listing"); - var certificateListingSrc = certificateListing.attr("src"); - $.template("certificate-listing", certificateListingSrc, function (template) { - var serviceURL = base_api_url + "/admin/certificates"; - - if (searchParam != null && searchParam != undefined && searchParam.trim() != '') { - serviceURL = base_api_url + "/admin/certificates?" + searchParam; - } - - var successCallback = function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - data = JSON.parse(data); - - var viewModel = {}; - viewModel.certificates = data.certificates; - - for (var i = 0; i < viewModel.certificates.length; i++) { - viewModel.certificates[i].removePermitted = true; - viewModel.certificates[i].viewPermitted = true; - } - - if (viewModel.certificates.length > 0) { - $('#certificate-table').removeClass('hidden'); - $('#ast-container').removeClass('hidden'); - $('#certificate-listing-status-msg').text(""); - var content = template(viewModel); - $("#ast-container").html(content); - } else { - $('#certificate-table').addClass('hidden'); - $('#certificate-listing-status-msg').text('No certificate is available to be displayed.'); - $('#certificate-listing-status').removeClass('hidden'); - } - - $("#loading-content").hide(); - - if (isInit) { - $('#certificate-grid').datatables_extended(); - isInit = false; - } - - $(".icon .text").res_text(0.2); - } - }; - invokerUtil.get(serviceURL, - successCallback, - function (message) { - $('#ast-container').addClass('hidden'); - $('#certificate-listing-status-msg'). - text('Invalid search query. Try again with a valid search query'); - } - ); - }); -} - -$(document).ready(function () { - loadCertificates(); - - $(".viewEnabledIcon").click(function () { - InitiateViewOption(); - }); -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/public/templates/certificate-listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/public/templates/certificate-listing.hbs deleted file mode 100644 index 8097c3e987..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/public/templates/certificate-listing.hbs +++ /dev/null @@ -1,30 +0,0 @@ -{{#each certificates}} - - - -
    - -
    - - {{serialNumber}} - {{subject}} - - {{#unequal adminUser serialNumber }} - {{#if removePermitted}} - - - - - - - - {{/if}} - {{/unequal}} - - - -{{/each}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.hbs deleted file mode 100644 index 85fdd17be9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.hbs +++ /dev/null @@ -1,172 +0,0 @@ -{{! - Copyright (c) 2018, 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. -}} -{{#zone "title"}}{{! to override parent page title }}{{/zone}} -{{unit "cdmf.unit.ui.title" pageTitle="Consent Page"}} - -{{#zone "content"}} -
    -
    - -

    COOKIE POLICY

    - -
    -

    About Entgra IoT Server

    -

    Entgra IoT Server 4.1.0 is a complete solution that enables device manufacturers and enterprises to - connect and manage their devices, build apps, manage events, secure devices and data, and visualize - sensor data in a scalable manner.

    -

    It also offers a complete and secure Enterprise Mobility Management (EMM/MDM) solution that aims to - address mobile computing challenges faced by enterprises today. Supporting iOS, Android, and Windows - devices, it helps organizations deal with both Corporate Owned, Personally Enabled (COPE) and - employee-owned devices with the Bring Your Own Device (BYOD) concept.

    -

    Entgra IoT Server 4.1.0 comes with advanced analytics, enabling users to analyze speed, proximity, - and - geo-fencing information of devices including details of those in motion and stationary state.

    -

    -

    Cookie Policy

    -

    IoT Server uses cookies to provide you with the best user experience, and to securely identify you. - You can disable cookies if you so wish . However you might not be able to access some of the services - if you disable cookies.

    -

    What is a cookie?

    -

    A browser cookie is a small piece of data that is stored on your device to help websites and mobile - apps remember things about you. Other technologies, including Web storage and identifiers associated - with your device, may be used for similar purposes. In this policy, we use the term “cookies” to - discuss all of these technologies.

    -

    How does Entgra IoT Server 4.1.0 process cookies?

    -

    Entgra IoT Server 4.1.0 uses cookies to store and retrieve information on your browser. This - information is used to provide a better user experience. Some cookies serve the purpose of allowing a - user to log in to the system, maintain sessions, and keep track of activities within the login - session.

    -

    Some cookies in Entgra IoT Server 4.1.0 are used to personally identify you. However, the cookie - lifetime ends once your session ends, i.e., after you log-out, or after the session expiry time has - elapsed.

    -

    Some cookies are simply used to give you a more personalised web experience, and these cannot be used - to identify you or your activities personally.

    -

    This Cookie Policy is part of the IoT Server Privacy Policy. -

    -

    What does Entgra IoT Server 4.1.0 use cookies for?

    -

    Cookies are used for two purposes in Entgra IoT Server 4.1.0.

    -
      -
    1. To identify you and provide security
    2. -
    3. To provide a satisfying user experience.
    4. -
    - -

    Preferences

    -

    Entgra IoT Server 4.1.0 uses cookies to remember your settings and preferences and to auto-fill the - fields to make your interactions with the site easier.

    -

    These cookies can not be used to personally identify you.

    - -

    Security

    -
      -
    1. Entgra IoT Server 4.1.0 uses selected cookies to identify and prevent security risks. For - example, - Entgra IoT Server 4.1.0 may use cookies to store your session information to prevent others from - changing your password without your username and password. -
    2. -
    3. Entgra IoT Server 4.1.0 uses session cookie to maintain your active session.
    4. -
    5. Entgra IoT Server 4.1.0 may use a temporary cookie when performing multi-factor authentication - and - federated authentication. -
    6. -
    7. Entgra IoT Server 4.1.0 may use permanent cookies to detect the devices you have logged in - previously. This is to to calculate the risk level associated with your current login - attempt. Using these cookies protects you and your account from possible attacks. -
    8. -
    -

    Performance

    -

    Entgra IoT Server 4.1.0 may use cookies to allow Remember Me functionalities.

    -

    Analytics

    -

    Entgra IoT Server 4.1.0 as a product does not use cookies for analytical purposes.

    -

    Third party cookies

    -

    Using Entgra IoT Server 4.1.0 may cause third-party cookie to be set in your browser. Entgra IoT - Server - 4.1.0 has no control over how any of them operate. The third-party cookies that maybe set - include:

    -
      -
    1. Any social login sites. For example, third-party cookies may be set when Entgra IoT Server 4.1.0 - is configured to use “social” or “federated” login, and you opt to login with your “Social - Account”. -
    2. -
    3. Any third party federated login.
    4. -
    -

    Entgra strongly advises you to refer the respective cookie policies of such sites carefully as Entgra has - no knowledge or use on these cookies.

    -

    What type of cookies does Entgra IoT Server 4.1.0 use?

    -

    Entgra IoT Server 4.1.0 uses persistent cookies and session cookies. A persistent cookie helps - Entgra IS - 3.8.0 to recognize you as an existing user so that it is easier to return to Entgra or interact with - Entgra IS 3.8.0 without signing in again. After you sign in, a persistent cookie stays in your browser - and will be read by Entgra IoT Server 4.1.0 when you return to Entgra IoT Server 4.1.0.

    -

    A session cookie is a cookie that is erased when the user closes the Web browser. The session cookie - is stored in temporarily and is not retained after the browser is closed. Session cookies do not - collect information from the user’s computer.

    -

    How do I control my cookies?

    -

    Most browsers allow you to control cookies through settings. However, if you limit the given ability - for websites to set cookies, you may worsen your overall user experience since it will no longer be - personalized to you. It may also stop you from saving customized settings like login information. - Most likely, disabling cookies will make it unable for you to use authentication and authorization - functionalities offered by Entgra IoT Server 4.1.0.

    -

    If you have any questions or concerns regarding the use of cookies, please contact the entity or - individuals (or their data protection officer, if applicable) running this Entgra IoT Server 4.1.0 - instance.

    -

    What are the cookies used?

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Cookie NamePurposeRetention
    JSESSIONIDTo keep your session data in order to give you a good user experience.Session
    commonAuthIdUsed to authenticate the the logged in session.Session
    samlssoTokenIdUsed to map the logged in user with the SAML token.Request
    requestedURIThe URI you are accessing.Session
    -

    Disclaimer

    -

    This cookie policy is only for illustrative purposes of the product Entgra IoT Server 4.1.0. The - content in the policy is technically correct at the time of the product shipment. The - entity,organization or individual that runs this Entgra IoT Server 4.1.0 instance has full authority - and responsibility with regard to the effective Cookie Policy. Entgra, its employees, partners, and - affiliates do not have access to and do not require, store, process or control any of the data, - including personal data contained in Entgra IoT Server 4.1.0. All data, including personal data is - controlled and processed by the entity, organization or individual running Entgra IoT Server 4.1.0. - Entgra, its employees partners and affiliates are not a data processor or a data controller within the - meaning of any data privacy regulations. Entgra does not provide any warranties or undertake any - responsibility or liability in connection with the lawfulness or the manner and purposes for which - Entgra IoT Server 4.1.0 is used by such entities, organizations or persons.

    -
    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.json deleted file mode 100644 index b531aa0319..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "layout": "uuf.layout.sign-in", - "uri": "/cookie-policy", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs deleted file mode 100644 index 689312a441..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs +++ /dev/null @@ -1,234 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Home"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -{{/zone}} - -{{#zone "content"}} -
    - {{#if permissions.VIEW_DASHBOARD}} -
    -
    -
    Devices
    -
    -
    -
    - {{deviceCount}} - - - {{#if deviceCount}} - - - - - - View - - {{/if}} - - - - - - - Add - - -
    -
    -
    -
    -
    -
    -
    Groups
    -
    -
    -
    - {{groupCount}} - - {{#if groupCount}} - - - - - - - View - - {{/if}} - - - - - - - - Add - - - -
    -
    -
    -
    -
    -
    -
    Users
    -
    -
    -
    - {{userCount}} - - {{#if userCount}} - - - - - - - View - - {{/if}} - - {{#unless isCloud}} - - - - - - Add - - {{/unless}} - -
    -
    -
    -
    -
    -
    -
    Policies
    -
    -
    -
    - {{policyCount}} - - {{#if policyCount}} - - - - - - - View - - {{/if}} - - - - - - - - Add - - - -
    -
    -
    -
    -
    -
    -
    Roles
    -
    -
    -
    - {{roleCount}} - - {{#if roleCount}} - - - - - - - View - - {{/if}} - - {{#unless isCloud}} - - - - - - Add - - {{/unless}} - -
    -
    -
    -
    - {{#if permissions.IS_ADMIN}} -
    -
    -
    Device Types
    -
    -
    -
    - {{deviceTypeCount}} - - - {{#if deviceTypeCount}} - - - - - - View - - {{/if}} - - - - - - - Add - - -
    -
    -
    -
    - {{/if}} - - {{else}} -

    - Permitted None -

    - {{/if}} -
    -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js deleted file mode 100644 index d61bb67833..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var constants = require("/app/modules/constants.js"); - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; - var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"]; - - if(!session.get(constants["TOKEN_PAIR"])){ - response.sendRedirect(context.app.context + "/welcome"); - return; - } - - var user = session.get(constants["USER_SESSION_KEY"]); - var permissions = userModule.getUIPermissions(); - - if (!permissions.VIEW_DASHBOARD) { - response.sendRedirect(devicemgtProps["appContext"] + "devices"); - return; - } - - var viewModel = {}; - viewModel.permissions = permissions; - viewModel.enrollmentURL = devicemgtProps.enrollmentURL; - viewModel.deviceCount = deviceModule.getDevicesCount(); - viewModel.groupCount = groupModule.getGroupCount(); - viewModel.userCount = userModule.getUsersCount(); - viewModel.policyCount = policyModule.getPoliciesCount(); - viewModel.deviceTypeCount = deviceModule.getDeviceTypeCount(); - viewModel.isCloud = devicemgtProps.isCloud; - if (devicemgtProps.isCloud) { - viewModel.roleCount = userModule.getFilteredRoles("devicemgt").content.count; - } else { - viewModel.roleCount = userModule.getRolesCount(); - } - return viewModel; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.json deleted file mode 100644 index 9674ea3a9b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.hbs deleted file mode 100644 index f2120857e0..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.hbs +++ /dev/null @@ -1,67 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{#zone "topCss"}} - {{css "css/analytics.css"}} -{{/zone}} - -{{unit "cdmf.unit.ui.title" pageTitle="Analytics"}} -{{unit "cdmf.unit.ui.content.title" pageHeader=title}} -{{unit "cdmf.unit.lib.service-invoker-utility"}} -{{unit "cdmf.unit.lib.handlebars"}} -{{unit "cdmf.unit.lib.rickshaw-graph"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Devices - -
  • -
  • - - {{deviceName}} - -
  • -
  • - - Analytics - -
  • -{{/zone}} - -{{#zone "content"}} -
    -
    -
    -
    -

    {{deviceName}} Analytics

    -
    - {{unit "cdmf.unit.analytics.date-range-picker"}} -
    -
    -
    -
    - {{unit deviceAnalyticsViewUnitName}} -
    -
    -
    -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.js deleted file mode 100644 index ca0ba7c9d9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var utility = require("/app/modules/utility.js").utility; - var deviceType = context.uriParams.deviceType; - var deviceName = request.getParameter("deviceName"); - var deviceId = request.getParameter("deviceId"); - var unitName = utility.getTenantedDeviceUnitName(deviceType, "analytics-view"); - if (!unitName) { - unitName = "cdmf.unit.default.device.type.analytics-view"; - } - return { - "deviceAnalyticsViewUnitName": unitName, - "deviceType": deviceType, - "deviceName": deviceName, - "deviceId": deviceId - }; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.json deleted file mode 100644 index 846ee092b8..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/analytics.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device/{deviceType}/analytics", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/public/css/analytics.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/public/css/analytics.css deleted file mode 100644 index 5dc50e2fa8..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.analytics/public/css/analytics.css +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -#rangeSliderWrapper { - margin-top: 25px; -} - -#chart { - display: inline-block; -} - -#legend { - display: inline-block; - position: relative; - left: 8px; -} - -#legend_container { - position: absolute; - right: 0; - bottom: 26px; - width: 0; -} - -#chart_container { - float: left; - position: relative; -} - -.ast-container { - padding-bottom: 30px; -} - -.container { - width: auto; -} - -.shrink { - margin-right: 20px; - margin-left: 20px; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.hbs deleted file mode 100644 index cab8dffe4a..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.hbs +++ /dev/null @@ -1,66 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Device Types"}} -{{unit "cdmf.unit.ui.content.title" pageHeader="Device List"}} - -{{unit "cdmf.unit.lib.data-table"}} -{{unit "cdmf.unit.lib.handlebars"}} -{{unit "cdmf.unit.lib.service-invoker-utility"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Devices - -
  • -
  • - - Enroll Device - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#if isCloud}} -
  • - - - - - - Request new device type - -
  • - {{/if}} -{{/zone}} - -{{#zone "content"}} -
    -
    -
    -
    - {{unit "cdmf.unit.device.types.listing"}} -
    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.js deleted file mode 100644 index 3c5739ea60..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Returns the dynamic state to be populated by device-enrollment page. - * - * @param context Object that gets updated with the dynamic state of this page to be presented - * @returns {*} A context object that returns the dynamic state of this page to be presented - */ -function onRequest(context) { - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var page = {}; - page["isCloud"] = devicemgtProps.isCloud; - page["contact_form_url"] = "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag?cloud-type=device_cloud&subject=Requesting for a new device type"; - return page; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.json deleted file mode 100644 index 3155ee3cec..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.enroll/enroll.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device/enroll", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/js/bottomJs.js deleted file mode 100644 index 7858a3678b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/js/bottomJs.js +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var removeCustomParam = function () { - $(this).parent().parent().remove(); -}; - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption() { - $(location).attr('href', $(this).data("url")); -} - -$("#back-to-search").click(function () { - $('#advance-search-result').addClass('hidden'); - $("#advance-search-form").removeClass('hidden'); - $("#view-search-param").addClass('hidden'); - $("#back-to-search").addClass('hidden'); -}); - -$("#view-search-param").click(function () { - $("#advance-search-form").removeClass('hidden'); - $(".title-result").addClass('hidden'); - $("#view-search-param").addClass('hidden'); -}); - -var dynamicForm = '
    ' - + '
    ' - + '
    ' - + '
    ' - + '
    '; - -var nonNumericKeyValuePair = ["deviceModel", "vendor", "osVersion", "connectionType", "ssid", "pluggedIn"]; - -$(document).ready(function () { - var isInit = true; - $("#add-custom-param").click(function () { - $("#customSearchParam").prepend(dynamicForm); - $(".close-button-div").unbind("click"); - $(".close-button-div").bind("click", removeCustomParam); - $(".no-tag").select2({tags: false}); - $(".txt-key").select2({tags: true}).on('change', function() { - // Based on the selected key, relevant operations are changed - var operationsForSelectedKey = getOperators($(this).val()); - $("#operators").empty(); - $("#operators").append(operationsForSelectedKey); - $("#operators").select2("val", "="); - }); - }); - - /** Function to get operators based on the key Value - * - * @param keyValue - */ - function getOperators(keyValue) { - if (nonNumericKeyValuePair.indexOf(keyValue) < 0) { - return ''; - } else { - return ''; - } - } - - /** To validate the key and value before sending that to back-end - * - * @param key Key of the search - * @param value value given for the search - */ - function isValidKeyAndValue(key, value) { - if (nonNumericKeyValuePair.indexOf(key) < 0) { - if (!isNaN(parseFloat(value)) && isFinite(value)){ - return true; - } - } else { - return true; - } - } - - $("#device-search-btn").click(function () { - var location = $("#location").val(); - var payload_obj = {}; - var conditions = []; - var hasError = false; - if (location) { - var conditionObject = {}; - conditionObject.key = "LOCATION"; - conditionObject.value = location; - conditionObject.operator = "="; - conditionObject.state = "OR"; - conditions.push(conditionObject) - } - - $("#customSearchParam .dynamic-search-param").each(function () { - var value = $(this).find(".txt-value").val(); - var key = $(this).find(".txt-key").val(); - if (!hasError && value && key ) { - if (isValidKeyAndValue(key, value)) { - var conditionObject = {}; - conditionObject.key = key; - conditionObject.value = value; - conditionObject.operator = $(this).find(".operator").val(); - conditionObject.state = $(this).find(".state").val(); - conditions.push(conditionObject); - } else { - hasError = true; - $("#advance-search-result").addClass("hidden"); - $("#advance-search-form").removeClass(" hidden"); - $('#device-listing-status').removeClass('hidden'); - $('#device-listing-status-msg').text('Error in user input values. ' + key + " requires a" + - " numerical value as the search value"); - } - } - }); - - // Sent the search conditions to back-end only, if all the values compliant with there key values - if (hasError) { - hasError = false; - } else { - payload_obj.conditions = conditions; - var deviceSearchAPI = "/api/device-mgt/v1.0/devices/search-devices"; - $("#advance-search-form").addClass(" hidden"); - $("#loading-content").removeClass('hidden'); - var deviceListing = $("#device-listing"); - var deviceListingSrc = deviceListing.attr("src"); - $.template("device-listing", deviceListingSrc, function (template) { - var successCallback = function (data) { - if (!data) { - $("#loading-content").addClass('hidden'); - $("#advance-search-result").addClass("hidden"); - $("#advance-search-form").removeClass(" hidden"); - $('#device-listing-status').removeClass('hidden'); - $('#device-listing-status-msg').text('No Device are available to be displayed.'); - return; - } - data = JSON.parse(data); - if (data.devices.length == 0) { - $("#loading-content").addClass('hidden'); - $("#advance-search-result").addClass("hidden"); - $("#advance-search-form").removeClass(" hidden"); - $('#device-listing-status').removeClass('hidden'); - $('#device-listing-status-msg').text('No Device are available to be displayed.'); - return; - } - var viewModel = {}; - var devices = []; - if (data.devices.length > 0) { - for (i = 0; i < data.devices.length; i++) { - var tempDevice = data.devices[i]; - var device = {}; - device.type = tempDevice.type; - device.name = tempDevice.name; - device.deviceIdentifier = tempDevice.deviceIdentifier; - var properties = {}; - var enrolmentInfo = {}; - properties.VENDOR = tempDevice.deviceInfo.vendor; - properties.DEVICE_MODEL = tempDevice.deviceInfo.deviceModel; - device.enrolmentInfo = tempDevice.enrolmentInfo; - device.properties = properties; - devices.push(device); - } - viewModel.devices = devices; - $('#advance-search-result').removeClass('hidden'); - $("#view-search-param").removeClass('hidden'); - $("#back-to-search").removeClass('hidden'); - $('#device-grid').removeClass('hidden'); - $('#ast-container').removeClass('hidden'); - $('#user-listing-status-msg').text(""); - var content = template(viewModel); - $("#ast-container").html(content); - } else { - $('#device-listing-status').removeClass('hidden'); - $('#device-listing-status-msg').text('No Device are available to be displayed.'); - } - $("#loading-content").addClass('hidden'); - if (isInit) { - $('#device-grid').datatables_extended(); - isInit = false; - } - $(".icon .text").res_text(0.2); - }; - invokerUtil.post(deviceSearchAPI, - payload_obj, - successCallback, - function (message) { - $("#loading-content").addClass('hidden'); - $("#advance-search-result").addClass("hidden"); - $("#advance-search-form").removeClass(" hidden"); - $('#device-listing-status').removeClass('hidden'); - $('#device-listing-status-msg').text('Server is unable to perform the search please enroll at least one device or check the search query'); - } - ); - }); - } - }); -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/templates/device-listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/templates/device-listing.hbs deleted file mode 100644 index 53cb478806..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/templates/device-listing.hbs +++ /dev/null @@ -1,44 +0,0 @@ - - - {{#each devices}} - - - -
    - -
    - - -

    Device {{name}}

    - {{#if properties.DEVICE_MODEL}} -
    ({{properties.VENDOR}} - {{properties.DEVICE_MODEL}})
    - {{/if}} - - {{enrolmentInfo.owner}} - - {{#equal enrolmentInfo.status "ACTIVE"}} Active{{/equal}} - {{#equal enrolmentInfo.status "INACTIVE"}} Inactive{{/equal}} - {{#equal enrolmentInfo.status "BLOCKED"}} Blocked{{/equal}} - {{#equal enrolmentInfo.status "REMOVED"}} Removed{{/equal}} - - {{type}} - {{enrolmentInfo.ownership}} - - - - - {{/each}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs deleted file mode 100644 index 5fe3223246..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs +++ /dev/null @@ -1,164 +0,0 @@ - -{{unit "cdmf.unit.ui.title" pageTitle="Advanced Search"}} -{{unit "cdmf.unit.ui.modal"}} -{{unit "cdmf.unit.data-tables-extended"}} -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Devices - -
  • -
  • - - - Search - -
  • -{{/zone}} - - -{{#zone "content"}} - -
    -
    - -
    -
    - - -
    -
    -
    -
    -

    Advanced Device Search

    -
    - -
    -
    - - - -
    -
    -
    - -
    - - -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    - -
    - - - - - - - -
    -
    - - -{{/zone}} -{{#zone "bottomJs"}} - {{js "/js/bottomJs.js"}} - -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.json deleted file mode 100644 index c202f579cf..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/devices/search", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.hbs deleted file mode 100644 index 70c449653c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.hbs +++ /dev/null @@ -1,58 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Device"}} -{{! unit "cdmf.unit.ui.content.title" pageHeader="Device Download"}} - -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.lib.handlebars"}} -{{unit "cdmf.unit.lib.service-invoker-utility"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Devices - -
  • -
  • - - Enroll Device - -
  • -
  • - - {{label}} - -
  • -{{/zone}} - -{{#zone "content"}} -
    -
    -
    -
    - {{! dynamically resolves device type-view unit according to deviceType URI param }} - {{unit deviceTypeViewUnitName}} -
    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.js deleted file mode 100644 index 981126bbb3..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - /** - * {{#itr context}}key : {{key}} value : {{value}}{{/itr}} - */ - context.handlebars.registerHelper("itr", function (obj, options) { - var key, buffer = ''; - for (key in obj) { - if (obj.hasOwnProperty(key)) { - buffer += options.fn({key: key, value: obj[key]}); - } - } - return buffer; - }); - - var utility = require("/app/modules/utility.js").utility; - var deviceType = context.uriParams.deviceType; - var configs = utility.getDeviceTypeConfig(deviceType); - var label = deviceType; - if (configs) { - label = configs["deviceType"]["label"]; - } - var unitName = utility.getTenantedDeviceUnitName(deviceType, "type-view"); - if (!unitName) { - unitName = "cdmf.unit.default.device.type.type-view"; - } - return { - "deviceTypeViewUnitName": unitName, - "deviceType": deviceType, - "label" : label - }; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.json deleted file mode 100644 index dd1754fc08..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device/{deviceType}/enroll", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.hbs deleted file mode 100644 index 1a58360409..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.hbs +++ /dev/null @@ -1,46 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Device Details"}} -{{unit "cdmf.unit.lib.service-invoker-utility"}} -{{unit "cdmf.unit.lib.handlebars"}} - - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Devices - -
  • -
  • - - Device Details - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit deviceViewUnitName}} - {{unit "cdmf.unit.lib.data-table"}} - {{unit "cdmf.unit.device.operation-mod"}} - {{unit "cdmf.unit.device.view"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.js deleted file mode 100644 index 13f1c108ec..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context){ - var utility = require("/app/modules/utility.js").utility; - context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { - if (arguments.length < 3) - throw new Error("Handlebars Helper equal needs 2 parameters"); - if( lvalue!=rvalue ) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - var deviceType = context.uriParams.deviceType; - var unitName = utility.getTenantedDeviceUnitName(deviceType, "device-view"); - if (!unitName) { - unitName = "cdmf.unit.default.device.type.device-view"; - } - return {"deviceViewUnitName": unitName}; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.json deleted file mode 100644 index 614f89ba43..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device/{deviceType}", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicelocations/devicelocations.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicelocations/devicelocations.hbs deleted file mode 100644 index 0dd4d4016e..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicelocations/devicelocations.hbs +++ /dev/null @@ -1,35 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Device Location"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Device Locations - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.geo-devices"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicelocations/devicelocations.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicelocations/devicelocations.json deleted file mode 100644 index 5021ee3906..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicelocations/devicelocations.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device-locations", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs deleted file mode 100644 index 3a12ea975e..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs +++ /dev/null @@ -1,760 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} - -{{! - Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - - Entgra (Pvt) Ltd. 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Device Management"}} - -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.lib.ui-permissions-utility"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • - {{#if group}} -
  • - - Groups - -
  • -
  • - - {{group.name}} - -
  • - {{else}} -
  • - - Devices - -
  • - {{/if}} -{{/zone}} - -{{#zone "navbarActions"}} - {{#if group}} -
  • - - - - - - Assign from My Devices - -
  • - - {{else}} - {{#if permissions.enroll}} -
  • - - - - - - Enroll Device - -
  • - {{/if}} - {{/if}} -{{/zone}} - -{{#zone "content"}} - {{#if group}} -

    - {{group.name}} group -

    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - Overview -
    - - - - - - - - - - - - - - - - - - - -
    Owner{{group.owner}}
    Shared with roles - {{#each roles}} - {{this}}
    - {{/each}} -
    Device Count{{deviceCount}}
    Description{{group.description}}
    -
    -
    -
    -
    -
    -

    - Devices in {{group.name}} group -

    - {{/if}} -
    -
    -
    -
    - - {{unit "cdmf.unit.device.operation-mod"}} - {{#if deviceCount}} -
    - - Loading devices . . . -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    - - {{else}} -
    - -
    - {{/if}} - -
    - - - -
    - -
    - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    -
    -
    -{{/zone}} - -{{#zone "bottomJs"}} - - {{js "js/listing.js"}} -{{/zone}} - -{{#zone "topCss"}} - -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js deleted file mode 100644 index 7fb6f87b20..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var constants = require("/app/modules/constants.js"); - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; - - var groupId = request.getParameter("groupId"); - - var viewModel = {}; - var title = "Devices"; - if (groupId) { - var group = groupModule.getGroup(groupId); - if (group) { - title = group.name + " " + title; - viewModel.roles = groupModule.getRolesOfGroup(groupId); - viewModel.group = group; - } - } - viewModel.title = title; - var currentUser = session.get(constants.USER_SESSION_KEY); - if (currentUser) { - viewModel.permissions = {}; - var uiPermissions = userModule.getUIPermissions(); - viewModel.permissions.list = stringify(uiPermissions); - if (uiPermissions.ADD_DEVICE) { - viewModel.permissions.enroll = true; - } - if (uiPermissions.UPDATE_ENROLLMENT) { - viewModel.permissions.updateEnrollment = true; - } - if (uiPermissions.PERMANENT_DELETE) { - viewModel.permissions.permanentDelete = true; - } - viewModel.currentUser = currentUser; - var deviceCount = 0; - if (groupId) { - deviceCount = groupModule.getGroupDeviceCount(groupId); - } else { - deviceCount = deviceModule.getDevicesCount(); - } - if (deviceCount > 0) { - viewModel.deviceCount = deviceCount; - var utility = require("/app/modules/utility.js").utility; - var typesListResponse = deviceModule.getDeviceTypes(); - var deviceTypes = []; - if (typesListResponse["status"] == "success") { - var data = typesListResponse.content; - if (data) { - for (var i = 0; i < data.length; i++) { - var config = utility.getDeviceTypeConfig(data[i].name); - var category = "iot"; - var label = data[i].name; - var analyticsEnabled = "false"; - var groupingEnabled = "true"; - var analyticsView = null; - if (config) { - var deviceType = config.deviceType; - category = deviceType.category; - label = deviceType.label; - analyticsEnabled = deviceType.analyticsEnabled; - groupingEnabled = deviceType.groupingEnabled; - analyticsView = deviceType.analyticsView; - } - - deviceTypes.push({ - "type": data[i].name, - "category": category, - "label": label, - "thumb": utility.getDeviceThumb(data[i].name), - "analyticsEnabled": analyticsEnabled, - "groupingEnabled": groupingEnabled, - "analyticsView" : analyticsView - }); - } - } - } - viewModel.deviceTypes = stringify(deviceTypes); - } - } - - var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; - var serverUrl = mdmProps["httpsURL"]; - var portalUrl = mdmProps["portalURL"]; - var backendRestEndpoints = mdmProps["backendRestEndpoints"]; - var userDomain = context.user.domain; - viewModel.serverUrl = serverUrl; - viewModel.portalUrl = portalUrl; - viewModel.userDomain = userDomain; - viewModel.apiContext = backendRestEndpoints["deviceMgt"]; - return viewModel; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.json deleted file mode 100644 index cba60e495a..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/devices", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js deleted file mode 100644 index eab877ed83..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js +++ /dev/null @@ -1,1310 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption(url) { - if ($(".select-enable-btn").text() == "Select" && !$(this).hasClass("btn")) { - url = $(this).parent().data("url"); - $(location).attr('href', url); - } -} - -(function () { - var cache = {}; - var validateAndReturn = function (value) { - return (value == undefined || value == null) ? "Unspecified" : value; - }; - Handlebars.registerHelper("deviceMap", function (device) { - device.owner = validateAndReturn(device.owner); - device.ownership = validateAndReturn(device.ownership); - var arr = device.properties; - if (arr) { - device.properties = arr.reduce(function (total, current) { - total[current.name] = validateAndReturn(current.value); - return total; - }, {}); - } - }); -})(); - -/* - * Setting-up global variables. - */ -var deviceCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']"; -var assetContainer = "#ast-container"; - -var deviceListing, currentUser, groupId, hasDeletePermission; - -/* - * DOM ready functions. - */ -$(document).ready(function () { - - var permissionSet = {}; - $.setPermission = function (permission) { - permissionSet[permission] = true; - }; - - $.hasPermission = function (permission) { - return permissionSet[permission]; - }; - - deviceListing = $("#device-listing"); - hasDeletePermission = $("#permission").data("permission")['PERMANENT_DELETE']; - currentUser = deviceListing.data("current-user"); - groupId = getParameterByName("groupId"); - - /* Adding selected class for selected devices */ - $(deviceCheckbox).each(function () { - addDeviceSelectedClass(this); - }); - - /* for device list sorting drop down */ - $(".ctrl-filter-type-switcher").popover({ - html: true, - content: function () { - return $("#content-filter-types").html(); - } - }); -}); - -/* - * On Select All Device button click function. - * - * @param button: Select All Device button - */ -function selectAllDevices(button) { - if (!$(button).data('select')) { - $(deviceCheckbox).each(function (index) { - $(this).prop('checked', true); - addDeviceSelectedClass(this); - }); - $(button).data('select', true); - $(button).html('Deselect All Devices'); - } else { - $(deviceCheckbox).each(function (index) { - $(this).prop('checked', false); - addDeviceSelectedClass(this); - }); - $(button).data('select', false); - $(button).html('Select All Devices'); - } -} - -/* - * On listing layout toggle buttons click function. - * - * @param view: Selected view type - * @param selection: Selection button - */ -function changeDeviceView(view, selection) { - $(".view-toggle").each(function () { - $(this).removeClass("selected"); - }); - $(selection).addClass("selected"); - if (view == "list") { - $(assetContainer).addClass("list-view"); - } else { - $(assetContainer).removeClass("list-view"); - } -} - -/* - * Add selected style class to the parent element function. - * - * @param checkbox: Selected checkbox - */ -function addDeviceSelectedClass(checkbox) { - if ($(checkbox).is(":checked")) { - $(checkbox).closest(".ctrl-wr-asset").addClass("selected device-select"); - } else { - $(checkbox).closest(".ctrl-wr-asset").removeClass("selected device-select"); - } -} - -function toTitleCase(str) { - return str.replace(/\w\S*/g, function (txt) { - return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); - }); -} - -function loadDevices(searchType, searchParam) { - var serviceURL; - if (groupId && $.hasPermission("LIST_OWN_DEVICES")) { - serviceURL = "/api/device-mgt/v1.0/groups/id/" + groupId + "/devices"; - } else if ($.hasPermission("LIST_DEVICES")) { - serviceURL = "/api/device-mgt/v1.0/devices"; - } else if (permissionsUtil.hasPermission("LIST_OWN_DEVICES")) { - //Get authenticated users devices - serviceURL = "/api/device-mgt/v1.0/devices?user=" + currentUser; - } else { - $("#loading-content").remove(); - $('#device-table').addClass('hidden'); - $('#device-listing-status-msg').text('Permission denied.'); - $("#device-listing-status").removeClass(' hidden'); - return; - } - - function getPropertyValue(deviceProperties, propertyName) { - if (!deviceProperties) { - return; - } - var property; - for (var i = 0; i < deviceProperties.length; i++) { - property = deviceProperties[i]; - if (property.name == propertyName) { - return property.value; - } - } - return {}; - } - - function getDeviceTypeLabel(type) { - var deviceTypes = deviceListing.data("deviceTypes"); - for (var i = 0; i < deviceTypes.length; i++) { - if (deviceTypes[i].type == type) { - return deviceTypes[i].label; - } - } - return type; - } - - function getDeviceTypeCategory(type) { - var deviceTypes = deviceListing.data("deviceTypes"); - for (var i = 0; i < deviceTypes.length; i++) { - if (deviceTypes[i].type == type) { - return deviceTypes[i].category; - } - } - return type; - } - - function getDeviceTypeThumb(type) { - var deviceTypes = deviceListing.data("deviceTypes"); - for (var i = 0; i < deviceTypes.length; i++) { - if (deviceTypes[i].type == type) { - return deviceTypes[i].thumb; - } - } - return type; - } - - function analyticsEnabled(type) { - var deviceTypes = deviceListing.data("deviceTypes"); - for (var i = 0; i < deviceTypes.length; i++) { - if (deviceTypes[i].type == type) { - var analyticsEnabled = deviceTypes[i].analyticsEnabled; - if (analyticsEnabled == undefined) { - // By default it should be enabled - return true; - } - // In JS Boolean("false") returns TRUE => http://stackoverflow.com/a/264037/1560536 - return (analyticsEnabled == "true"); - } - } - return true; - } - - // Read "analyticsView" from config.json and return value if exists - function getAnalyticsView(type) { - var deviceTypes = deviceListing.data("deviceTypes"); - for (var i = 0; i < deviceTypes.length; i++) { - if (deviceTypes[i].type == type) { - var analyticsView = deviceTypes[i].analyticsView; - if (analyticsEnabled == undefined) { - // if undefined go to default analytics view - return "none"; - } - return analyticsView; - } - } - return "none"; - } - - function groupingEnabled(type) { - var deviceTypes = deviceListing.data("deviceTypes"); - for (var i = 0; i < deviceTypes.length; i++) { - if (deviceTypes[i].type == type) { - var groupingEnabled = deviceTypes[i].groupingEnabled; - if (groupingEnabled == undefined) { - // By default it should be enabled - return true; - } - // In JS Boolean("false") returns TRUE => http://stackoverflow.com/a/264037/1560536 - return (groupingEnabled == "true"); - } - } - return true; - } - - var columns = [ - { - targets: 0, - data: 'namePattern', - class: 'remove-padding icon-only content-fill viewEnabledIcon', - render: function (data, type, row, meta) { - return '
    '; - } - }, - { - targets: 1, - data: 'name', - class: 'viewEnabledIcon', - render: function (name, type, row, meta) { - var model = getPropertyValue(row.properties, 'DEVICE_MODEL'); - var vendor = getPropertyValue(row.properties, 'VENDOR'); - var html = '

    ' + name + '

    '; - if (model) { - html += '
    (' + vendor + '-' + model + ')
    '; - } - return html; - } - }, - { - targets: 2, - data: 'userPattern', - class: 'remove-padding-top viewEnabledIcon' - }, - { - targets: 3, - data: 'status', - class: 'remove-padding-top viewEnabledIcon', - render: function (status, type, row, meta) { - var html; - switch (status) { - case 'ACTIVE' : - html = ' Active'; - break; - case 'INACTIVE' : - html = ' Inactive'; - break; - case 'BLOCKED' : - html = ' Blocked'; - break; - case 'REMOVED' : - html = ' Removed'; - break; - case 'UNREACHABLE' : - html = ' Unreachable'; - break; - case 'CREATED' : - html = ' Created'; - break; - } - return html; - } - }, - { - targets: 4, - data: 'type', - class: 'remove-padding-top viewEnabledIcon', - render: function (status, type, row, meta) { - return getDeviceTypeLabel(row.deviceType); - } - }, - { - targets: 5, - data: 'ownership', - class: 'remove-padding-top viewEnabledIcon', - render: function (status, type, row, meta) { - if (getDeviceTypeCategory(row.deviceType) === 'mobile' - || getDeviceTypeCategory(row.deviceType) === 'hybrid') { - return row.ownership; - } else { - return null; - } - } - }, - { - targets: 6, - data: 'action-buttons', - class: 'text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix', - render: function (status, type, row, meta) { - var deviceType = row.deviceType; - var deviceIdentifier = row.deviceIdentifier; - var html = ''; - var portalUrl = $("#device-listing").data("portal-url"); - var serverUrl = $("#device-listing").data("server-url"); - var userDomain = $("#device-listing").data("userDomain"); - var statusCode = row.status; - var statURL; - if (statusCode != 'REMOVED') { - html = ''; - - if (analyticsEnabled(row.deviceType)) { - // redirecting to respective analytics view depending on device configs - switch (getAnalyticsView(deviceType)) { - case "DAS" : { statURL =portalUrl + "/portal/t/"+ userDomain+ "/dashboards/android-iot/battery?owner=" +currentUser+"&deviceId=";break;} - default : {statURL=context+ "/device/" + row.deviceType +"/analytics?deviceId="} - } - - html += '' + - '' + - ''; - } - - if (!groupId && groupingEnabled(row.deviceType)) { - html += - '' + - '' + - ''; - } - - html += - '' - + '' - + '' - + ''; - var groupOwner = $('#group_owner').text(); - if (groupId && groupOwner != "wso2.system.user") { - html += - '' - + '' - + '' - + ''; - } else { - html += - '' - + '' - + '' - + ''; - } - } else if (statusCode == 'REMOVED' && hasDeletePermission) { - html = ''; - - if (analyticsEnabled(row.deviceType)) { - // redirecting to respective analytics view depending on device configs - switch (getAnalyticsView(deviceType)) { - case "DAS" : { - statURL = portalUrl + "/portal/t/" + userDomain + "/dashboards/android-iot/battery?owner=" + currentUser + "&deviceId="; - break; - } - default : { - statURL = context + "/device/" + row.deviceType + "/analytics?deviceId=" - } - } - - html += '' + - '' + - ''; - } - - if (!groupId && groupingEnabled(row.deviceType)) { - html += - '' + - '' + - ''; - } - - html += - '' - + '' - + '' - + ''; - var groupOwner = $('#group_owner').text(); - if (groupId && groupOwner != "wso2.system.user") { - html += - '' - + '' - + '' - + ''; - } else { - html += - '' - + '' - + '' - + ''; - } - } else { - html = ''; - - if (analyticsEnabled(row.deviceType)) { - // redirecting to respective analytics view depending on device configs - switch (getAnalyticsView(deviceType)) { - case "DAS" : { - statURL = portalUrl + "/portal/t/" + userDomain + "/dashboards/android-iot/battery?owner=" + currentUser + "&deviceId="; - break; - } - default : { - statURL = context + "/device/" + row.deviceType + "/analytics?deviceId=" - } - } - - html += '' + - '' + - ''; - } - - if (!groupId && groupingEnabled(row.deviceType)) { - html += - '' + - '' + - ''; - } - - html += - '' - + '' - + '' - + ''; - } - return html; - } - } - ]; - - var fnCreatedRow = function (row, data, dataIndex) { - if (data.status != "REMOVED") { - $(row).attr('data-type', 'selectable'); - } else { - $(row).attr('data-type', 'non-selectable'); - } - var model = htmlspecialchars(getPropertyValue(data.properties, 'DEVICE_MODEL')); - var vendor = htmlspecialchars(getPropertyValue(data.properties, 'VENDOR')); - var owner = htmlspecialchars(data.userPattern); - var status = htmlspecialchars(data.status); - var ownership = htmlspecialchars(data.ownership); - var deviceType = htmlspecialchars(data.deviceType); - var category = getDeviceTypeCategory(deviceType); - $(row).attr('data-deviceid', htmlspecialchars(data.deviceIdentifier)); - $(row).attr('data-devicetype', deviceType); - $(row).attr('data-url', context + '/device/' + htmlspecialchars(data.deviceType) + '?id=' - + htmlspecialchars(data.deviceIdentifier) + '&owner=' + owner + '&ownership=' + ownership) ; - $.each($('td', row), function (colIndex) { - switch (colIndex) { - case 1: - $(this).attr('data-search', model + ',' + vendor); - $(this).attr('data-display', model); - break; - case 2: - $(this).attr('data-grid-label', "Owner"); - $(this).attr('data-search', owner); - $(this).attr('data-display', owner); - break; - case 3: - $(this).attr('data-grid-label', "Status"); - $(this).attr('data-search', status); - $(this).attr('data-display', status); - break; - case 4: - $(this).attr('data-grid-label', "Type"); - $(this).attr('data-search', deviceType); - $(this).attr('data-display', getDeviceTypeLabel(deviceType)); - break; - case 5: - if (category === 'mobile' || category === 'hybrid') { - $(this).attr('data-grid-label', "Ownership"); - $(this).attr('data-search', ownership); - $(this).attr('data-display', ownership); - } - break; - } - }); - }; - - function htmlspecialchars(text) { - return jQuery('
    ').text(text).html(); - } - - var dataFilter = function (data) { - data = JSON.parse(data); - var objects = []; - - $(data.devices).each(function (index) { - objects.push( - { - model: getPropertyValue(data.devices[index].properties, "DEVICE_MODEL"), - vendor: getPropertyValue(data.devices[index].properties, "VENDOR"), - userPattern: data.devices[index].enrolmentInfo.owner, - status: data.devices[index].enrolmentInfo.status, - ownership: data.devices[index].enrolmentInfo.ownership, - deviceType: data.devices[index].type, - deviceIdentifier: data.devices[index].deviceIdentifier, - name: data.devices[index].name, - namePattern: data.devices[index].name - } - ); - }); - - var json = { - "recordsTotal": data.count, - "recordsFiltered": data.count, - "data": objects - }; - return JSON.stringify(json); - }; - - $('#device-grid').datatables_extended_serverside_paging( - null, - "/api/device-mgt/v1.0/devices/", - dataFilter, - columns, - fnCreatedRow, - function () { - $(".icon .text").res_text(0.2); - $('#device-grid').removeClass('hidden'); - $("#loading-content").remove(); - attachDeviceEvents(); - - - if ($('.advance-search').length < 1) { - $(this).closest('.dataTables_wrapper').find('div[id$=_filter] input') - .after('Advanced Search'); - } - - }, { - "placeholder": "Top-Device-Name-Search", - "searchKey": "namePattern", - "groupId": groupId - } - ); - - $(deviceCheckbox).click(function () { - addDeviceSelectedClass(this); - }); -} - -function openCollapsedNav() { - $('.wr-hidden-nav-toggle-btn').addClass('active'); - $('#hiddenNav').slideToggle('slideDown', function () { - if ($(this).css('display') == 'none') { - $('.wr-hidden-nav-toggle-btn').removeClass('active'); - } - }); -} - -/* - * DOM ready functions. - */ -$(document).ready(function () { - /* Adding selected class for selected devices */ - $(deviceCheckbox).each(function () { - addDeviceSelectedClass(this); - }); - - var permissionList = $("#permission").data("permission"); - for (var key in permissionList) { - if (permissionList.hasOwnProperty(key)) { - $.setPermission(key); - } - } - - loadDevices(); - - /* for device list sorting drop down */ - $(".ctrl-filter-type-switcher").popover({ - html: true, - content: function () { - return $("#content-filter-types").html(); - } - }); - - /* for data tables*/ - $('[data-toggle="tooltip"]').tooltip(); - - $("[data-toggle=popover]").popover(); - - $(".ctrl-filter-type-switcher").popover({ - html: true, - content: function () { - return $('#content-filter-types').html(); - } - }); - - $('#nav').affix({ - offset: { - top: $('header').height() - } - }); - - //Hide the search by device-name input - $("input[placeholder='Top-Device-Name-Search']").hide(); - -}); - -var modalPopup = ".modal"; -var modalPopupContainer = modalPopup + " .modal-content"; -var modalPopupContent = modalPopup + " .modal-content"; -var body = "body"; - -/* - * set popup maximum height function. - */ -function setPopupMaxHeight() { - $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30))); - $(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2))); -} - -/* - * show popup function. - */ -function showPopup() { - $(modalPopup).modal('show'); -} - -/* - * hide popup function. - */ -function hidePopup() { - $(modalPopupContent).html(""); - $(modalPopupContent).removeClass("operation-data"); - $(modalPopup).modal('hide'); - $('body').removeClass('modal-open').css('padding-right', '0px'); - $('.modal-backdrop').remove(); -} - -function markAlreadyAssignedGroups(deviceId, deviceType) { - var successCallback = function (data, textStatus, xhr) { - data = JSON.parse(data); - if (xhr.status == 200) { - if (data.length > 0) { - var selectedValues = []; - for (var i = 0; i < data.length; i++) { - if (data[i].owner != "wso2.system.user") { - selectedValues.push(data[i].id); - } - } - $("#groups").val(selectedValues).trigger("change"); - } - } else { - displayErrors(xhr); - } - }; - - invokerUtil.get("/api/device-mgt/v1.0/groups/device?deviceId=" + deviceId + "&deviceType=" + deviceType, - successCallback, function (message) { - displayErrors(message); - }); -} - -/** - * Following functions should be triggered after AJAX request is made. - */ -function attachDeviceEvents() { - - /** - * Following click function would execute - * when a user clicks on "Group" link - * on Device Management page in WSO2 DeviceMgt Console. - */ - if ($("a.group-device-link").length > 0) { - $("a.group-device-link").click(function () { - var deviceId = $(this).data("deviceid"); - var deviceType = $(this).data("devicetype"); - $(modalPopupContent).html($('#group-device-modal-content').html()); - $('#user-groups').html( - '
    '); - $("a#group-device-update-link").hide(); - showPopup(); - - var serviceURL; - if ($.hasPermission("LIST_ALL_GROUPS")) { - serviceURL = "/api/device-mgt/v1.0/admin/groups?limit=100"; - } else if ($.hasPermission("LIST_GROUPS")) { - //Get authenticated users groups - serviceURL = "/api/device-mgt/v1.0/groups?limit=100"; - } - - invokerUtil.get(serviceURL, function (data) { - $("a#group-device-add-link").hide(); - var groups = JSON.parse(data); - var html = ''; - var hasGroups = false; - for (var i = 0; i < groups.deviceGroups.length; i++) { - if (groups.deviceGroups[i].owner != "wso2.system.user") { - html += ''; - hasGroups = true; - } - } - if (hasGroups) { - html = '

    Please select device group(s)


    ' + - '
    ' + - '
    '; - markAlreadyAssignedGroups(deviceId, deviceType); - $("a#group-device-update-link").show(); - $("a#group-add-link").hide(); - } else { - $("a#group-device-update-link").hide(); - $("a#group-add-link").show(); - html += '

    You don\'t have any existing device groups. Please add new device group first.

    ' - } - $('#user-groups').html(html); - $("select.select2[multiple=multiple]").select2({ - tags: false - }); - $("a#group-device-update-link").click(function () { - var deviceIdentifier = {"id": deviceId, "type": deviceType}; - var deviceGroupIds = $("#groups").val(); - if (!deviceGroupIds) { - deviceGroupIds = []; - } - var deviceToGroupsAssignment = { - deviceIdentifier: deviceIdentifier, - deviceGroupIds: deviceGroupIds - }; - serviceURL = "/api/device-mgt/v1.0/groups/device/assign"; - invokerUtil.post(serviceURL, deviceToGroupsAssignment, function (data) { - $(modalPopupContent).html($('#group-associate-device-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - }, function (jqXHR) { - displayDeviceErrors(jqXHR); - }); - }); - }, function (jqXHR) { - if (jqXHR.status == 404) { - $(modalPopupContent).html($('#group-404-content').html()); - $("a#cancel-link").click(function () { - hidePopup(); - }); - } else { - displayDeviceErrors(jqXHR); - } - }); - - $("a#group-device-cancel-link").click(function () { - hidePopup(); - }); - }); - - } - - /** - * Following click function would execute - * when a user clicks on "Remove" link - * on Device Management page in WSO2 MDM Console. - */ - $("a.remove-device-link").click(function () { - var deviceIdentifiers = []; - var deviceId = $(this).data("deviceid"); - var deviceType = $(this).data("devicetype"); - - if (deviceId && deviceType) { - deviceIdentifiers = [{"id": deviceId, "type": deviceType}]; - } else { - deviceIdentifiers = getSelectedDevices(); - } - - if (deviceIdentifiers.length == 0) { - $(modalPopupContent).html($('#no-device-selected').html()); - $("a#no-device-selected-link").click(function () { - hidePopup(); - }); - showPopup(); - return; - } - - $(modalPopupContent).html($('#remove-device-modal-content').html()); - showPopup(); - - $("a#remove-device-yes-link").click(function () { - if (groupId) { - var serviceURL = "/api/device-mgt/v1.0/groups/id/" + groupId + "/devices/remove"; - invokerUtil.post(serviceURL, deviceIdentifiers, function (message) { - $(modalPopupContent).html($('#remove-device-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - }, function (jqXHR) { - displayDeviceErrors(jqXHR); - }); - } else { - removeDevices(deviceIdentifiers); - } - }); - - $("a#remove-device-cancel-link").click(function () { - hidePopup(); - }); - }); - - /** - * Following click function would execute - * when a user clicks on "Delete" link - * on Device Management page in Entgra MDM Console. - */ - $("a.delete-device-link").click(function () { - var deviceIdentifiers = []; - var deviceId = $(this).data("deviceid"); - if (deviceId) { - deviceIdentifiers = [deviceId]; - $(modalPopupContent).html($('#delete-device-modal-content').html()); - showPopup(); - } else { - var selectedDevices = getSelectedDevices(); - if (selectedDevices.length == 0) { - $(modalPopupContent).html($('#no-device-selected').html()); - $("a#no-device-selected-link").click(function () { - hidePopup(); - }); - showPopup(); - return; - } else { - var hasEnrolledDevice; - for (var i = 0; i < selectedDevices.length; i++) { - if (selectedDevices[i].selectability == 'selectable') { - hasEnrolledDevice = true; - break; - } else { - deviceIdentifiers.push(selectedDevices[i].id); - } - } - if (hasEnrolledDevice) { - $(modalPopupContent).html($('#enrolled-device-delete-content').html()); - $("a#enrolled-device-delete-link").click(function () { - hidePopup(); - }); - showPopup(); - } else { - $(modalPopupContent).html($('#delete-device-modal-content').html()); - showPopup(); - } - } - } - - - $("a#delete-device-yes-link").click(function () { - deleteDevices(deviceIdentifiers); - }); - - $("a#delete-device-cancel-link").click(function () { - hidePopup(); - }); - }); - - /** - * Following click function would execute - * when a user clicks on "Edit" link - * on Device Management page in WSO2 MDM Console. - */ - $("a.edit-device-link").click(function () { - var deviceId = $(this).data("deviceid"); - var deviceType = $(this).data("devicetype"); - var deviceName = $(this).data("devicename"); - var serviceURL = "/api/device-mgt/v1.0/devices/type/" + deviceType + "/id/" + deviceId + "/rename"; - - $(modalPopupContent).html($('#edit-device-modal-content').html()); - $('#edit-device-name').val(deviceName); - showPopup(); - - $("a#edit-device-yes-link").click(function () { - var newDeviceName = $('#edit-device-name').val(); - var request = {}; - request['name'] = newDeviceName; - invokerUtil.post(serviceURL, request, function (message) { - $(modalPopupContent).html($('#edit-device-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - }, function (jqXHR) { - displayDeviceErrors(jqXHR); - }); - }); - - $("a#edit-device-cancel-link").click(function () { - hidePopup(); - }); - }); - - /** - * Following click function would execute - * when a user clicks on "Update Enrollment" link - * on Device Management page. - */ - $("a.update-enrollment-link").click(function () { - var deviceIdentifiers = []; - var deviceId = $(this).data("deviceid"); - var deviceType = $(this).data("devicetype"); - - if (deviceId && deviceType) { - deviceIdentifiers = [{"id": deviceId, "type": deviceType}]; - } else { - deviceIdentifiers = getSelectedDevices(); - } - - if (deviceIdentifiers.length === 0) { - $(modalPopupContent).html($('#no-device-selected').html()); - $("a#no-device-selected-link").click(function () { - hidePopup(); - }); - showPopup(); - return; - } - - $(modalPopupContent).html($('#update-enrollment-modal-content').html()); - showPopup(); - - $("a#update-enrollment-yes-link").click(function () { - var username = $("#update-enrollment-name").val(); - console.log(username); - if (username) { - var i; - var deviceIds = []; - for (i=0; i
    '); - $("a#group-device-add-link").hide(); - showPopup(); - - var serviceURL; - if ($.hasPermission("LIST_ALL_GROUPS")) { - serviceURL = "/api/device-mgt/v1.0/admin/groups?limit=100"; - } else if ($.hasPermission("LIST_GROUPS")) { - //Get authenticated users groups - serviceURL = "/api/device-mgt/v1.0/groups?limit=100"; - } - - invokerUtil.get(serviceURL, function (data) { - var groups = JSON.parse(data); - var html = ''; - var hasGroups = false; - for (var i = 0; i < groups.deviceGroups.length; i++) { - if (groups.deviceGroups[i].owner != "wso2.system.user") { - html += ''; - hasGroups = true; - } - } - if (hasGroups) { - html = '
    '; - $("a#group-add-link").hide(); - $("a#group-device-add-link").show(); - } else { - html += '

    You don\'t have any existing device groups. Please add new device group first.

    '; - $("a#group-add-link").show(); - $("a#group-device-add-link").hide(); - } - $('#user-groups').html(html); - $("a#group-device-add-link").click(function () { - var selectedGroup = $('#assign-group-selector').val(); - serviceURL = "/api/device-mgt/v1.0/groups/id/" + selectedGroup + "/devices/add"; - invokerUtil.post(serviceURL, deviceIdentifiers, function (data) { - $(modalPopupContent).html($('#group-associate-device-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - }, function (jqXHR) { - displayDeviceErrors(jqXHR); - }); - }); - }, function (jqXHR) { - if (jqXHR.status == 404) { - $(modalPopupContent).html($('#group-404-content').html()); - $("a#cancel-link").click(function () { - hidePopup(); - }); - } else { - displayDeviceErrors(jqXHR); - } - }); - - $("a#group-device-cancel-link").click(function () { - hidePopup(); - }); - }); - - /** - * Following click function would execute when a user clicks on "Add Operation" link - * on Device Management page in device mgt Console. - */ - $('a.add-operation-link').click(function () { - var operationsRow = $("#device-type-operations-bar"); - if (!operationsRow.hasClass("hidden")) { - operationsRow.addClass("hidden"); - $("#device-type-operations").html(""); - return; - } - var deviceIdentifiers = getSelectedDevices(); - if (deviceIdentifiers.length === 0) { - $(modalPopupContent).html($('#no-device-selected').html()); - $("a#no-device-selected-link").click(function () { - hidePopup(); - }); - showPopup(); - return; - } - - var selectedDeviceType = deviceIdentifiers[0].type; - var deviceList = ""; - var count = 1; - deviceIdentifiers.forEach(function (deviceIdentifier) { - if (selectedDeviceType !== deviceIdentifier.type) { - ++count; - } - deviceList = !deviceList ? deviceIdentifier.id : deviceList + "," + deviceIdentifier.id; - }); - - // If multiple devices of multiple device types selected - if (count > 1) { - $(modalPopupContent).html($('#multiple-device-types-selected').html()); - $("a#multiple-device-types-selected-link").click(function () { - hidePopup(); - }); - showPopup(); - return; - } - var apiContext = $("#device-listing").data("api-context"); - var serviceURL = apiContext + "/device-types/" + selectedDeviceType + "/features?featureType=operation" + - "&hidden=false"; - invokerUtil.get(serviceURL, function (data) { - showOperationBar(JSON.parse(data), selectedDeviceType, deviceList); - }); - }); -} - -function showOperationBar(features, deviceType, deviceList) { - var featureList = []; - var feature; - for (var i = 0; i < features.length; i++) { - feature = {}; - feature.operation = features[i].code; - feature.name = features[i].name; - feature.description = features[i].description; - feature.deviceType = deviceType; - feature.params = []; - var metaData = features[i].metadataEntries; - if (metaData) { - for (var j = 0; j < metaData.length; j++) { - if (metaData[j].name === "operationMeta") { - var operationMeta = metaData[j].value; - var params = {}; - params.method = operationMeta.method; - params.pathParams = operationMeta.pathParams; - params.queryParams = operationMeta.queryParams; - params.formParams = operationMeta.formParams ? operationMeta.formParams : []; - params.uri = operationMeta.uri; - params.contentType = operationMeta.contentType; - feature.params.push(params); - feature.permission = operationMeta.permission; - if (operationMeta.icon) { - if (operationMeta.icon.indexOf("path:") === 0) { - feature.icon = operationMeta.icon.replace("path:", ""); - } else { - feature.iconFont = operationMeta.icon; - } - } - if (operationMeta.uiParams && operationMeta.uiParams.length > 0) { - feature.uiParams = operationMeta.uiParams; - } - continue; - } - feature.metadata.push(metaData[j].value); - } - featureList.push(feature); - } - } - - if (featureList.length > 0) { - var baseUnitPath = context + "/public/cdmf.unit.device.type." + deviceType + ".operation-bar"; - var operationBarScriptSrc = baseUnitPath + "/js/operation-bar.js"; - var operationBarTemplateSrc = baseUnitPath + "/templates/operation-bar.hbs"; - var operationBarCacheKey = deviceType + "-operation-bar"; - - $.template(operationBarCacheKey, operationBarTemplateSrc, function (template) { - var content = template({"controlOperations": featureList, "devices" : deviceList}); - $("#device-type-operations").html(content); - var operationRow = $("#device-type-operations-bar"); - var script = document.createElement("script"); - script.type = "text/javascript"; - script.src = operationBarScriptSrc; - operationRow.prepend(script); - operationRow.removeClass("hidden"); - }); - } else { - $(modalPopupContent).html($('#no-features-available').html()); - $("a#no-features-available-selected-link").click(function () { - hidePopup(); - }); - showPopup(); - } -} - -function removeDevices(deviceIdentifiers) { - var serviceURL = "/api/device-mgt/v1.0/devices/type/" + deviceIdentifiers[0].type + "/id/" + deviceIdentifiers[0].id; - invokerUtil.delete(serviceURL, function (message) { - if (deviceIdentifiers.length > 1) { - deviceIdentifiers.shift(); - removeDevices(deviceIdentifiers); - } else { - $(modalPopupContent).html($('#remove-device-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - } - }, function (jqXHR) { - displayDeviceErrors(jqXHR); - }); -} - -function deleteDevices(deviceIdentifiers) { - var serviceURL = "/api/device-mgt/v1.0/admin/devices/permanent-delete"; - invokerUtil.put(serviceURL, deviceIdentifiers, function (message) { - $(modalPopupContent).html($('#delete-device-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - }, function (jqXHR) { - displayDeviceErrors(jqXHR); - }); -} - -function displayDeviceErrors(jqXHR) { - showPopup(); - if (jqXHR.status == 400) { - $(modalPopupContent).html($('#device-400-content').html()); - $("a#device-400-link").click(function () { - hidePopup(); - }); - } else if (jqXHR.status == 403) { - $(modalPopupContent).html($('#device-403-content').html()); - $("a#device-403-link").click(function () { - hidePopup(); - }); - } else if (jqXHR.status == 409) { - $(modalPopupContent).html($('#device-409-content').html()); - $("a#device-409-link").click(function () { - hidePopup(); - }); - } else { - $(modalPopupContent).html($('#device-unexpected-error-content').html()); - $("a#device-unexpected-error-link").click(function () { - hidePopup(); - }); - console.log("Error code: " + jqXHR.status); - } -} - -function getParameterByName(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(location.search); - return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); -} - -/* - * Function to get selected devices. - */ -function getSelectedDevices() { - var deviceList = []; - var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable(); - thisTable.api().rows().every(function () { - if ($(this.node()).hasClass('DTTT_selected')) { - deviceList.push( - { - "id": $(thisTable.api().row(this).node()).data('deviceid'), - "type": $(thisTable.api().row(this).node()).data('devicetype'), - "selectability": $(thisTable.api().row(this).node()).data('type') - } - ); - } - }); - - return deviceList; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.hbs deleted file mode 100644 index 9227e4e312..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.hbs +++ /dev/null @@ -1,264 +0,0 @@ -{{! - Copyright (c) 2017, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Device Type Management"}} - -{{#zone "topCss"}} - {{css "css/devicetype.css"}} -{{/zone}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Device Types - -
  • -
  • - - - Add - -
  • -{{/zone}} - -{{#zone "content"}} - {{#if canManage}} - -
    -
    - -
    -
    -

    Create Device Type

    -
    -
    -
    -
    -
    -
    1
    - -
    -
    -
    -
    -
    2
    - -
    -
    -
    -
    -

    -
    - - - - - -
    - -
    - - -
    - -
    - - -
    - -
    - - - -
    -
    -
    - -
    -
    - -
    -
    - -
    - -
    -
    - - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - - - - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - -
    - -
    - -
    -
    - - - - - - - -
    -
    - - {{else}} -

    - Permission Denied -

    -
    - You not authorized to create device type. -
    - {{/if}} -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/bottomJs.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.js deleted file mode 100644 index 163141cbc0..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var displayData = {}; - - if (userModule.isAuthorized("/permission/admin/device-mgt/admin/device-type")) { - displayData.canManage = true; - } - - return displayData; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.json deleted file mode 100644 index 0de47dfc78..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/create.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device-type/add", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/public/css/devicetype.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/public/css/devicetype.css deleted file mode 100644 index 01233a0851..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/public/css/devicetype.css +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -.wr-btn-horizontal{ - padding: 7px 10px; -} - -.dontfloat { - clear:both; -} - -.hidden-div { - display: none; -} - -.feature-wrapper{ - margin-top: 10px; -} - -.wr-btn-secondary{ - background-color: #617d8b; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/public/js/bottomJs.js deleted file mode 100644 index 18022238fc..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.create/public/js/bottomJs.js +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -var validateInline = {}; -var clearInline = {}; - -var apiBasePath = "/api/device-mgt/v1.0"; - - -var enableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).addClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).removeClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).removeClass(" hidden"); - } -}; - -var disableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).removeClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).addClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).addClass(" hidden"); - } -}; - - -function formatRepo(user) { - if (user.loading) { - return user.text - } - if (!user.username) { - return; - } - var markup = '
    ' + - '
    ' + - '
    ' + - '
    ' + user.username + '
    '; - if (user.name || user.name != undefined) { - markup += '
    ( ' + user.name + ' )
    '; - } - markup += '
    '; - return markup; -} - -function formatRepoSelection(user) { - return user.username || user.text; -} - - - -$(document).ready(function () { - - $('[data-toggle="tooltip"]').tooltip(); - var appContext = $("#app-context").data("app-context"); - - var maxField = 100; //Input fields increment limitation - var addButton = $('.add_button'); //Add button selector - var wrapper = $('.attribute_field_wrapper'); //Input field wrapper - var fieldHTML = $('#add-attribute-field').html(); //New input field html - $(addButton).click(function(){ //Once add button is clicked - $(wrapper).append(fieldHTML); // Add field html - }); - $(wrapper).on('click', '.remove_button', function(e){ //Once remove button is clicked - e.preventDefault(); - $(this).parent('div').remove(); - }); - - var addOperationButton = $('.add_operation_button'); //Add button selector - var operationWrapper = $('.operation_field_wrapper'); //Input field wrapper - var operationFieldHTML = $('#add-operation-field').html(); //New input field html - $(addOperationButton).click(function(){ //Once add button is clicked - $(operationWrapper).append(operationFieldHTML); // Add field html - }); - $(operationWrapper).on('click', '.remove_operation_button', function(e){ //Once remove button is clicked - e.preventDefault(); - $(this).parent('div').remove(); - }); - - - var addFeatureButton = $('.add_feature_button'); //Add button selector - var featureWrapper = $('.feature_field_wrapper'); //Input field wrapper - $(addFeatureButton).click(function(){ //Once add button is clicked - var featureFieldHtml = '
    ' + - '
    ' + - '
    ' + - '
    ' - $(featureWrapper).append(featureFieldHtml); // Add field html - }); - $(featureWrapper).on('click', '.remove_feature_button', function(e){ //Once remove button is clicked - e.preventDefault(); - $(this).parent('div').remove(); //Remove field html - }); - - /** - * Following click function would execute - * when a user clicks on "Add Device type" button. - */ - $("button#add-devicetype-btn").click(function () { - - var errorMsgWrapper = "#devicetype-create-error-msg"; - var errorMsg = "#devicetype-create-error-msg span"; - var deviceType = {}; - var deviceTypeName = $("#deviceTypeName").val(); - var deviceTypeDescription = $("#deviceTypeDescription").val(); - if (!deviceTypeName || deviceTypeName.trim() == "" ) { - $(errorMsg).text("Device Type Name Cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - return; - } - - if (!deviceTypeDescription || deviceTypeDescription.trim() == "" ) { - $(errorMsg).text("Device Type Description Cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - return - } - - deviceType.name = deviceTypeName.trim(); - deviceType.deviceTypeMetaDefinition = {} - deviceType.deviceTypeMetaDefinition.description = deviceTypeDescription.trim(); - - var pushNotification = $("#pushNotification").val(); - if (pushNotification != "NONE") { - deviceType.deviceTypeMetaDefinition.pushNotificationConfig = {}; - deviceType.deviceTypeMetaDefinition.pushNotificationConfig.scheduled = true; - deviceType.deviceTypeMetaDefinition.pushNotificationConfig.type = pushNotification; - } - - var propertyValues = []; - $('input[name^="attribute"]').each(function() { - var propertyValue = $(this).val(); - if (propertyValue.trim() != "") { - propertyValues.push(propertyValue.trim()); - } - }); - deviceType.deviceTypeMetaDefinition.properties = propertyValues; - - var operationValues = []; - $('input[name^="operation"]').each(function() { - var operationValue = $(this).val(); - if (operationValue.trim() != "") { - operationValues.push(operationValue.trim()); - } - }); - if (operationValues.length > 0) { - deviceType.deviceTypeMetaDefinition.initialOperationConfig = {}; - deviceType.deviceTypeMetaDefinition.initialOperationConfig.operations = operationValues; - } - - var features = []; - $('div[name^="deviceFeature"]').each(function() { - var featureName = $(this).find("#feature-name").val(); - var featureCode = $(this).find("#feature-code").val(); - var featureDescription = $(this).find("#feature-description").val(); - if (featureName && featureName.trim() != "" && featureCode && featureCode.trim() != "") { - var feature = {}; - feature.name = featureName.trim(); - feature.code = featureCode.trim(); - feature.description = featureDescription.trim(); - features.push(feature); - } - }); - deviceType.deviceTypeMetaDefinition.features = features; - - var addRoleAPI = apiBasePath + "/admin/device-types"; - - invokerUtil.post( - addRoleAPI, - deviceType, - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200) { - window.location.href = appContext + "/device-type/edit-event?type=" + - encodeURIComponent(deviceTypeName); - } - }, - function (jqXHR) { - if (jqXHR.status == 500) { - $(errorMsg).text("Unexpected error."); - $(errorMsgWrapper).removeClass("hidden"); - } - if (jqXHR.status == 400) { - $(errorMsg).text("Device type name should not contain whitespaces."); - $(errorMsgWrapper).removeClass("hidden"); - } - - if (jqXHR.status == 409) { - $(errorMsg).text("Device type already exists"); - $(errorMsgWrapper).removeClass("hidden"); - } - } - ); - }); - -}); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.hbs deleted file mode 100644 index 1203de1aea..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.hbs +++ /dev/null @@ -1,272 +0,0 @@ -{{! - Copyright (c) 2017, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Device Type Management"}} - -{{#zone "topCss"}} - {{css "css/devicetype.css"}} -{{/zone}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Device Types - -
  • -
  • - - - Edit - -
  • -{{/zone}} - -{{#zone "content"}} - {{#if canManage}} - -
    -
    - -
    -
    -

    {{name}}

    -
    -
    -
    - -
    - - -
    - -
    - -
    - -
    - -
    - - -
    -
    - - -
    -
    - {{#if type.deviceTypeMetaDefinition.features}} - {{#each type.deviceTypeMetaDefinition.features}} -
    -
    -
    - -
    -
    - -
    -
    - -
    - -
    -
    - {{/each}} - {{/if}} -
    -
    -
    - -
    -
    - -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    - {{#if type.deviceTypeMetaDefinition.properties}} - {{#each type.deviceTypeMetaDefinition.properties}} -
    -
    -
    - -
    - -
    -
    - {{/each}} - {{/if}} -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - - - -
    - {{#if type.deviceTypeMetaDefinition.initialOperationConfig}} - {{#each type.deviceTypeMetaDefinition.initialOperationConfig.operations}} -
    -
    -
    - -
    - -
    -
    - {{/each}} - {{/if}} -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - -
    - -
    -
    - - -
    -
    - - - - -
    -
    - - {{else}} -

    - Permission Denied -

    -
    - You not authorized to edit device type. -
    - {{/if}} -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/bottomJs.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.js deleted file mode 100644 index 5e6deb2198..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var displayData = {}; - - - if (userModule.isAuthorized("/permission/admin/device-mgt/admin/device-type")) { - displayData.canManage = true; - } - context.handlebars.registerHelper('if_eq', function(a, b, opts) { - if(a == b) // Or === depending on your needs - return opts.fn(this); - else - return opts.inverse(this); - }); - - var deviceType = request.getParameter("type"); - var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - var restAPIEndpoint = deviceMgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] - + "/device-types/" + deviceType; - displayData.name = deviceType; - serviceInvokers.XMLHttp.get( - restAPIEndpoint, - function (restAPIResponse) { - if (restAPIResponse["status"] == 200 && restAPIResponse["responseText"]) { - var typeData = parse(restAPIResponse["responseText"]); - displayData.type = typeData; - - } - } - ); - - return displayData; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.json deleted file mode 100644 index 26088b9d86..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/edit.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device-type/edit", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/public/css/devicetype.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/public/css/devicetype.css deleted file mode 100644 index 25203e2b1c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/public/css/devicetype.css +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -.wr-btn-horizontal{ - padding: 7px 10px; -} - -.dontfloat { - clear:both; -} - -.hidden-div { - display: none; -} - -.hidden-input { - display: none; -} - -.feature-wrapper{ - margin-top: 10px; -} -.wr-btn-secondary{ - background-color: #617d8b; -} -.wr-btn-secondary{ - background-color: #617d8b; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/public/js/bottomJs.js deleted file mode 100644 index a388654574..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.edit/public/js/bottomJs.js +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -var validateInline = {}; -var clearInline = {}; - -var apiBasePath = "/api/device-mgt/v1.0"; -var domain = $("#domain").val(); - - -var enableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).addClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).removeClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).removeClass(" hidden"); - } -}; - -var disableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).removeClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).addClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).addClass(" hidden"); - } -}; - -function formatRepo(user) { - if (user.loading) { - return user.text - } - if (!user.username) { - return; - } - var markup = '
    ' + - '
    ' + - '
    ' + - '
    ' + user.username + '
    '; - if (user.name || user.name != undefined) { - markup += '
    ( ' + user.name + ' )
    '; - } - markup += '
    '; - return markup; -} - -function formatRepoSelection(user) { - return user.username || user.text; -} - -$(document).ready(function () { - - var appContext = $("#app-context").data("app-context"); - - var addButton = $('.add_button'); //Add button selector - var wrapper = $('.attribute_field_wrapper'); //Input field wrapper - var fieldHTML = $('#add-attribute-field').html(); //New input field html - $(addButton).click(function(){ //Once add button is clicked - $(wrapper).append(fieldHTML); // Add field html - }); - $(wrapper).on('click', '.remove_button', function(e){ //Once remove button is clicked - e.preventDefault(); - $(this).parent('div').remove(); //Remove field html - }); - - var addOperationButton = $('.add_operation_button'); //Add button selector - var operationWrapper = $('.operation_field_wrapper'); //Input field wrapper - var operationFieldHTML = $('#add-operation-field').html(); //New input field html - $(addOperationButton).click(function(){ //Once add button is clicked - $(operationWrapper).append(operationFieldHTML); // Add field html - }); - $(operationWrapper).on('click', '.remove_operation_button', function(e){ //Once remove button is clicked - e.preventDefault(); - $(this).parent('div').remove(); - }); - - - var addFeatureButton = $('.add_feature_button'); //Add button selector - var featureWrapper = $('.feature_field_wrapper'); //Input field wrapper - $(addFeatureButton).click(function(){ //Once add button is clicked - var featureFieldHtml = '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    '; - $(featureWrapper).append(featureFieldHtml); // Add field html - - }); - $(featureWrapper).on('click', '.remove_feature_button', function(e){ //Once remove button is clicked - e.preventDefault(); - $(this).parent('div').remove(); //Remove field html - }); - - /** - * Following click function would execute - * when a user clicks on "Add Device type" button. - */ - $("button#edit-devicetype-btn").click(function () { - - var errorMsgWrapper = "#devicetype-create-error-msg"; - var errorMsg = "#devicetype-create-error-msg span"; - var successMsgWrapper = "#devicetype-create-success-msg"; - var successMsg = "#devicetype-create-success-msg span"; - var deviceType = {}; - var deviceTypeName = $("#deviceTypeName").val(); - var deviceTypeDescription = $("#deviceTypeDescription").val(); - if (!deviceTypeName || deviceTypeName.trim() == "" ) { - $(errorMsg).text("Device Type Name Cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - $([document.documentElement, document.body]).animate({ - scrollTop: $(".page-sub-title").offset().top - }, 500); - return; - } - - if (!deviceTypeDescription || deviceTypeDescription.trim() == "") { - $(errorMsg).text("Device Type Description Cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - $([document.documentElement, document.body]).animate({ - scrollTop: $(".page-sub-title").offset().top - }, 500); - return; - } - - deviceType.name = deviceTypeName.trim(); - deviceType.deviceTypeMetaDefinition = {} - deviceType.deviceTypeMetaDefinition.description = deviceTypeDescription.trim(); - - var pushNotification = $("#pushNotification").val(); - if (pushNotification != "NONE") { - deviceType.deviceTypeMetaDefinition.pushNotificationConfig = {}; - deviceType.deviceTypeMetaDefinition.pushNotificationConfig.scheduled = true; - deviceType.deviceTypeMetaDefinition.pushNotificationConfig.type = pushNotification; - } - - var propertyValues = []; - $('input[name^="attribute"]').each(function() { - var propertyValue = $(this).val(); - if (propertyValue.trim() != "") { - propertyValues.push(propertyValue.trim()); - } - }); - deviceType.deviceTypeMetaDefinition.properties = propertyValues; - - var operationValues = []; - $('input[name^="operation"]').each(function() { - var operationValue = $(this).val(); - if (operationValue.trim() != "") { - operationValues.push(operationValue.trim()); - } - }); - if (operationValues.length > 0) { - deviceType.deviceTypeMetaDefinition.initialOperationConfig = {}; - deviceType.deviceTypeMetaDefinition.initialOperationConfig.operations = operationValues; - } - - var features = []; - var featureCodesValidation = true; - var regexp = /^[a-zA-Z0-9-_]+$/; - $('div[name^="deviceFeature"]').each(function() { - var featureName = $(this).find(".feature-name").val(); - var featureCode = $(this).find(".feature-code").val(); - var featureDescription = $(this).find(".feature-description").val(); - if (featureName && featureName.trim() != "" && featureCode && featureCode.trim() != "") { - featureCodesValidation = featureCodesValidation && (featureCode.search(regexp) != -1); - var feature = {}; - feature.name = featureName.trim(); - feature.code = featureCode.trim(); - feature.description = featureDescription; - features.push(feature); - } - }); - if (!featureCodesValidation) { - $(errorMsg).text("Device Type feature code can only contain alphanumeric, underscore and dash characters."); - $(errorMsgWrapper).removeClass("hidden"); - $([document.documentElement, document.body]).animate({ - scrollTop: $(".page-sub-title").offset().top - }, 500); - return; - } - deviceType.deviceTypeMetaDefinition.features = features; - - var addRoleAPI = apiBasePath + "/admin/device-types/" + deviceType.name; - - invokerUtil.put( - addRoleAPI, - deviceType, - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200) { - $(errorMsgWrapper).addClass(" hidden"); - $("#modalDevice").modal('show'); - } - }, - function (jqXHR) { - if (jqXHR.status == 500) { - $(errorMsg).text("Unexpected error."); - $(errorMsgWrapper).removeClass("hidden"); - } - - if (jqXHR.status == 409) { - $(errorMsg).text("Device type already exists"); - $(errorMsgWrapper).removeClass("hidden"); - } - } - ); - }); - -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.hbs deleted file mode 100644 index d4ac26f6d5..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.hbs +++ /dev/null @@ -1,181 +0,0 @@ -{{! - Copyright (c) 2017, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Device Type Management"}} - -{{#zone "topCss"}} - {{css "css/devicetype.css"}} -{{/zone}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Device Types - -
  • -
  • - - - Event - -
  • -{{/zone}} - -{{#zone "content"}} - {{#if canManage}} - -
    -
    - -
    -
    -

    {{name}}

    -
    -
    -
    - -
    - - - -
    - - -
    - - -
    -
    - {{#if event.eventAttributes}} - {{#each event.eventAttributes.attributes}} -
    -
    -
    - -
    -
    - -
    - -
    -
    - {{/each}} - {{/if}} -
    -
    -
    - -
    -
    - -
    - -
    -
    -
    - -
    - {{#if event}} - - {{else}} - - {{/if}} - - -
    -
    -
    -
    - - - -
    -
    - - - - {{else}} -

    - Permission Denied -

    -
    - You not authorized to edit device type. -
    - {{/if}} -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/bottomJs.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.js deleted file mode 100644 index 3945f57686..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var displayData = {}; - - - if (userModule.isAuthorized("/permission/admin/device-mgt/admin/device-type")) { - displayData.canManage = true; - } - context.handlebars.registerHelper('selected', function(a, b, opts) { - if(a == b) // Or === depending on your needs - return "selected"; - else - return ""; - }); - - var deviceType = request.getParameter("type"); - var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - var restAPIEndpoint = deviceMgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] - + "/events/" + deviceType; - displayData.name = deviceType; - serviceInvokers.XMLHttp.get( - restAPIEndpoint, - function (restAPIResponse) { - if (restAPIResponse["status"] == 200 && restAPIResponse["responseText"]) { - var typeData = parse(restAPIResponse["responseText"]); - displayData.event = typeData; - } - } - ); - - return displayData; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.json deleted file mode 100644 index 9e773121e5..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/edit.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device-type/edit-event", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/public/css/devicetype.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/public/css/devicetype.css deleted file mode 100644 index 30c7b95769..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/public/css/devicetype.css +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - - - -.dontfloat { - clear:both; -} - -.hidden-div { - display: none; -} - -.hidden-input { - display: none; -} - -.event-wrapper{ - margin-top: 10px; -} - -.wr-btn-horizontal{ - padding: 7px 10px; -} - -.wr-btn-secondary{ - background-color: #617d8b; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/public/js/bottomJs.js deleted file mode 100644 index 46cd46a361..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetype.event.edit/public/js/bottomJs.js +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -var validateInline = {}; -var clearInline = {}; - -var apiBasePath = "/api/device-mgt/v1.0"; -var domain = $("#domain").val(); - - -var enableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).addClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).removeClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).removeClass(" hidden"); - } -}; - -var disableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).removeClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).addClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).addClass(" hidden"); - } -}; - -function formatRepo(user) { - if (user.loading) { - return user.text - } - if (!user.username) { - return; - } - var markup = '
    ' + - '
    ' + - '
    ' + - '
    ' + user.username + '
    '; - if (user.name || user.name != undefined) { - markup += '
    ( ' + user.name + ' )
    '; - } - markup += '
    '; - return markup; -} - -function formatRepoSelection(user) { - return user.username || user.text; -} - - - -$(document).ready(function () { - - var appContext = $("#app-context").data("app-context"); - var addEventButton = $('.add_event_button'); //Add button selector - var eventWrapper = $('.event_field_wrapper'); //Input field wrapper - $(addEventButton).click(function(){ //Once add button is clicked - var eventFieldHtml = '
    ' + - '
    ' + - '
    ' + - '
    ' - $(eventWrapper).append(eventFieldHtml); // Add field html - - }); - $(eventWrapper).on('click', '.remove_event_button', function(e){ //Once remove button is clicked - e.preventDefault(); - $(this).parent('div').remove(); - }); - - /** - * Following click function would execute - * when a user clicks on "Add Device type" button. - */ - $("button#add-event-btn").click(function () { - - var errorMsgWrapper = "#devicetype-create-error-msg"; - var errorMsg = "#devicetype-create-error-msg span"; - var successMsgWrapper = "#devicetype-create-success-msg"; - var successMsg = "#devicetype-create-success-msg span"; - var deviceTypeEvent = {}; - var deviceTypeName = $("#deviceTypeName").val(); - var deviceTypeDescription = $("#deviceTypeDescription").val(); - if (!deviceTypeName || deviceTypeName.trim() == "" ) { - $(errorMsg).text("Device Type Name Cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - return; - } - - - deviceTypeEvent.eventAttributes = {}; - - deviceTypeEvent.transport = $("#transport").val(); - - var attributes = []; - $('div[name^="deviceEvent"]').each(function() { - var eventName = $(this).find("#event-name").val(); - var eventType = $(this).find("#event-type").val(); - if (eventName && eventName.trim() != "" && eventType && eventType.trim() != "" && eventName != "deviceId") { - var attribute = {}; - attribute.name = eventName.trim(); - attribute.type = eventType.trim(); - attributes.push(attribute); - } - }); - deviceTypeEvent.eventAttributes.attributes = attributes; - - var addEventsAPI = apiBasePath + "/events/" + deviceTypeName; - - invokerUtil.post( - addEventsAPI, - deviceTypeEvent, - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200) { - $("#modalDevice").modal('show'); - } - }, - function (jqXHR) { - if (jqXHR.status == 500) { - $(errorMsg).text("Failed to deploy event definition, Please Contact Administrator"); - $(errorMsgWrapper).removeClass("hidden"); - } - - if (jqXHR.status == 409) { - $(errorMsg).text("Device type definition cannot be updated"); - $(errorMsgWrapper).removeClass("hidden"); - } - } - ); - }); - - - -}); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.hbs deleted file mode 100644 index e59b248e4f..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.hbs +++ /dev/null @@ -1,114 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} - -{{unit "cdmf.unit.ui.title" pageTitle="Device Type Management"}} -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.ui.modal"}} - -{{#zone "topCss"}} - {{css "css/custom.css"}} -{{/zone}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Device Types - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#unless isCloud}} -
  • - - - - - - - Create Device Type - -
  • - {{/unless}} -{{/zone}} - -{{#zone "content"}} - {{#if hasDeviceTypes}} -
    - - - Loading device types . . . -
    -
    - -
    - - - - - - - - - - -
    By Device Type Name
    -
    - - - - {{else}} - -
    -
    -

    You Haven't created device types yet.

    -
    Please click "Create a Device Type", if you wish to create a device type. -
    - - - - - - - Create Device Type - -
    -
    - - {{/if}} -{{/zone}} - -{{#zone "bottomJs"}} - - - {{js "js/devicetype-listing.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.js deleted file mode 100644 index e83b53d265..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - - context["permissions"] = userModule.getUIPermissions(); - if (userModule.isAuthorized("/permission/admin/device-mgt/admin/device-type")) { - context["editPermitted"] = true; - } - var deviceTypeCount = deviceModule.getDeviceTypeCount(); - - if (deviceTypeCount > 0) { - context["hasDeviceTypes"] = true; - } else { - context["hasDeviceTypes"] = false; - } - - return context; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.json deleted file mode 100644 index 4dfd684380..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/devicetypes.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/device-types", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/css/custom.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/css/custom.css deleted file mode 100644 index e7d3595bec..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/css/custom.css +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -#devicetype-table .dataTablesTop{ - Display : none; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/js/devicetype-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/js/devicetype-listing.js deleted file mode 100644 index e2002277c3..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/js/devicetype-listing.js +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var loadDeviceTypeBasedActionURL = function (action, deviceTypeName) { - href = $("#ast-container").data("app-context") + "device-type/" + action + "?type=" + encodeURIComponent(deviceTypeName); - $(location).attr('href', href); -}; - -$(function () { - var sortableElem = '.wr-sortable'; - $(sortableElem).sortable({ - beforeStop: function () { - $(this).sortable('toArray'); - } - }); - $(sortableElem).disableSelection(); -}); - -var apiBasePath = "/api/device-mgt/v1.0"; -var modalPopup = ".modal"; -var modalPopupContainer = modalPopup + " .modal-content"; -var modalPopupContent = modalPopup + " .modal-content"; -var body = "body"; -var isInit = true; -var isCloud = false; - - -/** - * - * Fires the res_text when ever a data table redraw occurs making - * the font icons change the size to respective screen resolution. - * - */ -$(document).on('draw.dt', function () { - $(".icon .text").res_text(0.2); -}); - - -/* - * set popup maximum height function. - */ -function setPopupMaxHeight() { - $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30))); - $(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2))); -} - -/* - * show popup function. - */ -function showPopup() { - $(modalPopup).modal('show'); - //setPopupMaxHeight(); -} - -/* - * hide popup function. - */ -function hidePopup() { - $(modalPopupContent).html(''); - $(modalPopup).modal('hide'); - $('body').removeClass('modal-open').css('padding-right', '0px'); - $('.modal-backdrop').remove(); -} - - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption() { - // $(location).attr('href', $(this).data("url")); -} - -function htmlspecialchars(text) { - return jQuery('
    ').text(text).html(); -} - -function loadDeviceTypes() { - var loadingContent = $("#loading-content"); - loadingContent.show(); - - var dataFilter = function (data) { - data = JSON.parse(data); - var objects = []; - $(data).each(function (index) { - objects.push( - { - name: htmlspecialchars(data[index].name), - DT_RowId: "devicetype-" + htmlspecialchars(data[index].name), - metaDefinition: (data[index].deviceTypeMetaDefinition ? true : false) - } - ) - }); - - var json = { - "recordsTotal": data.length, - "recordsFiltered": data.length, - "data": objects - }; - - return JSON.stringify(json); - }; - - //noinspection JSUnusedLocalSymbols - var fnCreatedRow = function (nRow, aData, iDataIndex) { - $(nRow).attr('data-type', 'selectable'); - }; - - //noinspection JSUnusedLocalSymbols - var columns = [ - { - class: "remove-padding content-fill", - data: null, - defaultContent: "
    " + - "" + - "
    " - }, - { - class: "", - data: "name", - render: function (name, type, row, meta) { - return '

    ' + name.replace("devicemgt", "") + '

    '; - } - }, - { - class: "text-right content-fill text-left-on-grid-view no-wrap", - data: null, - render: function (data, type, row, meta) { - var isCloud = false; - if ($('#is-cloud').length > 0) { - isCloud = true; - } - - var innerhtml = ''; - if (data.metaDefinition) { - - var editLink = '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - ''; - - var editEventLink = '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - ''; - - innerhtml = editLink + editEventLink; - } - return innerhtml; - } - } - ]; - - var options = { - "placeholder": "Search By Device Type Name", - "searchKey": "filter", - "searching": false - }; - var settings = { - "sorting": false - }; - var deviceTypeApiUrl = '/api/device-mgt/v1.0/admin/device-types'; - - $('#devicetype-grid').datatables_extended_serverside_paging(settings, deviceTypeApiUrl, dataFilter, columns, fnCreatedRow, null, options); - loadingContent.hide(); - -} - -$(document).ready(function () { - loadDeviceTypes(); -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/templates/devicetype-listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/templates/devicetype-listing.hbs deleted file mode 100644 index 6835f28e9c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devicetypes/public/templates/devicetype-listing.hbs +++ /dev/null @@ -1,44 +0,0 @@ -{{#each deviceTypes}} - - -
    - -
    - - {{deviceTypeName}} - - - {{#if canEdit}} - - - - - - - - - - - - - - - - - - - - - - - - - {{/if}} - - -{{/each}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.hbs deleted file mode 100644 index c8c9b5e23c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.hbs +++ /dev/null @@ -1,44 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} - -{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | View Policy"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Policies - -
  • -
  • - - View - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.device.operation-mod"}} - {{unit "cdmf.unit.effective-policy.view"}} - {{unit "cdmf.unit.lib.data-table"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.js deleted file mode 100644 index 9293982898..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var utility = require("/app/modules/utility.js")["utility"]; - var deviceType = context.uriParams.deviceType; - var deviceId = context.uriParams.deviceId; - return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, deviceId,"policy-view")}; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.json deleted file mode 100644 index ec79d2b203..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/policy/effective-policy/", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.hbs deleted file mode 100644 index a1a620b4b8..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.hbs +++ /dev/null @@ -1,22 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}} - -{{#zone "messageDescription"}} - {{@page.params.status}} - {{@page.params.message}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.json deleted file mode 100644 index adad4c3291..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/errors/default", - "layout" : "cdmf.layout.error" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.hbs deleted file mode 100644 index 8b81fdd212..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.hbs +++ /dev/null @@ -1,84 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{#zone "topCss"}} - {{css "css/analytics.css"}} -{{/zone}} - -{{unit "cdmf.unit.ui.title" pageTitle="Analytics"}} -{{unit "cdmf.unit.ui.content.title" pageHeader=title}} -{{unit "cdmf.unit.lib.service-invoker-utility"}} -{{unit "cdmf.unit.lib.handlebars"}} -{{unit "cdmf.unit.lib.rickshaw-graph"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Groups - -
  • -
  • - - {{groupName}} - -
  • -
  • - - Analytics - -
  • -{{/zone}} - -{{#zone "content"}} -
    -
    - {{#if deviceTypes}} -
    - {{unit "cdmf.unit.analytics.date-range-picker" deviceTypes=deviceTypes}} -
    -
    -
    -
    - {{#each deviceTypes}} - {{unit deviceAnalyticsViewUnitName devices=devices}} - {{/each}} -
    - {{else}} -
    - -
    - {{/if}} -
    -
    -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.js deleted file mode 100644 index 2436a3495d..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var utility = require("/app/modules/utility.js").utility; - var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; - var groupId = context.uriParams.id; - var group = groupModule.getGroup(groupId); - var devices = []; - var deviceResponse = groupModule.getGroupDevices(groupId).responseText; - - if(deviceResponse != null) { - var deviceResponseObj = parse(deviceResponse); - devices = deviceResponseObj.devices; - } - var page = { - "groupId": groupId, - "groupName": group.name, - "title": group.name + " Analytics" - }; - if (devices) { - var deviceTypes = []; - for (var i = 0; i < devices.length; i++) { - var hasDeviceType = false; - for (var j = 0; j < deviceTypes.length; j++) { - if (deviceTypes[j].type === devices[i].type) { - deviceTypes[j].devices.push(devices[i]); - hasDeviceType = true; - break; - } - } - if (!hasDeviceType) { - var deviceType = {}; - deviceType.type = devices[i].type; - deviceType.devices = []; - deviceType.devices.push(devices[i]); - deviceType.deviceAnalyticsViewUnitName = utility.getTenantedDeviceUnitName(deviceType.type, "analytics-view"); - deviceTypes.push(deviceType); - } - } - page.deviceTypes = deviceTypes; - page.devices = devices; - } - - return page; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.json deleted file mode 100644 index 8535dab982..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/group/{id}/analytics", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/public/css/analytics.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/public/css/analytics.css deleted file mode 100644 index 99514d0545..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/public/css/analytics.css +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -#rangeSliderWrapper { - margin-top: 25px; -} - -#chart { - display: inline-block; -} - -#legend { - display: inline-block; - position: relative; - left: 8px; -} - -#legend_container { - position: absolute; - right: 0; - bottom: 26px; - width: 0; -} - -#chart_container { - float: left; - position: relative; -} - -.ast-container { - padding-bottom: 30px; -} - -.container { - width: auto; -} - -.shrink { - margin-right: 20px; - margin-left: 20px; -} -.date-range{ - border: 1px solid #ccc; -} - -#dateRangePickerContainer button.active{ - background-color: #e6e6e6 !important; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs deleted file mode 100644 index 62cea7955e..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs +++ /dev/null @@ -1,84 +0,0 @@ -{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}} -{{unit "cdmf.unit.ui.modal"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Groups - -
  • -
  • - - Add - -
  • -{{/zone}} - -{{#zone "content"}} -
    - - - - -
    -{{/zone}} -{{#zone "bottomJs"}} - {{js "js/group-add.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.js deleted file mode 100644 index f4ec0e15d6..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Returns the dynamic state to be populated by add-group page. - * - * @param context Object that gets updated with the dynamic state of this page to be presented - * @returns {*} A context object that returns the dynamic state of this page to be presented - */ -function onRequest(context) { - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var page = {}; - page["isCloud"] = devicemgtProps.isCloud; - page["groupNameJSRegEx"] = devicemgtProps.groupValidationConfig.groupNameJSRegEx; - page["groupNameRegExViolationErrorMsg"] = devicemgtProps.groupValidationConfig.groupNameRegExViolationErrorMsg; - page["groupNameHelpMsg"] = devicemgtProps.groupValidationConfig.groupNameHelpMsg; - return page; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.json deleted file mode 100644 index fe82d18f2d..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/group/add", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js deleted file mode 100644 index c2ed21ecba..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -$(function () { - $("button#add-group-btn").click(function () { - - var name = $("input#name").val(); - var description = $("input#description").val(); - - if (!name) { - triggerError($("input#name"),"Group Name is a required field. It cannot be empty."); - return false; - } else if (!inputIsValid($("input#name").data("regex"), name)) { - triggerError($("input#name"),$("input#name").data("errormsg")); - return false; - } else { - var group = {"name": name, "description": description}; - - var successCallback = function (jqXHR, status, resp) { - if (resp.status == 201) { - $("#group-create-form").addClass("hidden"); - $("#group-created-msg").removeClass("hidden"); - setTimeout(function() { - window.location.href = "/devicemgt/groups"; - }, 1000); - } else { - displayErrors(resp.status); - } - }; - - invokerUtil.post("/api/device-mgt/v1.0/groups", group, - successCallback, function (message) { - displayErrors(message); - }); - - return false; - } - }); -}); - -/** - * @param el - * @param errorMsg - * - * Triggers validation error for provided element. - * Note : the basic jQuery validation elements should be present in the markup - * - */ -function triggerError(el,errorMsg){ - var parent = el.parents('.form-group'), - errorSpan = parent.find('span'), - errorMsgContainer = parent.find('label'); - - errorSpan.on('click',function(event){ - event.stopPropagation(); - removeErrorStyling($(this)); - el.unbind('.errorspace'); - }); - - el.bind('focusin.errorspace',function(){ - removeErrorStyling($(this)) - }).bind('focusout.errorspace',function(){ - addErrorStyling($(this)); - }).bind('keypress.errorspace',function(){ - $(this).unbind('.errorspace'); - removeErrorStyling($(this)); - }); - - errorMsgContainer.text(errorMsg); - - parent.addClass('has-error has-feedback'); - errorSpan.removeClass('hidden'); - errorMsgContainer.removeClass('hidden'); - - function removeErrorStyling(el){ - var parent = el.parents('.form-group'), - errorSpan = parent.find('span'), - errorMsgContainer = parent.find('label'); - - parent.removeClass('has-error has-feedback'); - errorSpan.addClass('hidden'); - errorMsgContainer.addClass('hidden'); - } - - function addErrorStyling(el){ - var parent = el.parents('.form-group'), - errorSpan = parent.find('span'), - errorMsgContainer = parent.find('label'); - - parent.addClass('has-error has-feedback'); - errorSpan.removeClass('hidden'); - errorMsgContainer.removeClass('hidden'); - } -} - -function displayErrors(message) { - $('#error-msg').html(message.responseText); - modalDialog.header('Unexpected error occurred!'); - modalDialog.content('

    ' + message.responseText + '

    '); - modalDialog.footer(''); - modalDialog.showAsError(); - $("a#group-unexpected-error-link").click(function () { - modalDialog.hide(); - }); -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs deleted file mode 100644 index 7e556c556c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs +++ /dev/null @@ -1,428 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}} -{{unit "cdmf.unit.ui.content.title" pageHeader="Groups"}} - -{{unit "cdmf.unit.lib.service-invoker-utility"}} -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.lib.ui-permissions-utility"}} - -{{#zone "topCss"}} - {{css "css/groups.css"}} -{{/zone}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Groups - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#if permissions.ADD_GROUP}} -
  • - - - - - - Add Group - -
  • - {{/if}} -{{/zone}} - -{{#zone "content"}} -
    -
    -
    -
    - - - {{#if groupCount}} -
    - - - - - - - - - - - - - - - - -
    By Owner
    -
    - {{else}} -
    - -
    - {{/if}} - -
    - - - -
    - -
    - - - -
    - -
    -
    -
    -
    -

    Group successfully updated.

    -
    - Do you want to manage users? - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -

    New Role was successfully created.

    -
    - Do you need to Add / Remove users from the chosen roles? - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -

    Do you really want to remove this group?

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Successfully removed the group.

    -
    -
    -
    -
    - -
    - - - -
    - -
    -
    -
    -
    -

    Group was successfully updated.

    -
    -
    -
    -
    - -
    -
    -
    -
    -

    Bad Request. Please contact your administrator.

    - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Operation not permitted.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Not found.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Group does not exist.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Unexpected error occurred!

    - - -
    -
    -
    -
    -
    -
    -
    -{{/zone}} - -{{#zone "bottomJs"}} - {{#if groupCount}} - {{js "js/listing.js"}} - {{/if}} -{{/zone}} - -{{#zone "topCss"}} - -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.js deleted file mode 100644 index c600f0515b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var constants = require("/app/modules/constants.js"); - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var currentUser = session.get(constants.USER_SESSION_KEY); - var page = {}; - if (currentUser) { - page.permissions = userModule.getUIPermissions(); - page.permissions.list = stringify(page.permissions); - page.currentUser = currentUser; - var groupCount = groupModule.getGroupCount(); - if (groupCount > 0) { - page.groupCount = groupCount; - } - } - page.isCloud = deviceMgtProps.isCloud; - return page; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.json deleted file mode 100644 index 4c9f556503..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/groups", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css deleted file mode 100644 index 58e0371132..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -.dataTablesTop .dataTables_toolbar ul li:nth-child(1), .dataTables_toolbar ul li:nth-child(2) { - display: none; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/images/group-icon.png b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/images/group-icon.png deleted file mode 100644 index 156fbc6edc48b4f2f3f9d8481d2de75bbe1d1b51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7027 zcmXY$c|26__rULr8OCnxYZyz&r^deTBl|YiP?2ndC|e{ZS!S}!8fD8)QMN1@6s5@) zkqB9{6h`*=UEkMl{<-tI_qoq=&Ux-R&-2HQAgIBM z^PLJ0@B$0eHL^i~zX-%l0s!zy8DVs6?&fbiH6z&eHT9jYr9Ggc;ZgoTdcbw3i=LJn z?Lxvs;8e7tg@x*|ObzN(bacG_ZV_{DlY>lQu`m>dP{<iCngrlQ%VN?Q^goo!4 zgF4LoJB6;(I<}$3&r&*kY9|}3asSGu+XhxOJ;$!tuFYGZ!@r>yrz3 zd+c}C+-Bkm4kyA8uMhllWnEO$a`EoE=E|qdys5O%X!E%iUZ>QEj00DUL^Bqa$$yiV zdkIbg4!D!^rq}-+*PNn;h)f7=4!6e%Eoo^qMAQXI^1qE_+c0AfPF z3rzr6=lr`pA?^8-S?}5{Fxl38Ru?!S&*uU10c4im<67Dz!LgoE2tqz)tx=35vfdMX z)uo7+AI;k3>qB-*@(Q@|Y4@QissLN%#tM%DhwfjxHrP72Fr3so8nTlyPFyj^iQu|X zcqZ2+0raw9Y$;p~6e4+3Y5FzrRaCL`&$?)FLS<3~JOOB(XCWWtfyy$~GZs>{x28xg z%DXAxD@QMnMhiex@wtOk6Pc6Ai4MSKDC&ucpW!bD7z>Zb4~W{ybv^{8Bh#9c%pleZMbVFJ~xb))c0t2v{$6%4Pc?mwW-0QB8k)zF7CV9;o!*! z$oW%mTHC)YH{5*gs5QB&IhDazqR~cNiN5)Op;}h3$1j|6wcX*o0T3nk%*V&GZW_}7 z@cDD}{|8^5iD}Ol3>fY|56)yC3Ooj`{aR^k`1XO^#diNVej?7X;r#vz{N`!t>y+H_ zkS*O|C19psMc^nHB`1<^bKwwe{{fC_6?1lDJ@|Sfs3|NM2{9FUX_BKu5Fa~KiwVSi z&G^g)#Ea3hZ-uJN6f)P1%F^`v@!6AED%9 zcz;gcrkXS3yBjrJ1OZ6CF3$jS%jE(WhzTkjHXHLyMSq)xWCV_MPM_L$#GE)4>jUIt zCcNN{+Je+sqsEhSbLVQR{kXpqSJH1nJWi0>J40{umOu}+!ci4tfZQ2U@_feWk>mWA z=wgarm$QAqNv*`E14!u2#E=5y8X^E#jQmtfgGL^rkyoi*^!|J1febGH*DLdpY$eOP z%7^b^PT{dS)G_Qdtv`WehWy@%8d^o z(8+~5YGf14$Tio-D#B?$kk=qn7!{?{5{DQQdg|b+1H@0}jLs{`^Fqj{S<)o(b*hQ# zn-&FOKsKk%n(SCIU~GJpq{p6h;E^)f7yplG_QIK^=$yx{Gqy7<9#S_V@VTMDzPV3F z;@v#Li#YX_OD`hz-`;1%MxTb7peYuB;)QRIsVrtkqEqBKt%*QHq*{xic%Z1a&eld~ zud{8yiC+b10v9p%`(|qhG~6X=#PLl%XEdd}ATUaQFkhNw(5&Xz#4|eA)~5VD_|?6n z-b{=BPepFSzgSO&(ApdS)Q+2Cd#Bcj&1NK;7fE7pej4$aP}SHjN4V83_frNxpAMI* zRN(2O{+Rzr43mu~wVEoeTo8c|s%-28Y*S$wDw4s{wG%;Vvd8`l^P`NUj zOB_KIj*fg{k^WElSsTlM{$`^%8*eW=35O{C@=yfucm{0NF1)ALA06%`H_sh18e?jH z_mDe*i3&G!Bw@)0rVnU3*Z!pr;aAl3MRRfFM{$u43iLA=X*HnyItQL(mKZ9@#IT>-rs6eTqN>5>`;#b{y$n zkG^M{-(%Xp*Lqog5}-pm8op1ouV54#-*R2n)wezEhV|DH3HsG$uf1WGJvlEOz*l8$ zIl`e~lY?)Ay2JWr#*^IF#R>~rwlA#a?yyl+Rt?cD*oM{%2{?3-<$#mQn-)p(SPtAP z$fzPH5Es$Q6DM+qRN(rjYveO_mu>h%nvaMQK6>mvR`^BiOVF_(B(=&7349n3#h1y+ zA5JsdW8U^)Ozdui!+-m)t5rIg-0p>3z6$*c>PM|J=Gf@s-6>&uc(45dgE}-PBiQC# zk6EyvbFD2sxt*Dm4NjHngK2OdVvf@Xd|U?v6Kw0svX<)_uG=Uc9knlWw?Ot2q|&g} zG8utIZas9KkQb38LJx@$=*3CG%2?&ZSJPM`gC&w4y?4JMClA-yVXb>*)OhuFcYc&I zd`EL9EzQh*eig8TwxqOI4IMset#c#p7Zo&Hf45>eHNfa)J~r5e?%(ct)BJolwrA;h zeyf97{OOAx{@ziDJTC&f|9tWy_meo8XMH0>xI}^8kp@1?(ebM)3iNpDxj#ncAd>{% zlIQ6ixhu*oS3o0_g{n%G!|W8@gj_#&G-JFQ)a8a!mA*pCE}nU4TN1Y&{y2=mPZ2*B zz!jav={unAJT@~w1eXnod3s`}#qD#Meu*D>e`tY=F9mkN7wc!w|5&+mnPodLQu|^m z6x9lyeUh%xh)&_;+Vd-iX3JJK(epCi|y!y_!-Z_+A*HZ5cyYQ|J5%!%e8W2wu%M zAu|#?G@$1t?-5t-2u_#E#IPw3vYB-h6PlA zaGEj0?{3@cMkA3vv&B`|gj!9p;#uYkE`d_i=#ZT~iD(hPMdd%Q;NMKO4c9*kuIu>) ztx>xMN5nNZ%`%+jdAvYB2oYon`^bfSkS1nqw~l3XzfRX5{6^(f%+RO zwX6_e%+BX?*Zm_Ji`TWv`TtT0nCrY80(s9CiB3=9-wRF%@X7Pry?}01XI!|2t2s zEwio$6v(P>H1Bn2qw%UZT8~vZy*_M6pH(Bp?#E)0fdC{FJN~j<+~AVlwDN9kprs)i z+Wh=PUYn(>GEPu8s5&wvfM$7L23HupU*uy@Y6E*R?O(^~n$5$0bC1E8`)r0NCaF_#%qQj+7 zef0c>8uDtov?ac3=n86*?MT1a003s&7VntRpR>2zQvo4V(W{b3yY~IP+y;10{V-!M(7nSLXJiRB9Xnqmm^G>Ne zhw=$DFRxx5LI^5e@?zi?s>*NM;yg&l@sc2>qRi=eAJ#K!^Jo>XmW+n5_u`a4%Ioo{ zK_z;~%aCy;DKeewz2OLq=M<4{5qmA z+3c7YX9yoZOO^WfC4~Bqn;snqa9+{xLg5knMuweG7RF|D7Se)Ik=hNZ4WoM!GfML! zhtk)B!V}PxPDpz;Nbpx;O#UruPM0?aO*0*%wp;o0_B;=TB915;3o5jg%wAqJCv2os ziEm%v%mgnJ`%7OJwNv@W0)Dd$ucgByv<|g0*DHwz0W&A*jLPTBKs6Bfnd{eXcuM|scAZo`_XWd#3bsG$|{ zE#z)d{FLWU?{*$AIQQzm6hkJawA`^TafHk!Ok869hai!)iWqbfO)w2tU*Uu4lJ%#y z`p6gNlJiOlBe#T$ed;+=&RAYCV-6HLDOZVhJSX}nmG9w!bJ6skME~tbZ5`G7>@tg8 zCN@0>j3l4#Pn9WizcGpBxewcXGYwy6JBDrvBlUm95_ljP6>%lE3vRQTZ-2Y{L=yh% zuQP}!ImwxviL8*j3i(HXU9W?dOv>EbN>R9!8W2(LiQSzNDpmr6+5ERb)uo;EmjtiQ z-Qs!_o+slMC=VU!d^)^+;q^*c8ydsI8g+R3*`7G{yP{Mp>r*{o=-5^;QJGGn0e3zwFm6)0CUsXW_Ap-%NIo>p zcbw!smzncWpikY|ar5>HNXKACuw%NaG5%cd((%@sf!Mt}3)0Aqw2Q?YkPJus za157l%{nDpwUOMxHfXZr>GGFvi=5-K6g;B;?kuZ{k!&)RYUiP`GH~2vK>ibVo(H!1 zE|w(qi%Y0N_n+>IZ~J$Q&Z;6i#IE3TEp#Hwhdh@c$7T-txs-rh?)9BmcO63!JeZkY zs{a_OWxUVjTzR|FEAgN|ti_Z8GxDnoiN8e3(Z5ogjg`kb-GfBbdSd;DR-QZ4%qp(7 z9|*peK^@93=orBQU`xk?+p>7QZiRtv6%%iM8xXX8CjI#hj$sR5LAZtQUG>?7UHnf% z(tkSUmFo8wEW>T-@Z+u3dt&#D7ofzhM^639@Ri ztl*`_GqMOzQ?Jw_>*{TW95T50`0-{yc`o$^YKy>5vT!5G^*!DO1tjb7CA|M4N8b( zG2ZxlQpCT_81ClH4zZaEt$h$T@!oMk!OQ&_;i3uWW?wnQcz4uLL^!XEPg`)klx(fiojB&AJ_J`!UgYjA-L!+klaWw8m6 z&D#N&S+Siugv+^La=A$t)cI507D!u6w=k_mgZ=>ZE)ByJ5V4ol!E<}avPUv={zKbd z(Mtw_UfEUFq05oKM9%Tpsq*Y;?qq(#?3~mIGIhXql*W>H=@NTQb15mkdzyx0(Tsgi z{DbCGlf)XTO*m}VVScZN%8d{HUA83C`d4^%ARLkbXib)aHVASmnc4-u4(l0yjq5$ zNS7T+AM&;ATmH=4NTiOw?YcPn^tlhV+*z!+S&SY{VFG3(zgbh&?m#BZ;Z2hNZGhQr z^v%vU`LyJ&(}!X?2cAG)5LxmGyk&mL`3sGs8GLs>&cC6t3j2aiYroXg<(yhZF{IJ3 z+(hL^@4*AW8y%9Q+x%VAo+lxo==6^;b6^--4l`?7MMM7oPU)K#MD-YxqedxtpIQbC zCKSl`IdXQ-X9@<-88Bo6`!TupXMy}v1@}YRDp^JjnnqXQo-l?`Ci=rVS;~a~&(jfc zbb)X&^O^L*IhSXJZm|sK2{Tg@A0FOnViO*;!`m>H+t98Xd0ad1JTLF8m$`L5fhEH{ zzKV)!*Ms5bMSKwzcV8FzPtg=D`I5H8&fJ&Euje=AmkBGkR(f;{@M074-wWK=`FCCS zRTJ(>L?PBfysg>gP7yBE=^83>%%NLc>Uuh?5K?E_xTp{NyHd;LJ$~(j0cPbbV{iA8 zQn)~0X^%UG58wBL!5%Neaah-B!{Lqac*omvo6@zcxGq^s1m+RIN9j zlKhrot_TRN@o%(Yg2WbdqDt;F<9EK-*x_uzl0)d$xRI4LSepdS%C#e$Ll@s%#yIH; zdMr^@G*8=8S?$23Eu8wjsUoG*()~@!`LxY!G)46v_h2%P1hD?ZNLmM(FX-j**^2Ic zv>T!cf+1BO(uSIzN?Fv0pi`qgj>%Qi#@=57Pa182}{SnKz(S?lrW$T`+ZoLKA@_T*_scl2DUmL zPL4zuC40cS|+G{4H@d`vU;^$ka*3?Nvk1JB!q5@;P z5~mW?S%)a}L{lySie*hAtS{MypN?MUjsi>grxLcdEBPu>r{I8iG(`yzxBg!AfenaK zdXRDgPM{@eW(#^&lor@ph`;M8S*rIN;wyyn2R{^xt@$30vla-aFjx=9f?cF8aC@xj ztTy b?SyJ{w4pC4RD2igq5($w=9m|{F46x7NrSai diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js deleted file mode 100644 index e53fdd38db..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js +++ /dev/null @@ -1,646 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption(url) { - if ($(".select-enable-btn").text() == "Select") { - url = $(this).parent().data("url"); - $(location).attr('href', url); - } -} - -(function () { - var cache = {}; - var validateAndReturn = function (value) { - return (value == undefined || value == null) ? "Unspecified" : value; - }; - Handlebars.registerHelper("deviceMap", function (device) { - device.owner = validateAndReturn(device.owner); - device.ownership = validateAndReturn(device.ownership); - var arr = device.properties; - if (arr) { - device.properties = arr.reduce(function (total, current) { - total[current.name] = validateAndReturn(current.value); - return total; - }, {}); - } - }); -})(); - -/* - * Setting-up global variables. - */ -var groupCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']"; -var assetContainer = "#ast-container"; - -/* - * On Select All Groups button click function. - * - * @param button: Select All Groups button - */ -function selectAllDevices(button) { - if (!$(button).data('select')) { - $(groupCheckbox).each(function (index) { - $(this).prop('checked', true); - addGroupSelectedClass(this); - }); - $(button).data('select', true); - $(button).html('Deselect All Groups'); - } else { - $(groupCheckbox).each(function (index) { - $(this).prop('checked', false); - addGroupSelectedClass(this); - }); - $(button).data('select', false); - $(button).html('Select All Groups'); - } -} - -/* - * On listing layout toggle buttons click function. - * - * @param view: Selected view type - * @param selection: Selection button - */ -function changeDeviceView(view, selection) { - $(".view-toggle").each(function () { - $(this).removeClass("selected"); - }); - $(selection).addClass("selected"); - if (view == "list") { - $(assetContainer).addClass("list-view"); - } else { - $(assetContainer).removeClass("list-view"); - } -} - -/* - * Add selected style class to the parent element function. - * - * @param checkbox: Selected checkbox - */ -function addGroupSelectedClass(checkbox) { - if ($(checkbox).is(":checked")) { - $(checkbox).closest(".ctrl-wr-asset").addClass("selected device-select"); - } else { - $(checkbox).closest(".ctrl-wr-asset").removeClass("selected device-select"); - } -} - -function toTitleCase(str) { - return str.replace(/\w\S*/g, function (txt) { - return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); - }); -} - -function htmlspecialchars(text) { - return jQuery('
    ').text(text).html(); -} - -function loadGroups() { - var groupListing = $("#group-listing"); - var currentUser = groupListing.data("currentUser"); - var serviceURL; - if ($.hasPermission("LIST_ALL_GROUPS")) { - serviceURL = "/api/device-mgt/v1.0/admin/groups"; - } else if ($.hasPermission("LIST_GROUPS")) { - //Get authenticated users groups - serviceURL = "/api/device-mgt/v1.0/groups"; - } else { - $("#loading-content").remove(); - $('#device-table').addClass('hidden'); - $('#device-listing-status-msg').text('Permission denied.'); - $("#device-listing-status").removeClass(' hidden'); - return; - } - - var dataFilter = function (data) { - data = JSON.parse(data); - var objects = []; - $(data.deviceGroups).each(function (index) { - objects.push({ - groupId: htmlspecialchars(data.deviceGroups[index].id), - name: htmlspecialchars(data.deviceGroups[index].name), - description: htmlspecialchars(data.deviceGroups[index].description), - owner: htmlspecialchars(data.deviceGroups[index].owner) - }) - }); - var json = { - "recordsTotal": data.count, - "recordsFiltered": data.count, - "data": objects - }; - return JSON.stringify(json); - }; - - var columns = [ - { - targets: 0, - data: 'id', - class: 'remove-padding icon-only content-fill viewEnabledIcon', - render: function (data, type, row, meta) { - return '
    '; - } - }, - { - targets: 1, - data: 'name', - class: 'viewEnabledIcon' - }, - { - targets: 2, - data: 'owner', - class: 'remove-padding-top viewEnabledIcon' - }, - { - targets: 3, - data: 'description', - class: 'remove-padding-top viewEnabledIcon' - }, - { - targets: 4, - data: 'id', - class: 'text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix', - render: function (id, type, row, meta) { - var html = ''; - if ($.hasPermission("VIEW_GROUP_DEVICES")) { - /*html += '' + - '' - + - '';*/ - } - if (row.owner != "wso2.system.user") { - if ($.hasPermission("SHARE_GROUP")) { - html += - ''; - } - if ($.hasPermission("UPDATE_GROUP")) { - html += - '' + - ''; - } - if ($.hasPermission("REMOVE_GROUP")) { - html += - '' - + - ''; - } - } - return html; - } - } - ]; - - var fnCreatedRow = function (row, data) { - $(row).attr('data-type', 'selectable'); - if ($.hasPermission("VIEW_GROUP_DEVICES")) { - $(row).attr('data-url', 'devices?groupId=' + data.groupId + '&groupName=' + data.name); - } - $.each($('td', row), function (colIndex) { - switch (colIndex) { - case 1: - //TODO : The following line encodes html entities. - //Should check for a better solution since it only changes the presentation layer - $(this).text($("").html(this.innerText).text()) - $(this).attr('data-grid-label', "Name"); - $(this).attr('data-search', data.name); - $(this).attr('data-display', data.name); - break; - case 2: - $(this).attr('data-grid-label', "Owner"); - $(this).attr('data-search', data.owner); - $(this).attr('data-display', data.owner); - break; - case 3: - $(this).attr('data-grid-label', "Description"); - $(this).attr('data-search', data.description); - $(this).attr('data-display', data.description); - break; - } - }); - }; - - $('#group-grid').datatables_extended_serverside_paging( - null, - serviceURL, - dataFilter, - columns, - fnCreatedRow, - function (oSettings) { - $(".icon .text").res_text(0.2); - attachEvents(); - var thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); - thisTable.removeClass("table-selectable"); - }, - { - "placeholder": "Search By Group Name", - "searchKey": "name" - } - ); - $(groupCheckbox).click(function () { - addGroupSelectedClass(this); - }); -} - -function openCollapsedNav() { - $('.wr-hidden-nav-toggle-btn').addClass('active'); - $('#hiddenNav').slideToggle('slideDown', function () { - if ($(this).css('display') == 'none') { - $('.wr-hidden-nav-toggle-btn').removeClass('active'); - } - }); -} - -/* - * DOM ready functions. - */ -$(document).ready(function () { - - /* Adding selected class for selected devices */ - $(groupCheckbox).each(function () { - addGroupSelectedClass(this); - }); - - var permissionSet = {}; - - //This method is used to setup permission for device listing - $.setPermission = function (permission) { - permissionSet[permission] = true; - }; - - $.hasPermission = function (permission) { - return permissionSet[permission]; - }; - - var permissionList = $("#permission").data("permission"); - for (var key in permissionList) { - if (permissionList.hasOwnProperty(key)) { - $.setPermission(key); - } - } - - loadGroups(); - //$('#device-grid').datatables_extended(); - - /* for device list sorting drop down */ - $(".ctrl-filter-type-switcher").popover( - { - html: true, - content: function () { - return $("#content-filter-types").html(); - } - } - ); - - /* for data tables*/ - $('[data-toggle="tooltip"]').tooltip(); - - $("[data-toggle=popover]").popover(); - - $(".ctrl-filter-type-switcher").popover( - { - html: true, - content: function () { - return $('#content-filter-types').html(); - } - } - ); - - $('#nav').affix( - { - offset: { - top: $('header').height() - } - } - ); - -}); - -var modalPopup = ".modal"; -var modalPopupContainer = modalPopup + " .modal-content"; -var modalPopupContent = modalPopup + " .modal-content"; -var body = "body"; - -/* - * set popup maximum height function. - */ -function setPopupMaxHeight() { - $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30))); - $(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2))); -} - -/* - * show popup function. - */ -function showPopup() { - $(modalPopup).modal('show'); -} - -/* - * hide popup function. - */ -function hidePopup() { - $(modalPopupContent).html(""); - $(modalPopupContent).removeClass("operation-data"); - $(modalPopup).modal('hide'); - $('body').removeClass('modal-open').css('padding-right', '0px'); - $('.modal-backdrop').remove(); -} - -/** - * Following functions should be triggered after AJAX request is made. - */ -function attachEvents() { - /** - * Following click function would execute - * when a user clicks on "Share" link - * on Group Management page in WSO2 Device Management Server Console. - */ - $("a.share-group-link").click(function () { - var groupId = $(this).data("group-id"); - var groupOwner = $(this).data("group-owner"); - - $(modalPopupContent).html($('#share-group-w1-modal-content').html()); - showPopup(); - - listAllRoles(groupId); - var shareGroupNextLink = $("a#share-group-next-link"); - shareGroupNextLink.click(function () { - var roles = $("#roles").val(); - updateGroupShare(groupId, roles); - }); - - var shareGroupNewRoleFromSelectionLink = $("a#share-group-new-role-from-selection"); - shareGroupNewRoleFromSelectionLink.click(function () { - var roles = $("#roles").val(); - if (roles && roles.length >= 2) { - addNewRole(roles); - } else { - var errorMsgWrapper = "#notification-error-msg"; - var errorMsg = "#notification-error-msg span"; - $(errorMsg).text("To create a new role with the combination of roles, at least two roles should be" + - " selected."); - $(errorMsgWrapper).removeClass("hidden"); - } - }); - }); - - /** - * Following click function would execute - * when a user clicks on "Remove" link - * on Group Management page in WSO2 IoT Server Console. - */ - $("a.remove-group-link").click(function () { - var groupId = $(this).data("group-id"); - var groupOwner = $(this).data("group-owner"); - - $(modalPopupContent).html($('#remove-group-modal-content').html()); - showPopup(); - - $("a#remove-group-yes-link").click(function () { - var successCallback = function (data, textStatus, xhr) { - if (xhr.status == 200) { - $(modalPopupContent).html($('#remove-group-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - } else { - displayErrors(xhr); - } - }; - - invokerUtil.delete("/api/device-mgt/v1.0/groups/id/" + groupId, - successCallback, function (message) { - displayErrors(message); - }); - }); - - $("a#remove-group-cancel-link").click(function () { - hidePopup(); - }); - - }); - - /** - * Following click function would execute - * when a user clicks on "Edit" link - * on Device Management page in WSO2 MDM Console. - */ - $("a.edit-group-link").click(function () { - var groupId = $(this).data("group-id"); - var groupName = $(this).data("group-name"); - var groupOwner = $(this).data("group-owner"); - var groupDescription = $(this).data("group-description"); - - $(modalPopupContent).html($('#edit-group-modal-content').html()); - $('#edit-group-name').val(groupName); - $('#edit-group-description').val(groupDescription); - showPopup(); - - $("a#edit-group-yes-link").click(function () { - var newGroupName = $('#edit-group-name').val(); - var newGroupDescription = $('#edit-group-description').val(); - var group = {"name": newGroupName, "description": newGroupDescription, "owner": groupOwner}; - - var successCallback = function (data, textStatus, xhr) { - if (xhr.status == 200) { - $(modalPopupContent).html($('#edit-group-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - } else { - displayErrors(xhr); - } - }; - - invokerUtil.put("/api/device-mgt/v1.0/groups/id/" + groupId, group, - successCallback, function (message) { - displayErrors(message); - }); - }); - - $("a#edit-group-cancel-link").click(function () { - hidePopup(); - }); - }); -} - -function markAlreadySavedUsersRoles(groupId) { - var successCallback = function (data, textStatus, xhr) { - data = JSON.parse(data); - if (xhr.status == 200) { - if (data.roles.length > 0) { - var selectedValues = []; - for (var i = 0; i < data.roles.length; i++) { - selectedValues.push(data.roles[i]); - } - $("#roles").val(selectedValues).trigger("change"); - } else { - return; - } - } else { - displayErrors(xhr); - } - }; - - invokerUtil.get("/api/device-mgt/v1.0/groups/id/" + groupId + "/roles", - successCallback, function (message) { - displayErrors(message); - }); -} - -function listAllRoles(groupId) { - var successCallback = function (data, textStatus, xhr) { - data = JSON.parse(data); - if (xhr.status == 200) { - if (data.roles.length > 0) { - var html = ''; - $("#rolesListing").html(html); - markAlreadySavedUsersRoles(groupId); - $("select.select2[multiple=multiple]").select2({tags: false}).on("select2:select", function () { - $("#notification-error-msg").addClass("hidden"); - }); - } else { - $("#rolesListing").html("No roles available"); - } - } else { - displayErrors(xhr); - } - }; - - invokerUtil.get("/api/device-mgt/v1.0/roles?offset=0&limit=100&user-store=all", - successCallback, function (message) { - displayErrors(message); - }); -} - -function addNewRole(roles) { - $(modalPopupContent).html($('#share-group-w3-modal-content').html()); - $("a#share-group-w3-yes-link").click(function () { - var roleName = $('#group-sharing-role-name').val(); - if (roleName) { - createNewCombinedRole(roleName, roles); - } else { - var errorMsgWrapper = "#notification-error-msg"; - var errorMsg = "#notification-error-msg span"; - $(errorMsg).text("Role name cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } - }); - $("a#share-group-w3-cancel-link").click(function () { - hidePopup(); - }); -} - -function togglePermissionAction(element) { - $(element).data('value', 'checked'); - var icon = $(element).find("i")[1]; - if ($(icon).hasClass('fw-minus')) { - $(icon).removeClass('fw-minus'); - $(icon).addClass('fw-add'); - $(element).data('value', 'unchecked'); - } else { - $(icon).removeClass('fw-add'); - $(icon).addClass('fw-minus'); - $(element).data('value', 'checked'); - } -} - -function updateGroupShare(groupId, roles) { - var successCallback = function (data) { - $(modalPopupContent).html($('#share-group-200-content').html()); - }; - - invokerUtil.post("/api/device-mgt/v1.0/groups/id/" + groupId + "/share", - roles, successCallback, function (message) { - displayErrors(message); - }); -} - -function createNewCombinedRole(roleName, roleList) { - var successCallback = function (data, status, jqXHR, isLast) { - $(modalPopupContent).html($('#create-combined-role-200-content').html()); - showPopup(); - }; - invokerUtil.post("/api/device-mgt/v1.0/roles/create-combined-role/" + roleName, roleList, - successCallback, function (message) { - displayErrors(message); - }); -} - -function displayErrors(jqXHR) { - showPopup(); - if (jqXHR.status == 400) { - $(modalPopupContent).html($('#group-400-content').html()); - if (jqXHR.responseText) { - $('#error-msg').html(jqXHR.responseText.replace(new RegExp("\"", 'g'), "")); - } - $("a#group-400-link").click(function () { - hidePopup(); - }); - } else if (jqXHR.status == 403) { - $(modalPopupContent).html($('#group-403-content').html()); - $("a#group-403-link").click(function () { - hidePopup(); - }); - } else if (jqXHR.status == 404) { - $(modalPopupContent).html($('#group-404-content').html()); - $("#group-404-message").html(jqXHR.responseText); - $("a#group-404-link").click(function () { - hidePopup(); - }); - } else if (jqXHR.status == 409) { - $(modalPopupContent).html($('#group-409-content').html()); - $("a#group-409-link").click(function () { - hidePopup(); - }); - } else { - $(modalPopupContent).html($('#group-unexpected-error-content').html()); - if (jqXHR.responseText) { - $('#unexp-error-msg').html(jqXHR.responseText.replace(new RegExp("\"", 'g'), "")); - } - $("a#group-unexpected-error-link").click(function () { - hidePopup(); - }); - console.log("Error code: " + jqXHR.status); - } -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.notification.listing/listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.notification.listing/listing.hbs deleted file mode 100644 index 7e91f28497..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.notification.listing/listing.hbs +++ /dev/null @@ -1,34 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.ui.title" pageTitle="Notification Listing"}} -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Notifications - -
  • -{{/zone}} -{{#zone "content"}} - {{unit "cdmf.unit.notification.listing"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.notification.listing/listing.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.notification.listing/listing.json deleted file mode 100644 index 99d43a16b4..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.notification.listing/listing.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/notification-listing", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.hbs deleted file mode 100644 index b4c5c8af10..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.hbs +++ /dev/null @@ -1,35 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Platform Configuration"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Platform Configuration - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.platform.configuration"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.json deleted file mode 100644 index 7316b1146c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/platform-configuration", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs deleted file mode 100644 index 6742acaba5..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs +++ /dev/null @@ -1,278 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.ui.modal"}} - -{{#zone "topCss"}} - -{{/zone}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Policies - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#if permissions.ADD_ADMIN_POLICY}} - {{#equal noPolicy false}} -
  • - - - - - - - Add New Policy - -
  • - {{/equal}} - {{/if}} - {{#if permissions.CHANGE_POLICY_PRIORITY}} - {{#equal noPolicy false}} -
  • - - - - - - - Policy Priority - -
  • - {{/equal}} - {{/if}} -
  • - - - - - - Apply Changes To Devices - -
  • -{{/zone}} - -{{#zone "content"}} - {{#equal isUpdated true}} - - {{/equal}} - {{#equal noPolicy true}} -
    - -
    - {{/equal}} - {{#equal noPolicy false}} -
    - - Loading policies . . . -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{#each policyListToView}} - - - - - - - - - - - - {{/each}} -
    - - - {{/equal}} -
    - - -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/policy-list.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js deleted file mode 100644 index f4e7459293..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { - if (arguments.length < 3) { - throw new Error("Handlebars Helper equal needs 2 parameters"); - } - if (lvalue != rvalue) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - var page = {}; - var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"]; - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var utility = require("/app/modules/utility.js")["utility"]; - var response = policyModule.getAllPolicies(); - if (response["status"] == "success") { - var policyListToView = response["content"]; - for(var index in policyListToView) { - if(policyListToView.hasOwnProperty(index)) { - policyListToView[index]["icon"] = utility.getDeviceThumb(policyListToView[index]["platform"]); - } - } - page["policyListToView"] = policyListToView; - var policyCount = policyListToView.length; - if (policyCount == 0) { - page["policyListingStatusMsg"] = "No policy is available to be displayed."; - page["noPolicy"] = true; - } else { - page["noPolicy"] = false; - page["isUpdated"] = response["updated"]; - } - } else { - // here, response["status"] == "error" - page["policyListingStatusMsg"] = "An unexpected error occurred. Please try again later."; - page["noPolicy"] = true; - } - - if (userModule.isAuthorized("/permission/admin/device-mgt/policies/remove")) { - page["removePermitted"] = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/policies/update")) { - page["editPermitted"] = true; - } - page.permissions = userModule.getUIPermissions(); - return page; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.json deleted file mode 100644 index 07fd9fe9df..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/policies", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js deleted file mode 100644 index 437775da39..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/* sorting function */ -var sortUpdateBtn = "#sortUpdateBtn"; -// var sortedIDs; -// var dataTableSelection = ".DTTT_selected"; -var settings = { - "sorting": false -}; -$('#policy-grid').datatables_extended(settings); -// $(".icon .text").res_text(0.2); - -var saveNewPrioritiesButton = "#save-new-priorities-button"; -var saveNewPrioritiesButtonEnabled = Boolean($(saveNewPrioritiesButton).data("enabled")); -if (saveNewPrioritiesButtonEnabled) { - $(saveNewPrioritiesButton).removeClass("hide"); -} - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption() { - $(location).attr('href', $(this).data("url")); -} - -/** - * Modal related stuff are as follows. - */ - -var modalPopup = ".modal"; -var modalPopupContainer = modalPopup + " .modal-content"; -var modalPopupContent = modalPopup + " .modal-content"; -var body = "body"; - -/* - * set popup maximum height function. - */ -function setPopupMaxHeight() { - var maxHeight = "max-height"; - var marginTop = "margin-top"; - var body = "body"; - $(modalPopupContent).css(maxHeight, ($(body).height() - ($(body).height() / 100 * 30))); - $(modalPopupContainer).css(marginTop, (-($(modalPopupContainer).height() / 2))); -} - -/* - * show popup function. - */ -function showPopup() { - $(modalPopup).modal('show'); -} - -/* - * hide popup function. - */ -function hidePopup() { - $(modalPopupContent).html(""); - $(modalPopupContent).removeClass("operation-data"); - $(modalPopup).modal('hide'); - $('body').removeClass('modal-open').css('padding-right','0px'); - $('.modal-backdrop').remove(); -} - -/* - * Function to get selected policies. - */ -function getSelectedPolicyStates() { - var policyList = []; - var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable(); - thisTable.api().rows().every(function () { - if ($(this.node()).hasClass('DTTT_selected')) { - policyList.push($(thisTable.api().row(this).node()).data('status')); - } - }); - - return policyList; -} - -/* - * Function to get selected policies. - */ -function getSelectedPolicies() { - var policyList = []; - var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable(); - thisTable.api().rows().every(function () { - if ($(this.node()).hasClass('DTTT_selected')) { - policyList.push($(thisTable.api().row(this).node()).data('id')); - } - }); - - return policyList; -} - - -$(document).ready(function () { - - /** - * ******************************************** - * Click functions related to Policy Listing - * ******************************************** - */ - - // [1] logic for running apply-changes-for-devices use-case - - var applyChangesButtonId = "#appbar-btn-apply-changes"; - - var isUpdated = $("#is-updated").val(); - if (!isUpdated) { - // if no updated policies found, hide button from app bar - $(applyChangesButtonId).addClass("hidden"); - } else { - // if updated policies found, show button from app bar - $(applyChangesButtonId).removeClass("hidden"); - } - - // click-event function for applyChangesButton - $(applyChangesButtonId).click(function () { - var serviceURL = "/api/device-mgt/v1.0/policies/apply-changes"; - modalDialog.header('Do you really want to apply changes to all policies?'); - modalDialog.footer(''); - modalDialog.show(); - - $("a#change-policy-yes-link").click(function () { - invokerUtil.put( - serviceURL, - null, - // on success - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200) { - modalDialog.header('Done. Changes applied successfully.'); - modalDialog.footer(''); - $("a#change-policy-success-link").click(function () { - modalDialog.hide(); - location.reload(); - }); - } - }, - // on error - function (jqXHR) { - console.log(stringify(jqXHR.data)); - modalDialog.header('An unexpected error occurred. Please try again later.'); - modalDialog.footer(''); - modalDialog.showAsError(); - $("a#change-policy-error-link").click(function () { - modalDialog.hide(); - }); - } - ); - }); - - $("a#change-policy-cancel-link").click(function () { - modalDialog.hide(); - }); - }); - - // [2] logic for un-publishing a selected set of Active, Active/Updated policies - - $(".policy-unpublish-link").click(function () { - var policyList = getSelectedPolicies(); - var statusList = getSelectedPolicyStates(); - if (($.inArray("Inactive/Updated", statusList) > -1) || ($.inArray("Inactive", statusList) > -1)) { - // if policies found in Inactive or Inactive/Updated states with in the selection, - // pop-up an error saying - // "You cannot select already inactive policies. Please deselect inactive policies and try again." - modalDialog.header('Action cannot be performed !'); - modalDialog.content('You cannot select already inactive policies to be unpublished. Please deselect ' + - 'inactive policies and try again.'); - modalDialog.footer('
    Ok' + - '
    '); - modalDialog.showAsAWarning(); - } else { - var serviceURL = "/api/device-mgt/v1.0/policies/deactivate-policy"; - if (policyList.length == 0) { - modalDialog.header('Action cannot be performed !'); - modalDialog.content('Please select a policy or a list of policies to un-publish.'); - modalDialog.footer(''); - modalDialog.showAsAWarning(); - } else { - modalDialog.header('Do you really want to unpublish the selected policy(s)?'); - modalDialog.footer(''); - modalDialog.show(); - } - - // on-click function for policy un-publishing "yes" button - $("a#unpublish-policy-yes-link").click(function () { - invokerUtil.post( - serviceURL, - policyList, - // on success - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - modalDialog.header('Done. Selected policy was successfully unpublished.'); - modalDialog.footer(''); - $("a#unpublish-policy-success-link").click(function () { - modalDialog.hide(); - location.reload(); - }); - } - }, - // on error - function (jqXHR) { - console.log(stringify(jqXHR.data)); - modalDialog.header('An unexpected error occurred. Please try again later.'); - modalDialog.footer(''); - modalDialog.showAsError(); - $("a#unpublish-policy-error-link").click(function () { - modalDialog.hide(); - }); - } - ); - }); - - // on-click function for policy un-publishing "cancel" button - $("a#unpublish-policy-cancel-link").click(function () { - modalDialog.hide(); - }); - } - }); - - // [3] logic for publishing a selected set of Inactive, Inactive/Updated policies - - $(".policy-publish-link").click(function () { - var policyList = getSelectedPolicies(); - var statusList = getSelectedPolicyStates(); - if (($.inArray("Active/Updated", statusList) > -1) || ($.inArray("Active", statusList) > -1)) { - // if policies found in Active or Active/Updated states with in the selection, - // pop-up an error saying - // "You cannot select already active policies. Please deselect active policies and try again." - modalDialog.header('Action cannot be performed !'); - modalDialog.content('You cannot select already active policies. Please deselect active policies and try ' + - 'again.'); - modalDialog.footer(''); - modalDialog.showAsAWarning(); - } else { - var serviceURL = "/api/device-mgt/v1.0/policies/activate-policy"; - if (policyList.length == 0) { - modalDialog.header('Action cannot be performed !'); - modalDialog.content('Please select a policy or a list of policies to publish.'); - modalDialog.footer(''); - modalDialog.showAsAWarning(); - } else { - modalDialog.header('Do you really want to publish the selected policy(s)?'); - modalDialog.footer(''); - modalDialog.show(); - } - // on-click function for policy removing "yes" button - $("a#publish-policy-yes-link").click(function () { - invokerUtil.post( - serviceURL, - policyList, - // on success - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - modalDialog.header('Done. Selected policy was successfully published.'); - modalDialog.footer(''); - $("a#publish-policy-success-link").click(function () { - modalDialog.hide(); - location.reload(); - }); - } - }, - // on error - function (jqXHR) { - console.log(stringify(jqXHR.data)); - modalDialog.header('An unexpected error occurred. Please try again later.'); - modalDialog.footer(''); - modalDialog.showAsError(); - $("a#publish-policy-error-link").click(function () { - modalDialog.hide(); - }); - } - ); - }); - - // on-click function for policy removing "cancel" button - $("a#publish-policy-cancel-link").click(function () { - modalDialog.hide(); - }); - } - }); - - // [4] logic for removing a selected set of policies - - $(".policy-remove-link").click(function () { - var policyList = getSelectedPolicies(); - var statusList = getSelectedPolicyStates(); - if (($.inArray("Active/Updated", statusList) > -1) || ($.inArray("Active", statusList) > -1)) { - // if policies found in Active or Active/Updated states with in the selection, - // pop-up an error saying - // "You cannot remove already active policies. Please deselect active policies and try again." - modalDialog.header('Action cannot be performed !'); - modalDialog.content('You cannot select already active policies. Please deselect active policies and try ' + - 'again.'); - modalDialog.footer(''); - modalDialog.showAsAWarning(); - } else { - var serviceURL = "/api/device-mgt/v1.0/policies/remove-policy"; - if (policyList.length == 0) { - modalDialog.header('Action cannot be performed !'); - modalDialog.content('Please select a policy or a list of policies to remove.'); - modalDialog.footer(''); - modalDialog.showAsAWarning(); - } else { - modalDialog.header('Do you really want to remove the selected policy(s)?'); - modalDialog.footer(''); - modalDialog.show(); - } - - // on-click function for policy removing "yes" button - $("a#remove-policy-yes-link").click(function () { - invokerUtil.post( - serviceURL, - policyList, - // on success - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - modalDialog.header('Done. Selected policy was successfully removed.'); - modalDialog.footer(''); - $("a#remove-policy-success-link").click(function () { - modalDialog.hide(); - location.reload(); - }); - } - }, - // on error - function (jqXHR) { - console.log(stringify(jqXHR.data)); - modalDialog.header('An unexpected error occurred. Please try again later.'); - modalDialog.footer(''); - modalDialog.showAsError(); - $("a#remove-policy-error-link").click(function () { - modalDialog.hide(); - }); - } - ); - }); - - // on-click function for policy removing "cancel" button - $("a#remove-policy-cancel-link").click(function () { - modalDialog.hide(); - }); - } - }); - - $("#loading-content").remove(); - if ($("#policy-listing-status-msg").text()) { - $("#policy-listing-status").removeClass("hidden"); - } - $("#policy-grid").removeClass("hidden"); - - $('[data-toggle="tooltip"]').tooltip(); - -}); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.hbs deleted file mode 100644 index f78cb71f65..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.hbs +++ /dev/null @@ -1,40 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Policies - -
  • -
  • - - Add - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit policyWizardUnitName}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.js deleted file mode 100644 index 427af8deb6..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var utility = require("/app/modules/utility.js").utility; - context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { - if (arguments.length < 3) { - throw new Error("Handlebars Helper equal needs 2 parameters"); - } - if (lvalue != rvalue) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - var deviceType = context.uriParams.deviceType; - - return {"policyWizardUnitName": utility.getTenantedDeviceUnitName(deviceType, "policy-wizard")}; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.json deleted file mode 100644 index 5322b6ff2b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create.wizard/wizard.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/policy/add/{deviceType}", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.hbs deleted file mode 100644 index 52c43d2be9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.hbs +++ /dev/null @@ -1,61 +0,0 @@ -{{! - Copyright (c) 2016, 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. - - - Copyright (c) 2018, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - - Entgra (Pvt) Ltd. 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. -}} - -{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | Add Policy"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Policies - -
  • -
  • - - Add - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.device.operation-mod"}} - {{unit "cdmf.unit.policy.create"}} - {{unit "cdmf.unit.lib.data-table"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.js deleted file mode 100644 index ad7dcceaae..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context){ - context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { - if (arguments.length < 3) - throw new Error("Handlebars Helper equal needs 2 parameters"); - if( lvalue!=rvalue ) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.json deleted file mode 100644 index 761dcb2d2d..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/policy/add", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.hbs deleted file mode 100644 index 89c472b4be..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.hbs +++ /dev/null @@ -1,61 +0,0 @@ -{{! - Copyright (c) 2016, 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. - - - Copyright (c) 2018, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - - Entgra (Pvt) Ltd. 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. -}} - -{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | Edit Policy"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Policies - -
  • -
  • - - Edit - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.device.operation-mod"}} - {{unit "cdmf.unit.policy.edit"}} - {{unit "cdmf.unit.lib.data-table"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.js deleted file mode 100644 index c02a343604..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var utility = require("/app/modules/utility.js").utility; - var deviceType = request.getParameter("type"); - return {"deviceTypePolicyEdit": utility.getTenantedDeviceUnitName(deviceType, "policy-edit")}; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.json deleted file mode 100644 index f2122eb998..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/policy/edit", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.hbs deleted file mode 100644 index e526b7eaf4..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.hbs +++ /dev/null @@ -1,51 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | Policy Priorities"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Policies - -
  • -
  • - - - Priorities - -
  • -{{/zone}} - -{{#zone "content"}} - {{#if isAuthorized}} - {{unit "cdmf.unit.policy.priority"}} - {{else}} -

    - Permission Denied -

    -
    - You not authorized to enter Policy Management Section. -
    - {{/if}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.js deleted file mode 100644 index 72b72edace..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context){ - context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { - if (arguments.length < 3) - throw new Error("Handlebars Helper equal needs 2 parameters"); - if( lvalue!=rvalue ) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - var viewModel = {}; - viewModel.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage"); - return viewModel; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.json deleted file mode 100644 index b8be6d8bbb..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.priority/priority.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/policy/priority", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs deleted file mode 100644 index fdbbaf6016..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs +++ /dev/null @@ -1,69 +0,0 @@ -{{! - Copyright (c) 2016, 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. - - - Copyright (c) 2018, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - - Entgra (Pvt) Ltd. 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. -}} - -{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | View Policy"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Policies - -
  • -
  • - - View - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#if canEdit}} -
  • - -
  • - {{/if}} -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.device.operation-mod"}} - {{unit "cdmf.unit.policy.view"}} - {{unit "cdmf.unit.lib.data-table"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js deleted file mode 100644 index 0de2bb58ed..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var utility = require("/app/modules/utility.js")["utility"]; - var deviceType = request.getParameter("type"); - - var canEdit = false; - if(userModule.isAuthorized("/permission/admin/device-mgt/policy/manage")) { - canEdit = true; - } - - return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view"), "canEdit": canEdit}; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.json deleted file mode 100644 index a4d19525f6..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/policy/view", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.hbs deleted file mode 100644 index bfed7576e9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.hbs +++ /dev/null @@ -1,195 +0,0 @@ -{{! - Copyright (c) 2018, 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. -}} -{{#zone "title"}}{{! to override parent page title }}{{/zone}} -{{unit "cdmf.unit.ui.title" pageTitle="Consent Page"}} - -{{#zone "content"}} -
    -
    - -

    PRIVACY POLICY

    - -
    -

    About Entgra IoT Server

    -

    Entgra IoT Server is a complete solution that enables device manufacturers and enterprises to connect - and manage their devices, build apps, manage events, secure devices and data, and visualize sensor - data in a scalable manner.

    -

    It also offers a complete and secure Enterprise Mobility Management (EMM/MDM) solution that aims to - address mobile computing challenges faced by enterprises today. Supporting iOS, Android, and Windows - devices, it helps organizations deal with both Corporate Owned, Personally Enabled (COPE) and - employee-owned devices with the Bring Your Own Device (BYOD) concept.

    -

    Entgra IoT Server comes with advanced analytics, enabling users to analyze speed, proximity, and - geo-fencing information of devices including details of those in motion and stationary state.

    -

    Privacy Policy

    -

    This policy describes how Entgra IoT Server 4.1.0 captures your personal information, the purposes of - collection, and information about the retention of your personal information. -

    Please note that this policy is for reference only, and is applicable for the software as a product. - Entgra and its developers have no access to the information held within Entgra IoT Server - 4.1.0.Please see the Disclaimer section for more information. Entities, organisations or individuals - controlling the use and administration of Entgra IoT Server 4.1.0 should create their own privacy - policies setting out the manner in which data is controlled or processed by the respective entity, - organisation or individual. -

    What is personal information?

    -

    Entgra IoT Server 4.1.0 considers anything related to you and by which you may be identified as your - personal information.

    -

    Signing in to Entgra IoT Server 4.1.0

    -
      -
    1. Your user name (except in cases where the user name created by your employer is under - contract) -
    2. -
    3. IP address used to log in
    4. -
    5. Email address
    6. -
    -

    Enrolling a device with Entgra IoT Server 4.1.0

    -
      -
    • Your device ID (e.g., phone or tablet), mobile number, IMEI number, and IMSI number
    • -
    • Your device’s location
    • -
    • Your device’s application list, and memory usage
    • -
    • Your device’s usage statistics, such as RAM, battery level, connected hotspot details, and - memory usage -
    • -
    -

    However, Entgra IoT Server 4.1.0 also collects the following information that is not considered - personal information, but is used only for statistical purposes. The reason for this is that - this information can not be used to track you. -

      -
    • City/Country from which you originated the TCP/IP connection
    • -
    • Time of the day that you logged in (year, month, week, hour or minute)
    • -
    • Type of device that you used to log in (e.g., phone or tablet)
    • -
    • Operating system and generic browser information
    • -
    -

    Collection of personal information

    -

    Entgra IoT Server 4.1.0 collects your information only to serve your access requirements. For - example: -

      -
    • Entgra IoT Server 4.1.0 uses your IP address to detect any suspicious login attempts to your - account. -
    • Entgra IoT Server 4.1.0 uses attributes like your first name, last name, etc., to provide a rich - and personalized user experience. -
    • Entgra IoT Server 4.1.0 uses your security questions and answers only to allow account recovery. -
    • -
    -

    Tracking Technologies

    -

    Entgra IoT Server 4.1.0 collects your information by:

    -
      -
    • Collecting information from the user profile page where you enter your personal data.
    • -
    • Tracking your IP address with HTTP request, HTTP headers, and TCP/IP.
    • -
    • Tracking your geographic information with the IP address.
    • -
    • Tracking your login history with browser cookies. Please see our cookie policy - for more - information. -
    • -
    -

    Use of personal information

    -

    Entgra IoT Server 4.1.0 will only use your personal information for the purposes for which it was - collected (or for a use identified as consistent with that purpose).

    -

    Entgra IoT Server 4.1.0 uses your personal information only for the following purposes.

    -
      -
    • To provide you with a personalized user experience. Entgra IoT Server 4.1.0 uses your name and - uploaded profile pictures for this purpose. -
    • -
    • To protect your account from unauthorized access or potential hacking attempts. Entgra IoT Server - 4.1.0 uses HTTP or TCP/IP Headers for this purpose. -
    • -
    • -

      This includes:

      -
        -
      1. IP address
      2. -
      3. Browser fingerprinting
      4. -
      5. Cookies
      6. -
      -
    • -
    • Derive statistical data for analytical purposes on system performance improvements. Entgra IoT - Server 4.1.0 will not keep any personal information after statistical calculations. Therefore, - the statistical report has no means of identifying an individual person. -
    • -
    • Entgra IoT Server 4.1.0 may use:
    • -
    • -
        -
      1. IP Address to derive geographic information
      2. -
      3. Browser fingerprinting to determine the browser technology or/and version
      4. -
      -
    • -
    -

    Disclosure of personal information

    -

    Entgra IoT Server 4.1.0 only discloses personal information to the relevant applications (also - known as - “Service Providers”) that are registered with Entgra IoT Server 4.1.0. These applications are - registered by the identity administrator of your entity or organization. Personal information is - disclosed only for the purposes for which it was collected (or for a use identified as consistent - with that purpose) as controlled by such Service Providers, unless you have consented otherwise or - where it is required by law.

    -

    Legal process

    -

    Please note that the organisation, entity or individual running Entgra IoT Server 4.1.0 may be - compelled to disclose your personal information with or without your consent when it is required by - law following due and lawful process.

    -

    Storage of personal information

    -

    Where your personal information is stored

    -

    Entgra IoT Server 4.1.0 stores your personal information in secured databases. Entgra IoT Server - 4.1.0 exercises proper industry accepted security measures to protect the database where your - personal information is held.Entgra IoT Server 4.1.0 as a product does not transfer or share your - data with any third parties or locations.

    -

    Entgra IoT Server 4.1.0 may use encryption to keep your personal data with an added level of - security.

    -

    How long your personal information is retained

    -

    Entgra IoT Server 4.1.0 retains your personal data as long as you are an active user of our system. - You can update your personal data at any time using the given self-care user portals.

    -

    Entgra IoT Server 4.1.0 may keep hashed secrets to provide you with an added level of security. This - includes:

    -
      -
    • Current password
    • -
    • Previously used passwords
    • -
    -

    How to request removal of your personal information

    -

    You can request the administrator to delete your account. The administrator is the administrator of - the tenant you are registered under, or the super-administrator if you do not use the tenant - feature.

    -

    Additionally, you can request to anonymize all traces of your activities that Entgra IoT Server 4.1.0 - may have retained in logs, databases or analytical storage.

    -

    More information

    -

    Changes to this policy

    -

    Upgraded versions of Entgra IoT Server 4.1.0 may contain changes to this policy. Revisions to this - policy will be packaged within such upgrades and would only apply to users who choose to use upgraded - versions.

    -

    Your choices

    -

    If you are already have an user account within Entgra IoT Server 4.1.0 ; you have the right to - deactivate your account if you find that this privacy policy is unacceptable to you.

    -

    If you do not have an account and you do not agree with our privacy policy, you can chose not to - create one.

    -

    Contact us

    -

    Please contact Entgra if you have any question or concerns regarding this privacy policy.

    -

    https://entgra.io.com/contact/

    -

    Disclaimer

    -

    Entgra, its employees, partners, and affiliates do not have access to and do not require, store, - process or control any of the data, including personal data contained in Entgra IoT Server 4.1.0. All - data, including personal data is controlled and processed by the entity or individual running Entgra - IoT Server 4.1.0. Entgra, its employees partners and affiliates are not a data processor or a data - controller within the meaning of any data privacy regulations. Entgra does not provide any warranties - or undertake any responsibility or liability in connection with the lawfulness or the manner and - purposes for which Entgra IoT Server 4.1.0 is used by such entities or persons.

    -

    This privacy policy is for the informational purposes of the entity or persons running Entgra IoT - Server 4.1.0 and sets out the processes and functionality contained within Entgra IoT Server 4.1.0 - regarding personal data protection. It is the responsibility of entities and persons running Entgra IoT - Server 4.1.0 to create and administer its own rules and processes governing users’ personal data, - Please note that the creation of such rules and processes may change the use, storage and disclosure - policies contained herein. Therefore users should consult the entity or persons running Entgra IoT - Server 4.1.0 for its own privacy policy for details governing users’ personal data.

    -
    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.json deleted file mode 100644 index 2f12cb7da9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "layout": "uuf.layout.sign-in", - "uri": "/privacy-policy", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.hbs deleted file mode 100644 index ac4e28107d..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.hbs +++ /dev/null @@ -1,57 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Home"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -{{/zone}} - -{{#zone "content"}} -
    -
    - Loading...Please Wait -
    -
    -{{/zone}} - -{{#zone "bottomJs"}} - - {{js "/js/script.js"}} -{{/zone}} - -{{#zone "topCss"}} - -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.js deleted file mode 100644 index f9f9a814a6..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var constants = require("/app/modules/constants.js"); - var skipWelcomeScreen = session.get(constants.SKIP_WELCOME_SCREEN); - if (skipWelcomeScreen) { - response.sendRedirect(context.app.context + "/"); - exit(); - } - return {}; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.json deleted file mode 100644 index add6d0c2de..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/welcome", - "layout": "cdmf.layout.loading" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/public/js/script.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/public/js/script.js deleted file mode 100644 index 58f49e86eb..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/public/js/script.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var pollingCount = 24; -function poll() { - $.ajax({ - url: context + "/api/user/environment-loaded", - type: "GET", - success: function (data) { - if (data.isLoaded) { - window.location = context + "/"; - } - }, - dataType: "json", - complete: setTimeout(function () { - pollingCount = pollingCount - 1; - if (pollingCount > 0) { - poll(); - } else { - $(".loading-animation .logo").hide(); - $(".loading-animation").prepend( - ''); - $(".loading-animation p").css("width", "150%") - .html("Ops... it seems something went wrong.
    Refresh the page to retry!"); - } - }, 5000), - timeout: 5000 - }); -} - -$(document).ready(function () { - poll(); -}); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/public/js/validate-register.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/public/js/validate-register.js deleted file mode 100644 index 0be9a12ab7..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/public/js/validate-register.js +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -/** - * Checks if an email address has the valid format or not. - * - * @param email Email address - * @returns {boolean} true if email has the valid format, otherwise false. - */ -function emailIsValid(email) { - var regExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; - return regExp.test(email); -} - -$(document).ready(function(){ - - /** - * Following click function would execute - * when a user clicks on "Add User" button - * on Add User page in WSO2 Devicemgt Console. - */ - $("button#add-user-btn").click(function () { - - var usernameInput = $("input#user_name"); - var firstnameInput = $("input#first_name"); - var lastnameInput = $("input#last_name"); - var emailInput = $("input#email"); - var passwordInput = $("input#password"); - var passwordConfirmationInput = $("input#password_confirmation"); - var privacyPolicyConsentInput = $("input#privacy-consent"); - - var username = usernameInput.val().trim(); - var firstname = firstnameInput.val(); - var lastname = lastnameInput.val(); - var emailAddress = emailInput.val(); - var password = passwordInput.val(); - var passwordConfirmation = passwordConfirmationInput.val(); - var privacyPolicyConsentChecked = privacyPolicyConsentInput.is(':checked'); - var errorMsgWrapper = "#user-create-error-msg"; - var errorMsg = "#user-create-error-msg span"; - - if (!firstname) { - $(errorMsg).text("Firstname is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(firstnameInput.data("regex"), firstname)) { - $(errorMsg).text(firstnameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!lastname) { - $(errorMsg).text("Lastname is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(lastnameInput.data("regex"), lastname)) { - $(errorMsg).text(lastnameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!username) { - $(errorMsg).text("Username is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(usernameInput.data("regex"), username)) { - $(errorMsg).text(usernameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!emailAddress) { - $(errorMsg).text("Email is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!emailIsValid(emailAddress)) { - $(errorMsg).text(emailInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!password) { - $(errorMsg).text("Password is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (password.length < 6) { - $(errorMsg).text("Password should contain a minimum of 6 characters."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (password != passwordConfirmation) { - $(errorMsg).text("Please enter the same password for confirmation."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!privacyPolicyConsentChecked) { - $(errorMsg).text("You need to agree with the Privacy policy in order to register with IoT Server."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - $(errorMsgWrapper).addClass("hidden"); - $("#add-user-btn").prop('disabled', true); - - var addUserFormData = {}; - addUserFormData.username = username; - addUserFormData.firstname = firstname; - addUserFormData.lastname = lastname; - addUserFormData.emailAddress = emailAddress; - addUserFormData.password = $("input#password").val(); - addUserFormData.userRoles = null; - - var context = $(".form-login-box").data("context"); - var addUserAPI = context + "/api/user/register"; - - $.ajax({ - type: 'POST', - url: addUserAPI, - contentType: 'application/json', - data: JSON.stringify(addUserFormData), - success: function (data) { - $("#add-user-btn").prop('disabled', false); - if (data == 200) { - $('.wr-validation-summary strong').html( - " Successfully Submitted."); - $('.wr-validation-summary').removeClass("alert-danger"); - $('.wr-validation-summary').addClass("alert-success"); - } else if (data == 201) { - $('.wr-validation-summary strong').html( - " User created succssfully. You will be " + - "redirected to login page."); - $('.wr-validation-summary').removeClass("alert-danger"); - $('.wr-validation-summary').addClass("alert-success"); - $("#add-user-btn").prop('disabled', true); - setTimeout(function () { - window.location = context + "/login"; - }, 2000); - } else if (data == 400) { - $('.wr-validation-summary strong').html( - " Exception at backend."); - $('.wr-validation-summary').removeClass("alert-danger"); - $('.wr-validation-summary').addClass("alert-warning"); - } else if (data == 403) { - $('.wr-validation-summary strong').html("Action not permitted."); - } else if (data == 409) { - $('.wr-validation-summary strong').html( - " User name already exists."); - $('.wr-validation-summary').removeClass("alert-default"); - $('.wr-validation-summary').addClass("alert-success"); - } - $('.wr-validation-summary').removeClass("hidden"); - $('#password').val(''); - $('#password_confirmation').val(''); - }, - error: function (err) { - $("#add-user-btn").prop('disabled', false); - $('.wr-validation-summary strong').html( - " An unexpected error occurred."); - $('.wr-validation-summary').removeClass("hidden"); - } - }); - } - }); -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs deleted file mode 100644 index 98ee528e40..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs +++ /dev/null @@ -1,98 +0,0 @@ -{{unit "cdmf.unit.ui.title" pageTitle="Register"}} - -{{#zone "content"}} - {{unit "uuf.unit.lib.form-validation"}} - -
    - -

    Register

    - -

    Create a new account in Entgra IoT Server(All fields are required.)

    -
    - - - - -
    -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/validate-register.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.js deleted file mode 100644 index 88cec36cde..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Returns the dynamic state to be populated by add-user page. - * - * @param context Object that gets updated with the dynamic state of this page to be presented - * @returns {*} A context object that returns the dynamic state of this page to be presented - */ -function onRequest(context) { - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var page = {}; - page["usernameJSRegEx"] = devicemgtProps.userValidationConfig.usernameJSRegEx; - page["usernameHelpText"] = devicemgtProps.userValidationConfig.usernameHelpMsg; - page["usernameRegExViolationErrorMsg"] = devicemgtProps.userValidationConfig.usernameRegExViolationErrorMsg; - page["firstnameJSRegEx"] = devicemgtProps.userValidationConfig.firstnameJSRegEx; - page["firstnameRegExViolationErrorMsg"] = devicemgtProps.userValidationConfig.firstnameRegExViolationErrorMsg; - page["lastnameJSRegEx"] = devicemgtProps.userValidationConfig.lastnameJSRegEx; - page["lastnameRegExViolationErrorMsg"] = devicemgtProps.userValidationConfig.lastnameRegExViolationErrorMsg; - page["emailJSRegEx"] = devicemgtProps.userValidationConfig.emailJSRegEx; - page["emailRegExViolationErrorMsg"] = devicemgtProps.userValidationConfig.emailRegExViolationErrorMsg; - return page; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.json deleted file mode 100644 index 58346ba14a..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/register", - "isAnonymous": true, - "layout": "uuf.layout.sign-in" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.hbs deleted file mode 100644 index 45411b407f..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.hbs +++ /dev/null @@ -1,161 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Roles - -
  • -
  • - - - Add - -
  • -{{/zone}} - -{{#zone "content"}} - {{#if canManage}} - -
    -
    - -
    -
    -

    Add Role

    -
    -
    -
    -
    -
    -
    -
    1
    - -
    -
    -
    -
    -
    2
    - -
    -
    -
    -
    -

    -
    - - -
    - - -
    - - -
    - - {{#if isCloud}} -
    - - devicemgt - - {{else}} -
    - - - {{/if}} - - -
    - {{#if canViewUsers}} - - -
    - - -
    - {{/if}} -
    -
    -
    - -
    -
    - - - -
    -
    - - {{else}} -

    - Permission Denied -

    -
    - You not authorized to enter Role Management Section. -
    - {{/if}} -{{/zone}} -{{#zone "bottomJs"}} - {{js "js/bottomJs.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.js deleted file mode 100644 index c24bbffbd9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Returns the dynamic state to be populated by add-user page. - * - * @param context Object that gets updated with the dynamic state of this page to be presented - * @returns {*} A displayData object that returns the dynamic state of this page to be presented - */ -function onRequest(context) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var displayData = {}; - - displayData["userStores"] = userModule.getSecondaryUserStores(); - displayData["roleNameJSRegEx"] = deviceMgtProps["roleValidationConfig"]["roleNameJSRegEx"]; - displayData["roleNameHelpText"] = deviceMgtProps["roleValidationConfig"]["roleNameHelpMsg"]; - displayData["roleNameRegExViolationErrorMsg"] = deviceMgtProps["roleValidationConfig"]["roleNameRegExViolationErrorMsg"]; - - if (userModule.isAuthorized("/permission/admin/device-mgt/roles/manage")) { - displayData.canManage = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) { - displayData.canViewUsers = true; - } - displayData.isCloud = deviceMgtProps.isCloud; - - return displayData; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.json deleted file mode 100644 index adab2be0f6..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/role/add", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/public/js/bottomJs.js deleted file mode 100644 index 0e3c0f6d5f..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/public/js/bottomJs.js +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -var validateInline = {}; -var clearInline = {}; - -var apiBasePath = "/api/device-mgt/v1.0"; -var domain = $("#domain").val(); -var isCloud = $("#role-create-form").data("cloud"); - - -var enableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).addClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).removeClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).removeClass(" hidden"); - } -}; - -var disableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).removeClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).addClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).addClass(" hidden"); - } -}; - -/** - *clear inline validation messages. - */ -clearInline["role-name"] = function () { - disableInlineError("roleNameField", "roleNameEmpty", "roleNameError"); -}; - - -/** - * Validate if provided role-name is valid against RegEx configures. - */ -validateInline["role-name"] = function () { - var roleNameInput = $("input#roleName"); - var roleName = roleNameInput.val(); - if (inputIsValid(roleNameInput.data("regex"), roleName) && roleName.indexOf("@") < 0 && roleName.indexOf("/") < 0) { - disableInlineError("roleNameField", "roleNameEmpty", "roleNameError"); - } else { - enableInlineError("roleNameField", "roleNameEmpty", "roleNameError"); - } -}; - -function formatRepo(user) { - if (user.loading) { - return user.text - } - if (!user.username) { - return; - } - var markup = '
    ' + - '
    ' + - '
    ' + - '
    ' + user.username + '
    '; - if (user.name || user.name != undefined) { - markup += '
    ( ' + user.name + ' )
    '; - } - markup += '
    '; - return markup; -} - -function formatRepoSelection(user) { - return user.username || user.text; -} - -$(document).ready(function () { - isCloud = $("#role-create-form").data("cloud"); - - var appContext = $("#app-context").data("app-context"); - $("#users").select2({ - multiple: true, - tags: false, - ajax: { - url: appContext + "/api/invoker/execute/", - method: "POST", - dataType: 'json', - delay: 250, - id: function (user) { - return user.username; - }, - data: function (params) { - var postData = {}; - postData.requestMethod = "GET"; - postData.requestURL = "/api/device-mgt/v1.0/users/search/usernames?filter=" + params.term + - "&domain=" + encodeURIComponent(domain); - postData.requestPayload = null; - return JSON.stringify(postData); - }, - processResults: function (data) { - var newData = []; - $.each(data, function (index, value) { - var user = {}; - user.id = value.username; - user.username = value.username; - if (value.firstname && value.lastname) { - user.name = value.firstname + " " + value.lastname; - } - newData.push(user); - }); - return { - results: newData - }; - }, - cache: true - }, - escapeMarkup: function (markup) { - return markup; - }, // let our custom formatter work - minimumInputLength: 1, - templateResult: formatRepo, // omitted for brevity, see the source of this page - templateSelection: formatRepoSelection // omitted for brevity, see the source of this page - }); - - /** - * Following click function would execute - * when a user clicks on "Add Role" button - * on Add Role page in WSO2 MDM Console. - */ - $("button#add-role-btn").click(function () { - - var domain = $("#domain").val(); - var roleNameInput = $("input#roleName"); - var roleName = roleNameInput.val(); - var users = $("#users").val(); - - var errorMsgWrapper = "#role-create-error-msg"; - var errorMsg = "#role-create-error-msg span"; - if (!roleName) { - $(errorMsg).text("Role name is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(roleNameInput.data("regex"), roleName) || roleName.indexOf("@") >= 0 || - roleName.indexOf("/") >= 0) { - $(errorMsg).text(roleNameInput.data("error-msg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!domain) { - $(errorMsg).text("Domain is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(/^[^~?!#$:;%^*`+={}\[\]\\()|<>,'"]/, domain)) { - $(errorMsg).text("Provided domain is invalid."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - var addRoleFormData = {}; - if (isCloud) { - addRoleFormData.roleName = "devicemgt" + roleName; - } else { - addRoleFormData.roleName = roleName; - } - if (domain != "PRIMARY") { - addRoleFormData.roleName = domain + "/" + roleName; - } - if (users == null) { - users = []; - } - addRoleFormData.users = users; - - var addRoleAPI = apiBasePath + "/roles"; - - invokerUtil.post( - addRoleAPI, - addRoleFormData, - function (data, textStatus, jqXHR) { - if (jqXHR.status == 201) { - // Clearing user input fields. - $("input#roleName").val(""); - $("#domain").val("PRIMARY"); - $("#users").val(""); - window.location.href = appContext + "/role/edit-permission/?rolename=" + - encodeURIComponent(addRoleFormData.roleName); - } - }, - function (jqXHR) { - if (jqXHR.status == 500) { - $(errorMsg).text("Either role already exists or unexpected error."); - $(errorMsgWrapper).removeClass("hidden"); - } - } - ); - } - }); - - var roleNameInputElement = "#roleName"; - $(roleNameInputElement).focus(function () { - clearInline["role-name"](); - }); - - $(roleNameInputElement).blur(function () { - validateInline["role-name"](); - }); - - /* When the user store domain value is changed, the users who are assigned to that role should be removed, as - user and role can be mapped only if both are in same user store - */ - $("#domain").change(function () { - $("#users").select2("val", ""); - domain = $("#domain").val(); - }); -}); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit.permission/permission.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit.permission/permission.hbs deleted file mode 100644 index a05a504ca0..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit.permission/permission.hbs +++ /dev/null @@ -1,44 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} - -{{unit "cdmf.unit.lib.service-invoker-utility"}} -{{unit "cdmf.unit.lib.data-table"}} -{{unit "cdmf.unit.lib.handlebars"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Roles - -
  • -
  • - - Edit Permission - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.role.edit.permission"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit.permission/permission.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit.permission/permission.json deleted file mode 100644 index 952c4abe20..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit.permission/permission.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/role/edit-permission/", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit/edit.hbs deleted file mode 100644 index d1c488dbef..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit/edit.hbs +++ /dev/null @@ -1,43 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} - -{{unit "cdmf.unit.lib.select2"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Roles - -
  • -
  • - - Edit - -
  • -{{/zone}} - -{{#zone "content"}} - {{unit "cdmf.unit.role.edit"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit/edit.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit/edit.json deleted file mode 100644 index 6959b98af0..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.edit/edit.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/role/edit/", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js deleted file mode 100644 index 1e8a7156c2..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var loadRoleBasedActionURL = function (action, rolename) { - href = $("#ast-container").data("app-context") + "role/" + action + "/?rolename=" + encodeURIComponent(rolename); - $(location).attr('href', href); -}; - -$(function () { - var sortableElem = '.wr-sortable'; - $(sortableElem).sortable({ - beforeStop: function () { - $(this).sortable('toArray'); - } - }); - $(sortableElem).disableSelection(); -}); - -var apiBasePath = "/api/device-mgt/v1.0"; -var modalPopup = ".modal"; -var modalPopupContainer = modalPopup + " .modal-content"; -var modalPopupContent = modalPopup + " .modal-content"; -var body = "body"; -var isInit = true; -var isCloud = false; - - -/** - * - * Fires the res_text when ever a data table redraw occurs making - * the font icons change the size to respective screen resolution. - * - */ -$(document).on('draw.dt', function () { - $(".icon .text").res_text(0.2); -}); - - -/* - * set popup maximum height function. - */ -function setPopupMaxHeight() { - $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30))); - $(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2))); -} - -/* - * show popup function. - */ -function showPopup() { - $(modalPopup).modal('show'); - //setPopupMaxHeight(); -} - -/* - * hide popup function. - */ -function hidePopup() { - $(modalPopupContent).html(''); - $(modalPopup).modal('hide'); - $('body').removeClass('modal-open').css('padding-right', '0px'); - $('.modal-backdrop').remove(); -} - - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption() { - // $(location).attr('href', $(this).data("url")); -} - -function htmlspecialchars(text) { - return jQuery('
    ').text(text).html(); -} - -function loadRoles() { - isCloud = $("#role-table").data("cloud"); - var loadingContent = $("#loading-content"); - loadingContent.show(); - - var dataFilter = function (data) { - data = JSON.parse(data); - var objects = []; - var count = 0; - $(data.roles).each(function (index) { - objects.push( - { - name: htmlspecialchars(data.roles[index]), - DT_RowId: "role-" + htmlspecialchars(data.roles[index]) - } - ) - }); - - var json = { - "recordsTotal": data.count, - "recordsFiltered": data.count, - "data": objects - }; - - return JSON.stringify(json); - }; - - //noinspection JSUnusedLocalSymbols - var fnCreatedRow = function (nRow, aData, iDataIndex) { - $(nRow).attr('data-type', 'selectable'); - }; - - //noinspection JSUnusedLocalSymbols - var columns = [ - { - class: "remove-padding icon-only content-fill", - data: null, - defaultContent: "
    " + - "" + - "
    " - }, - { - class: "", - data: "name", - render: function (name, type, row, meta) { - return '

    ' + name.replace("devicemgt", ""); + '

    '; - } - }, - { - class: "text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix", - data: null, - render: function (data, type, row, meta) { - var isCloud = false; - if ($('#is-cloud').length > 0) { - isCloud = true; - } - - var innerhtml = ''; - - var isAdminRole = $("#role-table").data("role") === data.name; - - var editLink = ' ' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - ''; - - var editPermissionLink = '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - ''; - - var removeLink = '' + - '' + - '' + - '' + - '' + - '' + - ''; - - if (!isCloud && !isAdminRole) { - innerhtml = editLink + editPermissionLink + removeLink; - } - return innerhtml; - } - } - ]; - - var options = { - "placeholder": "Search By Role Name", - "searchKey": "filter" - }; - var settings = { - "sorting": false - }; - var roleApiUrl = '/api/device-mgt/v1.0/roles?user-store=all'; - if (isCloud) { - roleApiUrl = '/api/device-mgt/v1.0/roles/filter/devicemgt?user-store=all'; - } - - $('#role-grid').datatables_extended_serverside_paging(settings, roleApiUrl, dataFilter, columns, fnCreatedRow, null, options); - loadingContent.hide(); - -} - - -/** - * Following click function would execute - * when a user clicks on "Remove" link - * on Role Listing page in WSO2 Devicemgt Console. - */ -$("#role-grid").on("click", ".remove-role-link", function () { - var role = $(this).data("role"); - var userStore; - if (role.indexOf('/') > 0) { - userStore = role.substr(0, role.indexOf('/')); - role = role.substr(role.indexOf('/') + 1); - } - var removeRoleAPI = apiBasePath + "/roles/" + encodeURIComponent(role); - if (userStore) { - removeRoleAPI += "?user-store=" + encodeURIComponent(userStore); - } - modalDialog.header('Do you really want to remove this role ?'); - modalDialog.footer(''); - modalDialog.show(); - - $("a#remove-role-yes-link").click(function () { - invokerUtil.delete( - removeRoleAPI, - function () { - if (userStore) { - role = userStore + '/' + role; - } - $('[id="role-' + role + '"]').remove(); - modalDialog.header('Done. Role was successfully removed.'); - modalDialog.footer(''); - $("a#remove-role-success-link").click(function () { - modalDialog.hide(); - }); - }, - function () { - // $(modalPopupContent).html($('#remove-role-error-content').html()); - modalDialog.header('An unexpected error occurred. Please try again later.'); - modalDialog.footer(''); - modalDialog.showAsError(); - $("a#remove-role-error-link").click(function () { - modalDialog.hide(); - }); - } - ); - }); - - $("a#remove-role-cancel-link").click(function () { - modalDialog.hide(); - }); -}); - -$(document).ready(function () { - loadRoles(); - $(function () { - $('[data-toggle="tooltip"]').tooltip() - }); -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/templates/role-listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/templates/role-listing.hbs deleted file mode 100644 index 3f752a185a..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/templates/role-listing.hbs +++ /dev/null @@ -1,56 +0,0 @@ -{{#each roles}} - - -
    - -
    - - {{roleName}} - - - {{#unequal adminRole roleName }} - {{#if canEdit}} - - - - - - - - - - - - - - - - - - - - - - - - - {{/if}} - {{#if canRemove}} - - - - - - - - {{/if}} - {{/unequal}} - - -{{/each}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs deleted file mode 100644 index 98f85e8137..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs +++ /dev/null @@ -1,120 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} - -{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.ui.modal"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Roles - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#unless isCloud}} -
  • - - - - - - - Add Role - -
  • - {{/unless}} -{{/zone}} - -{{#zone "content"}} - {{#if hasRoles}} -
    - {{#unless isCloud}} - {{#if removePermitted}} - - {{/if}} - {{#if editPermitted}} - - {{/if}} - {{/unless}} - {{#if isCloud}} - - {{/if}} - - Loading roles . . . -
    -
    - -
    - - - - - - - - - - -
    By Role Name
    -
    - - - - {{else}} - -
    -
    -

    You Haven't created roles yet.

    -
    Please click "Add A New Role", if you wish to add a role. -
    - - - - - - - Add Role - -
    -
    - - {{/if}} -{{/zone}} - -{{#zone "bottomJs"}} - - - {{js "js/role-listing.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js deleted file mode 100644 index d2abe1a56b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - - context["permissions"] = userModule.getUIPermissions(); - if (userModule.isAuthorized("/permission/admin/device-mgt/roles/delete")) { - context["removePermitted"] = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/roles/update")) { - context["editPermitted"] = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/roles/remove")) { - context["removePermitted"] = true; - } - - context["adminRole"] = deviceMgtProps["adminRole"]; - context["isCloud"] = deviceMgtProps["isCloud"]; - var roleCount = userModule.getRolesCount() - if (deviceMgtProps["isCloud"]) { - roleCount = userModule.getFilteredRoles("devicemgt").content.count; - } - - if (roleCount > 0) { - context["hasRoles"] = true; - } else { - context["hasRoles"] = false; - } - - return context; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.json deleted file mode 100644 index 44d4ee20c8..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/roles", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs deleted file mode 100644 index 22869a4828..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs +++ /dev/null @@ -1,75 +0,0 @@ -{{! - Copyright (c) 2018, 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. -}} -{{#zone "title"}}{{! to override parent page title }}{{/zone}} -{{unit "cdmf.unit.ui.title" pageTitle="Consent Page"}} - -{{#zone "content"}} -
    -
    - -

    User Consents

    -
    -
    - {{appName}} application requests access to your profile information -
    - -
    -
    -

    By selecting following attributes I agree to share them with the above service provider.

    - {{#unless singleMandatoryClaim}} -
    - -
    - {{/unless}} -
    - {{#each mandatoryClaims}} - - {{/each}} -
    -
    - {{#each requestedClaims}} - - {{/each}} -
    -

    Mandatory claims are marked with an asterisk ( * )

    -
    - - - - -
    -
    -
    -
    -
    -{{/zone}} -{{#zone "bottomJs"}} - {{js "js/script.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js deleted file mode 100644 index 6e8ed84016..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var Encode = Packages.org.owasp.encoder.Encode; - var viewModel = {}; - - // if sp is received, its a saml request or else its oidc - if(request.getParameter("sp") !== null) { - viewModel.appName = Encode.forHtml(request.getParameter("sp")); - viewModel.action = "/commonauth"; - viewModel.sessionDataKey = Encode.forHtmlAttribute(request.getParameter("sessionDataKey")); - viewModel.sessionDataKeyName = "sessionDataKey"; - viewModel.ssoProtocol = "saml"; - } else { - viewModel.appName = Encode.forHtml(request.getParameter("application")); - viewModel.action = "../oauth2/authorize"; - viewModel.sessionDataKey = Encode.forHtmlAttribute(request.getParameter("sessionDataKeyConsent")); - viewModel.sessionDataKeyName = "sessionDataKeyConsent"; - viewModel.ssoProtocol = "oidc"; - } - var mandatoryClaims = []; - var requestedClaims = []; - var singleMandatoryClaim = false; - - var mandatoryClaimsList, requestedClaimsList; - var i, j, partOne, partTwo; - if (request.getParameter("mandatoryClaims")) { - mandatoryClaimsList = request.getParameter("mandatoryClaims").split(","); - singleMandatoryClaim = (mandatoryClaimsList.length === 1); - for (j = 0; j < mandatoryClaimsList.length; j++) { - var mandatoryClaimsStr = mandatoryClaimsList[j]; - i = mandatoryClaimsStr.indexOf('_'); - partOne = mandatoryClaimsStr.slice(0, i); - partTwo = mandatoryClaimsStr.slice(i + 1, mandatoryClaimsStr.length); - mandatoryClaims.push( - {"claimId": Encode.forHtmlAttribute(partOne), "displayName": Encode.forHtmlAttribute(partTwo)} - ); - } - } - if (request.getParameter("requestedClaims")) { - requestedClaimsList = request.getParameter("requestedClaims").split(","); - for (j = 0; j < requestedClaimsList.length; j++) { - var requestedClaimsStr = requestedClaimsList[j]; - i = requestedClaimsStr.indexOf('_'); - partOne = requestedClaimsStr.slice(0, i); - partTwo = requestedClaimsStr.slice(i + 1, requestedClaimsStr.length); - requestedClaims.push( - {"claimId": Encode.forHtmlAttribute(partOne), "displayName": Encode.forHtmlAttribute(partTwo)} - ); - } - } - viewModel.mandatoryClaims = mandatoryClaims; - viewModel.requestedClaims = requestedClaims; - viewModel.singleMandatoryClaim = singleMandatoryClaim; - return viewModel; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.json deleted file mode 100644 index 4ca8fc3a6c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "layout": "uuf.layout.sign-in", - "uri": "/consent.do", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js deleted file mode 100644 index 63a02f526f..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function approved(ssoProtocol) { - var mandatoryClaimCBs = $(".mandatory-claim"); - var checkedMandatoryClaimCBs = $(".mandatory-claim:checked"); - - if (checkedMandatoryClaimCBs.length == mandatoryClaimCBs.length) { - if(ssoProtocol === "saml") { - document.getElementById('consent').value = "approve"; - } else if(ssoProtocol === "oidc") { - document.getElementById('consent').value = "approveAlways"; - } - document.getElementById("consentForm").submit(); - } else { - $("#modal_claim_validation").modal(); - } -} - -function deny() { - document.getElementById('consent').value = "deny"; - document.getElementById("consentForm").submit(); -} - -$(document).ready(function () { - $("#consent_select_all").click(function () { - if (this.checked) { - $('.checkbox input:checkbox').each(function () { - $(this).prop("checked", true); - }); - } else { - $('.checkbox :checkbox').each(function () { - $(this).prop("checked", false); - }); - } - }); - $(".checkbox input").click(function (e) { - if (e.target.id !== 'consent_select_all') { - $("#consent_select_all").prop("checked", false); - } - }); -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.hbs deleted file mode 100644 index e2e0a92c1f..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.hbs +++ /dev/null @@ -1,68 +0,0 @@ -{{! - Copyright (c) 2018, 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. -}} -{{#zone "title"}}{{! to override parent page title }}{{/zone}} -{{unit "cdmf.unit.ui.title" pageTitle="Login"}} - -{{#zone "content"}} -
    -
    - -

    Login

    -
    - {{#if message}} -
    - {{message}}! -
    - {{/if}} - -
    -
    -
    - - -
    -
    - - -
    - {{#if sessionDataKey}} - - {{/if}} - {{#if referer}} - - {{/if}} - -
    -
    - -
    - -
    -
    -
    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.js deleted file mode 100644 index 0b0a29d8ef..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var authModuleConfigs = context.app.conf["authModule"]; - var sessionDataKey = request.getParameter("sessionDataKey"); - var authFailure = request.getParameter("authFailure"); - - //if sso enabled and sessionDataKey is empty redirect - var ssoConfigs = authModuleConfigs["sso"]; - if (ssoConfigs && (ssoConfigs["enabled"].toString() == "true") && !sessionDataKey) { - // SSO is enabled in Auth module. - var redirectUri = context.app.context + "/uuf/login"; - var queryString = request.getQueryString(); - if (queryString && (queryString.length > 0)) { - redirectUri = redirectUri + "?" + queryString; - } - response.sendRedirect(encodeURI(redirectUri)); - exit(); - } - - var viewModel = {}; - var loginActionUrl = context.app.context + "/uuf/login"; - if (sessionDataKey) { - loginActionUrl = "/commonauth"; - } - - if (authFailure) { - viewModel.message = "Login failed! Please recheck the username and password and try again."; - } - - viewModel.sessionDataKey = sessionDataKey; - viewModel.loginActionUrl = loginActionUrl; - return viewModel; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.json deleted file mode 100644 index 467bcc522b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "layout": "uuf.layout.sign-in", - "uri": "/login.do", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.hbs deleted file mode 100644 index db89a9d7bc..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.hbs +++ /dev/null @@ -1,32 +0,0 @@ -{{! - Copyright (c) 2018, 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. -}} -{{#zone "title"}}{{! to override parent page title }}{{/zone}} -{{unit "cdmf.unit.ui.title" pageTitle="Authentication Failed!"}} - -{{#zone "content"}} -
    -
    - -

    {{stat}}

    -
    -
    - {{statusMessage}} -
    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.js deleted file mode 100644 index bb0ec87cac..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var Encode = Packages.org.owasp.encoder.Encode; - session.invalidate(); - var viewModel = {}; - - var stat = request.getParameter("status"); - var statusMessage = request.getParameter("statusMsg"); - - if (!stat || !statusMessage) { - stat = "Authentication Error!"; - statusMessage = "Something went wrong during the authentication process.Please try signing in again."; - } - - viewModel.stat = Encode.forHtmlContent(stat); - viewModel.statusMessage = Encode.forHtmlContent(statusMessage); - return viewModel; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.json deleted file mode 100644 index b66acf55c9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "layout": "uuf.layout.sign-in", - "uri": "/retry.do", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs deleted file mode 100644 index 104579406b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs +++ /dev/null @@ -1,23 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{#zone "title"}}{{! to override parent page title }}{{/zone}} -{{unit "cdmf.unit.ui.title" pageTitle="Login"}} - -{{#zone "content"}} - Redirecting, Please wait... -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js deleted file mode 100644 index a300ba0785..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - response.sendRedirect(context.app.context + "/uuf/login"); -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json deleted file mode 100644 index 91d4a819bd..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "layout": "uuf.layout.sign-in", - "uri": "/login", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-out/sign-out.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-out/sign-out.json deleted file mode 100644 index 48f1ee4829..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-out/sign-out.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/logout", - "extends": "uuf.page.sign-out" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/public/js/topic-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/public/js/topic-listing.js deleted file mode 100644 index 568c2b80a3..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/public/js/topic-listing.js +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption(url) { - if (!$(".select-enable-btn").text() == "Select" && !$(this).hasClass("btn")) { - url = $(this).parent().data("url"); - $(location).attr('href', url); - } -} - -/* - * DOM ready functions. - */ -$(document).ready(function () { - - var permissionSet = {}; - $.setPermission = function (permission) { - permissionSet[permission] = true; - }; - - $.hasPermission = function (permission) { - return permissionSet[permission]; - }; - - name = getParameterByName("name"); - - /* for device list sorting drop down */ - $(".ctrl-filter-type-switcher").popover({ - html: true, - content: function () { - return $("#content-filter-types").html(); - } - }); -}); - -function loadTopics(searchType, searchParam) { - - var serviceURL; - if ($.hasPermission("VIEW_TOPICS")) { - serviceURL = "/api/mqtt-topics/v1.0/admin/topics"; - } else { - $("#loading-content").remove(); - $('#topics-table').addClass('hidden'); - $('#topics-listing-status-msg').text('Permission denied.'); - $("#topics-listing-status").removeClass(' hidden'); - return; - } - - var columns = [ - { - targets: 0, - data: 'localSubscribedQueueOrTopicName', - class: 'remove-padding-top viewEnabledIcon', - render: function (data, type, row, meta) { - return '
    '; - } - }, - { - targets: 1, - data: 'localSubscribedQueueOrTopicName', - class: 'remove-padding-top viewEnabledIcon', - }, - { - targets: 2, - data: 'localNumberOfMessagesRemainingForSubscriber', - class: 'remove-padding-top viewEnabledIcon', - }, - { - targets: 3, - data: 'localActive', - class: 'remove-padding-top viewEnabledIcon', - }, - { - targets: 4, - data: 'localDurable', - class: 'remove-padding-top viewEnabledIcon', - }, - { - targets: 5, - data: 'localSubscriberQueueName', - class: 'remove-padding-top viewEnabledIcon', - }, - { - targets: 6, - data: 'localSubscriptionIdentifier', - class: 'remove-padding-top viewEnabledIcon', - } - ]; - - var fnCreatedRow = function (row, data, dataIndex) { - $(row).attr('data-type', 'selectable'); - $(row).attr('localSubscribedQueueOrTopicName', htmlspecialchars(data.localSubscribedQueueOrTopicName)); - $(row).attr('localNumberOfMessagesRemainingForSubscriber', htmlspecialchars(data.localNumberOfMessagesRemainingForSubscriber)); - $(row).attr('data-url', context + '/device/' + htmlspecialchars(data.localSubscribedQueueOrTopicName) + '?id=' + htmlspecialchars(data.localNumberOfMessagesRemainingForSubscriber)); - - var topicName = htmlspecialchars(data.localSubscribedQueueOrTopicName); - var remainingMesgCount = htmlspecialchars(data.localNumberOfMessagesRemainingForSubscriber); - var isActive = htmlspecialchars(data.localActive); - var isDurable = htmlspecialchars(data.localDurable); - var localSubscriberQueueName = htmlspecialchars(data.localSubscriberQueueName); - var subscriptionIdentifier = htmlspecialchars(data.localSubscriptionIdentifier); - $.each($('td', row), function (colIndex) { - switch (colIndex) { - case 1: - $(this).attr('data-grid-label', "Topic Name"); - $(this).attr('data-search', topicName); - $(this).attr('data-display', topicName); - break; - case 2: - $(this).attr('data-grid-label', "Remaining Messages"); - $(this).attr('data-search', remainingMesgCount); - $(this).attr('data-display', remainingMesgCount); - break; - case 3: - $(this).attr('data-grid-label', "Active"); - $(this).attr('data-search', isActive); - $(this).attr('data-display', isActive); - break; - case 4: - $(this).attr('data-grid-label', "Durable"); - $(this).attr('data-search', isDurable); - $(this).attr('data-display', isDurable); - break; - case 5: - $(this).attr('data-grid-label', "Subscriber Queue Name"); - $(this).attr('data-search', localSubscriberQueueName); - $(this).attr('data-display', localSubscriberQueueName); - break; - case 6: - $(this).attr('data-grid-label', "SubscriptionIdentifier"); - $(this).attr('data-search', subscriptionIdentifier); - $(this).attr('data-display', subscriptionIdentifier); - break; - } - }); - }; - - function htmlspecialchars(text) { - return jQuery('
    ').text(text).html(); - } - - var dataFilter = function (data) { - data = JSON.parse(data); - var objects = []; - $(data.subscriptions).each(function (index) { - objects.push( - { - localSubscribedQueueOrTopicName: data.subscriptions[index].localSubscribedQueueOrTopicName, - localNumberOfMessagesRemainingForSubscriber: data.subscriptions[index].localNumberOfMessagesRemainingForSubscriber, - localActive: data.subscriptions[index].localActive, - localDurable: data.subscriptions[index].localDurable, - localSubscriberQueueName: data.subscriptions[index].localSubscriberQueueName, - localSubscriptionIdentifier: data.subscriptions[index].localSubscriptionIdentifier, - name: data.subscriptions[index].localSubscribedQueueOrTopicName - } - ); - }); - - var json = { - "recordsTotal": data.count, - "recordsFiltered": data.count, - "data": objects - }; - - return JSON.stringify(json); - }; - - $('#topics-grid').datatables_extended_serverside_paging( - null, - serviceURL, - dataFilter, - columns, - fnCreatedRow, - function () { - $(".icon .text").res_text(0.2); - $('#topics-grid').removeClass('hidden'); - $("#loading-content").remove(); - }, { - "placeholder": "Search By Topic Name", - "searchKey": "name" - } - ); -} - -/* - * DOM ready functions. - */ -$(document).ready(function () { - /* Adding selected class for selected devices */ - var permissionList = $("#permission").data("permission"); - for (var key in permissionList) { - if (permissionList.hasOwnProperty(key)) { - $.setPermission(key); - } - } - loadTopics(); - $(".dataTables_toolbar").css("display", "none"); - - /* for topic list sorting drop down */ - $(".ctrl-filter-type-switcher").popover({ - html: true, - content: function () { - return $("#content-filter-types").html(); - } - }); - - /* for data tables*/ - $('[data-toggle="tooltip"]').tooltip(); - - $("[data-toggle=popover]").popover(); - - $(".ctrl-filter-type-switcher").popover({ - html: true, - content: function () { - return $('#content-filter-types').html(); - } - }); - - $('#nav').affix({ - offset: { - top: $('header').height() - } - }); - -}); - -var modalPopup = ".modal"; -var modalPopupContainer = modalPopup + " .modal-content"; -var modalPopupContent = modalPopup + " .modal-content"; -var body = "body"; - -/* - * set popup maximum height function. - */ -function setPopupMaxHeight() { - $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30))); - $(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2))); -} - -/* - * show popup function. - */ -function showPopup() { - $(modalPopup).modal('show'); -} - -/* - * hide popup function. - */ -function hidePopup() { - $(modalPopupContent).html(""); - $(modalPopupContent).removeClass("operation-data"); - $(modalPopup).modal('hide'); - $('body').removeClass('modal-open').css('padding-right', '0px'); - $('.modal-backdrop').remove(); -} - -function getParameterByName(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(location.search); - return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.hbs deleted file mode 100644 index e34956912d..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.hbs +++ /dev/null @@ -1,131 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}}` -{{unit "cdmf.unit.ui.title" pageTitle="MQTT Dashboard"}} - -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.lib.ui-permissions-utility"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - Dashboard - -
  • -
  • - - MQTT - -
  • -{{/zone}} - - -{{#zone "content"}} -
    -
    -
    -
    - -
    - - Loading subscriptions . . . -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    - -
    -
    -
    -{{/zone}} - -{{#zone "bottomJs"}} - - {{js "js/topic-listing.js"}} -{{/zone}} - -{{#zone "topCss"}} - -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.js deleted file mode 100644 index df6a76b512..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var constants = require("/app/modules/constants.js"); - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; - - var groupId = request.getParameter("groupId"); - - var viewModel = {}; - var title = "Topics"; - viewModel.title = title; - var currentUser = session.get(constants.USER_SESSION_KEY); - if (currentUser) { - viewModel.permissions = {}; - var uiPermissions = userModule.getUIPermissions(); - viewModel.permissions.list = stringify(uiPermissions); - if (uiPermissions.VIEW_TOPICS) { - viewModel.permissions.enroll = true; - } - viewModel.currentUser = currentUser; - var deviceCount = 1; - viewModel.deviceCount = deviceCount; - var utility = require("/app/modules/utility.js").utility; - } - return viewModel; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.json deleted file mode 100644 index a7f2976443..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/topics", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs deleted file mode 100644 index 6dc712ad2c..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs +++ /dev/null @@ -1,154 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="User Management | Add User"}} -{{unit "cdmf.unit.ui.modal"}} -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Users - -
  • -
  • - - Add - -
  • -{{/zone}} - -{{#zone "content"}} - {{#if canManage}} - -
    -
    - -
    -
    -

    Add User

    -

    Please note that * sign represents required fields of data.

    -
    -
    -
    - - -
    - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - - -
    - {{#if canViewRoles}} - -
    - -
    - {{/if}} -
    -
    -
    - -
    -
    - - - - -
    -
    - {{else}} -

    - Permission Denied -

    -
    - You not authorized to enter User Management Section. -
    - {{/if}} -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/bottomJs.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.js deleted file mode 100644 index 09861e8564..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Returns the dynamic state to be populated by add-user page. - * @returns {*} A context object that returns the dynamic state of this page to be presented - */ -function onRequest() { - //var log = new Log("/app/pages/cdmf.page.user.create server-side js"); - - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - - var page = {}; - var response = userModule.getRolesByUserStore("PRIMARY"); - if (response["status"] == "success") { - page["roles"] = response["content"]; - } - - if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) { - page.canManage = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/roles/view")) { - page.canViewRoles = true; - } - var userStores = userModule.getSecondaryUserStores(); - page["userStores"] = userStores; - page["charLimit"] = devicemgtProps["userValidationConfig"]["usernameLength"]; - page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"]; - page["usernameHelpMsg"] = devicemgtProps["userValidationConfig"]["usernameHelpMsg"]; - page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"]; - page["firstnameJSRegEx"] = devicemgtProps["userValidationConfig"]["firstnameJSRegEx"]; - page["firstnameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"]; - page["lastnameJSRegEx"] = devicemgtProps["userValidationConfig"]["lastnameJSRegEx"]; - page["lastnameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"]; - page["enrollmentURL"] = devicemgtProps["generalConfig"]["host"] + devicemgtProps["enrollmentDir"]; - - return page; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.json deleted file mode 100644 index f13f2d4902..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/user/add", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js deleted file mode 100644 index ad6f25f51e..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -var validateInline = {}; -var clearInline = {}; -var deviceMgtAPIsBasePath = "/api/device-mgt/v1.0"; - -var enableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).addClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).removeClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).removeClass(" hidden"); - } -}; - -var disableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).removeClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).addClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).addClass(" hidden"); - } -}; - -/** - * Validate if provided username is valid against RegEx configures. - */ -validateInline["user-name"] = function () { - var usernameInput = $("input#username"); - if (inputIsValid(usernameInput.data("regex"), usernameInput.val())) { - disableInlineError("usernameInputField", "usernameEmpty", "usernameError"); - } else { - enableInlineError("usernameInputField", "usernameEmpty", "usernameError"); - } -}; - -/** - * Validate if provided first name is valid against RegEx configures. - */ -validateInline["first-name"] = function () { - var firstnameInput = $("input#firstname"); - if (firstnameInput.val()) { - disableInlineError("firstNameField", "fnError"); - } else { - enableInlineError("firstNameField", "fnError"); - } -}; - -/** - * Validate if provided last name is valid against RegEx configures. - */ -validateInline["last-name"] = function () { - var lastnameInput = $("input#lastname"); - if (lastnameInput.val()) { - disableInlineError("lastNameField", "lnError"); - } else { - enableInlineError("lastNameField", "lnError"); - } -}; - -/** - * Checks if provided email address is valid against - * the email format. - */ -validateInline["emailAddress"] = function () { - var email = $("#emailAddress").val(); - if (!email) { - enableInlineError("emailField", "email-required", "emailError"); - } else if (emailIsValid(email)) { - disableInlineError("emailField", "email-required", "emailError"); - disableInlineError("emailField", "email-invalid", "emailError"); - } else { - enableInlineError("emailField", "email-invalid", "emailError"); - } -}; - -/** - * clear Validation messages when gain focus to the field. - */ -clearInline["user-name"] = function () { - disableInlineError("usernameInputField", "usernameEmpty", "usernameError"); -}; - -/** - * clear Validation messages when gain focus to the field. - */ -clearInline["first-name"] = function () { - disableInlineError("firstNameField", "fnError"); -}; - -/** - * clear Validation messages when gain focus to the field. - */ -clearInline["last-name"] = function () { - disableInlineError("lastNameField", "lnError"); -}; - - -/** - * clear Validation messages when gain focus to the field. - */ -clearInline["emailAddress"] = function () { - disableInlineError("emailField", "email-required", "emailError"); - disableInlineError("emailField", "email-invalid", "emailError"); -}; - -/** - * Checks if an email address has the valid format or not. - * - * @param email Email address - * @returns {boolean} true if email has the valid format, otherwise false. - */ -function emailIsValid(email) { - var regExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; - return regExp.test(email); -} - -/* - * QR-code generation function. - */ -function generateQRCode(qrCodeClass) { - var enrollmentURL = $("#qr-code-modal").data("enrollment-url"); - $(qrCodeClass).qrcode({ - text: enrollmentURL, - width: 200, - height: 200 - }); -} - -$("#userStore").change( - function () { - var str = ""; - $("select option:selected").each(function () { - str += $(this).text() + ""; - }); - if ($("#roles").length > 0) { - var getRolesAPI = deviceMgtAPIsBasePath + "/roles?user-store=" + encodeURIComponent(str) + "&limit=100"; - invokerUtil.get( - getRolesAPI, - function (data) { - data = JSON.parse(data); - if (data.errorMessage) { - $(errorMsg).text("Selected user store prompted an error : " + data.errorMessage); - $(errorMsgWrapper).removeClass("hidden"); - } else { - $("#roles").empty(); - for (var i = 0; i < data.roles.length; i++) { - var newOption = $(''); - $('#roles').append(newOption); - } - } - }, - function (jqXHR) { - - } - ); - - } - }).change(); - -$(document).ready(function () { - $("#emailValidationText").hide(); - $("select.select2[multiple=multiple]").select2({ - tags: false - }); - - /** - * Following click function would execute - * when a user clicks on "Add User" button - * on Add User page in WSO2 Devicemgt Console. - */ - $("button#add-user-btn").click(function () { - - var usernameInput = $("input#username"); - var firstnameInput = $("input#firstname"); - var lastnameInput = $("input#lastname"); - var charLimit = parseInt($("input#username").attr("limit")); - var domain = $("#userStore").val(); - var username = usernameInput.val().trim(); - var firstname = firstnameInput.val(); - var lastname = lastnameInput.val(); - var emailAddress = $("input#emailAddress").val(); - var roles; - if ($("#roles").length > 0) { - roles = $("select#roles").val(); - } - var errorMsgWrapper = "#user-create-error-msg"; - var errorMsg = "#user-create-error-msg span"; - if (!username) { - $(errorMsg).text("Username is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(usernameInput.data("regex"), username)) { - $(errorMsg).text(usernameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!firstname) { - $(errorMsg).text("Firstname is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(firstnameInput.data("regex"), firstname)) { - $(errorMsg).text(firstnameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!lastname) { - $(errorMsg).text("Lastname is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(lastnameInput.data("regex"), lastname)) { - $(errorMsg).text(lastnameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!emailAddress) { - $(errorMsg).text("Email is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!emailIsValid(emailAddress)) { - $(errorMsg).text("Provided email is invalid."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!roles) { - $(errorMsg).text("Role is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - var addUserFormData = {}; - - addUserFormData.username = domain + "/" + username; - addUserFormData.firstname = firstname; - addUserFormData.lastname = lastname; - addUserFormData.emailAddress = emailAddress; - addUserFormData.roles = roles; - - var addUserAPI = deviceMgtAPIsBasePath + "/users"; - - invokerUtil.post( - addUserAPI, - addUserFormData, - function (data, textStatus, jqXHR) { - if (jqXHR.status == 201) { - var response = JSON.parse(data); - // Clearing user input fields. - $("input#username").val(""); - $("input#firstname").val(""); - $("input#lastname").val(""); - $("input#email").val(""); - if ($("#roles").length > 0) { - $("select#roles").select2("val", ""); - } - // Refreshing with success message - $("#user-create-form").addClass("hidden"); - modalDialog.header('' + - ' User was added successfully'); - if (response.message) { - $("#modal-content-user-created-with-message").append("

    " + response.message + "

    "); - modalDialog.content($("#modal-content-user-created-with-message").html()); - } else { - modalDialog.content($("#modal-content-user-created").html()); - } - modalDialog.footer('
    ' + - ' OK' + - '
    '); - modalDialog.show(); - generateQRCode("#user-created-msg .qr-code"); - - } - }, function (data) { - var payload = JSON.parse(data.responseText); - if (data.status == 409) { - $(errorMsg).text("User : " + username + " already exists. Pick another username."); - } else if (data.status == 500) { - $(errorMsg).text("An unexpected error occurred at backend server. Please try again later."); - } else { - $(errorMsg).text(payload.message); - } - $(errorMsgWrapper).removeClass("hidden"); - } - ); - } - }); - - $("#username").focus(function () { - clearInline["user-name"](); - }); - - $("#username").blur(function () { - validateInline["user-name"](); - }); - - $("#emailAddress").focus(function () { - clearInline["emailAddress"](); - }); - - $("#emailAddress").blur(function () { - validateInline["emailAddress"](); - }); - - $("#lastname").focus(function () { - clearInline["last-name"](); - }); - - $("#lastname").blur(function () { - validateInline["last-name"](); - }); - - $("#firstname").focus(function () { - clearInline["first-name"](); - }); - - $("#firstname").blur(function () { - validateInline["first-name"](); - }); -}); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.hbs deleted file mode 100644 index 41728ad0a8..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.hbs +++ /dev/null @@ -1,146 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="User Management | Edit User"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Users - -
  • -
  • - - Edit - -
  • -{{/zone}} - -{{#zone "content"}} - {{#if canManage}} - -
    -
    - -
    -
    -

    Edit User

    -

    Please note that * sign represents required fields of data.

    -
    -
    -
    - - -
    - -
    - -
    - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - - -
    - {{#if canViewRoles}} - -
    - -
    - {{/if}} -
    -
    -
    - -
    -
    - - -
    -
    - - {{else}} -

    - Permission Denied -

    -
    - You not authorized to enter User Management Section. -
    - {{/if}} - -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/bottomJs.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.js deleted file mode 100644 index 5d067bac11..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest() { - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - - var userName = request.getParameter("username"); - var user = userModule.getUser(userName)["content"]; - - if (user) { - var title; - if (user.firstname && user.lastname) { - title = user.firstname + " " + user.lastname; - } else { - title = user.username; - } - var page = {"user": user, "title": title}; - - var userStore = "PRIMARY"; - if (userName.indexOf("/") > -1) { - userStore = userName.substr(0, userName.indexOf('/')); - } - page["userStore"] = userStore; - - var response = userModule.getUser(userName); - - if (response["status"] == "success") { - page["editUser"] = response["content"]; - } - - response = userModule.getRolesByUsername(userName); - var rolesByUsername; - if (response["status"] == "success") { - rolesByUsername = response["content"]; - } - - response = userModule.getRolesByUserStore(userStore); - var rolesByUserStore; - if (response["status"] == "success") { - rolesByUserStore = response["content"]; - } - - page["rolesByUsername"] = rolesByUsername; - page["rolesByUserStore"] = rolesByUserStore; - } - - if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) { - page.canManage = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/roles/view")) { - page.canViewRoles = true; - } - - page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"]; - page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"]; - page["firstnameJSRegEx"] = devicemgtProps["userValidationConfig"]["firstnameJSRegEx"]; - page["firstnameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"]; - page["lastnameJSRegEx"] = devicemgtProps["userValidationConfig"]["lastnameJSRegEx"]; - page["lastnameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"]; - - return page; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.json deleted file mode 100644 index cfa389ca80..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/edit.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/user/edit", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js deleted file mode 100644 index 5d26f65ff4..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -//holds the list of inline validation methods -var validateInline = {}; -var clearInline = {}; - -var deviceMgtBasePath = "/api/device-mgt/v1.0"; - -var enableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).addClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).removeClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).removeClass(" hidden"); - } -}; - -var disableInlineError = function (inputField, errorMsg, errorSign) { - var fieldIdentifier = "#" + inputField; - var errorMsgIdentifier = "#" + inputField + " ." + errorMsg; - var errorSignIdentifier = "#" + inputField + " ." + errorSign; - - if (inputField) { - $(fieldIdentifier).removeClass(" has-error has-feedback"); - } - - if (errorMsg) { - $(errorMsgIdentifier).addClass(" hidden"); - } - - if (errorSign) { - $(errorSignIdentifier).addClass(" hidden"); - } -}; - -/** - * Validate if provided username is valid against RegEx configures. - */ -validateInline["user-name"] = function () { - var usernameinput = $("input#username"); - if (inputIsValid(usernameinput.data("regex"), usernameinput.val())) { - disableInlineError("usernameInputField", "usernameEmpty", "usernameError"); - } else { - enableInlineError("usernameInputField", "usernameEmpty", "usernameError"); - } -}; - -/** - * Validate if provided first name is valid against RegEx configures. - */ -validateInline["first-name"] = function () { - var firstnameinput = $("input#firstname"); - if (firstnameinput.val()) { - disableInlineError("firstNameField", "fnError"); - } else { - enableInlineError("firstNameField", "fnError"); - } -}; - -/** - * Validate if provided last name is valid against RegEx configures. - */ -validateInline["last-name"] = function () { - var lastnameinput = $("input#lastname"); - if (lastnameinput.val()) { - disableInlineError("lastNameField", "lnError"); - } else { - enableInlineError("lastNameField", "lnError"); - } -}; - -/** - * Checks if provided email address is valid against - * the email format. - */ -validateInline["emailAddress"] = function () { - var email = $("#emailAddress").val(); - if (!email) { - enableInlineError("emailField", "email-required", "emailError"); - } else if (emailIsValid(email)) { - disableInlineError("emailField", "email-required", "emailError"); - disableInlineError("emailField", "email-invalid", "emailError"); - } else { - enableInlineError("emailField", "email-invalid", "emailError"); - } -}; - -/** - * clear Validation messages when gain focus to the field. - */ -clearInline["user-name"] = function () { - disableInlineError("usernameInputField", "usernameEmpty", "usernameError"); -}; - -/** - * clear Validation messages when gain focus to the field. - */ -clearInline["first-name"] = function () { - disableInlineError("firstNameField", "fnError"); -}; - -/** - * clear Validation messages when gain focus to the field. - */ -clearInline["last-name"] = function () { - disableInlineError("lastNameField", "lnError"); -}; - - -/** - * clear Validation messages when gain focus to the field. - */ -clearInline["emailAddress"] = function () { - disableInlineError("emailField", "email-required", "emailError"); - disableInlineError("emailField", "email-invalid", "emailError"); -}; - -/** - * Checks if an email address has the valid format or not. - * - * @param email Email address - * @returns {boolean} true if email has the valid format, otherwise false. - */ -function emailIsValid(email) { - var regExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; - return regExp.test(email); -} - -$(document).ready(function () { - $("#emailValidationText").hide(); - $("select.select2[multiple=multiple]").select2({ - tags: false - }); - var roleList, roleArr; - if ($("#roles").length > 0) { - roleList = $("#roles").attr("selectedVals").trim().replace(/ /g, ""); - roleList = roleList.replace(/(\r\n|\n|\r)/gm, ""); - roleArr = roleList.split(","); - } - - if ($("#roles").length > 0) { - $("#roles").val(roleArr).trigger("change"); - } - /** - * Following click function would execute - * when a user clicks on "Add User" button - * on Add User page in WSO2 Devicemgt Console. - */ - $("button#add-user-btn").click(function () { - var usernameInput = $("input#username"); - var firstnameInput = $("input#firstname"); - var lastnameInput = $("input#lastname"); - // var charLimit = parseInt($("input#username").attr("limit")); - var domain = $("#userStore").val(); - var username = usernameInput.val().trim(); - var firstname = firstnameInput.val(); - var lastname = lastnameInput.val(); - var emailAddress = $("input#emailAddress").val(); - var roles; - if ($("#roles").length > 0) { - var roles = $("select#roles").val(); - } - var errorMsgWrapper = "#user-create-error-msg"; - var errorMsg = "#user-create-error-msg span"; - if (!username) { - $(errorMsg).text("Username is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(usernameInput.data("regex"), username)) { - $(errorMsg).text(usernameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!firstname) { - $(errorMsg).text("Firstname is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(firstnameInput.data("regex"), firstname)) { - $(errorMsg).text(firstnameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!lastname) { - $(errorMsg).text("Lastname is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(lastnameInput.data("regex"), lastname)) { - $(errorMsg).text(lastnameInput.data("errormsg")); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!emailAddress) { - $(errorMsg).text("Email is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!emailIsValid(emailAddress)) { - $(errorMsg).text("Provided email is invalid."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - var addUserFormData = {}; - - addUserFormData.username = domain + "/" + username; - addUserFormData.firstname = firstname; - addUserFormData.lastname = lastname; - addUserFormData.emailAddress = emailAddress; - - if (!roles) { - roles = []; - } - addUserFormData.roles = roles; - username = username.substr(username.indexOf('/') + 1); - var addUserAPI = deviceMgtBasePath + "/users/" + encodeURIComponent(username) + "?domain=" + - encodeURIComponent(domain); - - invokerUtil.put( - addUserAPI, - addUserFormData, - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200) { - // Clearing user input fields. - // Refreshing with success message - $("#user-create-form").addClass("hidden"); - $("#user-created-msg").removeClass("hidden"); - setTimeout(function () { - window.location.href = "/devicemgt/users" - }, 1000); - - } - }, function (jqXHR) { - var payload = JSON.parse(jqXHR.responseText); - if (jqXHR.status == 409) { - $(errorMsg).text("User : " + username + " doesn't exists. You cannot proceed."); - } else if (jqXHR.status == 500) { - $(errorMsg).text("An unexpected error occurred at backend server. Please try again later."); - } else { - $(errorMsg).text(payload.message); - } - $(errorMsgWrapper).removeClass("hidden"); - } - ); - } - }); - - $("#emailAddress").focus(function () { - clearInline["emailAddress"](); - }); - - $("#emailAddress").blur(function () { - validateInline["emailAddress"](); - }); - - $("#lastname").focus(function () { - clearInline["last-name"](); - }); - - $("#lastname").blur(function () { - validateInline["last-name"](); - }); - - $("#firstname").focus(function () { - clearInline["first-name"](); - }); - - $("#firstname").blur(function () { - validateInline["first-name"](); - }); -}); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs deleted file mode 100644 index fb9420eb52..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs +++ /dev/null @@ -1,218 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{unit "cdmf.unit.ui.title" pageTitle="User Management"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - Users - -
  • -
  • - - {{user.username}} - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#if canEdit}} -
  • - - - - - - Edit - -
  • - {{/if}} -{{/zone}} - -{{#zone "content"}} - {{#if canView}} - {{#if exists}} - {{#zone "contentTitle"}} -
    -
    - -
    -
    - {{/zone}} - -
    -
    -
    -
    -
    -
    - - {{#unless isCloud}} - {{#if editPermitted}} - - {{/if}} - {{/unless}} -
    -
    -
    -
    Profile Overview -
    - {{#defineZone "user-detail-properties"}} - - - - - - - - - - - - - - - - - - - - - - - -
    Username{{user.username}}
    First Name{{user.firstname}}
    Last Name{{user.lastname}}
    Email{{user.emailAddress}}
    Roles - {{#each userRoles}} - - {{/each}} -
    - {{/defineZone}} -
    -
    -
    -
    - -
    - {{#defineZone "user-enrolled-devices"}} -
    -
    -
    -
    Enrolled Devices by - {{#if user.firstname}} - {{user.firstname}} {{user.lastname}} - {{else}} - {{user.username}} - {{/if}} -
    -
    -
    -
    - {{#each devices}} -
    - -
    -
    - -
    - -
    -
    - -

    {{name}}

    -
    -
    -
    -
    - -
    -
    -
    - {{/each}} -
    -
    -
    -
    -
    -
    -
    - {{/defineZone}} -
    -
    - {{else}} -
    -
    -

    User not found.

    -
    Please click "Add A New User", if you wish to add user or click - "View User List" to navigate to the user list. -
    - - - - - - - Add Another User - -
    -
    - {{/if}} - {{else}} -

    - Permission Denied -

    -
    - You not authorized to enter User Management Section. -
    - {{/if}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js deleted file mode 100644 index c308e39f1e..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var isExsistingUser = false; - var userName = request.getParameter("username"); - - var user, userRoles, devices; - - if (userName) { - var response = userModule.getUser(userName); - - if (response["status"] == "success") { - user = response["content"]; - user.domain = response["userDomain"]; - isExsistingUser = true; - } - - response = userModule.getRolesByUsername(userName); - if (response["status"] == "success") { - userRoles = response["content"]; - } - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - devices = deviceModule.getDevices(userName); - } - - var canView = false; - if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) { - canView = true; - } - - var canEdit = false; - if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit") && - userName !== deviceMgtProps['adminUser'].split("@")[0]) { - canEdit = true; - } - - var isCloud = deviceMgtProps.isCloud; - - return {"exists": isExsistingUser, "user": user, "userRoles": userRoles, "devices": devices, "canEdit": canEdit, - "canView": canView, "isCloud" : isCloud}; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.json deleted file mode 100644 index dada092ce4..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/user/view", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js deleted file mode 100644 index 3d800fe736..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js +++ /dev/null @@ -1,460 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - regExp = new RegExp(regExp); - return regExp.test(inputString); -} - -$(function () { - var sortableElem = '.wr-sortable'; - $(sortableElem).sortable({ - beforeStop: function () { - $(this).sortable('toArray'); - } - }); - $(sortableElem).disableSelection(); -}); - -var apiBasePath = "/api/device-mgt/v1.0"; -var body = "body"; - -/** - * - * Fires the res_text when ever a data table redraw occurs making - * the font icons change the size to respective screen resolution. - * - */ -$(document).on('draw.dt', function () { - $(".icon .text").res_text(0.2); -}); - -/** - * Following click function would execute - * when a user clicks on "Invite" link - * on User Management page in WSO2 MDM Console. - */ -$("a#invite-user-link").click(function () { - var usernameList = getSelectedUsernames(); - var inviteUserAPI = apiBasePath + "/users/send-invitation"; - - if (usernameList.length == 0) { - modalDialog.header("Operation cannot be performed !"); - modalDialog.content("Please select a user or a list of users to send invitation emails."); - modalDialog.footer(''); - modalDialog.showAsError(); - } else { - modalDialog.header(""); - modalDialog.content("An invitation mail will be sent to the selected user(s) to initiate an enrolment " + - "process. Do you wish to continue ?"); - modalDialog.footer('
    yes' + - 'No
    '); - modalDialog.show(); - - } - - $("a#invite-user-yes-link").click(function () { - invokerUtil.post( - inviteUserAPI, - usernameList, - function () { - modalDialog.header("User invitation email for enrollment was successfully sent."); - modalDialog.content(""); - modalDialog.footer(''); - $("a#invite-user-success-link").click(function () { - modalDialog.hide(); - }); - }, - function (data) { - var msg = JSON.parse(data.responseText); - modalDialog.header(' Unexpected Error !'); - modalDialog.content(msg.message); - modalDialog.footer(''); - $("a#invite-user-error-link").click(function () { - modalDialog.hide(); - }); - } - ); - }); - - $("a#invite-user-cancel-link").click(function () { - modalDialog.hide(); - }); -}); - -/* - * Function to get selected usernames. - */ -function getSelectedUsernames() { - const tbl = $('#user-grid').DataTable(); - let usernameList = []; - let userList = $("#user-grid").find("tr.DTTT_selected"); - userList.each(function (idx, el) { - usernameList.push(tbl.row(el).data().username); - }); - return usernameList; -} - -/** - * Following click function would execute - * when a user clicks on "Reset Password" link - * on User Listing page in WSO2 MDM Console. - */ -function resetPassword(username) { - modalDialog.header(' Reset Password'); - modalDialog.content($("#modal-content-reset-password").html()); - modalDialog.footer(''); - modalDialog.show(); - - $("a#reset-password-yes-link").click(function () { - var newPassword = $("#basic-modal-view .new-password").val(); - var confirmedPassword = $("#basic-modal-view .confirmed-password").val(); - var errorMsgWrapper = ".modal #notification-error-msg"; - var errorMsg = ".modal #notification-error-msg span"; - if (!newPassword) { - $(errorMsg).text("New password is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!confirmedPassword) { - $(errorMsg).text("Retyping the new password is required."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (confirmedPassword != newPassword) { - $(errorMsg).text("New password doesn't match the confirmation."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(/^[\S]{5,30}$/, confirmedPassword)) { - $(errorMsg).text("Password should be minimum 5 characters long, should not include any whitespaces."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - var resetPasswordFormData = {}; - resetPasswordFormData.newPassword = unescape(confirmedPassword); - var domain; - if (username.indexOf('/') > 0) { - domain = username.substr(0, username.indexOf('/')); - username = username.substr(username.indexOf('/') + 1); - } - var resetPasswordServiceURL = apiBasePath + "/admin/users/" + encodeURIComponent(username) + "/credentials"; - if (domain) { - resetPasswordServiceURL += '?domain=' + encodeURIComponent(domain); - } - invokerUtil.post( - resetPasswordServiceURL, - resetPasswordFormData, - // The success callback - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200) { - modalDialog.header("Password reset is successful."); - modalDialog.content(""); - modalDialog.footer('
    Ok
    '); - } - }, - // The error callback - function (jqXHR) { - var payload = JSON.parse(jqXHR.responseText); - $(errorMsg).text(payload.message); - $(errorMsgWrapper).removeClass("hidden"); - } - ); - } - }); - - $("a#reset-password-cancel-link").click(function () { - modalDialog.hide(); - }); -} - -/** - * Following click function would execute - * when a user clicks on "Remove" link - * on User Listing page in WSO2 MDM Console. - */ -function removeUser(username) { - var domain; - if (username.indexOf('/') > 0) { - domain = username.substr(0, username.indexOf('/')); - username = username.substr(username.indexOf('/') + 1); - } - var removeUserAPI = apiBasePath + "/users/" + encodeURIComponent(username); - if (domain) { - removeUserAPI += '?domain=' + encodeURIComponent(domain); - } - modalDialog.header("Remove User"); - modalDialog.content("Do you really want to remove this user ?"); - modalDialog.footer('
    Remove ' + - 'Cancel
    '); - modalDialog.showAsAWarning(); - - $("a#remove-user-cancel-link").click(function () { - modalDialog.hide(); - }); - - $("a#remove-user-yes-link").click(function () { - invokerUtil.delete( - removeUserAPI, - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200) { - if (domain) { - username = domain + '/' + username; - } - $('[id="user-' + username + '"]').remove(); - // update modal-content with success message - modalDialog.header("User Removed."); - modalDialog.content("Done. User was successfully removed."); - modalDialog.footer('
    Ok
    '); - - } - }, - function () { - modalDialog.hide(); - modalDialog.header("Operation cannot be performed !"); - modalDialog.content("An unexpected error occurred. Please try again later."); - modalDialog.footer('
    Ok
    '); - modalDialog.showAsError(); - } - ); - }); - -} - -/** - * Following function would execute - * when a user clicks on the list item - * initial mode and with out select mode. - */ -function InitiateViewOption() { - if ($("#can-view").val()) { - $(location).attr('href', $(this).data("url")); - } else { - modalDialog.header("Unauthorized action!"); - modalDialog.content("You don't have permissions to view users"); - modalDialog.footer('
    Ok
    '); - modalDialog.showAsError(); - } -} - -function htmlspecialchars(text){ - return jQuery('
    ').text(text).html(); -} - -function loadUsers() { - var loadingContentView = "#loading-content"; - $(loadingContentView).show(); - - var dataFilter = function (data) { - data = JSON.parse(data); - - var objects = []; - - $(data.users).each(function (index) { - objects.push({ - username: htmlspecialchars(data.users[index].username), - firstName: htmlspecialchars(data.users[index].firstname) ? htmlspecialchars(data.users[index].firstname) : "", - lastName: htmlspecialchars(data.users[index].lastname) ? htmlspecialchars(data.users[index].lastname) : "", - emailAddress: htmlspecialchars(data.users[index].emailAddress) ? htmlspecialchars(data.users[index].emailAddress) : "", - namePattern: htmlspecialchars(data.users[index].firstname) + ' ' + htmlspecialchars(data.users[index].lastname), - DT_RowId: "user-" + htmlspecialchars(data.users[index].username) - }) - }); - - var json = { - "recordsTotal": data.count, - "recordsFiltered": data.count, - "data": objects - }; - - return JSON.stringify(json); - }; - - //noinspection JSUnusedLocalSymbols - var fnCreatedRow = function (nRow, aData, iDataIndex) { - var adminUser = $("#user-table").data("user"); - if (adminUser !== aData["filter"]) { - $(nRow).attr('data-type', 'selectable'); - } - $(nRow).attr('data-username', aData["filter"]); - }; - - //noinspection JSUnusedLocalSymbols - var columns = [ - { - targets: 0, - class: "remove-padding icon-only content-fill", - data: 'username', - render: function (username, type, row, meta) { - return '
    ' + - '' + - '
    '; - } - }, - { - targets: 1, - class: "", - data: 'namePattern', - render: function (namePattern, type, row, meta) { - if (!namePattern) { - return ""; - } else { - return "

    " + namePattern + "

    "; - } - } - }, - { - targets: 2, - class: "remove-padding-top", - data: 'username', - render: function (username, type, row, meta) { - return '' + username; - } - }, - { - targets: 3, - class: "hidden", - data: 'firstName', - render: function (firstName, type, row, meta) { - if (!firstName) { - return ""; - } else if (firstName) { - return "

    " + firstName + "

    "; - } - } - }, - { - targets: 4, - class: "hidden", - data: 'lastName', - render: function (lastName, type, row, meta) { - if (!lastName) { - return ""; - } else if (lastName) { - return "

    " + lastName + "

    "; - } - } - }, - { - targets: 5, - class: "remove-padding-top", - data: 'emailAddress', - render: function (emailAddress, type, row, meta) { - if (!emailAddress) { - return ""; - } else { - return "" + emailAddress + ""; - } - } - }, - { - targets: 6, - class: "text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix", - data: null, - render: function (data, type, row, meta) { - var editbtn = ' ' + - ' ' + - '' + - '' + - ''; - - var resetPasswordbtn = '' + - '' + - '' + - '' + - ''; - - var removebtn = '' + - '' + - '' + - '' + - ''; - - var returnbtnSet = ''; - var adminUser = $("#user-table").data("user"); - var currentUser = $("#user-table").data("logged-user"); - if ($("#can-edit").length > 0 && adminUser !== data.username) { - returnbtnSet = returnbtnSet + editbtn; - } - if ($("#can-reset-password").length > 0 && adminUser !== data.username) { - returnbtnSet = returnbtnSet + resetPasswordbtn; - } - if ($("#can-remove").length > 0 && adminUser !== data.username && currentUser !== data.username) { - returnbtnSet = returnbtnSet + removebtn; - } - - return returnbtnSet; - } - } - ]; - - var options = { - "placeholder": "Search By Username", - "searchKey": "filter" - }; - - var settings = { - "sorting": false - }; - - $('#user-grid').datatables_extended_serverside_paging( - settings, - '/api/device-mgt/v1.0/users/search', - dataFilter, - columns, - fnCreatedRow, - null, - options - ); - - $(loadingContentView).hide(); - -} - -$(document).ready(function () { - loadUsers(); - - $(function () { - $('[data-toggle="tooltip"]').tooltip() - }); - - if (!$("#can-invite").val()) { - $("#invite-user-button").remove(); - } - - $("#user-grid_filter").hide(); - -}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/templates/listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/templates/listing.hbs deleted file mode 100644 index 3fc0078c99..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/templates/listing.hbs +++ /dev/null @@ -1,67 +0,0 @@ -{{#each users}} - - -
    - -
    - - -

    {{firstname}} {{lastname}}

    - - {{username}} - - - {{emailAddress}} - - - - {{#unequal adminUser username }} - {{#if canEdit}} - - - - - - - - {{/if}} - {{/unequal}} - - {{#unequal adminUser username }} - {{#if canRemove}} - - - - - - - - {{/if}} - {{/unequal}} - - {{#unequal adminUser username }} - {{#if canResetPassword}} - - - - - - - - - - - - - {{/if}} - {{/unequal}} - - -{{/each}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs deleted file mode 100644 index 34071d41b9..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs +++ /dev/null @@ -1,158 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} - -{{unit "cdmf.unit.ui.title" pageTitle="User Management"}} -{{unit "cdmf.unit.data-tables-extended"}} -{{unit "cdmf.unit.ui.modal"}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -
  • - - - USERS - -
  • -{{/zone}} - -{{#zone "navbarActions"}} - {{#unless isCloud}} -
  • - - - - - - - Add User - -
  • - {{/unless}} -{{/zone}} - -{{#zone "content"}} - - -
    - {{#unless isCloud}} - {{#if canManage}} - - - - - {{/if}} - {{/unless}} - {{#if canView}} - - {{/if}} - - - Loading users . . . -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    By UsernameBy First NameBy Last NameBy Email
    -
    - - - - - -{{/zone}} -{{#zone "common-navigation"}} - -{{/zone}} -{{#zone "bottomJs"}} - - - {{js "js/listing.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js deleted file mode 100644 index 58711710f7..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - context.handlebars.registerHelper('unequal', function (lvalue, rvalue, options) { - if (arguments.length < 3) - throw new Error("Handlebars Helper equal needs 2 parameters"); - if (lvalue == rvalue) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - var page = {}; - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - - page["currentUser"] = userModule.getCarbonUser().username; - page["adminUser"] = deviceMgtProps["adminUser"].split("@")[0]; - page["isCloud"] = deviceMgtProps["isCloud"]; - - if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) { - page.canManage = true; - } - - if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) { - page.canView = true; - } - return page; -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.json deleted file mode 100644 index cd0eb1438d..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/users", - "layout": "cdmf.layout.default" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.hbs deleted file mode 100755 index 6a7f2bb962..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.hbs +++ /dev/null @@ -1,48 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{#zone "topCss"}} - {{css "css/daterangepicker.css"}} -{{/zone}} - -
    -
    -
    - - - - - -
    -
    -
    -{{#zone "bottomJs"}} - {{js "js/moment.js"}} - {{js "js/jquery.daterangepicker.js"}} - {{js "js/date-picker.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.js deleted file mode 100755 index 4775342cf7..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -function onRequest(context) { - var deviceTypes = context.unit.params.deviceTypes; - var deviceType = context.uriParams.deviceType; - - var deviceTypesList = []; - if (deviceTypes) { - for (var i = 0; i < deviceTypes.length; i++) { - deviceTypesList.push(deviceTypes[i].type); - } - } else if (deviceType) { - deviceTypesList.push(deviceType); - } - return {"deviceTypes": stringify(deviceTypesList)}; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.json deleted file mode 100755 index 688e939808..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/date-range-picker.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/css/daterangepicker.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/css/daterangepicker.css deleted file mode 100644 index fed735c97b..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/css/daterangepicker.css +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -.date-picker { - width: 170px; - height: 25px; - padding: 0; - border: 0; - line-height: 25px; - padding-left: 10px; - font-size: 12px; - font-family: Arial; - font-weight: bold; - cursor: pointer; - color: #303030; - position: relative; - z-index: 2; -} - -.date-picker-wrapper { - position: absolute; - z-index: 1; - border: 1px solid #bfbfbf; - background-color: #efefef; - width: 448px; - padding: 5px 12px; - font-size: 12px; - line-height: 20px; - color: #aaa; - font-family: Arial; - box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5); -} - -.date-picker-wrapper.single-date { - width: auto; -} - -.date-picker-wrapper.no-shortcuts { - padding-bottom: 12px; -} - -.date-picker-wrapper .footer { - display: none; - font-size: 11px; - padding-top: 3px; -} - -.date-picker-wrapper b { - color: #666; - font-weight: 700; -} - -.date-picker-wrapper a { - color: rgb(107, 180, 214); - text-decoration: underline; -} - -.date-picker-wrapper .month-wrapper { - border: 1px solid #bfbfbf; - border-radius: 3px; - background-color: #fff; - padding: 5px; - cursor: default; - position: relative; - _overflow: hidden; -} - -.date-picker-wrapper .month-wrapper table { - width: 190px; - float: left; -} - -.date-picker-wrapper .month-wrapper table.month2 { - width: 190px; - float: right; -} - -.date-picker-wrapper .month-wrapper table th, -.date-picker-wrapper .month-wrapper table td { - vertical-align: middle; - text-align: center; - line-height: 14px; - margin: 0px; - padding: 0px; -} - -.date-picker-wrapper .month-wrapper table .day { - height: 19px; - line-height: 19px; - font-size: 12px; - margin-bottom: 1px; - color: #999; - cursor: default; -} - -.date-picker-wrapper .month-wrapper table div.day.lastMonth, -.date-picker-wrapper .month-wrapper table div.day.nextMonth { - color: #999; - cursor: default; -} - -.date-picker-wrapper .month-wrapper table .day.checked { - background-color: rgb(156, 219, 247); -} - -.date-picker-wrapper .month-wrapper table .week-name { - height: 20px; - line-height: 20px; - font-weight: 100; -} - -.date-picker-wrapper .month-wrapper table .day.has-tooltip { - cursor: help !important; -} - -.date-picker-wrapper .month-wrapper table .day.toMonth.valid { - color: #333; - cursor: pointer; -} - -.date-picker-wrapper .month-wrapper table .day.real-today { - background-color: rgb(255, 230, 132); -} - -.date-picker-wrapper .month-wrapper table .day.real-today.checked { - background-color: rgb(112, 204, 213); -} - -.date-picker-wrapper table .caption { - height: 40px; -} - -.date-picker-wrapper table .caption .next, -.date-picker-wrapper table .caption .prev { - padding: 0 5px; - cursor: pointer; -} - -.date-picker-wrapper table .caption .next:hover, -.date-picker-wrapper table .caption .prev:hover { - background-color: #ccc; - color: white; -} - -.date-picker-wrapper .gap { - position: absolute; - display: none; - top: 0px; - left: 204px; - z-index: 1; - width: 15px; - height: 100%; - background-color: red; - font-size: 0; - line-height: 0; -} - -.date-picker-wrapper .gap .gap-lines { - height: 100%; - overflow: hidden; -} - -.date-picker-wrapper .gap .gap-line { - height: 15px; - width: 15px; - position: relative; -} - -.date-picker-wrapper .gap .gap-line .gap-1 { - z-index: 1; - height: 0; - border-left: 8px solid white; - border-top: 8px solid #eee; - border-bottom: 8px solid #eee; -} - -.date-picker-wrapper .gap .gap-line .gap-2 { - position: absolute; - right: 0; - top: 0px; - z-index: 2; - height: 0; - border-left: 8px solid transparent; - border-top: 8px solid white; -} - -.date-picker-wrapper .gap .gap-line .gap-3 { - position: absolute; - right: 0; - top: 8px; - z-index: 2; - height: 0; - border-left: 8px solid transparent; - border-bottom: 8px solid white; -} - -.date-picker-wrapper .gap .gap-top-mask { - width: 6px; - height: 1px; - position: absolute; - top: -1px; - left: 1px; - background-color: #eee; - z-index: 3; -} - -.date-picker-wrapper .gap .gap-bottom-mask { - width: 6px; - height: 1px; - position: absolute; - bottom: -1px; - left: 7px; - background-color: #eee; - z-index: 3; -} - -.date-picker-wrapper .selected-days { - display: none; -} - -.date-picker-wrapper .drp_top-bar { - line-height: 40px; - height: 40px; - position: relative; -} - -.date-picker-wrapper .drp_top-bar .error-top { - display: none; -} - -.date-picker-wrapper .drp_top-bar .normal-top { - display: none; -} - -.date-picker-wrapper .drp_top-bar .default-top { - display: block; -} - -.date-picker-wrapper .drp_top-bar.error .default-top { - display: none; -} - -.date-picker-wrapper .drp_top-bar.error .error-top { - display: block; - color: red; -} - -.date-picker-wrapper .drp_top-bar.normal .default-top { - display: none; -} - -.date-picker-wrapper .drp_top-bar.normal .normal-top { - display: block; -} - -.date-picker-wrapper .drp_top-bar .apply-btn { - position: absolute; - right: 0px; - top: 6px; - padding: 3px 5px; - margin: 0; - font-size: 12px; - border-radius: 4px; - cursor: pointer; - - color: #d9eef7; - border: solid 1px #0076a3; - background: #0095cd; - background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5)); - background: -moz-linear-gradient(top, #00adee, #0078a5); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5'); - color: white; -} - -.date-picker-wrapper .drp_top-bar .apply-btn.disabled { - pointer-events: none; - color: #606060; - border: solid 1px #b7b7b7; - background: #fff; - background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); - background: -moz-linear-gradient(top, #fff, #ededed); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); -} - -/*time styling*/ -.time { - position: relative; -} - -.time input[type=range] { - vertical-align: middle; -} - -.time1, .time2 { - width: 180px; - padding: 0 5px; - text-align: center; -} - -.time1 { - float: left; -} - -.time2 { - float: right; -} - -.hour, .minute { - text-align: left; -} - -.hide { - display: none; -} - -input.hour-range, input.minute-range { - width: 150px; -} - -#dateRangePickerContainer .date-range, #dateRangePickerContainer .input-append { - background: none !important; -} - -#date-range { - padding-right: 30px; - width: 300px; - height: 100%; - display: inline-block; -} - -#dateRangePickerContainer { - float: right; -} - -.date-range { - border: 1px solid #ccc; -} - -#dateRangePickerContainer button.active { - background-color: #e6e6e6 !important; -} - -#dateRangePickerContainer .btn-default:hover { - background-color: #b2b2b2; - border-color: #000000; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/date-picker.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/date-picker.js deleted file mode 100755 index 5fc42a3a6d..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/date-picker.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -var fromDate, toDate, currentDay = new Date(); -var startDate = new Date(currentDay.getTime() - (60 * 60 * 24 * 100)); -var endDate = new Date(currentDay.getTime()); - -function initDate() { - currentDay = new Date(); -} - -var DateRange = convertDate(startDate) + " to " + convertDate(endDate); - -$(document).ready(function () { - initDate(); - var configObject = { - startOfWeek: 'monday', - separator: ' to ', - format: 'YYYY-MM-DD HH:mm', - autoClose: false, - time: { - enabled: true - }, - shortcuts: 'hide', - endDate: currentDay, - maxDays: 2, - getValue: function () { - return this.value; - }, - setValue: function (s) { - this.value = s; - } - }; - $('#date-range').html(DateRange); - $('#date-range').dateRangePicker(configObject) - .bind('datepicker-apply', function (event, dateRange) { - $(this).addClass('active'); - $(this).siblings().removeClass('active'); - fromDate = dateRange.date1 != "Invalid Date" ? dateRange.date1.getTime() / 1000 : null; - toDate = dateRange.date2 != "Invalid Date" ? dateRange.date2.getTime() / 1000 : null; - drawGraph(fromDate, toDate); - } - ); - setDateTime(currentDay.getTime() - 3600000, currentDay.getTime()); - $('#hour-btn').addClass('active'); -}); - -//hour -$('#hour-btn').on('click', function () { - initDate(); - setDateTime(currentDay.getTime() - 3600000, currentDay.getTime()); -}); - -//12 hours -$('#h12-btn').on('click', function () { - initDate(); - setDateTime(currentDay.getTime() - (3600000 * 12), currentDay.getTime()); -}); - -//24 hours -$('#h24-btn').on('click', function () { - initDate(); - setDateTime(currentDay.getTime() - (3600000 * 24), currentDay.getTime()); -}); - -//48 hours -$('#h48-btn').on('click', function () { - initDate(); - setDateTime(currentDay.getTime() - (3600000 * 48), currentDay.getTime()); -}); - -$('body').on('click', '.btn-group button', function (e) { - $(this).addClass('active'); - $(this).siblings().removeClass('active'); -}); - -function setDateTime(from, to) { - fromDate = from; - toDate = to; - startDate = new Date(from); - endDate = new Date(to); - DateRange = convertDate(startDate) + " to " + convertDate(endDate); - $('#date-range').html(DateRange); - var tzOffset = new Date().getTimezoneOffset() * 60 / 1000; - from += tzOffset; - to += tzOffset; - - // Implement drawGraph_ method in your UI unit for analytics. - var deviceTypes = $("#device-type-details").data("devicetypes"); - for (var i = 0; i < deviceTypes.length; i++){ - try{ - window["drawGraph_" + deviceTypes](parseInt(from / 1000), parseInt(to / 1000)); - }catch(e){ - } - try{ - window["drawTable"](parseInt(from / 1000), parseInt(to / 1000)); - }catch(e){ - } - } -} - -function convertDate(date) { - var month = date.getMonth() + 1; - var day = date.getDate(); - var hour = date.getHours(); - var minute = date.getMinutes(); - return date.getFullYear() + '-' + (('' + month).length < 2 ? '0' : '') + month + '-' + - (('' + day).length < 2 ? '0' : '') + day + " " + (('' + hour).length < 2 ? '0' : '') + - hour + ":" + (('' + minute).length < 2 ? '0' : '') + minute; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/jquery-ui-timepicker-addon.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/jquery-ui-timepicker-addon.js deleted file mode 100644 index 180a8f8c92..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/jquery-ui-timepicker-addon.js +++ /dev/null @@ -1,2238 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -(function ($) { - - /* - * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded" - */ - $.ui.timepicker = $.ui.timepicker || {}; - if ($.ui.timepicker.version) { - return; - } - - /* - * Extend jQueryUI, get it started with our version number - */ - $.extend($.ui, { - timepicker: { - version: "1.5.0" - } - }); - - /* - * Timepicker manager. - * Use the singleton instance of this class, $.timepicker, to interact with the time picker. - * Settings for (groups of) time pickers are maintained in an instance object, - * allowing multiple different settings on the same page. - */ - var Timepicker = function () { - this.regional = []; // Available regional settings, indexed by language code - this.regional[''] = { // Default regional settings - currentText: 'Now', - closeText: 'Done', - amNames: ['AM', 'A'], - pmNames: ['PM', 'P'], - timeFormat: 'HH:mm', - timeSuffix: '', - timeOnlyTitle: 'Choose Time', - timeText: 'Time', - hourText: 'Hour', - minuteText: 'Minute', - secondText: 'Second', - millisecText: 'Millisecond', - microsecText: 'Microsecond', - timezoneText: 'Time Zone', - isRTL: false - }; - this._defaults = { // Global defaults for all the datetime picker instances - showButtonPanel: true, - timeOnly: false, - timeOnlyShowDate: false, - showHour: null, - showMinute: null, - showSecond: null, - showMillisec: null, - showMicrosec: null, - showTimezone: null, - showTime: true, - stepHour: 1, - stepMinute: 1, - stepSecond: 1, - stepMillisec: 1, - stepMicrosec: 1, - hour: 0, - minute: 0, - second: 0, - millisec: 0, - microsec: 0, - timezone: null, - hourMin: 0, - minuteMin: 0, - secondMin: 0, - millisecMin: 0, - microsecMin: 0, - hourMax: 23, - minuteMax: 59, - secondMax: 59, - millisecMax: 999, - microsecMax: 999, - minDateTime: null, - maxDateTime: null, - maxTime: null, - minTime: null, - onSelect: null, - hourGrid: 0, - minuteGrid: 0, - secondGrid: 0, - millisecGrid: 0, - microsecGrid: 0, - alwaysSetTime: true, - separator: ' ', - altFieldTimeOnly: true, - altTimeFormat: null, - altSeparator: null, - altTimeSuffix: null, - altRedirectFocus: true, - pickerTimeFormat: null, - pickerTimeSuffix: null, - showTimepicker: true, - timezoneList: null, - addSliderAccess: false, - sliderAccessArgs: null, - controlType: 'slider', - defaultValue: null, - parse: 'strict' - }; - $.extend(this._defaults, this.regional['']); - }; - - $.extend(Timepicker.prototype, { - $input: null, - $altInput: null, - $timeObj: null, - inst: null, - hour_slider: null, - minute_slider: null, - second_slider: null, - millisec_slider: null, - microsec_slider: null, - timezone_select: null, - maxTime: null, - minTime: null, - hour: 0, - minute: 0, - second: 0, - millisec: 0, - microsec: 0, - timezone: null, - hourMinOriginal: null, - minuteMinOriginal: null, - secondMinOriginal: null, - millisecMinOriginal: null, - microsecMinOriginal: null, - hourMaxOriginal: null, - minuteMaxOriginal: null, - secondMaxOriginal: null, - millisecMaxOriginal: null, - microsecMaxOriginal: null, - ampm: '', - formattedDate: '', - formattedTime: '', - formattedDateTime: '', - timezoneList: null, - units: ['hour', 'minute', 'second', 'millisec', 'microsec'], - support: {}, - control: null, - - /* - * Override the default settings for all instances of the time picker. - * @param {Object} settings object - the new settings to use as defaults (anonymous object) - * @return {Object} the manager object - */ - setDefaults: function (settings) { - extendRemove(this._defaults, settings || {}); - return this; - }, - - /* - * Create a new Timepicker instance - */ - _newInst: function ($input, opts) { - var tp_inst = new Timepicker(), - inlineSettings = {}, - fns = {}, - overrides, i; - - for (var attrName in this._defaults) { - if (this._defaults.hasOwnProperty(attrName)) { - var attrValue = $input.attr('time:' + attrName); - if (attrValue) { - try { - inlineSettings[attrName] = eval(attrValue); - } catch (err) { - inlineSettings[attrName] = attrValue; - } - } - } - } - - overrides = { - beforeShow: function (input, dp_inst) { - if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) { - return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst); - } - }, - onChangeMonthYear: function (year, month, dp_inst) { - // Update the time as well : this prevents the time from disappearing from the $input field. - tp_inst._updateDateTime(dp_inst); - if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) { - tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst); - } - }, - onClose: function (dateText, dp_inst) { - if (tp_inst.timeDefined === true && $input.val() !== '') { - tp_inst._updateDateTime(dp_inst); - } - if ($.isFunction(tp_inst._defaults.evnts.onClose)) { - tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst); - } - } - }; - for (i in overrides) { - if (overrides.hasOwnProperty(i)) { - fns[i] = opts[i] || null; - } - } - - tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, { - evnts: fns, - timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker'); - }); - tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) { - return val.toUpperCase(); - }); - tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) { - return val.toUpperCase(); - }); - - // detect which units are supported - tp_inst.support = detectSupport( - tp_inst._defaults.timeFormat + - (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') + - (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : '')); - - // controlType is string - key to our this._controls - if (typeof(tp_inst._defaults.controlType) === 'string') { - if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') { - tp_inst._defaults.controlType = 'select'; - } - tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType]; - } - // controlType is an object and must implement create, options, value methods - else { - tp_inst.control = tp_inst._defaults.controlType; - } - - // prep the timezone options - var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60, - 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840]; - if (tp_inst._defaults.timezoneList !== null) { - timezoneList = tp_inst._defaults.timezoneList; - } - var tzl = timezoneList.length, tzi = 0, tzv = null; - if (tzl > 0 && typeof timezoneList[0] !== 'object') { - for (; tzi < tzl; tzi++) { - tzv = timezoneList[tzi]; - timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) }; - } - } - tp_inst._defaults.timezoneList = timezoneList; - - // set the default units - tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) : - ((new Date()).getTimezoneOffset() * -1); - tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin : - tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour; - tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin : - tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute; - tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin : - tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second; - tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin : - tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec; - tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin : - tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec; - tp_inst.ampm = ''; - tp_inst.$input = $input; - - if (tp_inst._defaults.altField) { - tp_inst.$altInput = $(tp_inst._defaults.altField); - if (tp_inst._defaults.altRedirectFocus === true) { - tp_inst.$altInput.css({ - cursor: 'pointer' - }).focus(function () { - $input.trigger("focus"); - }); - } - } - - if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) { - tp_inst._defaults.minDate = new Date(); - } - if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) { - tp_inst._defaults.maxDate = new Date(); - } - - // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime.. - if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) { - tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime()); - } - if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) { - tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime()); - } - if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) { - tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime()); - } - if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) { - tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime()); - } - tp_inst.$input.bind('focus', function () { - tp_inst._onFocus(); - }); - - return tp_inst; - }, - - /* - * add our sliders to the calendar - */ - _addTimePicker: function (dp_inst) { - var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val(); - - this.timeDefined = this._parseTime(currDT); - this._limitMinMaxDateTime(dp_inst, false); - this._injectTimePicker(); - }, - - /* - * parse the time string from input value or _setTime - */ - _parseTime: function (timeString, withDate) { - if (!this.inst) { - this.inst = $.datepicker._getInst(this.$input[0]); - } - - if (withDate || !this._defaults.timeOnly) { - var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat'); - try { - var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults); - if (!parseRes.timeObj) { - return false; - } - $.extend(this, parseRes.timeObj); - } catch (err) { - $.timepicker.log("Error parsing the date/time string: " + err + - "\ndate/time string = " + timeString + - "\ntimeFormat = " + this._defaults.timeFormat + - "\ndateFormat = " + dp_dateFormat); - return false; - } - return true; - } else { - var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults); - if (!timeObj) { - return false; - } - $.extend(this, timeObj); - return true; - } - }, - - /* - * generate and inject html for timepicker into ui datepicker - */ - _injectTimePicker: function () { - var $dp = this.inst.dpDiv, - o = this.inst.settings, - tp_inst = this, - litem = '', - uitem = '', - show = null, - max = {}, - gridSize = {}, - size = null, - i = 0, - l = 0; - - // Prevent displaying twice - if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) { - var noDisplay = ' style="display:none;"', - html = '
    ' + '
    ' + o.timeText + '
    ' + - '
    '; - - // Create the markup - for (i = 0, l = this.units.length; i < l; i++) { - litem = this.units[i]; - uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1); - show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem]; - - // Added by Peter Medeiros: - // - Figure out what the hour/minute/second max should be based on the step values. - // - Example: if stepMinute is 15, then minMax is 45. - max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10); - gridSize[litem] = 0; - - html += '
    ' + o[litem + 'Text'] + '
    ' + - '
    '; - - if (show && o[litem + 'Grid'] > 0) { - html += '
    '; - - if (litem === 'hour') { - for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) { - gridSize[litem]++; - var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o); - html += ''; - } - } - else { - for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) { - gridSize[litem]++; - html += ''; - } - } - - html += '
    ' + tmph + '' + ((m < 10) ? '0' : '') + m + '
    '; - } - html += '
    '; - } - - // Timezone - var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone; - html += '
    ' + o.timezoneText + '
    '; - html += '
    '; - - // Create the elements from string - html += '
    '; - var $tp = $(html); - - // if we only want time picker... - if (o.timeOnly === true) { - $tp.prepend('
    ' + '
    ' + o.timeOnlyTitle + '
    ' + '
    '); - $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide(); - } - - // add sliders, adjust grids, add events - for (i = 0, l = tp_inst.units.length; i < l; i++) { - litem = tp_inst.units[i]; - uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1); - show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem]; - - // add the slider - tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]); - - // adjust the grid and add click event - if (show && o[litem + 'Grid'] > 0) { - size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']); - $tp.find('.ui_tpicker_' + litem + ' table').css({ - width: size + "%", - marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"), - marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0', - borderCollapse: 'collapse' - }).find("td").click(function (e) { - var $t = $(this), - h = $t.html(), - n = parseInt(h.replace(/[^0-9]/g), 10), - ap = h.replace(/[^apm]/ig), - f = $t.data('for'); // loses scope, so we use data-for - - if (f === 'hour') { - if (ap.indexOf('p') !== -1 && n < 12) { - n += 12; - } - else { - if (ap.indexOf('a') !== -1 && n === 12) { - n = 0; - } - } - } - - tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n); - - tp_inst._onTimeChange(); - tp_inst._onSelectHandler(); - }).css({ - cursor: 'pointer', - width: (100 / gridSize[litem]) + '%', - textAlign: 'center', - overflow: 'hidden' - }); - } // end if grid > 0 - } // end for loop - - // Add timezone options - this.timezone_select = $tp.find('.ui_tpicker_timezone').append('').find("select"); - $.fn.append.apply(this.timezone_select, - $.map(o.timezoneList, function (val, idx) { - return $("
    '; - - - return $(html); - } - - function getHideClass() - { - if (opt.autoClose === true) { - return 'hide'; - } - return ''; - } - - function getWeekHead() - { - if (opt.startOfWeek == 'monday') - { - return ''+lang('week-1')+'\ - '+lang('week-2')+'\ - '+lang('week-3')+'\ - '+lang('week-4')+'\ - '+lang('week-5')+'\ - '+lang('week-6')+'\ - '+lang('week-7')+''; - } - else - { - return ''+lang('week-7')+'\ - '+lang('week-1')+'\ - '+lang('week-2')+'\ - '+lang('week-3')+'\ - '+lang('week-4')+'\ - '+lang('week-5')+'\ - '+lang('week-6')+''; - } - } - function isMonthOutOfBounds(month) - { - var month = moment(month); - if (opt.startDate && month.endOf('month').isBefore(opt.startDate)) - { - return true; - } - if (opt.endDate && month.startOf('month').isAfter(opt.endDate)) - { - return true; - } - return false; - } - - function getGapHTML() - { - var html = ['
    ']; - for(var i=0;i<20;i++) - { - html.push('
    \ -
    \ -
    \ -
    \ -
    '); - } - html.push('
    '); - return html.join(''); - } - - function createMonthHTML(d) - { - var days = []; - d.setDate(1); - var lastMonth = new Date(d.getTime() - 86400000); - var now = new Date(); - - var dayOfWeek = d.getDay(); - if((dayOfWeek == 0) && (opt.startOfWeek == 'monday')) { - // add one week - dayOfWeek = 7; - } - - if (dayOfWeek > 0) - { - for (var i = dayOfWeek; i > 0; i--) - { - var day = new Date(d.getTime() - 86400000*i); - var valid = true; - if (opt.startDate && compare_day(day,opt.startDate) < 0) valid = false; - if (opt.endDate && compare_day(day,opt.endDate) > 0) valid = false; - days.push({type:'lastMonth',day: day.getDate(),time:day.getTime(), valid:valid }); - } - } - var toMonth = d.getMonth(); - for(var i=0; i<40; i++) - { - var today = moment(d).add(i,'days').toDate(); - var valid = true; - if (opt.startDate && compare_day(today,opt.startDate) < 0) valid = false; - if (opt.endDate && compare_day(today,opt.endDate) > 0) valid = false; - days.push({type: today.getMonth() == toMonth ? 'toMonth' : 'nextMonth',day: today.getDate(),time:today.getTime(), valid:valid }); - } - var html = []; - for(var week=0; week<6; week++) - { - if (days[week*7].type == 'nextMonth') break; - html.push(''); - for(var day = 0; day<7; day++) - { - var _day = (opt.startOfWeek == 'monday') ? day+1 : day; - var today = days[week*7+_day]; - var highlightToday = moment(today.time).format('L') == moment(now).format('L'); - today.extraClass = ''; - today.tooltip = ''; - if(opt.beforeShowDay && typeof opt.beforeShowDay == 'function') - { - var _r = opt.beforeShowDay(moment(today.time).toDate()); - today.valid = _r[0]; - today.extraClass = _r[1] || ''; - today.tooltip = _r[2] || ''; - if (today.tooltip != '') today.extraClass += ' has-tooltip '; - } - html.push('
    '+today.day+'
    '); - } - html.push(''); - } - return html.join(''); - } - - function getLanguages() - { - if (opt.language == 'auto') - { - var language = navigator.language ? navigator.language : navigator.browserLanguage; - if (!language) return $.dateRangePickerLanguages['en']; - var language = language.toLowerCase(); - for(var key in $.dateRangePickerLanguages) - { - if (language.indexOf(key) != -1) - { - return $.dateRangePickerLanguages[key]; - } - } - return $.dateRangePickerLanguages['en']; - } - else if ( opt.language && opt.language in $.dateRangePickerLanguages) - { - return $.dateRangePickerLanguages[opt.language]; - } - else - { - return $.dateRangePickerLanguages['en']; - } - } - - function lang(t) - { - return (t in langs)? langs[t] : t; - } - - - }; -})(jQuery); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/moment.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/moment.js deleted file mode 100755 index bb7dff4542..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.analytics.date-range-picker/public/js/moment.js +++ /dev/null @@ -1,4058 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -//! moment.js -//! version : 2.13.0 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() -}(this, function () { 'use strict'; - - var hookCallback; - - function utils_hooks__hooks () { - return hookCallback.apply(null, arguments); - } - - // This is done to register the method called with moment() - // without creating circular dependencies. - function setHookCallback (callback) { - hookCallback = callback; - } - - function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; - } - - function isDate(input) { - return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; - } - - function map(arr, fn) { - var res = [], i; - for (i = 0; i < arr.length; ++i) { - res.push(fn(arr[i], i)); - } - return res; - } - - function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } - - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } - - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } - - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } - - return a; - } - - function create_utc__createUTC (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); - } - - function defaultParsingFlags() { - // We need to deep clone this object. - return { - empty : false, - unusedTokens : [], - unusedInput : [], - overflow : -2, - charsLeftOver : 0, - nullInput : false, - invalidMonth : null, - invalidFormat : false, - userInvalidated : false, - iso : false, - parsedDateParts : [], - meridiem : null - }; - } - - function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); - } - return m._pf; - } - - var some; - if (Array.prototype.some) { - some = Array.prototype.some; - } else { - some = function (fun) { - var t = Object(this); - var len = t.length >>> 0; - - for (var i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } - - return false; - }; - } - - function valid__isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m); - var parsedParts = some.call(flags.parsedDateParts, function (i) { - return i != null; - }); - m._isValid = !isNaN(m._d.getTime()) && - flags.overflow < 0 && - !flags.empty && - !flags.invalidMonth && - !flags.invalidWeekday && - !flags.nullInput && - !flags.invalidFormat && - !flags.userInvalidated && - (!flags.meridiem || (flags.meridiem && parsedParts)); - - if (m._strict) { - m._isValid = m._isValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } - } - return m._isValid; - } - - function valid__createInvalid (flags) { - var m = create_utc__createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); - } - else { - getParsingFlags(m).userInvalidated = true; - } - - return m; - } - - function isUndefined(input) { - return input === void 0; - } - - // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - var momentProperties = utils_hooks__hooks.momentProperties = []; - - function copyConfig(to, from) { - var i, prop, val; - - if (!isUndefined(from._isAMomentObject)) { - to._isAMomentObject = from._isAMomentObject; - } - if (!isUndefined(from._i)) { - to._i = from._i; - } - if (!isUndefined(from._f)) { - to._f = from._f; - } - if (!isUndefined(from._l)) { - to._l = from._l; - } - if (!isUndefined(from._strict)) { - to._strict = from._strict; - } - if (!isUndefined(from._tzm)) { - to._tzm = from._tzm; - } - if (!isUndefined(from._isUTC)) { - to._isUTC = from._isUTC; - } - if (!isUndefined(from._offset)) { - to._offset = from._offset; - } - if (!isUndefined(from._pf)) { - to._pf = getParsingFlags(from); - } - if (!isUndefined(from._locale)) { - to._locale = from._locale; - } - - if (momentProperties.length > 0) { - for (i in momentProperties) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } - } - } - - return to; - } - - var updateInProgress = false; - - // Moment prototype object - function Moment(config) { - copyConfig(this, config); - this._d = new Date(config._d != null ? config._d.getTime() : NaN); - // Prevent infinite loop in case updateOffset creates new moment - // objects. - if (updateInProgress === false) { - updateInProgress = true; - utils_hooks__hooks.updateOffset(this); - updateInProgress = false; - } - } - - function isMoment (obj) { - return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); - } - - function absFloor (number) { - if (number < 0) { - return Math.ceil(number); - } else { - return Math.floor(number); - } - } - - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; - - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); - } - - return value; - } - - // compare two arrays, return the number of differences - function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - for (i = 0; i < len; i++) { - if ((dontConvert && array1[i] !== array2[i]) || - (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { - diffs++; - } - } - return diffs + lengthDiff; - } - - function warn(msg) { - if (utils_hooks__hooks.suppressDeprecationWarnings === false && - (typeof console !== 'undefined') && console.warn) { - console.warn('Deprecation warning: ' + msg); - } - } - - function deprecate(msg, fn) { - var firstTime = true; - - return extend(function () { - if (utils_hooks__hooks.deprecationHandler != null) { - utils_hooks__hooks.deprecationHandler(null, msg); - } - if (firstTime) { - warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); - } - - var deprecations = {}; - - function deprecateSimple(name, msg) { - if (utils_hooks__hooks.deprecationHandler != null) { - utils_hooks__hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } - - utils_hooks__hooks.suppressDeprecationWarnings = false; - utils_hooks__hooks.deprecationHandler = null; - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - function isObject(input) { - return Object.prototype.toString.call(input) === '[object Object]'; - } - - function locale_set__set (config) { - var prop, i; - for (i in config) { - prop = config[i]; - if (isFunction(prop)) { - this[i] = prop; - } else { - this['_' + i] = prop; - } - } - this._config = config; - // Lenient ordinal parsing accepts just a number in addition to - // number + (possibly) stuff coming from _ordinalParseLenient. - this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source); - } - - function mergeConfigs(parentConfig, childConfig) { - var res = extend({}, parentConfig), prop; - for (prop in childConfig) { - if (hasOwnProp(childConfig, prop)) { - if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { - res[prop] = {}; - extend(res[prop], parentConfig[prop]); - extend(res[prop], childConfig[prop]); - } else if (childConfig[prop] != null) { - res[prop] = childConfig[prop]; - } else { - delete res[prop]; - } - } - } - return res; - } - - function Locale(config) { - if (config != null) { - this.set(config); - } - } - - var keys; - - if (Object.keys) { - keys = Object.keys; - } else { - keys = function (obj) { - var i, res = []; - for (i in obj) { - if (hasOwnProp(obj, i)) { - res.push(i); - } - } - return res; - }; - } - - // internal storage for locale config files - var locales = {}; - var globalLocale; - - function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } - - // pick the locale from the array - // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each - // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - function chooseLocale(names) { - var i = 0, j, next, locale, split; - - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - if (locale) { - return locale; - } - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return null; - } - - function loadLocale(name) { - var oldLocale = null; - // TODO: Find a better way to register and load all the locales in Node - if (!locales[name] && (typeof module !== 'undefined') && - module && module.exports) { - try { - oldLocale = globalLocale._abbr; - require('./locale/' + name); - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales - locale_locales__getSetGlobalLocale(oldLocale); - } catch (e) { } - } - return locales[name]; - } - - // This function will load locale and then set the global locale. If - // no arguments are passed in, it will simply return the current global - // locale key. - function locale_locales__getSetGlobalLocale (key, values) { - var data; - if (key) { - if (isUndefined(values)) { - data = locale_locales__getLocale(key); - } - else { - data = defineLocale(key, values); - } - - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } - } - - return globalLocale._abbr; - } - - function defineLocale (name, config) { - if (config !== null) { - config.abbr = name; - if (locales[name] != null) { - deprecateSimple('defineLocaleOverride', - 'use moment.updateLocale(localeName, config) to change ' + - 'an existing locale. moment.defineLocale(localeName, ' + - 'config) should only be used for creating a new locale'); - config = mergeConfigs(locales[name]._config, config); - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - config = mergeConfigs(locales[config.parentLocale]._config, config); - } else { - // treat as if there is no base config - deprecateSimple('parentLocaleUndefined', - 'specified parentLocale is not defined yet'); - } - } - locales[name] = new Locale(config); - - // backwards compat for now: also set the locale - locale_locales__getSetGlobalLocale(name); - - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } - } - - function updateLocale(name, config) { - if (config != null) { - var locale; - if (locales[name] != null) { - config = mergeConfigs(locales[name]._config, config); - } - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; - - // backwards compat for now: also set the locale - locale_locales__getSetGlobalLocale(name); - } else { - // pass null for config to unupdate, useful for tests - if (locales[name] != null) { - if (locales[name].parentLocale != null) { - locales[name] = locales[name].parentLocale; - } else if (locales[name] != null) { - delete locales[name]; - } - } - } - return locales[name]; - } - - // returns locale data - function locale_locales__getLocale (key) { - var locale; - - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } - - if (!key) { - return globalLocale; - } - - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; - } - key = [key]; - } - - return chooseLocale(key); - } - - function locale_locales__listLocales() { - return keys(locales); - } - - var aliases = {}; - - function addUnitAlias (unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; - } - - function normalizeUnits(units) { - return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; - } - - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; - - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } - } - - return normalizedInput; - } - - function makeGetSet (unit, keepTime) { - return function (value) { - if (value != null) { - get_set__set(this, unit, value); - utils_hooks__hooks.updateOffset(this, keepTime); - return this; - } else { - return get_set__get(this, unit); - } - }; - } - - function get_set__get (mom, unit) { - return mom.isValid() ? - mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; - } - - function get_set__set (mom, unit, value) { - if (mom.isValid()) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); - } - } - - // MOMENTS - - function getSet (units, value) { - var unit; - if (typeof units === 'object') { - for (unit in units) { - this.set(unit, units[unit]); - } - } else { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](value); - } - } - return this; - } - - function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, - sign = number >= 0; - return (sign ? (forceSign ? '+' : '') : '-') + - Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; - } - - var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; - - var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; - - var formatFunctions = {}; - - var formatTokenFunctions = {}; - - // token: 'M' - // padded: ['MM', 2] - // ordinal: 'Mo' - // callback: function () { this.month() + 1 } - function addFormatToken (token, padded, ordinal, callback) { - var func = callback; - if (typeof callback === 'string') { - func = function () { - return this[callback](); - }; - } - if (token) { - formatTokenFunctions[token] = func; - } - if (padded) { - formatTokenFunctions[padded[0]] = function () { - return zeroFill(func.apply(this, arguments), padded[1], padded[2]); - }; - } - if (ordinal) { - formatTokenFunctions[ordinal] = function () { - return this.localeData().ordinal(func.apply(this, arguments), token); - }; - } - } - - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } - return input.replace(/\\/g, ''); - } - - function makeFormatFunction(format) { - var array = format.match(formattingTokens), i, length; - - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } - - return function (mom) { - var output = '', i; - for (i = 0; i < length; i++) { - output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; - } - return output; - }; - } - - // format date using native date object - function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); - } - - format = expandFormat(format, m.localeData()); - formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); - - return formatFunctions[format](m); - } - - function expandFormat(format, locale) { - var i = 5; - - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } - - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } - - return format; - } - - var match1 = /\d/; // 0 - 9 - var match2 = /\d\d/; // 00 - 99 - var match3 = /\d{3}/; // 000 - 999 - var match4 = /\d{4}/; // 0000 - 9999 - var match6 = /[+-]?\d{6}/; // -999999 - 999999 - var match1to2 = /\d\d?/; // 0 - 99 - var match3to4 = /\d\d\d\d?/; // 999 - 9999 - var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 - var match1to3 = /\d{1,3}/; // 0 - 999 - var match1to4 = /\d{1,4}/; // 0 - 9999 - var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 - - var matchUnsigned = /\d+/; // 0 - inf - var matchSigned = /[+-]?\d+/; // -inf - inf - - var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z - var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z - - var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 - - // any word (or two) characters or numbers including two/three word month in arabic. - // includes scottish gaelic two word and hyphenated months - var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; - - - var regexes = {}; - - function addRegexToken (token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { - return (isStrict && strictRegex) ? strictRegex : regex; - }; - } - - function getParseRegexForToken (token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } - - return regexes[token](config._strict, config._locale); - } - - // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function unescapeFormat(s) { - return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - })); - } - - function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } - - var tokens = {}; - - function addParseToken (token, callback) { - var i, func = callback; - if (typeof token === 'string') { - token = [token]; - } - if (typeof callback === 'number') { - func = function (input, array) { - array[callback] = toInt(input); - }; - } - for (i = 0; i < token.length; i++) { - tokens[token[i]] = func; - } - } - - function addWeekParseToken (token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); - } - - function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } - } - - var YEAR = 0; - var MONTH = 1; - var DATE = 2; - var HOUR = 3; - var MINUTE = 4; - var SECOND = 5; - var MILLISECOND = 6; - var WEEK = 7; - var WEEKDAY = 8; - - var indexOf; - - if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; - } else { - indexOf = function (o) { - // I know - var i; - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - return -1; - }; - } - - function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); - } - - // FORMATTING - - addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; - }); - - addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); - }); - - addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); - }); - - // ALIASES - - addUnitAlias('month', 'M'); - - // PARSING - - addRegexToken('M', match1to2); - addRegexToken('MM', match1to2, match2); - addRegexToken('MMM', function (isStrict, locale) { - return locale.monthsShortRegex(isStrict); - }); - addRegexToken('MMMM', function (isStrict, locale) { - return locale.monthsRegex(isStrict); - }); - - addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; - }); - - addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { - var month = config._locale.monthsParse(input, token, config._strict); - // if we didn't find a month name, mark the date as invalid. - if (month != null) { - array[MONTH] = month; - } else { - getParsingFlags(config).invalidMonth = input; - } - }); - - // LOCALES - - var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/; - var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); - function localeMonths (m, format) { - return isArray(this._months) ? this._months[m.month()] : - this._months[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; - } - - var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); - function localeMonthsShort (m, format) { - return isArray(this._monthsShort) ? this._monthsShort[m.month()] : - this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; - } - - function units_month__handleStrictParse(monthName, format, strict) { - var i, ii, mom, llc = monthName.toLocaleLowerCase(); - if (!this._monthsParse) { - // this is not used - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - for (i = 0; i < 12; ++i) { - mom = create_utc__createUTC([2000, i]); - this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); - this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeMonthsParse (monthName, format, strict) { - var i, mom, regex; - - if (this._monthsParseExact) { - return units_month__handleStrictParse.call(this, monthName, format, strict); - } - - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - } - - // TODO: add sorting - // Sorting makes sure if one month (or abbr) is a prefix of another - // see sorting in computeMonthsParse - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, i]); - if (strict && !this._longMonthsParse[i]) { - this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); - this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); - } - if (!strict && !this._monthsParse[i]) { - regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { - return i; - } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { - return i; - } else if (!strict && this._monthsParse[i].test(monthName)) { - return i; - } - } - } - - // MOMENTS - - function setMonth (mom, value) { - var dayOfMonth; - - if (!mom.isValid()) { - // No op - return mom; - } - - if (typeof value === 'string') { - if (/^\d+$/.test(value)) { - value = toInt(value); - } else { - value = mom.localeData().monthsParse(value); - // TODO: Another silent failure? - if (typeof value !== 'number') { - return mom; - } - } - } - - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; - } - - function getSetMonth (value) { - if (value != null) { - setMonth(this, value); - utils_hooks__hooks.updateOffset(this, true); - return this; - } else { - return get_set__get(this, 'Month'); - } - } - - function getDaysInMonth () { - return daysInMonth(this.year(), this.month()); - } - - var defaultMonthsShortRegex = matchWord; - function monthsShortRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsShortStrictRegex; - } else { - return this._monthsShortRegex; - } - } else { - return this._monthsShortStrictRegex && isStrict ? - this._monthsShortStrictRegex : this._monthsShortRegex; - } - } - - var defaultMonthsRegex = matchWord; - function monthsRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsStrictRegex; - } else { - return this._monthsRegex; - } - } else { - return this._monthsStrictRegex && isStrict ? - this._monthsStrictRegex : this._monthsRegex; - } - } - - function computeMonthsParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var shortPieces = [], longPieces = [], mixedPieces = [], - i, mom; - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, i]); - shortPieces.push(this.monthsShort(mom, '')); - longPieces.push(this.months(mom, '')); - mixedPieces.push(this.months(mom, '')); - mixedPieces.push(this.monthsShort(mom, '')); - } - // Sorting makes sure if one month (or abbr) is a prefix of another it - // will match the longer piece. - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 12; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._monthsShortRegex = this._monthsRegex; - this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - } - - function checkOverflow (m) { - var overflow; - var a = m._a; - - if (a && getParsingFlags(m).overflow === -2) { - overflow = - a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : - a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : - a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : - a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : - a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : - a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : - -1; - - if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { - overflow = DATE; - } - if (getParsingFlags(m)._overflowWeeks && overflow === -1) { - overflow = WEEK; - } - if (getParsingFlags(m)._overflowWeekday && overflow === -1) { - overflow = WEEKDAY; - } - - getParsingFlags(m).overflow = overflow; - } - - return m; - } - - // iso 8601 regex - // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) - var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - - var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; - - var isoDates = [ - ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], - ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], - ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], - ['GGGG-[W]WW', /\d{4}-W\d\d/, false], - ['YYYY-DDD', /\d{4}-\d{3}/], - ['YYYY-MM', /\d{4}-\d\d/, false], - ['YYYYYYMMDD', /[+-]\d{10}/], - ['YYYYMMDD', /\d{8}/], - // YYYYMM is NOT allowed by the standard - ['GGGG[W]WWE', /\d{4}W\d{3}/], - ['GGGG[W]WW', /\d{4}W\d{2}/, false], - ['YYYYDDD', /\d{7}/] - ]; - - // iso time formats and regexes - var isoTimes = [ - ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], - ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], - ['HH:mm:ss', /\d\d:\d\d:\d\d/], - ['HH:mm', /\d\d:\d\d/], - ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], - ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], - ['HHmmss', /\d\d\d\d\d\d/], - ['HHmm', /\d\d\d\d/], - ['HH', /\d\d/] - ]; - - var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; - - // date from iso format - function configFromISO(config) { - var i, l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, dateFormat, timeFormat, tzFormat; - - if (match) { - getParsingFlags(config).iso = true; - - for (i = 0, l = isoDates.length; i < l; i++) { - if (isoDates[i][1].exec(match[1])) { - dateFormat = isoDates[i][0]; - allowTime = isoDates[i][2] !== false; - break; - } - } - if (dateFormat == null) { - config._isValid = false; - return; - } - if (match[3]) { - for (i = 0, l = isoTimes.length; i < l; i++) { - if (isoTimes[i][1].exec(match[3])) { - // match[2] should be 'T' or space - timeFormat = (match[2] || ' ') + isoTimes[i][0]; - break; - } - } - if (timeFormat == null) { - config._isValid = false; - return; - } - } - if (!allowTime && timeFormat != null) { - config._isValid = false; - return; - } - if (match[4]) { - if (tzRegex.exec(match[4])) { - tzFormat = 'Z'; - } else { - config._isValid = false; - return; - } - } - config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); - configFromStringAndFormat(config); - } else { - config._isValid = false; - } - } - - // date from iso format or fallback - function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); - - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } - - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - utils_hooks__hooks.createFromInputFallback(config); - } - } - - utils_hooks__hooks.createFromInputFallback = deprecate( - 'moment construction falls back to js Date. This is ' + - 'discouraged and will be removed in upcoming major ' + - 'release. Please refer to ' + - 'https://github.com/moment/moment/issues/1407 for more info.', - function (config) { - config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); - } - ); - - function createDate (y, m, d, h, M, s, ms) { - //can't just apply() to create a date: - //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply - var date = new Date(y, m, d, h, M, s, ms); - - //the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); - } - return date; - } - - function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); - - //the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); - } - return date; - } - - // FORMATTING - - addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; - }); - - addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; - }); - - addFormatToken(0, ['YYYY', 4], 0, 'year'); - addFormatToken(0, ['YYYYY', 5], 0, 'year'); - addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - - // ALIASES - - addUnitAlias('year', 'y'); - - // PARSING - - addRegexToken('Y', matchSigned); - addRegexToken('YY', match1to2, match2); - addRegexToken('YYYY', match1to4, match4); - addRegexToken('YYYYY', match1to6, match6); - addRegexToken('YYYYYY', match1to6, match6); - - addParseToken(['YYYYY', 'YYYYYY'], YEAR); - addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input); - }); - addParseToken('YY', function (input, array) { - array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input); - }); - addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); - }); - - // HELPERS - - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } - - function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - } - - // HOOKS - - utils_hooks__hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); - }; - - // MOMENTS - - var getSetYear = makeGetSet('FullYear', true); - - function getIsLeapYear () { - return isLeapYear(this.year()); - } - - // start-of-first-week - start-of-year - function firstWeekOffset(year, dow, doy) { - var // first-week day -- which january is always in the first week (4 for iso, 1 for other) - fwd = 7 + dow - doy, - // first-week day local weekday -- which local weekday is fwd - fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; - - return -fwdlw + fwd - 1; - } - - //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - function dayOfYearFromWeeks(year, week, weekday, dow, doy) { - var localWeekday = (7 + weekday - dow) % 7, - weekOffset = firstWeekOffset(year, dow, doy), - dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, - resYear, resDayOfYear; - - if (dayOfYear <= 0) { - resYear = year - 1; - resDayOfYear = daysInYear(resYear) + dayOfYear; - } else if (dayOfYear > daysInYear(year)) { - resYear = year + 1; - resDayOfYear = dayOfYear - daysInYear(year); - } else { - resYear = year; - resDayOfYear = dayOfYear; - } - - return { - year: resYear, - dayOfYear: resDayOfYear - }; - } - - function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, resYear; - - if (week < 1) { - resYear = mom.year() - 1; - resWeek = week + weeksInYear(resYear, dow, doy); - } else if (week > weeksInYear(mom.year(), dow, doy)) { - resWeek = week - weeksInYear(mom.year(), dow, doy); - resYear = mom.year() + 1; - } else { - resYear = mom.year(); - resWeek = week; - } - - return { - week: resWeek, - year: resYear - }; - } - - function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(utils_hooks__hooks.now()); - if (config._useUTC) { - return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; - } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; - } - - // convert an array to a date. - // the array should mirror the parameters below - // note: all values past the year are optional and will default to the lowest possible value. - // [year, month, day , hour, minute, second, millisecond] - function configFromArray (config) { - var i, date, input = [], currentDate, yearToUse; - - if (config._d) { - return; - } - - currentDate = currentDateArray(config); - - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } - - //if the day of the year is set, figure out what it is - if (config._dayOfYear) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); - - if (config._dayOfYear > daysInYear(yearToUse)) { - getParsingFlags(config)._overflowDayOfYear = true; - } - - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } - - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } - - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; - } - - // Check for 24:00:00.000 - if (config._a[HOUR] === 24 && - config._a[MINUTE] === 0 && - config._a[SECOND] === 0 && - config._a[MILLISECOND] === 0) { - config._nextDay = true; - config._a[HOUR] = 0; - } - - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } - - if (config._nextDay) { - config._a[HOUR] = 24; - } - } - - function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; - - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; - - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } - } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; - - weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year); - week = defaults(w.w, 1); - - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to begining of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } - } - - // constant that refers to the ISO standard - utils_hooks__hooks.ISO_8601 = function () {}; - - // date from string and format string - function configFromStringAndFormat(config) { - // TODO: Move this to another part of the creation flow to prevent circular deps - if (config._f === utils_hooks__hooks.ISO_8601) { - configFromISO(config); - return; - } - - config._a = []; - getParsingFlags(config).empty = true; - - // This array is used to make a Date, either with `new Date` or `Date.UTC` - var string = '' + config._i, - i, parsedInput, tokens, token, skipped, - stringLength = string.length, - totalParsedInputLength = 0; - - tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; - - for (i = 0; i < tokens.length; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; - // console.log('token', token, 'parsedInput', parsedInput, - // 'regex', getParseRegexForToken(token, config)); - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - getParsingFlags(config).unusedInput.push(skipped); - } - string = string.slice(string.indexOf(parsedInput) + parsedInput.length); - totalParsedInputLength += parsedInput.length; - } - // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - getParsingFlags(config).empty = false; - } - else { - getParsingFlags(config).unusedTokens.push(token); - } - addTimeToArrayFromToken(token, parsedInput, config); - } - else if (config._strict && !parsedInput) { - getParsingFlags(config).unusedTokens.push(token); - } - } - - // add remaining unparsed input length to the string - getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; - if (string.length > 0) { - getParsingFlags(config).unusedInput.push(string); - } - - // clear _12h flag if hour is <= 12 - if (getParsingFlags(config).bigHour === true && - config._a[HOUR] <= 12 && - config._a[HOUR] > 0) { - getParsingFlags(config).bigHour = undefined; - } - - getParsingFlags(config).parsedDateParts = config._a.slice(0); - getParsingFlags(config).meridiem = config._meridiem; - // handle meridiem - config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); - - configFromArray(config); - checkOverflow(config); - } - - - function meridiemFixWrap (locale, hour, meridiem) { - var isPm; - - if (meridiem == null) { - // nothing to do - return hour; - } - if (locale.meridiemHour != null) { - return locale.meridiemHour(hour, meridiem); - } else if (locale.isPM != null) { - // Fallback - isPm = locale.isPM(meridiem); - if (isPm && hour < 12) { - hour += 12; - } - if (!isPm && hour === 12) { - hour = 0; - } - return hour; - } else { - // this is not supposed to happen - return hour; - } - } - - // date from string and array of format strings - function configFromStringAndArray(config) { - var tempConfig, - bestMoment, - - scoreToBeat, - i, - currentScore; - - if (config._f.length === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } - - for (i = 0; i < config._f.length; i++) { - currentScore = 0; - tempConfig = copyConfig({}, config); - if (config._useUTC != null) { - tempConfig._useUTC = config._useUTC; - } - tempConfig._f = config._f[i]; - configFromStringAndFormat(tempConfig); - - if (!valid__isValid(tempConfig)) { - continue; - } - - // if there is any input that was not parsed add a penalty for that format - currentScore += getParsingFlags(tempConfig).charsLeftOver; - - //or tokens - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - - getParsingFlags(tempConfig).score = currentScore; - - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - } - } - - extend(config, bestMoment || tempConfig); - } - - function configFromObject(config) { - if (config._d) { - return; - } - - var i = normalizeObjectUnits(config._i); - config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { - return obj && parseInt(obj, 10); - }); - - configFromArray(config); - } - - function createFromConfig (config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } - - return res; - } - - function prepareConfig (config) { - var input = config._i, - format = config._f; - - config._locale = config._locale || locale_locales__getLocale(config._l); - - if (input === null || (format === undefined && input === '')) { - return valid__createInvalid({nullInput: true}); - } - - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } - - if (isMoment(input)) { - return new Moment(checkOverflow(input)); - } else if (isArray(format)) { - configFromStringAndArray(config); - } else if (format) { - configFromStringAndFormat(config); - } else if (isDate(input)) { - config._d = input; - } else { - configFromInput(config); - } - - if (!valid__isValid(config)) { - config._d = null; - } - - return config; - } - - function configFromInput(config) { - var input = config._i; - if (input === undefined) { - config._d = new Date(utils_hooks__hooks.now()); - } else if (isDate(input)) { - config._d = new Date(input.valueOf()); - } else if (typeof input === 'string') { - configFromString(config); - } else if (isArray(input)) { - config._a = map(input.slice(0), function (obj) { - return parseInt(obj, 10); - }); - configFromArray(config); - } else if (typeof(input) === 'object') { - configFromObject(config); - } else if (typeof(input) === 'number') { - // from milliseconds - config._d = new Date(input); - } else { - utils_hooks__hooks.createFromInputFallback(config); - } - } - - function createLocalOrUTC (input, format, locale, strict, isUTC) { - var c = {}; - - if (typeof(locale) === 'boolean') { - strict = locale; - locale = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c._isAMomentObject = true; - c._useUTC = c._isUTC = isUTC; - c._l = locale; - c._i = input; - c._f = format; - c._strict = strict; - - return createFromConfig(c); - } - - function local__createLocal (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); - } - - var prototypeMin = deprecate( - 'moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548', - function () { - var other = local__createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other < this ? this : other; - } else { - return valid__createInvalid(); - } - } - ); - - var prototypeMax = deprecate( - 'moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548', - function () { - var other = local__createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other > this ? this : other; - } else { - return valid__createInvalid(); - } - } - ); - - // Pick a moment m from moments so that m[fn](other) is true for all - // other. This relies on the function fn to be transitive. - // - // moments should either be an array of moment objects or an array, whose - // first element is an array of moment objects. - function pickBy(fn, moments) { - var res, i; - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - if (!moments.length) { - return local__createLocal(); - } - res = moments[0]; - for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { - res = moments[i]; - } - } - return res; - } - - // TODO: Use [].sort instead? - function min () { - var args = [].slice.call(arguments, 0); - - return pickBy('isBefore', args); - } - - function max () { - var args = [].slice.call(arguments, 0); - - return pickBy('isAfter', args); - } - - var now = function () { - return Date.now ? Date.now() : +(new Date()); - }; - - function Duration (duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; - - // representation for dateAddRemove - this._milliseconds = +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + - weeks * 7; - // It is impossible translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - this._months = +months + - quarters * 3 + - years * 12; - - this._data = {}; - - this._locale = locale_locales__getLocale(); - - this._bubble(); - } - - function isDuration (obj) { - return obj instanceof Duration; - } - - // FORMATTING - - function offset (token, separator) { - addFormatToken(token, 0, 0, function () { - var offset = this.utcOffset(); - var sign = '+'; - if (offset < 0) { - offset = -offset; - sign = '-'; - } - return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); - }); - } - - offset('Z', ':'); - offset('ZZ', ''); - - // PARSING - - addRegexToken('Z', matchShortOffset); - addRegexToken('ZZ', matchShortOffset); - addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); - }); - - // HELPERS - - // timezone chunker - // '+10:00' > ['10', '00'] - // '-1530' > ['-15', '30'] - var chunkOffset = /([\+\-]|\d\d)/gi; - - function offsetFromString(matcher, string) { - var matches = ((string || '').match(matcher) || []); - var chunk = matches[matches.length - 1] || []; - var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - var minutes = +(parts[1] * 60) + toInt(parts[2]); - - return parts[0] === '+' ? minutes : -minutes; - } - - // Return a moment from input, that is local/utc/zone equivalent to model. - function cloneWithOffset(input, model) { - var res, diff; - if (model._isUTC) { - res = model.clone(); - diff = (isMoment(input) || isDate(input) ? input.valueOf() : local__createLocal(input).valueOf()) - res.valueOf(); - // Use low-level api, because this fn is low-level api. - res._d.setTime(res._d.valueOf() + diff); - utils_hooks__hooks.updateOffset(res, false); - return res; - } else { - return local__createLocal(input).local(); - } - } - - function getDateOffset (m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset() / 15) * 15; - } - - // HOOKS - - // This function will be called whenever a moment is mutated. - // It is intended to keep the offset in sync with the timezone. - utils_hooks__hooks.updateOffset = function () {}; - - // MOMENTS - - // keepLocalTime = true means only change the timezone, without - // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> - // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset - // +0200, so we adjust the time as needed, to be valid. - // - // Keeping the time actually adds/subtracts (one hour) - // from the actual represented time. That is why we call updateOffset - // a second time. In case it wants us to change the offset again - // _changeInProgress == true case, then we have to adjust, because - // there is no such time in the given timezone. - function getSetOffset (input, keepLocalTime) { - var offset = this._offset || 0, - localAdjust; - if (!this.isValid()) { - return input != null ? this : NaN; - } - if (input != null) { - if (typeof input === 'string') { - input = offsetFromString(matchShortOffset, input); - } else if (Math.abs(input) < 16) { - input = input * 60; - } - if (!this._isUTC && keepLocalTime) { - localAdjust = getDateOffset(this); - } - this._offset = input; - this._isUTC = true; - if (localAdjust != null) { - this.add(localAdjust, 'm'); - } - if (offset !== input) { - if (!keepLocalTime || this._changeInProgress) { - add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - utils_hooks__hooks.updateOffset(this, true); - this._changeInProgress = null; - } - } - return this; - } else { - return this._isUTC ? offset : getDateOffset(this); - } - } - - function getSetZone (input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } - - this.utcOffset(input, keepLocalTime); - - return this; - } else { - return -this.utcOffset(); - } - } - - function setOffsetToUTC (keepLocalTime) { - return this.utcOffset(0, keepLocalTime); - } - - function setOffsetToLocal (keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; - - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - return this; - } - - function setOffsetToParsedOffset () { - if (this._tzm) { - this.utcOffset(this._tzm); - } else if (typeof this._i === 'string') { - this.utcOffset(offsetFromString(matchOffset, this._i)); - } - return this; - } - - function hasAlignedHourOffset (input) { - if (!this.isValid()) { - return false; - } - input = input ? local__createLocal(input).utcOffset() : 0; - - return (this.utcOffset() - input) % 60 === 0; - } - - function isDaylightSavingTime () { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); - } - - function isDaylightSavingTimeShifted () { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } - - var c = {}; - - copyConfig(c, this); - c = prepareConfig(c); - - if (c._a) { - var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a); - this._isDSTShifted = this.isValid() && - compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; - } - - return this._isDSTShifted; - } - - function isLocal () { - return this.isValid() ? !this._isUTC : false; - } - - function isUtcOffset () { - return this.isValid() ? this._isUTC : false; - } - - function isUtc () { - return this.isValid() ? this._isUTC && this._offset === 0 : false; - } - - // ASP.NET json date format regex - var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/; - - // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html - // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere - // and further modified to allow for strings containing both week and day - var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; - - function create__createDuration (input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - diffRes; - - if (isDuration(input)) { - duration = { - ms : input._milliseconds, - d : input._days, - M : input._months - }; - } else if (typeof input === 'number') { - duration = {}; - if (key) { - duration[key] = input; - } else { - duration.milliseconds = input; - } - } else if (!!(match = aspNetRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : 0, - d : toInt(match[DATE]) * sign, - h : toInt(match[HOUR]) * sign, - m : toInt(match[MINUTE]) * sign, - s : toInt(match[SECOND]) * sign, - ms : toInt(match[MILLISECOND]) * sign - }; - } else if (!!(match = isoRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : parseIso(match[2], sign), - M : parseIso(match[3], sign), - w : parseIso(match[4], sign), - d : parseIso(match[5], sign), - h : parseIso(match[6], sign), - m : parseIso(match[7], sign), - s : parseIso(match[8], sign) - }; - } else if (duration == null) {// checks for null or undefined - duration = {}; - } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { - diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to)); - - duration = {}; - duration.ms = diffRes.milliseconds; - duration.M = diffRes.months; - } - - ret = new Duration(duration); - - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } - - return ret; - } - - create__createDuration.fn = Duration.prototype; - - function parseIso (inp, sign) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); - // apply sign while we're at it - return (isNaN(res) ? 0 : res) * sign; - } - - function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; - - res.months = other.month() - base.month() + - (other.year() - base.year()) * 12; - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } - - res.milliseconds = +other - +(base.clone().add(res.months, 'M')); - - return res; - } - - function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return {milliseconds: 0, months: 0}; - } - - other = cloneWithOffset(other, base); - if (base.isBefore(other)) { - res = positiveMomentsDifference(base, other); - } else { - res = positiveMomentsDifference(other, base); - res.milliseconds = -res.milliseconds; - res.months = -res.months; - } - - return res; - } - - function absRound (number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } - } - - // TODO: remove 'name' arg after deprecation is removed - function createAdder(direction, name) { - return function (val, period) { - var dur, tmp; - //invert the arguments, but complain about it - if (period !== null && !isNaN(+period)) { - deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).'); - tmp = val; val = period; period = tmp; - } - - val = typeof val === 'string' ? +val : val; - dur = create__createDuration(val, period); - add_subtract__addSubtract(this, dur, direction); - return this; - }; - } - - function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); - - if (!mom.isValid()) { - // No op - return; - } - - updateOffset = updateOffset == null ? true : updateOffset; - - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); - } - if (days) { - get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding); - } - if (months) { - setMonth(mom, get_set__get(mom, 'Month') + months * isAdding); - } - if (updateOffset) { - utils_hooks__hooks.updateOffset(mom, days || months); - } - } - - var add_subtract__add = createAdder(1, 'add'); - var add_subtract__subtract = createAdder(-1, 'subtract'); - - function moment_calendar__calendar (time, formats) { - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're local/utc/offset or not. - var now = time || local__createLocal(), - sod = cloneWithOffset(now, this).startOf('day'), - diff = this.diff(sod, 'days', true), - format = diff < -6 ? 'sameElse' : - diff < -1 ? 'lastWeek' : - diff < 0 ? 'lastDay' : - diff < 1 ? 'sameDay' : - diff < 2 ? 'nextDay' : - diff < 7 ? 'nextWeek' : 'sameElse'; - - var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]); - - return this.format(output || this.localeData().calendar(format, this, local__createLocal(now))); - } - - function clone () { - return new Moment(this); - } - - function isAfter (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } - } - - function isBefore (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } - } - - function isBetween (from, to, units, inclusivity) { - inclusivity = inclusivity || '()'; - return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && - (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); - } - - function isSame (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input), - inputMs; - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units || 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() === localInput.valueOf(); - } else { - inputMs = localInput.valueOf(); - return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); - } - } - - function isSameOrAfter (input, units) { - return this.isSame(input, units) || this.isAfter(input,units); - } - - function isSameOrBefore (input, units) { - return this.isSame(input, units) || this.isBefore(input,units); - } - - function diff (input, units, asFloat) { - var that, - zoneDelta, - delta, output; - - if (!this.isValid()) { - return NaN; - } - - that = cloneWithOffset(input, this); - - if (!that.isValid()) { - return NaN; - } - - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - - units = normalizeUnits(units); - - if (units === 'year' || units === 'month' || units === 'quarter') { - output = monthDiff(this, that); - if (units === 'quarter') { - output = output / 3; - } else if (units === 'year') { - output = output / 12; - } - } else { - delta = this - that; - output = units === 'second' ? delta / 1e3 : // 1000 - units === 'minute' ? delta / 6e4 : // 1000 * 60 - units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - delta; - } - return asFloat ? output : absFloor(output); - } - - function monthDiff (a, b) { - // difference in months - var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), - // b is in (anchor - 1 month, anchor + 1 month) - anchor = a.clone().add(wholeMonthDiff, 'months'), - anchor2, adjust; - - if (b - anchor < 0) { - anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor - anchor2); - } else { - anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor2 - anchor); - } - - //check for negative zero, return zero if negative zero - return -(wholeMonthDiff + adjust) || 0; - } - - utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - utils_hooks__hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; - - function toString () { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); - } - - function moment_format__toISOString () { - var m = this.clone().utc(); - if (0 < m.year() && m.year() <= 9999) { - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - return this.toDate().toISOString(); - } else { - return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } else { - return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } - - function format (inputString) { - if (!inputString) { - inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat; - } - var output = formatMoment(this, inputString); - return this.localeData().postformat(output); - } - - function from (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - local__createLocal(time).isValid())) { - return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function fromNow (withoutSuffix) { - return this.from(local__createLocal(), withoutSuffix); - } - - function to (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - local__createLocal(time).isValid())) { - return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function toNow (withoutSuffix) { - return this.to(local__createLocal(), withoutSuffix); - } - - // If passed a locale key, it will set the locale for this - // instance. Otherwise, it will return the locale configuration - // variables for this instance. - function locale (key) { - var newLocaleData; - - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = locale_locales__getLocale(key); - if (newLocaleData != null) { - this._locale = newLocaleData; - } - return this; - } - } - - var lang = deprecate( - 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', - function (key) { - if (key === undefined) { - return this.localeData(); - } else { - return this.locale(key); - } - } - ); - - function localeData () { - return this._locale; - } - - function startOf (units) { - units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. - switch (units) { - case 'year': - this.month(0); - /* falls through */ - case 'quarter': - case 'month': - this.date(1); - /* falls through */ - case 'week': - case 'isoWeek': - case 'day': - case 'date': - this.hours(0); - /* falls through */ - case 'hour': - this.minutes(0); - /* falls through */ - case 'minute': - this.seconds(0); - /* falls through */ - case 'second': - this.milliseconds(0); - } - - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); - } - - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); - } - - return this; - } - - function endOf (units) { - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { - return this; - } - - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; - } - - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); - } - - function to_type__valueOf () { - return this._d.valueOf() - ((this._offset || 0) * 60000); - } - - function unix () { - return Math.floor(this.valueOf() / 1000); - } - - function toDate () { - return this._offset ? new Date(this.valueOf()) : this._d; - } - - function toArray () { - var m = this; - return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; - } - - function toObject () { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() - }; - } - - function toJSON () { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; - } - - function moment_valid__isValid () { - return valid__isValid(this); - } - - function parsingFlags () { - return extend({}, getParsingFlags(this)); - } - - function invalidAt () { - return getParsingFlags(this).overflow; - } - - function creationData() { - return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict - }; - } - - // FORMATTING - - addFormatToken(0, ['gg', 2], 0, function () { - return this.weekYear() % 100; - }); - - addFormatToken(0, ['GG', 2], 0, function () { - return this.isoWeekYear() % 100; - }); - - function addWeekYearFormatToken (token, getter) { - addFormatToken(0, [token, token.length], 0, getter); - } - - addWeekYearFormatToken('gggg', 'weekYear'); - addWeekYearFormatToken('ggggg', 'weekYear'); - addWeekYearFormatToken('GGGG', 'isoWeekYear'); - addWeekYearFormatToken('GGGGG', 'isoWeekYear'); - - // ALIASES - - addUnitAlias('weekYear', 'gg'); - addUnitAlias('isoWeekYear', 'GG'); - - // PARSING - - addRegexToken('G', matchSigned); - addRegexToken('g', matchSigned); - addRegexToken('GG', match1to2, match2); - addRegexToken('gg', match1to2, match2); - addRegexToken('GGGG', match1to4, match4); - addRegexToken('gggg', match1to4, match4); - addRegexToken('GGGGG', match1to6, match6); - addRegexToken('ggggg', match1to6, match6); - - addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); - }); - - addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = utils_hooks__hooks.parseTwoDigitYear(input); - }); - - // MOMENTS - - function getSetWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, - this.week(), - this.weekday(), - this.localeData()._week.dow, - this.localeData()._week.doy); - } - - function getSetISOWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, this.isoWeek(), this.isoWeekday(), 1, 4); - } - - function getISOWeeksInYear () { - return weeksInYear(this.year(), 1, 4); - } - - function getWeeksInYear () { - var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); - } - - function getSetWeekYearHelper(input, week, weekday, dow, doy) { - var weeksTarget; - if (input == null) { - return weekOfYear(this, dow, doy).year; - } else { - weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; - } - return setWeekAll.call(this, input, week, weekday, dow, doy); - } - } - - function setWeekAll(weekYear, week, weekday, dow, doy) { - var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), - date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); - - this.year(date.getUTCFullYear()); - this.month(date.getUTCMonth()); - this.date(date.getUTCDate()); - return this; - } - - // FORMATTING - - addFormatToken('Q', 0, 'Qo', 'quarter'); - - // ALIASES - - addUnitAlias('quarter', 'Q'); - - // PARSING - - addRegexToken('Q', match1); - addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; - }); - - // MOMENTS - - function getSetQuarter (input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); - } - - // FORMATTING - - addFormatToken('w', ['ww', 2], 'wo', 'week'); - addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); - - // ALIASES - - addUnitAlias('week', 'w'); - addUnitAlias('isoWeek', 'W'); - - // PARSING - - addRegexToken('w', match1to2); - addRegexToken('ww', match1to2, match2); - addRegexToken('W', match1to2); - addRegexToken('WW', match1to2, match2); - - addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); - }); - - // HELPERS - - // LOCALES - - function localeWeek (mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - } - - var defaultLocaleWeek = { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - }; - - function localeFirstDayOfWeek () { - return this._week.dow; - } - - function localeFirstDayOfYear () { - return this._week.doy; - } - - // MOMENTS - - function getSetWeek (input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - function getSetISOWeek (input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - // FORMATTING - - addFormatToken('D', ['DD', 2], 'Do', 'date'); - - // ALIASES - - addUnitAlias('date', 'D'); - - // PARSING - - addRegexToken('D', match1to2); - addRegexToken('DD', match1to2, match2); - addRegexToken('Do', function (isStrict, locale) { - return isStrict ? locale._ordinalParse : locale._ordinalParseLenient; - }); - - addParseToken(['D', 'DD'], DATE); - addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0], 10); - }); - - // MOMENTS - - var getSetDayOfMonth = makeGetSet('Date', true); - - // FORMATTING - - addFormatToken('d', 0, 'do', 'day'); - - addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); - }); - - addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); - }); - - addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); - }); - - addFormatToken('e', 0, 0, 'weekday'); - addFormatToken('E', 0, 0, 'isoWeekday'); - - // ALIASES - - addUnitAlias('day', 'd'); - addUnitAlias('weekday', 'e'); - addUnitAlias('isoWeekday', 'E'); - - // PARSING - - addRegexToken('d', match1to2); - addRegexToken('e', match1to2); - addRegexToken('E', match1to2); - addRegexToken('dd', function (isStrict, locale) { - return locale.weekdaysMinRegex(isStrict); - }); - addRegexToken('ddd', function (isStrict, locale) { - return locale.weekdaysShortRegex(isStrict); - }); - addRegexToken('dddd', function (isStrict, locale) { - return locale.weekdaysRegex(isStrict); - }); - - addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { - var weekday = config._locale.weekdaysParse(input, token, config._strict); - // if we didn't get a weekday name, mark the date as invalid - if (weekday != null) { - week.d = weekday; - } else { - getParsingFlags(config).invalidWeekday = input; - } - }); - - addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); - }); - - // HELPERS - - function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } - - if (!isNaN(input)) { - return parseInt(input, 10); - } - - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; - } - - return null; - } - - // LOCALES - - var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); - function localeWeekdays (m, format) { - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; - } - - var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); - function localeWeekdaysShort (m) { - return this._weekdaysShort[m.day()]; - } - - var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); - function localeWeekdaysMin (m) { - return this._weekdaysMin[m.day()]; - } - - function day_of_week__handleStrictParse(weekdayName, format, strict) { - var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; - - for (i = 0; i < 7; ++i) { - mom = create_utc__createUTC([2000, 1]).day(i); - this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); - this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); - this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeWeekdaysParse (weekdayName, format, strict) { - var i, mom, regex; - - if (this._weekdaysParseExact) { - return day_of_week__handleStrictParse.call(this, weekdayName, format, strict); - } - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } - - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - - mom = create_utc__createUTC([2000, 1]).day(i); - if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); - this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); - this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); - } - if (!this._weekdaysParse[i]) { - regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { - return i; - } - } - } - - // MOMENTS - - function getSetDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - if (input != null) { - input = parseWeekday(input, this.localeData()); - return this.add(input - day, 'd'); - } else { - return day; - } - } - - function getSetLocaleDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; - return input == null ? weekday : this.add(input - weekday, 'd'); - } - - function getSetISODayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. - return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); - } - - var defaultWeekdaysRegex = matchWord; - function weekdaysRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysStrictRegex; - } else { - return this._weekdaysRegex; - } - } else { - return this._weekdaysStrictRegex && isStrict ? - this._weekdaysStrictRegex : this._weekdaysRegex; - } - } - - var defaultWeekdaysShortRegex = matchWord; - function weekdaysShortRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysShortStrictRegex; - } else { - return this._weekdaysShortRegex; - } - } else { - return this._weekdaysShortStrictRegex && isStrict ? - this._weekdaysShortStrictRegex : this._weekdaysShortRegex; - } - } - - var defaultWeekdaysMinRegex = matchWord; - function weekdaysMinRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysMinStrictRegex; - } else { - return this._weekdaysMinRegex; - } - } else { - return this._weekdaysMinStrictRegex && isStrict ? - this._weekdaysMinStrictRegex : this._weekdaysMinRegex; - } - } - - - function computeWeekdaysParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], - i, mom, minp, shortp, longp; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, 1]).day(i); - minp = this.weekdaysMin(mom, ''); - shortp = this.weekdaysShort(mom, ''); - longp = this.weekdays(mom, ''); - minPieces.push(minp); - shortPieces.push(shortp); - longPieces.push(longp); - mixedPieces.push(minp); - mixedPieces.push(shortp); - mixedPieces.push(longp); - } - // Sorting makes sure if one weekday (or abbr) is a prefix of another it - // will match the longer piece. - minPieces.sort(cmpLenRev); - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 7; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._weekdaysShortRegex = this._weekdaysRegex; - this._weekdaysMinRegex = this._weekdaysRegex; - - this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); - } - - // FORMATTING - - addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); - - // ALIASES - - addUnitAlias('dayOfYear', 'DDD'); - - // PARSING - - addRegexToken('DDD', match1to3); - addRegexToken('DDDD', match3); - addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); - }); - - // HELPERS - - // MOMENTS - - function getSetDayOfYear (input) { - var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; - return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); - } - - // FORMATTING - - function hFormat() { - return this.hours() % 12 || 12; - } - - function kFormat() { - return this.hours() || 24; - } - - addFormatToken('H', ['HH', 2], 0, 'hour'); - addFormatToken('h', ['hh', 2], 0, hFormat); - addFormatToken('k', ['kk', 2], 0, kFormat); - - addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); - }); - - addFormatToken('hmmss', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); - - addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); - }); - - addFormatToken('Hmmss', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); - - function meridiem (token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); - }); - } - - meridiem('a', true); - meridiem('A', false); - - // ALIASES - - addUnitAlias('hour', 'h'); - - // PARSING - - function matchMeridiem (isStrict, locale) { - return locale._meridiemParse; - } - - addRegexToken('a', matchMeridiem); - addRegexToken('A', matchMeridiem); - addRegexToken('H', match1to2); - addRegexToken('h', match1to2); - addRegexToken('HH', match1to2, match2); - addRegexToken('hh', match1to2, match2); - - addRegexToken('hmm', match3to4); - addRegexToken('hmmss', match5to6); - addRegexToken('Hmm', match3to4); - addRegexToken('Hmmss', match5to6); - - addParseToken(['H', 'HH'], HOUR); - addParseToken(['a', 'A'], function (input, array, config) { - config._isPm = config._locale.isPM(input); - config._meridiem = input; - }); - addParseToken(['h', 'hh'], function (input, array, config) { - array[HOUR] = toInt(input); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('Hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - }); - addParseToken('Hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - }); - - // LOCALES - - function localeIsPM (input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return ((input + '').toLowerCase().charAt(0) === 'p'); - } - - var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; - function localeMeridiem (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } - } - - - // MOMENTS - - // Setting the hour should keep the time, because the user explicitly - // specified which hour he wants. So trying to maintain the same hour (in - // a new timezone) makes sense. Adding/subtracting hours does not follow - // this rule. - var getSetHour = makeGetSet('Hours', true); - - // FORMATTING - - addFormatToken('m', ['mm', 2], 0, 'minute'); - - // ALIASES - - addUnitAlias('minute', 'm'); - - // PARSING - - addRegexToken('m', match1to2); - addRegexToken('mm', match1to2, match2); - addParseToken(['m', 'mm'], MINUTE); - - // MOMENTS - - var getSetMinute = makeGetSet('Minutes', false); - - // FORMATTING - - addFormatToken('s', ['ss', 2], 0, 'second'); - - // ALIASES - - addUnitAlias('second', 's'); - - // PARSING - - addRegexToken('s', match1to2); - addRegexToken('ss', match1to2, match2); - addParseToken(['s', 'ss'], SECOND); - - // MOMENTS - - var getSetSecond = makeGetSet('Seconds', false); - - // FORMATTING - - addFormatToken('S', 0, 0, function () { - return ~~(this.millisecond() / 100); - }); - - addFormatToken(0, ['SS', 2], 0, function () { - return ~~(this.millisecond() / 10); - }); - - addFormatToken(0, ['SSS', 3], 0, 'millisecond'); - addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; - }); - addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; - }); - addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; - }); - addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; - }); - addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; - }); - addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; - }); - - - // ALIASES - - addUnitAlias('millisecond', 'ms'); - - // PARSING - - addRegexToken('S', match1to3, match1); - addRegexToken('SS', match1to3, match2); - addRegexToken('SSS', match1to3, match3); - - var token; - for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); - } - - function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); - } - - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); - } - // MOMENTS - - var getSetMillisecond = makeGetSet('Milliseconds', false); - - // FORMATTING - - addFormatToken('z', 0, 0, 'zoneAbbr'); - addFormatToken('zz', 0, 0, 'zoneName'); - - // MOMENTS - - function getZoneAbbr () { - return this._isUTC ? 'UTC' : ''; - } - - function getZoneName () { - return this._isUTC ? 'Coordinated Universal Time' : ''; - } - - var momentPrototype__proto = Moment.prototype; - - momentPrototype__proto.add = add_subtract__add; - momentPrototype__proto.calendar = moment_calendar__calendar; - momentPrototype__proto.clone = clone; - momentPrototype__proto.diff = diff; - momentPrototype__proto.endOf = endOf; - momentPrototype__proto.format = format; - momentPrototype__proto.from = from; - momentPrototype__proto.fromNow = fromNow; - momentPrototype__proto.to = to; - momentPrototype__proto.toNow = toNow; - momentPrototype__proto.get = getSet; - momentPrototype__proto.invalidAt = invalidAt; - momentPrototype__proto.isAfter = isAfter; - momentPrototype__proto.isBefore = isBefore; - momentPrototype__proto.isBetween = isBetween; - momentPrototype__proto.isSame = isSame; - momentPrototype__proto.isSameOrAfter = isSameOrAfter; - momentPrototype__proto.isSameOrBefore = isSameOrBefore; - momentPrototype__proto.isValid = moment_valid__isValid; - momentPrototype__proto.lang = lang; - momentPrototype__proto.locale = locale; - momentPrototype__proto.localeData = localeData; - momentPrototype__proto.max = prototypeMax; - momentPrototype__proto.min = prototypeMin; - momentPrototype__proto.parsingFlags = parsingFlags; - momentPrototype__proto.set = getSet; - momentPrototype__proto.startOf = startOf; - momentPrototype__proto.subtract = add_subtract__subtract; - momentPrototype__proto.toArray = toArray; - momentPrototype__proto.toObject = toObject; - momentPrototype__proto.toDate = toDate; - momentPrototype__proto.toISOString = moment_format__toISOString; - momentPrototype__proto.toJSON = toJSON; - momentPrototype__proto.toString = toString; - momentPrototype__proto.unix = unix; - momentPrototype__proto.valueOf = to_type__valueOf; - momentPrototype__proto.creationData = creationData; - - // Year - momentPrototype__proto.year = getSetYear; - momentPrototype__proto.isLeapYear = getIsLeapYear; - - // Week Year - momentPrototype__proto.weekYear = getSetWeekYear; - momentPrototype__proto.isoWeekYear = getSetISOWeekYear; - - // Quarter - momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter; - - // Month - momentPrototype__proto.month = getSetMonth; - momentPrototype__proto.daysInMonth = getDaysInMonth; - - // Week - momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek; - momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek; - momentPrototype__proto.weeksInYear = getWeeksInYear; - momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear; - - // Day - momentPrototype__proto.date = getSetDayOfMonth; - momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek; - momentPrototype__proto.weekday = getSetLocaleDayOfWeek; - momentPrototype__proto.isoWeekday = getSetISODayOfWeek; - momentPrototype__proto.dayOfYear = getSetDayOfYear; - - // Hour - momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour; - - // Minute - momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute; - - // Second - momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond; - - // Millisecond - momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond; - - // Offset - momentPrototype__proto.utcOffset = getSetOffset; - momentPrototype__proto.utc = setOffsetToUTC; - momentPrototype__proto.local = setOffsetToLocal; - momentPrototype__proto.parseZone = setOffsetToParsedOffset; - momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset; - momentPrototype__proto.isDST = isDaylightSavingTime; - momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted; - momentPrototype__proto.isLocal = isLocal; - momentPrototype__proto.isUtcOffset = isUtcOffset; - momentPrototype__proto.isUtc = isUtc; - momentPrototype__proto.isUTC = isUtc; - - // Timezone - momentPrototype__proto.zoneAbbr = getZoneAbbr; - momentPrototype__proto.zoneName = getZoneName; - - // Deprecations - momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); - momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); - momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); - momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone); - - var momentPrototype = momentPrototype__proto; - - function moment__createUnix (input) { - return local__createLocal(input * 1000); - } - - function moment__createInZone () { - return local__createLocal.apply(null, arguments).parseZone(); - } - - var defaultCalendar = { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }; - - function locale_calendar__calendar (key, mom, now) { - var output = this._calendar[key]; - return isFunction(output) ? output.call(mom, now) : output; - } - - var defaultLongDateFormat = { - LTS : 'h:mm:ss A', - LT : 'h:mm A', - L : 'MM/DD/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }; - - function longDateFormat (key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; - - if (format || !formatUpper) { - return format; - } - - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); - - return this._longDateFormat[key]; - } - - var defaultInvalidDate = 'Invalid date'; - - function invalidDate () { - return this._invalidDate; - } - - var defaultOrdinal = '%d'; - var defaultOrdinalParse = /\d{1,2}/; - - function ordinal (number) { - return this._ordinal.replace('%d', number); - } - - function preParsePostFormat (string) { - return string; - } - - var defaultRelativeTime = { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }; - - function relative__relativeTime (number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return (isFunction(output)) ? - output(number, withoutSuffix, string, isFuture) : - output.replace(/%d/i, number); - } - - function pastFuture (diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); - } - - var prototype__proto = Locale.prototype; - - prototype__proto._calendar = defaultCalendar; - prototype__proto.calendar = locale_calendar__calendar; - prototype__proto._longDateFormat = defaultLongDateFormat; - prototype__proto.longDateFormat = longDateFormat; - prototype__proto._invalidDate = defaultInvalidDate; - prototype__proto.invalidDate = invalidDate; - prototype__proto._ordinal = defaultOrdinal; - prototype__proto.ordinal = ordinal; - prototype__proto._ordinalParse = defaultOrdinalParse; - prototype__proto.preparse = preParsePostFormat; - prototype__proto.postformat = preParsePostFormat; - prototype__proto._relativeTime = defaultRelativeTime; - prototype__proto.relativeTime = relative__relativeTime; - prototype__proto.pastFuture = pastFuture; - prototype__proto.set = locale_set__set; - - // Month - prototype__proto.months = localeMonths; - prototype__proto._months = defaultLocaleMonths; - prototype__proto.monthsShort = localeMonthsShort; - prototype__proto._monthsShort = defaultLocaleMonthsShort; - prototype__proto.monthsParse = localeMonthsParse; - prototype__proto._monthsRegex = defaultMonthsRegex; - prototype__proto.monthsRegex = monthsRegex; - prototype__proto._monthsShortRegex = defaultMonthsShortRegex; - prototype__proto.monthsShortRegex = monthsShortRegex; - - // Week - prototype__proto.week = localeWeek; - prototype__proto._week = defaultLocaleWeek; - prototype__proto.firstDayOfYear = localeFirstDayOfYear; - prototype__proto.firstDayOfWeek = localeFirstDayOfWeek; - - // Day of Week - prototype__proto.weekdays = localeWeekdays; - prototype__proto._weekdays = defaultLocaleWeekdays; - prototype__proto.weekdaysMin = localeWeekdaysMin; - prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin; - prototype__proto.weekdaysShort = localeWeekdaysShort; - prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort; - prototype__proto.weekdaysParse = localeWeekdaysParse; - - prototype__proto._weekdaysRegex = defaultWeekdaysRegex; - prototype__proto.weekdaysRegex = weekdaysRegex; - prototype__proto._weekdaysShortRegex = defaultWeekdaysShortRegex; - prototype__proto.weekdaysShortRegex = weekdaysShortRegex; - prototype__proto._weekdaysMinRegex = defaultWeekdaysMinRegex; - prototype__proto.weekdaysMinRegex = weekdaysMinRegex; - - // Hours - prototype__proto.isPM = localeIsPM; - prototype__proto._meridiemParse = defaultLocaleMeridiemParse; - prototype__proto.meridiem = localeMeridiem; - - function lists__get (format, index, field, setter) { - var locale = locale_locales__getLocale(); - var utc = create_utc__createUTC().set(setter, index); - return locale[field](utc, format); - } - - function listMonthsImpl (format, index, field) { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - - if (index != null) { - return lists__get(format, index, field, 'month'); - } - - var i; - var out = []; - for (i = 0; i < 12; i++) { - out[i] = lists__get(format, i, field, 'month'); - } - return out; - } - - // () - // (5) - // (fmt, 5) - // (fmt) - // (true) - // (true, 5) - // (true, fmt, 5) - // (true, fmt) - function listWeekdaysImpl (localeSorted, format, index, field) { - if (typeof localeSorted === 'boolean') { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } else { - format = localeSorted; - index = format; - localeSorted = false; - - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } - - var locale = locale_locales__getLocale(), - shift = localeSorted ? locale._week.dow : 0; - - if (index != null) { - return lists__get(format, (index + shift) % 7, field, 'day'); - } - - var i; - var out = []; - for (i = 0; i < 7; i++) { - out[i] = lists__get(format, (i + shift) % 7, field, 'day'); - } - return out; - } - - function lists__listMonths (format, index) { - return listMonthsImpl(format, index, 'months'); - } - - function lists__listMonthsShort (format, index) { - return listMonthsImpl(format, index, 'monthsShort'); - } - - function lists__listWeekdays (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); - } - - function lists__listWeekdaysShort (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); - } - - function lists__listWeekdaysMin (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); - } - - locale_locales__getSetGlobalLocale('en', { - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (toInt(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); - - // Side effect imports - utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale); - utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale); - - var mathAbs = Math.abs; - - function duration_abs__abs () { - var data = this._data; - - this._milliseconds = mathAbs(this._milliseconds); - this._days = mathAbs(this._days); - this._months = mathAbs(this._months); - - data.milliseconds = mathAbs(data.milliseconds); - data.seconds = mathAbs(data.seconds); - data.minutes = mathAbs(data.minutes); - data.hours = mathAbs(data.hours); - data.months = mathAbs(data.months); - data.years = mathAbs(data.years); - - return this; - } - - function duration_add_subtract__addSubtract (duration, input, value, direction) { - var other = create__createDuration(input, value); - - duration._milliseconds += direction * other._milliseconds; - duration._days += direction * other._days; - duration._months += direction * other._months; - - return duration._bubble(); - } - - // supports only 2.0-style add(1, 's') or add(duration) - function duration_add_subtract__add (input, value) { - return duration_add_subtract__addSubtract(this, input, value, 1); - } - - // supports only 2.0-style subtract(1, 's') or subtract(duration) - function duration_add_subtract__subtract (input, value) { - return duration_add_subtract__addSubtract(this, input, value, -1); - } - - function absCeil (number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } - } - - function bubble () { - var milliseconds = this._milliseconds; - var days = this._days; - var months = this._months; - var data = this._data; - var seconds, minutes, hours, years, monthsFromDays; - - // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - if (!((milliseconds >= 0 && days >= 0 && months >= 0) || - (milliseconds <= 0 && days <= 0 && months <= 0))) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; - } - - // The following code bubbles up values, see the tests for - // examples of what that means. - data.milliseconds = milliseconds % 1000; - - seconds = absFloor(milliseconds / 1000); - data.seconds = seconds % 60; - - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; - - hours = absFloor(minutes / 60); - data.hours = hours % 24; - - days += absFloor(hours / 24); - - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - data.days = days; - data.months = months; - data.years = years; - - return this; - } - - function daysToMonths (days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; - } - - function monthsToDays (months) { - // the reverse of daysToMonths - return months * 146097 / 4800; - } - - function as (units) { - var days; - var months; - var milliseconds = this._milliseconds; - - units = normalizeUnits(units); - - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week' : return days / 7 + milliseconds / 6048e5; - case 'day' : return days + milliseconds / 864e5; - case 'hour' : return days * 24 + milliseconds / 36e5; - case 'minute' : return days * 1440 + milliseconds / 6e4; - case 'second' : return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': return Math.floor(days * 864e5) + milliseconds; - default: throw new Error('Unknown unit ' + units); - } - } - } - - // TODO: Use this.as('ms')? - function duration_as__valueOf () { - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); - } - - function makeAs (alias) { - return function () { - return this.as(alias); - }; - } - - var asMilliseconds = makeAs('ms'); - var asSeconds = makeAs('s'); - var asMinutes = makeAs('m'); - var asHours = makeAs('h'); - var asDays = makeAs('d'); - var asWeeks = makeAs('w'); - var asMonths = makeAs('M'); - var asYears = makeAs('y'); - - function duration_get__get (units) { - units = normalizeUnits(units); - return this[units + 's'](); - } - - function makeGetter(name) { - return function () { - return this._data[name]; - }; - } - - var milliseconds = makeGetter('milliseconds'); - var seconds = makeGetter('seconds'); - var minutes = makeGetter('minutes'); - var hours = makeGetter('hours'); - var days = makeGetter('days'); - var months = makeGetter('months'); - var years = makeGetter('years'); - - function weeks () { - return absFloor(this.days() / 7); - } - - var round = Math.round; - var thresholds = { - s: 45, // seconds to minute - m: 45, // minutes to hour - h: 22, // hours to day - d: 26, // days to month - M: 11 // months to year - }; - - // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { - return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); - } - - function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) { - var duration = create__createDuration(posNegDuration).abs(); - var seconds = round(duration.as('s')); - var minutes = round(duration.as('m')); - var hours = round(duration.as('h')); - var days = round(duration.as('d')); - var months = round(duration.as('M')); - var years = round(duration.as('y')); - - var a = seconds < thresholds.s && ['s', seconds] || - minutes <= 1 && ['m'] || - minutes < thresholds.m && ['mm', minutes] || - hours <= 1 && ['h'] || - hours < thresholds.h && ['hh', hours] || - days <= 1 && ['d'] || - days < thresholds.d && ['dd', days] || - months <= 1 && ['M'] || - months < thresholds.M && ['MM', months] || - years <= 1 && ['y'] || ['yy', years]; - - a[2] = withoutSuffix; - a[3] = +posNegDuration > 0; - a[4] = locale; - return substituteTimeAgo.apply(null, a); - } - - // This function allows you to set a threshold for relative time strings - function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) { - if (thresholds[threshold] === undefined) { - return false; - } - if (limit === undefined) { - return thresholds[threshold]; - } - thresholds[threshold] = limit; - return true; - } - - function humanize (withSuffix) { - var locale = this.localeData(); - var output = duration_humanize__relativeTime(this, !withSuffix, locale); - - if (withSuffix) { - output = locale.pastFuture(+this, output); - } - - return locale.postformat(output); - } - - var iso_string__abs = Math.abs; - - function iso_string__toISOString() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - var seconds = iso_string__abs(this._milliseconds) / 1000; - var days = iso_string__abs(this._days); - var months = iso_string__abs(this._months); - var minutes, hours, years; - - // 3600 seconds -> 60 minutes -> 1 hour - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var Y = years; - var M = months; - var D = days; - var h = hours; - var m = minutes; - var s = seconds; - var total = this.asSeconds(); - - if (!total) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } - - return (total < 0 ? '-' : '') + - 'P' + - (Y ? Y + 'Y' : '') + - (M ? M + 'M' : '') + - (D ? D + 'D' : '') + - ((h || m || s) ? 'T' : '') + - (h ? h + 'H' : '') + - (m ? m + 'M' : '') + - (s ? s + 'S' : ''); - } - - var duration_prototype__proto = Duration.prototype; - - duration_prototype__proto.abs = duration_abs__abs; - duration_prototype__proto.add = duration_add_subtract__add; - duration_prototype__proto.subtract = duration_add_subtract__subtract; - duration_prototype__proto.as = as; - duration_prototype__proto.asMilliseconds = asMilliseconds; - duration_prototype__proto.asSeconds = asSeconds; - duration_prototype__proto.asMinutes = asMinutes; - duration_prototype__proto.asHours = asHours; - duration_prototype__proto.asDays = asDays; - duration_prototype__proto.asWeeks = asWeeks; - duration_prototype__proto.asMonths = asMonths; - duration_prototype__proto.asYears = asYears; - duration_prototype__proto.valueOf = duration_as__valueOf; - duration_prototype__proto._bubble = bubble; - duration_prototype__proto.get = duration_get__get; - duration_prototype__proto.milliseconds = milliseconds; - duration_prototype__proto.seconds = seconds; - duration_prototype__proto.minutes = minutes; - duration_prototype__proto.hours = hours; - duration_prototype__proto.days = days; - duration_prototype__proto.weeks = weeks; - duration_prototype__proto.months = months; - duration_prototype__proto.years = years; - duration_prototype__proto.humanize = humanize; - duration_prototype__proto.toISOString = iso_string__toISOString; - duration_prototype__proto.toString = iso_string__toISOString; - duration_prototype__proto.toJSON = iso_string__toISOString; - duration_prototype__proto.locale = locale; - duration_prototype__proto.localeData = localeData; - - // Deprecations - duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString); - duration_prototype__proto.lang = lang; - - // Side effect imports - - // FORMATTING - - addFormatToken('X', 0, 0, 'unix'); - addFormatToken('x', 0, 0, 'valueOf'); - - // PARSING - - addRegexToken('x', matchSigned); - addRegexToken('X', matchTimestamp); - addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input, 10) * 1000); - }); - addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); - }); - - // Side effect imports - - - utils_hooks__hooks.version = '2.13.0'; - - setHookCallback(local__createLocal); - - utils_hooks__hooks.fn = momentPrototype; - utils_hooks__hooks.min = min; - utils_hooks__hooks.max = max; - utils_hooks__hooks.now = now; - utils_hooks__hooks.utc = create_utc__createUTC; - utils_hooks__hooks.unix = moment__createUnix; - utils_hooks__hooks.months = lists__listMonths; - utils_hooks__hooks.isDate = isDate; - utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale; - utils_hooks__hooks.invalid = valid__createInvalid; - utils_hooks__hooks.duration = create__createDuration; - utils_hooks__hooks.isMoment = isMoment; - utils_hooks__hooks.weekdays = lists__listWeekdays; - utils_hooks__hooks.parseZone = moment__createInZone; - utils_hooks__hooks.localeData = locale_locales__getLocale; - utils_hooks__hooks.isDuration = isDuration; - utils_hooks__hooks.monthsShort = lists__listMonthsShort; - utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin; - utils_hooks__hooks.defineLocale = defineLocale; - utils_hooks__hooks.updateLocale = updateLocale; - utils_hooks__hooks.locales = locale_locales__listLocales; - utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort; - utils_hooks__hooks.normalizeUnits = normalizeUnits; - utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold; - utils_hooks__hooks.prototype = momentPrototype; - - var _moment = utils_hooks__hooks; - - return _moment; - -})); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.hbs deleted file mode 100644 index 497a259d45..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.hbs +++ /dev/null @@ -1,29 +0,0 @@ -{{! - Copyright (c) 2016, 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. -}} -{{#zone "topCss"}} - {{~css "css/dataTables.bootstrap.css"}} - {{~css "css/dataTables.responsive.css"}} -{{/zone}} -{{#zone "bottomJs"}} - {{~js "js/jquery.dataTables.min.js"}} - {{~js "js/dataTables.bootstrap.js"}} - {{~js "js/dataTables.responsive.min.js"}} - {{~js "js/dataTables.extended.js"}} - {{~js "js/dataTables.fnSetFilteringDelay.js"}} - {{~js "js/dataTables.extended.serversidepaging.js"}} -{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.js deleted file mode 100644 index 9ce9112cdb..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.json deleted file mode 100644 index ea6d636876..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/data-tables-extended.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version" : "1.0.0" -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/css/dataTables.bootstrap.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/css/dataTables.bootstrap.css deleted file mode 100644 index 94e35f77a2..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/css/dataTables.bootstrap.css +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -div.dataTables_length label { - font-weight: normal; - text-align: left; - white-space: nowrap; -} - -div.dataTables_length select { - width: 75px; - display: inline-block; -} - -div.dataTables_filter { - text-align: right; -} - -div.dataTables_filter label { - font-weight: normal; - white-space: nowrap; - text-align: left; -} - -div.dataTables_filter input { - margin-left: 0.5em; - display: inline-block; - width: auto; -} - -div.dataTables_info { - padding-top: 8px; - white-space: nowrap; -} - -div.dataTables_paginate { - margin: 0; - white-space: nowrap; - text-align: right; -} - -div.dataTables_paginate ul.pagination { - margin: 2px 0; - white-space: nowrap; -} - -@media screen and (max-width: 767px) { - div.dataTables_wrapper > div.row > div, - div.dataTables_length, - div.dataTables_filter, - div.dataTables_info, - div.dataTables_paginate { - text-align: center; - } - - div.DTTT { - margin-bottom: 0.5em; - } -} - - -table.dataTable td, -table.dataTable th { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - - -table.dataTable { - clear: both; - margin-top: 6px !important; - margin-bottom: 6px !important; - max-width: none !important; -} - -table.dataTable thead .sorting, -table.dataTable thead .sorting_asc, -table.dataTable thead .sorting_desc, -table.dataTable thead .sorting_asc_disabled, -table.dataTable thead .sorting_desc_disabled { - cursor: pointer; - position: relative; -} - -table.dataTable thead .sorting:after, -table.dataTable thead .sorting_asc:after, -table.dataTable thead .sorting_desc:after { - position: absolute; - top: 8px; - right: 8px; - display: block; - font-family: 'Glyphicons Halflings'; - opacity: 0.5; -} -table.dataTable thead .sorting:after { - opacity: 0.2; - content: "\e150"; /* sort */ -} -table.dataTable thead .sorting_asc:after { - content: "\e155"; /* sort-by-attributes */ -} -table.dataTable thead .sorting_desc:after { - content: "\e156"; /* sort-by-attributes-alt */ -} -div.dataTables_scrollBody table.dataTable thead .sorting:after, -div.dataTables_scrollBody table.dataTable thead .sorting_asc:after, -div.dataTables_scrollBody table.dataTable thead .sorting_desc:after { - display: none; -} - -table.dataTable thead .sorting_asc_disabled:after, -table.dataTable thead .sorting_desc_disabled:after { - color: #eee; -} - -table.dataTable thead > tr > th { - padding-right: 30px; -} - -table.dataTable th:active { - outline: none; -} - - -/* Condensed */ -table.dataTable.table-condensed thead > tr > th { - padding-right: 20px; -} - -table.dataTable.table-condensed thead .sorting:after, -table.dataTable.table-condensed thead .sorting_asc:after, -table.dataTable.table-condensed thead .sorting_desc:after { - top: 6px; - right: 6px; -} - -/* Scrolling */ -div.dataTables_scrollHead table { - margin-bottom: 0 !important; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; -} - -div.dataTables_scrollHead table thead tr:last-child th:first-child, -div.dataTables_scrollHead table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.dataTables_scrollBody table { - border-top: none; - margin-top: 0 !important; - margin-bottom: 0 !important; -} - -div.dataTables_scrollBody tbody tr:first-child th, -div.dataTables_scrollBody tbody tr:first-child td { - border-top: none; -} - -div.dataTables_scrollFoot table { - margin-top: 0 !important; - border-top: none; -} - -/* Frustratingly the border-collapse:collapse used by Bootstrap makes the column - width calculations when using scrolling impossible to align columns. We have - to use separate - */ -table.table-bordered.dataTable { - border-collapse: separate !important; -} -table.table-bordered thead th, -table.table-bordered thead td { - border-left-width: 0; - border-top-width: 0; -} -table.table-bordered tbody th, -table.table-bordered tbody td { - border-left-width: 0; - border-bottom-width: 0; -} -table.table-bordered tfoot th, -table.table-bordered tfoot td { - border-left-width: 0; - border-bottom-width: 0; -} -table.table-bordered th:last-child, -table.table-bordered td:last-child { - border-right-width: 0; -} -div.dataTables_scrollHead table.table-bordered { - border-bottom-width: 0; -} - - - - -/* - * TableTools styles - */ -.table.dataTable tbody tr.active td, -.table.dataTable tbody tr.active th { - background-color: #08C; - color: white; -} - -.table.dataTable tbody tr.active:hover td, -.table.dataTable tbody tr.active:hover th { - background-color: #0075b0 !important; -} - -.table.dataTable tbody tr.active th > a, -.table.dataTable tbody tr.active td > a { - color: white; -} - -.table-striped.dataTable tbody tr.active:nth-child(odd) td, -.table-striped.dataTable tbody tr.active:nth-child(odd) th { - background-color: #017ebc; -} - -table.DTTT_selectable tbody tr { - cursor: pointer; -} - -div.DTTT .btn:hover { - text-decoration: none !important; -} - -ul.DTTT_dropdown.dropdown-menu { - z-index: 2003; -} - -ul.DTTT_dropdown.dropdown-menu a { - color: #333 !important; /* needed only when demo_page.css is included */ -} - -ul.DTTT_dropdown.dropdown-menu li { - position: relative; -} - -ul.DTTT_dropdown.dropdown-menu li:hover a { - background-color: #0088cc; - color: white !important; -} - -div.DTTT_collection_background { - z-index: 2002; -} - -/* TableTools information display */ -div.DTTT_print_info { - position: fixed; - top: 50%; - left: 50%; - width: 400px; - height: 150px; - margin-left: -200px; - margin-top: -75px; - text-align: center; - color: #333; - padding: 10px 30px; - opacity: 0.95; - - background-color: white; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 6px; - - -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); -} - -div.DTTT_print_info h6 { - font-weight: normal; - font-size: 28px; - line-height: 28px; - margin: 1em; -} - -div.DTTT_print_info p { - font-size: 14px; - line-height: 20px; -} - -div.dataTables_processing { - position: absolute; - top: 50%; - left: 50%; - width: 100%; - height: 60px; - margin-left: -50%; - margin-top: -25px; - padding-top: 20px; - padding-bottom: 20px; - text-align: center; - font-size: 1.2em; - background-color: white; - background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0))); - background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); -} - - - -/* - * FixedColumns styles - */ -div.DTFC_LeftHeadWrapper table, -div.DTFC_LeftFootWrapper table, -div.DTFC_RightHeadWrapper table, -div.DTFC_RightFootWrapper table, -table.DTFC_Cloned tr.even { - background-color: white; - margin-bottom: 0; -} - -div.DTFC_RightHeadWrapper table , -div.DTFC_LeftHeadWrapper table { - border-bottom: none !important; - margin-bottom: 0 !important; - border-top-right-radius: 0 !important; - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_RightHeadWrapper table thead tr:last-child td:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightBodyWrapper table, -div.DTFC_LeftBodyWrapper table { - border-top: none; - margin: 0 !important; -} - -div.DTFC_RightBodyWrapper tbody tr:first-child th, -div.DTFC_RightBodyWrapper tbody tr:first-child td, -div.DTFC_LeftBodyWrapper tbody tr:first-child th, -div.DTFC_LeftBodyWrapper tbody tr:first-child td { - border-top: none; -} - -div.DTFC_RightFootWrapper table, -div.DTFC_LeftFootWrapper table { - border-top: none; - margin-top: 0 !important; -} - - -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting:after, -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting_asc:after, -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting_desc:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting_asc:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting_desc:after { - display: none; -} - - -/* - * FixedHeader styles - */ -div.FixedHeader_Cloned table { - margin: 0 !important -} - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/css/dataTables.responsive.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/css/dataTables.responsive.css deleted file mode 100644 index 91ff7a1270..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/css/dataTables.responsive.css +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child, -table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child { - position: relative; - padding-left: 30px; - cursor: pointer; -} -table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before, -table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before { - top: 8px; - left: 4px; - height: 16px; - width: 16px; - display: block; - position: absolute; - color: white; - border: 2px solid white; - border-radius: 16px; - text-align: center; - line-height: 14px; - box-shadow: 0 0 3px #444; - box-sizing: content-box; - content: '+'; - background-color: #31b131; -} -table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child.dataTables_empty:before, -table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child.dataTables_empty:before { - display: none; -} -table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before, -table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before { - content: '-'; - background-color: #d33333; -} -table.dataTable.dtr-inline.collapsed > tbody > tr.child td:before { - display: none; -} -table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child, -table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child { - padding-left: 27px; -} -table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child:before, -table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:before { - top: 5px; - left: 4px; - height: 14px; - width: 14px; - border-radius: 14px; - line-height: 12px; -} -table.dataTable.dtr-column > tbody > tr > td.control, -table.dataTable.dtr-column > tbody > tr > th.control { - position: relative; - cursor: pointer; -} -table.dataTable.dtr-column > tbody > tr > td.control:before, -table.dataTable.dtr-column > tbody > tr > th.control:before { - top: 50%; - left: 50%; - height: 16px; - width: 16px; - margin-top: -10px; - margin-left: -10px; - display: block; - position: absolute; - color: white; - border: 2px solid white; - border-radius: 16px; - text-align: center; - line-height: 14px; - box-shadow: 0 0 3px #444; - box-sizing: content-box; - content: '+'; - background-color: #31b131; -} -table.dataTable.dtr-column > tbody > tr.parent td.control:before, -table.dataTable.dtr-column > tbody > tr.parent th.control:before { - content: '-'; - background-color: #d33333; -} -table.dataTable > tbody > tr.child { - padding: 0.5em 1em; -} -table.dataTable > tbody > tr.child:hover { - background: transparent !important; -} -table.dataTable > tbody > tr.child ul { - display: inline-block; - list-style-type: none; - margin: 0; - padding: 0; -} -table.dataTable > tbody > tr.child ul li { - border-bottom: 1px solid #efefef; - padding: 0.5em 0; -} -table.dataTable > tbody > tr.child ul li:first-child { - padding-top: 0; -} -table.dataTable > tbody > tr.child ul li:last-child { - border-bottom: none; -} -table.dataTable > tbody > tr.child span.dtr-title { - display: inline-block; - min-width: 75px; - font-weight: bold; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.bootstrap.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.bootstrap.js deleted file mode 100644 index 241f7094a8..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.bootstrap.js +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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. - */ - -/*! DataTables Bootstrap 3 integration - * ©2011-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and - * DataTables 1.10 or newer. - * - * This file sets the defaults and adds options to DataTables to style its - * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap - * for further information. - */ -(function(window, document, undefined){ - -var factory = function( $, DataTable ) { -"use strict"; - - -/* Set the defaults for DataTables initialisation */ -$.extend( true, DataTable.defaults, { - dom: - "<'row'<'col-sm-6'l><'col-sm-6'f>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", - renderer: 'bootstrap' -} ); - - -/* Default class modification */ -$.extend( DataTable.ext.classes, { - sWrapper: "dataTables_wrapper form-inline dt-bootstrap", - sFilterInput: "form-control input-sm", - sLengthSelect: "form-control input-sm" -} ); - - -/* Bootstrap paging button renderer */ -DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) { - var api = new DataTable.Api( settings ); - var classes = settings.oClasses; - var lang = settings.oLanguage.oPaginate; - var btnDisplay, btnClass, counter=0; - - var attach = function( container, buttons ) { - var i, ien, node, button; - var clickHandler = function ( e ) { - e.preventDefault(); - if ( !$(e.currentTarget).hasClass('disabled') ) { - api.page( e.data.action ).draw( false ); - } - }; - - for ( i=0, ien=buttons.length ; i 0 ? - '' : ' disabled'); - break; - - case 'previous': - btnDisplay = lang.sPrevious; - btnClass = button + (page > 0 ? - '' : ' disabled'); - break; - - case 'next': - btnDisplay = lang.sNext; - btnClass = button + (page < pages-1 ? - '' : ' disabled'); - break; - - case 'last': - btnDisplay = lang.sLast; - btnClass = button + (page < pages-1 ? - '' : ' disabled'); - break; - - default: - btnDisplay = button + 1; - btnClass = page === button ? - 'active' : ''; - break; - } - - if ( btnDisplay ) { - node = $('
  • ', { - 'class': classes.sPageButton+' '+btnClass, - 'id': idx === 0 && typeof button === 'string' ? - settings.sTableId +'_'+ button : - null - } ) - .append( $('', { - 'href': '#', - 'aria-controls': settings.sTableId, - 'data-dt-idx': counter, - 'tabindex': settings.iTabIndex - } ) - .html( btnDisplay ) - ) - .appendTo( container ); - - settings.oApi._fnBindAction( - node, {action: button}, clickHandler - ); - - counter++; - } - } - } - }; - - // IE9 throws an 'unknown error' if document.activeElement is used - // inside an iframe or frame. - var activeEl; - - try { - // Because this approach is destroying and recreating the paging - // elements, focus is lost on the select button which is bad for - // accessibility. So we want to restore focus once the draw has - // completed - activeEl = $(document.activeElement).data('dt-idx'); - } - catch (e) {} - - attach( - $(host).empty().html('