From 6c96d228ae381ee71695d57703acc50bec8e2a3d Mon Sep 17 00:00:00 2001 From: ayyoob Date: Thu, 9 Feb 2017 03:02:56 +0530 Subject: [PATCH 01/10] added subscription fix --- .../APIManagementProviderServiceImpl.java | 28 +++++++++++-------- .../store/api/SubscriptionindividualApi.java | 17 +++++++++++ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java index af471ebd6e..50bcc5ad0f 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -87,6 +87,10 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe throw new APIManagerException ( "Api application creation failed for " + applicationName + " to the user " + username); } + + SubscriptionList subscriptionList = storeClient.getSubscriptions().subscriptionsGet + (null, application.getApplicationId(), "", 0, 100, CONTENT_TYPE, null); + List needToSubscribe = new ArrayList<>(); // subscribe to apis. if (tags != null && tags.length > 0) { for (String tag: tags) { @@ -100,32 +104,32 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe if (apiList.getList() != null && apiList.getList().size() > 0) { for (APIInfo apiInfo : apiList.getList()) { - Subscription subscription = new Subscription(); - //fix for APIMANAGER-5566 admin-AT-tenant1.com-Tenant1API1-1.0.0 - String id = apiInfo.getProvider().replace("@", "-AT-") - + "-" + apiInfo.getName()+ "-" + apiInfo.getVersion(); - subscription.setApiIdentifier(id); - subscription.setApplicationId(application.getApplicationId()); - subscription.tier(ApiApplicationConstants.DEFAULT_TIER); - SubscriptionList subscriptionList = storeClient.getSubscriptions().subscriptionsGet - (id, application.getApplicationId(), "", 0, 100, CONTENT_TYPE, null); boolean subscriptionExist = false; if (subscriptionList.getList() != null && subscriptionList.getList().size() > 0) { for (Subscription subs : subscriptionList.getList()) { - if (subs.getApiIdentifier().equals(id) && subs.getApplicationId().equals( - application.getApplicationId())) { + if (subs.getApiIdentifier().equals(apiInfo.getId())) { subscriptionExist = true; break; } } } if (!subscriptionExist) { - storeClient.getIndividualSubscription().subscriptionsPost(subscription, CONTENT_TYPE); + Subscription subscription = new Subscription(); + //fix for APIMANAGER-5566 admin-AT-tenant1.com-Tenant1API1-1.0.0 + String id = apiInfo.getProvider().replace("@", "-AT-") + + "-" + apiInfo.getName()+ "-" + apiInfo.getVersion(); + subscription.setApiIdentifier(id); + subscription.setApplicationId(application.getApplicationId()); + subscription.tier(ApiApplicationConstants.DEFAULT_TIER); + needToSubscribe.add(subscription); } } } } } + if (!needToSubscribe.isEmpty()) { + storeClient.getIndividualSubscription().subscriptionsPost(needToSubscribe, CONTENT_TYPE); + } //end of subscription List applicationKeys = application.getKeys(); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionindividualApi.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionindividualApi.java index adf57708a4..02e24ebe62 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionindividualApi.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/api/SubscriptionindividualApi.java @@ -22,6 +22,8 @@ import feign.Param; import feign.RequestLine; import org.wso2.carbon.apimgt.integration.client.store.model.Subscription; +import java.util.List; + @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-01-24T00:03:54.991+05:30") public interface SubscriptionindividualApi { @@ -42,6 +44,21 @@ public interface SubscriptionindividualApi { }) Subscription subscriptionsPost(Subscription body, @Param("contentType") String contentType); + /** + * Add new subscriptions + * Add new subscriptions + * @param body Subscription objects that should to be added (required) + * @param contentType Media type of the entity in the body. Default is JSON. (required) + * @return Subscription + */ + @RequestLine("POST /subscriptions/multiple") + @Headers({ + "Content-type: application/json", + "Accept: application/json", + "Content-Type: {contentType}" + }) + List subscriptionsPost(List body, @Param("contentType") String contentType); + /** * Remove subscription * Remove subscription From 67ae4c7c6849a1a00ef719bf807d5e6d05ff8bef Mon Sep 17 00:00:00 2001 From: ayyoob Date: Thu, 9 Feb 2017 09:11:22 +0530 Subject: [PATCH 02/10] fixed api subscription issue --- .../extension/APIManagementProviderServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java index 50bcc5ad0f..4dd85b2532 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -104,10 +104,12 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe if (apiList.getList() != null && apiList.getList().size() > 0) { for (APIInfo apiInfo : apiList.getList()) { + String id = apiInfo.getProvider().replace("@", "-AT-") + + "-" + apiInfo.getName()+ "-" + apiInfo.getVersion(); boolean subscriptionExist = false; if (subscriptionList.getList() != null && subscriptionList.getList().size() > 0) { for (Subscription subs : subscriptionList.getList()) { - if (subs.getApiIdentifier().equals(apiInfo.getId())) { + if (subs.getApiIdentifier().equals(id)) { subscriptionExist = true; break; } @@ -116,8 +118,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe if (!subscriptionExist) { Subscription subscription = new Subscription(); //fix for APIMANAGER-5566 admin-AT-tenant1.com-Tenant1API1-1.0.0 - String id = apiInfo.getProvider().replace("@", "-AT-") - + "-" + apiInfo.getName()+ "-" + apiInfo.getVersion(); + subscription.setApiIdentifier(id); subscription.setApplicationId(application.getApplicationId()); subscription.tier(ApiApplicationConstants.DEFAULT_TIER); From dac7d3c1eedfe6e2f13ff1372e4a6620158e85b4 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Thu, 9 Feb 2017 09:59:06 +0530 Subject: [PATCH 03/10] made device management to be default tag --- .../api/ApiApplicationRegistrationServiceImpl.java | 2 +- .../apimgt/application/extension/api/util/APIUtil.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java index 425c9a1141..b2f46dc09e 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java @@ -63,7 +63,7 @@ public class ApiApplicationRegistrationServiceImpl implements ApiApplicationRegi PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(username); APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService(); ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( - applicationName, APIUtil.getAllowedApisTags().toArray(new String[APIUtil.getAllowedApisTags().size()]), + applicationName, APIUtil.getDefaultTags(), ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username, false, ApiApplicationConstants.DEFAULT_VALIDITY_PERIOD); return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build(); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/APIUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/APIUtil.java index cdce160c54..8b888a010d 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/APIUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/APIUtil.java @@ -31,6 +31,7 @@ import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; +import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; @@ -95,8 +96,13 @@ public class APIUtil { return deviceManagementProviderService; } + public static String[] getDefaultTags() throws DeviceManagementException { + String[] allowedApisTags = new String[1]; + allowedApisTags[0] = DEFAULT_CDMF_API_TAG; + return allowedApisTags; + } + public static List getAllowedApisTags() throws DeviceManagementException { - //Todo get allowed cdmf service tags from config. List allowedApisTags = getDeviceManagementProviderService().getAvailableDeviceTypes(); allowedApisTags.add(DEFAULT_CDMF_API_TAG); allowedApisTags.add(DEFAULT_CERT_API_TAG); From f772b357698637dc009cb4d20223d5bbb5a94769 Mon Sep 17 00:00:00 2001 From: kamidu Date: Thu, 9 Feb 2017 20:15:49 +0530 Subject: [PATCH 04/10] enable cloud related configurations to the devicemgt application --- .../jaggeryapps/devicemgt/app/conf/config.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 83e03ee710..1a98afd88f 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 @@ -2,12 +2,12 @@ "appContext": "/devicemgt/", "isCloud": false, "cloudConfig": { - "upgradeNowURL": "", - "monetizationURL": "", - "requestExtensionURL": "", + "upgradeNowURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/payment-plans.jag?cloud-type=device_cloud", + "monetizationURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/monetization-dashboard.jag", + "requestExtensionURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/contact-us.jag?cloud-type=device_cloud&request-extension=true", "publisherURL": "", "storeURL": "", - "contactUsURL": "", + "contactUsURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/contact-us.jag", "apiCloudDocURL": "https://docs.wso2.com/display/APICloud/WSO2+API+Cloud+Documentation", "appCloudDocURL": "https://docs.wso2.com/display/AppCloud/WSO2+App+Cloud+Documentation", "deviceCloudDocURL": "https://docs.wso2.com/display/DeviceCloud/WSO2+Device+Cloud+Documentation", @@ -18,8 +18,8 @@ "apiCloudURL": "", "appCloudURL": "", "deviceCloudURL": "", - "oraganizationURL": "", - "membersURL": "" + "oraganizationURL": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag", + "membersURL": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag" }, "httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%", "httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port", From b946eeae74e1f69aea670fabb3fc0510959a424c Mon Sep 17 00:00:00 2001 From: kamidu Date: Thu, 9 Feb 2017 23:24:15 +0530 Subject: [PATCH 05/10] fix url issues in the config.json --- .../jaggeryapps/devicemgt/app/conf/config.json | 2 +- .../cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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 1a98afd88f..4c385b0123 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 @@ -14,7 +14,7 @@ "apiCloudWalkthroughURL": "https://api.clouddev.wso2.com/publisher?interactiveTutorial=true", "profileURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/user-profile.jag", "changePasswordURL": "https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/change-password.jag", - "logoutURL": "https://api.clouddev.wso2.com/publisher/site/pages/logout.jag", + "logoutURL": "https://devicemgt.cloud.wso2.com/devicemgt/logout", "apiCloudURL": "", "appCloudURL": "", "deviceCloudURL": "", diff --git a/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 b/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 index b28e0ae5df..8c7d88c063 100644 --- a/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 +++ b/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 @@ -229,17 +229,17 @@
- +
API Cloud
- +
App Cloud
- +
Device Cloud
@@ -249,12 +249,12 @@

