diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/META-INF/permissions.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/META-INF/permissions.xml index b38133cc1fb..df2b2cf629b 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/META-INF/permissions.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/META-INF/permissions.xml @@ -32,7 +32,7 @@ get certificate in the database - /device-mgt/emm-admin/certificate/GetSignCSR + /device-mgt/admin/certificate/GetSignCSR /certificates/scep/signcsr POST emm_admin diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/META-INF/permissions.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/META-INF/permissions.xml index dcd6b92155f..0fc47021456 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/META-INF/permissions.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/META-INF/permissions.xml @@ -32,22 +32,16 @@ - Save certificate - /device-mgt/admin/certificate/Save + View all certificates + /device-mgt/admin/certificate/GetAll /admin/certificates - POST - - - Get certificate - /device-mgt/admin/certificate/Get - /admin/certificates/* GET - Get all certificates - /device-mgt/admin/certificate/GetAll + Add certificate + /device-mgt/admin/certificate/Add /admin/certificates - GET + POST Remove certificate @@ -55,5 +49,11 @@ /admin/certificates/* DELETE + + View certificate + /device-mgt/admin/certificate/View + /admin/certificates/* + GET + 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 eff12570bff..a150bed3273 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 @@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; @@ -144,6 +145,32 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { } } + @GET + @Path("/user-devices") + public Response getDeviceByUser(@QueryParam("offset") int offset, + @QueryParam("limit") int limit) { + + PaginationRequest request = new PaginationRequest(offset, limit); + PaginationResult result; + DeviceList devices = new DeviceList(); + + String currentUser = CarbonContext.getThreadLocalCarbonContext().getUsername(); + request.setOwner(currentUser); + + try { + result = DeviceMgtAPIUtils.getDeviceManagementService().getDevicesOfUser(request); + devices.setList((List) result.getData()); + devices.setCount(result.getRecordsTotal()); + return Response.status(Response.Status.OK).entity(devices).build(); + } catch (DeviceManagementException e) { + String msg = "Error occurred while fetching all enrolled devices"; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } + } + + @GET @Path("/{type}/{id}") @Override 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 30bc4bf8864..9ade27a7e2c 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,965 +29,368 @@ --> - - - Device Management - /device-mgt - / - GET - - - - Device Management Admin - /device-mgt/admin - / - GET - - - - Device Management User - /device-mgt/user - / - GET - - - - Devices - /device-mgt/admin/devices - / - GET - - - - User Devices - /device-mgt/user/devices - / - GET - - - - Policies - /device-mgt/admin/policies - / - GET - - - - User Policies - /device-mgt/user/policies - / - GET - - - - Notifications - /device-mgt/admin/notifications - / - GET - - - - User Notifications - /device-mgt/user/notifications - / - GET - - - - Users - /device-mgt/admin/users - / - GET - - - - Operations - /device-mgt/admin/operations - / - GET - - - - User Operations - /device-mgt/user/operations - / - GET - - - - Applications - /device-mgt/admin/operations/applications - / - GET - - - - Roles - /device-mgt/admin/roles - / - GET - - - - Configurations - /device-mgt/admin/platform-configs - / - GET - - - - View Dashboard - /device-mgt/admin/dashboard - / - GET - + + Device Management + /device-mgt + / + GET + + + + Device Management Admin + /device-mgt/admin + / + GET + + + Devices + /device-mgt/admin/devices + / + GET + + + + List devices + /device-mgt/admin/devices/List + /devices + GET + + + Search devices + /device-mgt/admin/devices/Search + /devices/search-devices + POST + + + View device + /device-mgt/admin/devices/View + /devices/*/* + GET + + + View device applications + /device-mgt/admin/devices/View-Applications + /devices/*/*/applications + GET + + + View device effective-policy + /device-mgt/admin/devices/View-Active-Policy + /devices/*/*/effective-policy + GET + + + View devices feature + /device-mgt/admin/devices/View-Features + /devices/*/*/features + GET + + + View device operations + /device-mgt/admin/devices/View-Operations + /devices/*/*/operations + GET + + + View Compliance Data + /device-mgt/admin/devices/View-Compliance-Data + /devices/*/*/compliance-data + GET + + + List all devices + /device-mgt/admin/devices/Admin-View + /admin/devices + GET + + + + Policies + /device-mgt/admin/policies + / + GET + + + + List policies + /device-mgt/admin/policies/List + /policies + GET + + + Add Policy + /device-mgt/admin/policies/Add + /policies + POST + + + Activate policy + /device-mgt/admin/policies/Activate-Policy + /policies/activate-policy + PUT + + + Deactivate Policy + /device-mgt/admin/policies/Deactivate-Policy + /policies/deactivate-policy + PUT + + + Remove Policy + /device-mgt/admin/policies/Remove + /policies/remove-policy + POST + + + View Policy + /device-mgt/admin/policies/View + /policies/* + GET + + + Update Policy + /device-mgt/admin/policies/Update + /policies/* + PUT + + + Update Policy + /device-mgt/admin/policies/Update + /policies/apply-changes + PUT + + + Update Policy + /device-mgt/admin/policies/Change-Priority + /policies/priorities + PUT + + + + Notifications + /device-mgt/admin/notifications + / + GET + + + + View notifications + /device-mgt/admin/notifications/View + /notifications + GET + + + Mark checked notifications + /device-mgt/admin/notifications/View + /notifications/*/mark-checked + PUT + + + + Users + /device-mgt/admin/users + / + GET + + + + List users + /device-mgt/admin/users/List + /users + GET + + + Add user + /device-mgt/admin/users/Add + /users + POST + + + List users + /device-mgt/admin/users/Search + /users/search/usernames + GET + + + Remove user + /device-mgt/admin/users/Remove + /users/* + DELETE + + + View user + /device-mgt/admin/users/View + /users/* + GET + + + Update user + /device-mgt/admin/users/Update + /users/* + PUT + + + Update user credentials + /device-mgt/admin/users/Change-Password + /users/*/credentials + PUT + + + View assigned role + /device-mgt/admin/roles/Assigned-Roles + /users/*/roles + GET + + + Change any user credentials + /device-mgt/admin/users/Change-Password-Any + /admin/users/*/credentials + POST + + + + Roles + /device-mgt/admin/roles + / + GET + + + + List roles + /device-mgt/admin/roles/List + /roles + GET + + + Add role + /device-mgt/admin/roles/Add + /roles + POST + + + Remove role + /device-mgt/admin/roles/Remove + /roles/* + DELETE + + + View role + /device-mgt/admin/roles/View + /roles/* + GET + + + Update role + /device-mgt/admin/roles/Update + /roles/* + PUT + + + View role permissions + /device-mgt/admin/roles/View-Permission + /roles/*/permissions + GET + + + Add Users to role + /device-mgt/admin/roles/Add-Users + /roles/*/users + PUT + + + + Configurations + /device-mgt/admin/general-configs + / + GET + + + + View configuration + /device-mgt/admin/general-configuration/View + /configuration + GET + + + Update configuration + /device-mgt/admin/general-configuration/Update + /configuration + PUT + + + + Activities + /device-mgt/admin/activities + / + GET + + + + View Activities + /device-mgt/admin/activities/View + /activities + GET + + + View Activity Details + /device-mgt/admin/activities/View + /activities/* + GET + + + + Applications + /device-mgt/admin/applications + / + GET + + + + Install Applications + /device-mgt/admin/application/Install + /admin/applications/install-application + POST + + + Uninstall-Applications + /device-mgt/admin/application/Uninstall + /admin/applications/uninstall-application + POST + + + + + + Device Management User + /device-mgt/user + / + GET + + + User Devices + /device-mgt/user/devices + / + GET + + + User Policies + /device-mgt/user/policies + / + GET + + + User Notifications + /device-mgt/user/notifications + / + GET + + + User Operations + /device-mgt/user/operations + / + GET + + - - - - Fetch Activity related details - /device-mgt/admin/activities/view - /activities/* - GET - - - 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/types - /devices/types - GET - - - Retrieve device information - /device-mgt/admin/devices/list - /devices/*/*/info - GET - - - Get device - /device-mgt/admin/devices/list - /devices/*/* - GET - - - Get device location - /device-mgt/admin/devices/list - /devices/*/*/location - GET - - - devices location - /device-mgt/admin/devices/list - /devices/locations - POST - - - Get devices feature - /device-mgt/admin/devices/list - /devices/*/*/features - GET - - - Search devices - /device-mgt/admin/devices/list - /devices/search-devices - POST - - - list device application - /device-mgt/admin/devices/list - /devices/*/*/applications - GET - - - list device operation - /device-mgt/admin/devices/list - /devices/*/*/operations - GET - - - list device effective-policy - /device-mgt/admin/devices/list - /devices/*/*/effective-policy - GET - - - list devices - /device-mgt/admin/devices/list - /admin/devices - GET - - - - - - - View notifications - /device-mgt/admin/notifications/view - /notifications - GET - - - - Add notification - /device-mgt/admin/notifications/add - /notifications - POST - - - - Update notification - /device-mgt/admin/notifications/update - /notifications/*/* - PUT - - - - View notifications - /device-mgt/admin/notifications/view - /notifications/* - GET - - - - - - View user - /device-mgt/admin/users/view - /operations - GET - - - - Install application - /device-mgt/admin/operations/applications/install-applications - /operations - POST - - - - Install application - /device-mgt/admin/operations/applications/install-applications - /operations/installApp/* - POST - - - - Uninstall application - /device-mgt/admin/operations/applications/uninstall-applications - /operations/uninstallApp/* - POST - - - - View application - /device-mgt/admin/operations/applications/view-applications - /operations/*/*/* - GET - - - - View devices - /device-mgt/user/devices/view - /operations/*/*/* - GET - - - - View device - /device-mgt/admin/devices/view - /operations/*/*/* - GET - - - - View device - /device-mgt/admin/devices/view - /operations/*/* - GET - - - - View device - /device-mgt/admin/devices/view - /operations/paginate/*/* - GET - - - - View device - /device-mgt/user/devices/view - /operations/*/* - GET - - - - View device - /device-mgt/user/devices/view - /operations/paginate/*/* - GET - - - - View device - /device-mgt/admin/devices/view - /devices/*/*/operations - GET - - - - View device - /device-mgt/user/devices/view - /devices/*/*/operations - GET - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - List policies - /device-mgt/admin/policies/list - /devices/*/*/features - GET - - - - View device - /device-mgt/admin/devices/view - /devices/*/*/features - GET - - - - View device - /device-mgt/user/devices/view - /devices/*/*/features - GET - - - - View device - /device-mgt/user/devices/view - /devices/*/*/features - GET - - - - - - - List roles - /device-mgt/admin/roles/list - /roles - GET - - - - View user - /device-mgt/admin/users/view - /roles - GET - - - - Add policy - /device-mgt/admin/policies/add - /roles - GET - - - - Update policy - /device-mgt/admin/policies/update - /roles - GET - - - - List roles - /device-mgt/admin/roles/list - /roles/*/permissions - GET - - - - List roles - /device-mgt/admin/roles/list - /roles/* - GET - - - - Add user - /device-mgt/admin/users/add - /roles/* - GET - - - - Update role - /device-mgt/admin/roles/update - /roles/* - PUT - - - - Update role - /device-mgt/admin/roles/update - /roles/*/users - PUT - - - - Add role - /device-mgt/admin/roles/add - /roles - POST - - - - Remove role - /device-mgt/admin/roles/remove - /roles/* - DELETE - - - - List roles - /device-mgt/admin/roles/list - /roles/count - GET - - - - - - List users - /device-mgt/admin/users/list - /users - GET - - - List users - /device-mgt/admin/users/list - /users/search/usernames - GET - - - Add user - /device-mgt/admin/users/add - /users - POST - - - Remove user - /device-mgt/admin/users/remove - /users/* - DELETE - - - View user - /device-mgt/admin/users/view - /users/* - GET - - - Update user - /device-mgt/admin/users/update - /users/* - PUT - - - Update user credential - /device-mgt/admin/users/update - /users/*/credentials - PUT - - - Get role - /device-mgt/admin/roles/add - /users/*/roles - GET - - - Update user credential - /device-mgt/admin/users/update - /admin/users/*/credentials - POST - - - - - - - - List policies - /device-mgt/admin/policies/list - /policies - GET - - - Add Policy - /device-mgt/admin/policies/add - /policies - POST - - - Activate policy - /device-mgt/admin/policies/add - /policies/activate-policy - PUT - - - Deactivate Policy - /device-mgt/admin/policies/add - /policies/deactivate-policy - PUT - - - Remove Policy - /device-mgt/admin/policies/remove - /policies/remove-policy - POST - - - View Policy - /device-mgt/admin/policies/view - /policies/* - GET - - - Update Policy - /device-mgt/admin/policies/update - /policies/* - Put - - - - - - Add policy - /device-mgt/admin/policies/add - /profiles - POST - - - - Edit policy - /device-mgt/admin/policies/update - /profiles/* - PUT - - - - Remove policy - /device-mgt/admin/policies/remove - /profiles/* - DELETE - - - - - - - Device Information - /device-mgt/admin/information/get - /information/*/* - GET - - - - Get additional information of devices - /device-mgt/admin/information/list - /devices/get-info - POST - - - - Device Search - /device-mgt/admin/search - /search - POST - - - - Device Updated - /device-mgt/admin/search/after - /search/after/* - GET - - - - - - - - - - - - - - - - - - - - - - - - View configuration - /device-mgt/admin/platform-configs/view - /configuration - GET - - - Update configuration - /device-mgt/admin/platform-configs/modify - /configuration - PUT - - - - - - - Save certificate in the database - /device-mgt/admin/certificate/save - /certificates - POST - - - get certificate in the database - /device-mgt/admin/certificate/Get - /certificates/* - GET - - - get certificate in the database - /device-mgt/admin/certificate/GetAll - /certificates - GET - - - get certificate in the database - /device-mgt/admin/certificate/Get - /certificates/* - DELETE - - - - - - Group Management Admin - /device-mgt/admin/groups - / - GET - - - - Group Management User - /device-mgt/user/groups - / - GET - - - - Add Group - /device-mgt/user/groups/add - /groups - POST - - - - Group update - /device-mgt/user/groups/update - /groups/owner/*/name/* - PUT - - - - Group Delete - /device-mgt/user/groups/remove - /groups/owner/*/name/* - DELETE - - - - List All Groups with Pagination - /device-mgt/admin/groups/list - /groups - GET - - - - List All Groups - /device-mgt/admin/groups/list - /groups/all - GET - - - - List Groups - /device-mgt/user/groups/list - /groups/user/* - GET - - - - List Groups - /device-mgt/user/groups/list - /groups/user/*/all - GET - - - - View Group - /device-mgt/user/groups/view - /groups/owner/*/name/* - GET - - - - Search Group User - /device-mgt/user/groups/list - /groups/user/*/search - GET - - - - All Group Count - /device-mgt/admin/groups/list - /groups/count - GET - - - - Group Count - /device-mgt/user/groups/list - /groups/user/*/count - GET - - - - Group Share - /device-mgt/user/groups/share - /groups/owner/*/name/*/share - PUT - - - - Group Unshare - /device-mgt/user/groups/unshare - /groups/owner/*/name/*/unshare - PUT - - - - Group Roles - /device-mgt/user/groups/roles - /groups/owner/*/name/*/share/roles - GET - - - - Group Roles - /device-mgt/user/groups/roles - /groups/owner/*/name/*/user/*/share/roles - PUT - - - - Group Permissions - /device-mgt/admin/groups/roles/permissions - /groups/owner/*/name/*/share/roles/*/permissions - GET - - - - Group Add Permissions - /device-mgt/admin/groups/roles/permissions/add - /groups/owner/*/name/*/share/roles/*/permissions - PUT - - - - Group Delete Permissions - /device-mgt/admin/groups/roles/permissions/remove - /groups/owner/*/name/*/share/roles/*/permissions - DELETE - - - - Group Users - /device-mgt/user/groups/users - / - GET - - - - List Group Users - /device-mgt/user/groups/users/list - /groups/owner/*/name/*/users - GET - - - - Get Permissions for Group - /device-mgt/user/groups/users/permissions - /groups/owner/*/name/*/users/*/permissions - GET - - - - Group Devices - /device-mgt/user/groups/devices - / - GET - - - - List Group Devices - /device-mgt/user/groups/devices/list - /groups/owner/*/name/*/devices - GET - - - - Group Devices Count - /device-mgt/user/groups/devices/count - /groups/owner/*/name/*/devices/count - GET - - - - Add Device to Group - /device-mgt/user/groups/devices/add - /groups/owner/*/name/*/devices - POST - - - - Remove Device from Group - /device-mgt/user/groups/devices/remove - /groups/owner/*/name/*/devices/*/* - DELETE - - - - - get device count overview - /device-mgt/admin/dashboard/device-count-overview - /dashboard/device-count-overview - GET - - - get device counts by potential vulnerabilities - /device-mgt/admin/dashboard/device-counts-by-potential-vulnerabilities - /dashboard/device-counts-by-potential-vulnerabilities - GET - - - get non-compliant device counts by features - /device-mgt/admin/dashboard/non-compliant-device-counts-by-features - /dashboard/non-compliant-device-counts-by-features - GET - - - get device counts by groups - /device-mgt/admin/dashboard/device-counts-by-groups - /dashboard/device-counts-by-groups - GET - - - get feature-non-compliant device counts by groups - /device-mgt/admin/dashboard/feature-non-compliant-device-counts-by-groups - /dashboard/feature-non-compliant-device-counts-by-groups - GET - - - get filtered device count over total - /device-mgt/admin/dashboard/filtered-device-count-over-total - /dashboard/filtered-device-count-over-total - GET - - - get feature-non-compliant device count over total - /device-mgt/admin/dashboard/feature-non-compliant-device-count-over-total - /dashboard/feature-non-compliant-device-count-over-total - GET - - - get devices with details - /device-mgt/admin/dashboard/devices-with-details - /dashboard/devices-with-details - GET - - - get feature-non-compliant devices with details - /device-mgt/admin/dashboard/feature-non-compliant-devices-with-details - /dashboard/feature-non-compliant-devices-with-details - GET - - - - - - Get device types registered in the system - /device-mgt/admin/device-types - /admin/device-types - GET - -