From 635416f76686c10c8cf648923f0c606a935b2ec2 Mon Sep 17 00:00:00 2001 From: Dharmakeerthi Lasantha Date: Wed, 30 Oct 2019 17:17:22 +0000 Subject: [PATCH] Fix public app installing issue and improve tool-tip texts --- .../mgt/core/impl/ApplicationManagerImpl.java | 20 +++++-- .../core/impl/SubscriptionManagerImpl.java | 3 +- .../cdmf.page.cookie-policy/cookie-policy.hbs | 52 +++++++++---------- 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java index a937169b83..f5b7882659 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java @@ -1802,6 +1802,8 @@ public class ApplicationManagerImpl implements ApplicationManager { } List appUnrestrictedRoles = this.visibilityDAO.getUnrestrictedRoles(applicationId, tenantId); + List appCategories = this.applicationDAO.getAppCategories(applicationId, tenantId); + List appTags = this.applicationDAO.getAppTags(applicationId, tenantId); boolean isExistingAppRestricted = !appUnrestrictedRoles.isEmpty(); boolean isUpdatingAppRestricted = false; @@ -1812,6 +1814,7 @@ public class ApplicationManagerImpl implements ApplicationManager { if (isExistingAppRestricted && !isUpdatingAppRestricted) { visibilityDAO.deleteUnrestrictedRoles(appUnrestrictedRoles, applicationId, tenantId); + appUnrestrictedRoles.clear(); } else if (isUpdatingAppRestricted) { if (!hasUserRole(applicationUpdateWrapper.getUnrestrictedRoles(), userName)) { String msg = @@ -1827,6 +1830,7 @@ public class ApplicationManagerImpl implements ApplicationManager { if (!isExistingAppRestricted) { visibilityDAO .addUnrestrictedRoles(applicationUpdateWrapper.getUnrestrictedRoles(), applicationId, tenantId); + appUnrestrictedRoles = applicationUpdateWrapper.getUnrestrictedRoles(); } else { List addingRoleList = getDifference(applicationUpdateWrapper.getUnrestrictedRoles(), applicationDTO.getUnrestrictedRoles()); @@ -1834,15 +1838,16 @@ public class ApplicationManagerImpl implements ApplicationManager { applicationUpdateWrapper.getUnrestrictedRoles()); if (!addingRoleList.isEmpty()) { visibilityDAO.addUnrestrictedRoles(addingRoleList, applicationId, tenantId); + appUnrestrictedRoles.addAll(addingRoleList); } if (!removingRoleList.isEmpty()) { visibilityDAO.deleteUnrestrictedRoles(removingRoleList, applicationId, tenantId); + appUnrestrictedRoles.removeAll(removingRoleList); } } } - applicationDTO.setUnrestrictedRoles(applicationUpdateWrapper.getUnrestrictedRoles()); - List updatingAppCategries = applicationUpdateWrapper.getCategories(); + List updatingAppCategries = applicationUpdateWrapper.getCategories(); if (updatingAppCategries != null){ List allCategories = this.applicationDAO.getAllCategories(tenantId); List allCategoryName = allCategories.stream().map(CategoryDTO::getCategoryName) @@ -1854,22 +1859,23 @@ public class ApplicationManagerImpl implements ApplicationManager { throw new BadRequestException(msg); } - List appCategories = this.applicationDAO.getAppCategories(applicationId, tenantId); + List addingAppCategories = getDifference(updatingAppCategries, appCategories); List removingAppCategories = getDifference(appCategories, updatingAppCategries); if (!addingAppCategories.isEmpty()) { List categoryIds = this.applicationDAO.getCategoryIdsForCategoryNames(addingAppCategories, tenantId); this.applicationDAO.addCategoryMapping(categoryIds, applicationId, tenantId); + appCategories.addAll(addingAppCategories); } if (!removingAppCategories.isEmpty()) { List categoryIds = this.applicationDAO.getCategoryIdsForCategoryNames(removingAppCategories, tenantId); this.applicationDAO.deleteAppCategories(categoryIds, applicationId, tenantId); + appCategories.removeAll(removingAppCategories); } } List updatingAppTags = applicationUpdateWrapper.getTags(); if (updatingAppTags!= null){ - List appTags = this.applicationDAO.getAppTags(applicationId, tenantId); List addingTagList = getDifference(updatingAppTags, appTags); List removingTagList = getDifference(appTags, updatingAppTags); if (!addingTagList.isEmpty()) { @@ -1881,10 +1887,12 @@ public class ApplicationManagerImpl implements ApplicationManager { } List addingTagIds = this.applicationDAO.getTagIdsForTagNames(addingTagList, tenantId); this.applicationDAO.addTagMapping(addingTagIds, applicationId, tenantId); + appTags.addAll(addingTagList); } if (!removingTagList.isEmpty()) { List removingTagIds = this.applicationDAO.getTagIdsForTagNames(removingTagList, tenantId); this.applicationDAO.deleteApplicationTags(removingTagIds, applicationId, tenantId); + appTags.removeAll(removingTagList); } } if (!applicationDAO.updateApplication(applicationDTO, tenantId)){ @@ -1893,6 +1901,10 @@ public class ApplicationManagerImpl implements ApplicationManager { log.error(msg); throw new ApplicationManagementException(msg); } + + applicationDTO.setUnrestrictedRoles(appUnrestrictedRoles); + applicationDTO.setAppCategories(appCategories); + applicationDTO.setTags(appTags); ConnectionManagerUtil.commitDBTransaction(); return APIUtil.appDtoToAppResponse(applicationDTO); } catch (UserStoreException e) { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index d5633471c2..892acc28e6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -336,7 +336,6 @@ public class SubscriptionManagerImpl implements SubscriptionManager { ApplicationDTO applicationDTO = getApplicationDTO(applicationUUID); ApplicationReleaseDTO applicationReleaseDTO = applicationDTO.getApplicationReleaseDTOs().get(0); - //todo need to check application release status if it is not in installable state send forbidden exception int applicationReleaseId = applicationReleaseDTO.getId(); if (!ApplicationType.PUBLIC.toString().equals(applicationDTO.getType())) { String msg = "Application type is not public. Hence you can't perform google ent.install operation on " @@ -726,6 +725,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { log.error(msg); throw new ForbiddenException(msg); } + applicationDTO.setTags(this.applicationDAO.getAppTags(applicationDTO.getId(), tenantId)); + applicationDTO.setAppCategories(this.applicationDAO.getAppCategories(applicationDTO.getId(), tenantId)); return applicationDTO; } catch (LifecycleManagementException e) { String msg = "Error occured when getting life-cycle state from life-cycle state manager."; 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 index 66f9fff3ce..50c83c3f43 100644 --- 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 @@ -26,14 +26,14 @@

About Entgra IoT Server

-

Entgra IoT Server 4.0.0 is a complete solution that enables device manufacturers and enterprises to +

Entgra IoT Server 3.8.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.0.0 comes with advanced analytics, enabling users to analyze speed, proximity, and +

Entgra IoT Server 3.8.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

@@ -45,55 +45,55 @@ 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.0.0 process cookies?

-

Entgra IoT Server 4.0.0 uses cookies to store and retrieve information on your browser. This +

How does Entgra IoT Server 3.8.0 process cookies?

+

Entgra IoT Server 3.8.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.0.0 are used to personally identify you. However, the cookie +

Some cookies in Entgra IoT Server 3.8.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 3.0.0 use cookies for?

-

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

+

What does Entgra IoT Server 3.8.0 use cookies for?

+

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

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

Preferences

-

Entgra IoT Server 4.0.0 uses cookies to remember your settings and preferences and to auto-fill the +

Entgra IoT Server 3.8.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.0.0 uses selected cookies to identify and prevent security risks. For example, - Entgra IoT Server 4.0.0 may use cookies to store your session information to prevent others from +
  2. Entgra IoT Server 3.8.0 uses selected cookies to identify and prevent security risks. For example, + Entgra IoT Server 3.8.0 may use cookies to store your session information to prevent others from changing your password without your username and password.
  3. -
  4. Entgra IoT Server 4.0.0 uses session cookie to maintain your active session.
  5. -
  6. Entgra IoT Server 4.0.0 may use a temporary cookie when performing multi-factor authentication and +
  7. Entgra IoT Server 3.8.0 uses session cookie to maintain your active session.
  8. +
  9. Entgra IoT Server 3.8.0 may use a temporary cookie when performing multi-factor authentication and federated authentication.
  10. -
  11. Entgra IoT Server 4.0.0 may use permanent cookies to detect the devices you have logged in +
  12. Entgra IoT Server 3.8.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.

Performance

-

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

+

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

Analytics

-

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

+

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

Third party cookies

-

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

Using Entgra IoT Server 3.8.0 may cause third-party cookie to be set in your browser. Entgra IoT Server + 3.8.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.0.0 +
  2. Any social login sites. For example, third-party cookies may be set when Entgra IoT Server 3.8.0 is configured to use “social” or “federated” login, and you opt to login with your “Social Account”.
  3. @@ -101,11 +101,11 @@

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.0.0 use?

-

Entgra IoT Server 4.0.0 uses persistent cookies and session cookies. A persistent cookie helps Entgra IS - 4.0.0 to recognize you as an existing user so that it is easier to return to Entgra or interact with - Entgra IS 4.0.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.0.0 when you return to Entgra IoT Server 4.0.0.

+

What type of cookies does Entgra IoT Server 3.8.0 use?

+

Entgra IoT Server 3.8.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 3.8.0 when you return to Entgra IoT Server 3.8.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.

@@ -114,9 +114,9 @@ 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.0.0.

+ functionalities offered by Entgra IoT Server 3.8.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.0.0 + individuals (or their data protection officer, if applicable) running this Entgra IoT Server 3.8.0 instance.

What are the cookies used?

@@ -150,7 +150,7 @@

Disclaimer

-

This cookie policy is only for illustrative purposes of the product Entgra IoT Server 4.0.0. The +

This cookie policy is only for illustrative purposes of the product Entgra IoT Server 3.8.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.0.0 instance has full authority and responsibility with regard to the effective Cookie Policy. Entgra, its employees, partners, and