Manage your cloud

- +
Organization
- +
Members
From 6e19ec31e368ae3c159a3bdfb917fe8703799558 Mon Sep 17 00:00:00 2001 From: kamidu Date: Fri, 10 Feb 2017 02:47:25 +0530 Subject: [PATCH 06/10] fix url issues in the config.json --- .../units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/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 b/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 index 8c7d88c063..cb8071077f 100644 --- a/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 +++ b/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 @@ -176,11 +176,7 @@ - {{else}} - {{@user.username}}@{{@user.domain}} - {{/if}}
@@ -128,7 +132,7 @@
{{policyCount}} - + {{#if policyCount}} @@ -139,14 +143,16 @@ View {{/if}} - - + + {{#unless isCloud}} + Add + {{/unless}}
@@ -171,13 +177,15 @@ {{/if}} - + {{#unless isCloud}} + Add + {{/unless}}
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 index 35a4eb0c05..f52ce80319 100644 --- 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 @@ -40,6 +40,7 @@ function onRequest() { viewModel.userCount = userModule.getUsersCount(); viewModel.policyCount = policyModule.getPoliciesCount(); viewModel.roleCount = userModule.getRolesCount(); + viewModel.isCloud = devicemgtProps.isCloud; 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.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 index d673e72929..d2b7521ff7 100644 --- 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 @@ -142,8 +142,14 @@ function loadRoles() { class: "text-right content-fill text-left-on-grid-view no-wrap", data: null, render: function (data, type, row, meta) { - return '' + - ' 0){ + isCloud = true; + } + + var innerhtml = ''; + + var editLink = '' + @@ -156,8 +162,9 @@ function loadRoles() { '' + '' + '' + - '' + - ''; + + var editPermissionLink = '' + @@ -170,8 +177,9 @@ function loadRoles() { '' + '' + '' + - '' + - ''; + + car removeLink = '' + '' + @@ -180,6 +188,11 @@ function loadRoles() { '' + '' + ''; + + if (!isCloud){ + innerhtml = editLink + editPermissionLink + removeLink; + } + return innerhtml; } } ]; 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 index e92009887d..962a7f3cea 100644 --- 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 @@ -35,6 +35,7 @@ {{/zone}} {{#zone "navbarActions"}} + {{#unless isCloud}}
  • @@ -45,16 +46,22 @@ Add Role
  • + {{/unless}} {{/zone}} {{#zone "content"}}
    + {{#unless isCloud}} {{#if removePermitted}} {{/if}} {{#if editPermitted}} {{/if}} + {{/unless}} + {{#if isCloud}} + + {{/if}} Loading roles . . .
    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 index 957d29a5f8..10121aa72d 100644 --- 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 @@ -32,6 +32,7 @@ function onRequest(context) { } context["adminRole"] = deviceMgtProps["adminRole"]; + context["isCloud"] = deviceMgtProps["isCloud"]; 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.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 index 01acd48ffa..6230be73b7 100644 --- 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 @@ -37,94 +37,99 @@ {{#zone "content"}} {{#if canView}} - {{#zone "contentTitle"}} -
    -
    - + {{#zone "contentTitle"}} +
    +
    + +
    -
    - {{/zone}} + {{/zone}} -
    -
    -
    -
    +
    +
    +
    +
    +
    +
    + + {{#unless isCloud}} + {{#if editPermitted}} + + {{/if}} + {{/unless}} +
    -
    - {{#if editPermitted}} - - {{/if}} +
    +
    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}}
    -
    -
    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}} -
    +
    +
    + +
    + {{#defineZone "user-enrolled-devices"}} +
    +
    +
    +
    Enrolled Devices by + {{#if user.firstname}} + {{user.firstname}} {{user.lastname}} + {{else}} + {{user.username}} + {{/if}} +
    +
    +
    +
    + {{#each devices}} +
    @@ -155,19 +160,19 @@
    -
    - {{/each}} +
    + {{/each}} +
    +
    -
    -
    - {{/defineZone}} + {{/defineZone}} +
    -
    - {{else}} + {{else}}

    Permission Denied

    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 index 3ad6887941..2d544949b0 100644 --- 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 @@ -20,6 +20,7 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var username = request.getParameter("username"); var user = userModule.getUser(username)["content"]; + var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var userName = request.getParameter("username"); @@ -45,5 +46,8 @@ function onRequest(context) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) { canView = true; } - return {"user": user, "userRoles": userRoles, "devices": devices, "canView": canView}; + + var isCloud = deviceMgtProps.isCloud; + + return {"user": user, "userRoles": userRoles, "devices": devices, "canView": canView, "isCloud" : isCloud}; } 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 index fad118d1a4..85f2241db3 100644 --- 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 @@ -35,6 +35,7 @@ {{/zone}} {{#zone "navbarActions"}} + {{#unless isCloud}}
  • @@ -45,18 +46,21 @@ Add User
  • + {{/unless}} {{/zone}} {{#zone "content"}}
    - {{#if canManage}} - - - - - {{/if}} + {{#unless isCloud}} + {{#if canManage}} + + + + + {{/if}} + {{/unless}} {{#if canView}} {{/if}} @@ -108,14 +112,16 @@ Enter new password

    -

    Retype new password

    -

    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 index e777b314ac..4b7f9c01bc 100644 --- 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 @@ -33,6 +33,7 @@ function onRequest(context) { 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; diff --git a/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 b/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 index f1c9eb0fa0..2ed8c3af49 100644 --- a/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 +++ b/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 @@ -29,80 +29,80 @@ -
  • - - - - - - - - - - - - -
  • - -
  • - - - - - - - - - - -
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  • {{/if}} + + {{#unless isCloud}} {{#if permissions.VIEW_DASHBOARD}}
  • @@ -57,6 +59,9 @@
  • {{/if}} + {{/unless}} + + {{#if permissions.LIST_GROUPS}}
  • @@ -81,6 +86,8 @@ {{#if permissions.LIST_POLICIES}}
  • Policy Management
  • {{/if}} + + {{#unless isCloud}} {{#if permissions.TENANT_CONFIGURATION}}
  • Configuration Management
      @@ -92,6 +99,10 @@
  • {{/if}} + {{/unless}} + + + {{/zone}} {{#zone "navbarCollapsableRightItems"}} diff --git a/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 b/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 index 471a152402..69e306f590 100644 --- a/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 +++ b/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 @@ -52,6 +52,7 @@ function onRequest(context) { context["isAuthorizedForNotifications"] = isAuthorizedForNotifications; context["currentUser"] = currentUser; context["appContext"] = mdmProps["appContext"]; + context["isCloud"] = mdmProps["isCloud"]; return context; } \ No newline at end of file From 8931478a55973dbadc1894d02c54cc12c4dbb6ed Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 14 Feb 2017 19:37:38 +0530 Subject: [PATCH 09/10] Moving error into common logic page. If in cloud mode; change "default": "uuf.page.error" into "default": "cdmf.page.error" in config.json --- .../devicemgt/app/conf/app-conf.json | 1 - .../app/layouts/cdmf.layout.error.hbs | 48 +++++++++++++++++++ .../pages/cdmf.page.error-404/error-404.json | 6 --- .../error.hbs} | 20 +------- .../app/pages/cdmf.page.error/error.json | 5 ++ 5 files changed, 55 insertions(+), 25 deletions(-) create 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/pages/cdmf.page.error-404/error-404.json rename components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/{cdmf.page.error-404/error-404.hbs => cdmf.page.error/error.hbs} (58%) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.json 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 index bfe2bd2a0f..4be20160d3 100644 --- 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 @@ -40,7 +40,6 @@ } }, "errorPages": { - "404": "cdmf.page.error-404", "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/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 new file mode 100644 index 0000000000..d14f195c32 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/layouts/cdmf.layout.error.hbs @@ -0,0 +1,48 @@ +{{!-- Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + +WSO2 Inc. licenses this file to you under the Apache License, +Version 2.0 (the "License"); you may not use this file except +in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +either express or implied. See the License for the +specific language governing permissions and limitations +under the License. --}} + + + + + + + + {{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/pages/cdmf.page.error-404/error-404.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error-404/error-404.json deleted file mode 100644 index 581e0119d3..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error-404/error-404.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/error/404", - "layout": "uuf.layout.default", - "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.error-404/error-404.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.hbs similarity index 58% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error-404/error-404.hbs rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.hbs index a4a31d008c..a1a620b4b8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error-404/error-404.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.hbs @@ -17,22 +17,6 @@ }} {{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}} -{{#zone "breadcrumbs"}} -
  • - - - -
  • -{{/zone}} - -{{#zone "content"}} -
    -

    An Error Occurred!

    - -
    -
    HTTP Status : {{@page.params.status}}
    - -

    {{@page.params.message}}

    -
    -
    +{{#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 new file mode 100644 index 0000000000..adad4c3291 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.error/error.json @@ -0,0 +1,5 @@ +{ + "version": "1.0.0", + "uri": "/errors/default", + "layout" : "cdmf.layout.error" +} \ No newline at end of file From d92c52b89b71df05f9bb373d95057e468b186dcc Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 14 Feb 2017 19:49:41 +0530 Subject: [PATCH 10/10] Adding cloud error pages for jaggery.conf --- .../devicemgt/error-pages/error400-cloud.html | 30 +++++++++++++++++++ .../devicemgt/error-pages/error401-cloud.html | 30 +++++++++++++++++++ .../devicemgt/error-pages/error403-cloud.html | 30 +++++++++++++++++++ .../devicemgt/error-pages/error404-cloud.html | 30 +++++++++++++++++++ .../devicemgt/error-pages/error405-cloud.html | 30 +++++++++++++++++++ .../devicemgt/error-pages/error500-cloud.html | 30 +++++++++++++++++++ 6 files changed, 180 insertions(+) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error400-cloud.html create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error401-cloud.html create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error403-cloud.html create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error404-cloud.html create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error405-cloud.html create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error500-cloud.html diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error400-cloud.html b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error400-cloud.html new file mode 100644 index 0000000000..3007e7d0be --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error400-cloud.html @@ -0,0 +1,30 @@ + + + + + + + + +
    +
    +
    + +
    +
    +

    Oops something went wrong

    +

    400 - Bad request

    +
    + +
    +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error401-cloud.html b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error401-cloud.html new file mode 100644 index 0000000000..8c195bd0f0 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error401-cloud.html @@ -0,0 +1,30 @@ + + + + + + + + +
    +
    +
    + +
    +
    +

    Oops something went wrong

    +

    401 - Unauthorized

    +
    + +
    +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error403-cloud.html b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error403-cloud.html new file mode 100644 index 0000000000..d9d7d00b0c --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error403-cloud.html @@ -0,0 +1,30 @@ + + + + + + + + +
    +
    +
    + +
    +
    +

    Oops something went wrong

    +

    403 - Forbidden

    +
    + +
    +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error404-cloud.html b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error404-cloud.html new file mode 100644 index 0000000000..897eeb4821 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error404-cloud.html @@ -0,0 +1,30 @@ + + + + + + + + +
    +
    +
    + +
    +
    +

    Oops something went wrong

    +

    404 - Page Not Found

    +
    + +
    +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error405-cloud.html b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error405-cloud.html new file mode 100644 index 0000000000..bc3d5bdd57 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error405-cloud.html @@ -0,0 +1,30 @@ + + + + + + + + +
    +
    +
    + +
    +
    +

    Oops something went wrong

    +

    405 - Method Not Allowed

    +
    + +
    +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error500-cloud.html b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error500-cloud.html new file mode 100644 index 0000000000..1ece4cc29d --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/error-pages/error500-cloud.html @@ -0,0 +1,30 @@ + + + + + + + + +
    +
    +
    + +
    +
    +

    Oops something went wrong

    +

    500 - Internal Server Error

    +
    + +
    +
    + +
    +
    +
    +
    + + \ No newline at end of file