diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java index 042da6b8c27..2466c7cbe2b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java @@ -29,6 +29,7 @@ import org.wso2.carbon.apimgt.webapp.publisher.APIConfig; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherUtil; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResourceConfiguration; +import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig; import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder; import org.wso2.carbon.apimgt.webapp.publisher.lifecycle.util.AnnotationProcessor; @@ -48,7 +49,8 @@ public class APIPublisherLifecycleListener implements LifecycleListener { @Override public void lifecycleEvent(LifecycleEvent lifecycleEvent) { - if (Lifecycle.AFTER_START_EVENT.equals(lifecycleEvent.getType())) { + 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); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 945afa81d31..89e8d131ce9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -44,7 +44,7 @@ public interface ActivityInfoProviderService { @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", + httpMethod = "GET", response = Activity.class, value = "Retrieve details of a particular activity.", notes = "This will return information of a particular activity i.e. meta information of an operation, " + @@ -78,7 +78,7 @@ public interface ActivityInfoProviderService { code = 500, message = "Internal Server Error. \n Server error occurred while fetching activity data.") }) - @Permission(scope = "operation-view", permissions = {"/permission/admin/device-mgt/admin/devices/view"}) + @Permission(scope = "activity-view", permissions = {"/permission/admin/device-mgt/admin/activities/view"}) Response getActivity( @ApiParam( name = "id", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java index 977b9cbc849..b984bb699e5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -47,7 +47,7 @@ import java.util.Date; import java.util.List; @Path("/devices") -public class DeviceManagementServiceImpl implements DeviceManagementService { +public class DeviceManagementServiceImpl implements DeviceManagementService{ private static final Log log = LogFactory.getLog(DeviceManagementServiceImpl.class); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java index d34a284ac25..0d89dbc9a62 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java @@ -82,7 +82,7 @@ public class DeviceMgtAPIUtils { } public static DeviceManagementProviderService getDeviceManagementService() { - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); DeviceManagementProviderService deviceManagementProviderService = (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null); if (deviceManagementProviderService == null) { @@ -94,7 +94,7 @@ public class DeviceMgtAPIUtils { } public static GroupManagementProviderService getGroupManagementProviderService() { - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); GroupManagementProviderService groupManagementProviderService = (GroupManagementProviderService) ctx.getOSGiService(GroupManagementProviderService.class, null); if (groupManagementProviderService == null) { @@ -108,7 +108,7 @@ public class DeviceMgtAPIUtils { public static UserStoreManager getUserStoreManager() throws UserStoreException { RealmService realmService; UserStoreManager userStoreManager; - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); if (realmService == null) { String msg = "Realm service has not initialized."; @@ -126,7 +126,7 @@ public class DeviceMgtAPIUtils { public static UserRealm getUserRealm() throws UserStoreException { RealmService realmService; UserRealm realm; - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); if (realmService == null) { @@ -140,7 +140,7 @@ public class DeviceMgtAPIUtils { public static AuthorizationManager getAuthorizationManager() throws UserStoreException { RealmService realmService; AuthorizationManager authorizationManager; - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); if (realmService == null) { throw new IllegalStateException("Realm service is not initialized."); @@ -159,7 +159,7 @@ public class DeviceMgtAPIUtils { } public static ApplicationManagementProviderService getAppManagementService() { - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); ApplicationManagementProviderService applicationManagementProviderService = (ApplicationManagementProviderService) ctx.getOSGiService(ApplicationManagementProviderService.class, null); if (applicationManagementProviderService == null) { @@ -170,7 +170,7 @@ public class DeviceMgtAPIUtils { public static PolicyManagerService getPolicyManagementService() { PolicyManagerService policyManagementService; - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); policyManagementService = (PolicyManagerService) ctx.getOSGiService(PolicyManagerService.class, null); if (policyManagementService == null) { @@ -194,7 +194,7 @@ public class DeviceMgtAPIUtils { public static NotificationManagementService getNotificationManagementService() { NotificationManagementService notificationManagementService; - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); notificationManagementService = (NotificationManagementService) ctx.getOSGiService( NotificationManagementService.class, null); if (notificationManagementService == null) { @@ -204,7 +204,7 @@ public class DeviceMgtAPIUtils { } public static CertificateManagementService getCertificateManagementService() { - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); CertificateManagementService certificateManagementService = (CertificateManagementService) ctx.getOSGiService(CertificateManagementService.class, null); @@ -227,7 +227,7 @@ public class DeviceMgtAPIUtils { } public static DeviceInformationManager getDeviceInformationManagerService() { - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); DeviceInformationManager deviceInformationManager = (DeviceInformationManager) ctx.getOSGiService(DeviceInformationManager.class, null); if (deviceInformationManager == null) { @@ -238,7 +238,7 @@ public class DeviceMgtAPIUtils { public static SearchManagerService getSearchManagerService() { - CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); SearchManagerService searchManagerService = (SearchManagerService) ctx.getOSGiService(SearchManagerService.class, null); if (searchManagerService == null) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml index 8146d01640b..a886c71925a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml @@ -29,7 +29,98 @@ --> + + + + Fetch Activity related details + /device-mgt/admin/activities/view + /activities/* + GET + + + + List devices + /device-mgt/admin/devices/list + /devices + GET + + + + List device types + /device-mgt/admin/devices/list + /devices/types + GET + + + + List device types + /device-mgt/user/devices/list + /devices/types + GET + + + + Add policy + /device-mgt/admin/policies/add + /devices/types + GET + + + + Add User policy + /device-mgt/user/policies/add + /devices/types + GET + + + + Edit policy + /device-mgt/admin/policies/update + /devices/types + GET + + + + Edit User policy + /device-mgt/user/policies/update + /devices/types + GET + + + + View device + /device-mgt/admin/devices/view + /devices/view + GET + + + + View user device + /device-mgt/user/devices/view + /devices/view + GET + + + + Modify user device + /device-mgt/user/devices/update + /devices/type/*/id/* + PUT + + + + Remove user device + /device-mgt/user/devices/remove + /devices/type/*/id/* + DELETE + + + + + + + Device Management @@ -143,82 +234,7 @@ GET - - List devices - /device-mgt/admin/devices/list - /devices - GET - - - - List device types - /device-mgt/admin/devices/list - /devices/types - GET - - - - List device types - /device-mgt/user/devices/list - /devices/types - GET - - - - Add policy - /device-mgt/admin/policies/add - /devices/types - GET - - - - Add User policy - /device-mgt/user/policies/add - /devices/types - GET - - - - Edit policy - /device-mgt/admin/policies/update - /devices/types - GET - - - - Edit User policy - /device-mgt/user/policies/update - /devices/types - GET - - - - View device - /device-mgt/admin/devices/view - /devices/view - GET - - - View user device - /device-mgt/user/devices/view - /devices/view - GET - - - - Modify user device - /device-mgt/user/devices/update - /devices/type/*/id/* - PUT - - - - Remove user device - /device-mgt/user/devices/remove - /devices/type/*/id/* - DELETE -