diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java index a5ad6f12040..9fb7d0ccfb2 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java @@ -41,7 +41,7 @@ import javax.ws.rs.core.Response; name = "Sign CSR", description = "Sign CSR", key = "cdmf:sign-csr", - permissions = {"/certificate-mgt/sign-csr"} + permissions = {"/device-mgt/certificates/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java index b9d5058ce0e..76aab15079c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java @@ -13,10 +13,13 @@ import io.swagger.annotations.Info; import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Tag; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup; import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardGadgetDataWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardPaginationGadgetDataWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -44,6 +47,70 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "Device Analytics Dashboard related APIs.") } ) +@Scopes( + scopes = { + @Scope( + name = "Device Count Overview", + description = "Device Count Overview", + key = "cdmf:dashboard:count-overview", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Device Counts by Potential Vulnerabilities", + description = "Device Counts by Potential Vulnerabilities", + key = "cdmf:dashboard:vulnerabilities", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices that have not complied to a policy", + description = "Get the number of devices that have not complied to a policy", + key = "cdmf:dashboard:non-compliant", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices for a given device type, such as connectivity status, " + + "potential vulnerability, platform, and ownership", + description = "Get the number of devices for a given device type, such as connectivity status, " + + "potential vulnerability, platform, and ownership", + key = "cdmf:dashboard:by-groups", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy based on a particular", + description = "Get the number of devices that have not complied to a given policy based on a particular", + key = "cdmf:dashboard:device-counts", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy based on a particular" + + " device type.", + description = "Get the number of devices that have not complied to a given policy based on a " + + "particular device type.", + key = "cdmf:dashboard:filtered-count", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy over the total" + + " number of devices registered with WSO2 EMM.\n", + description = "Get the number of devices that have not complied to a given policy over the total" + + " number of devices registered with WSO2 EMM.\n", + key = "cdmf:dashboard:non-compliant-count", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get device details of devices based on a particular device type.", + description = "Get device details of devices based on a particular device type.", + key = "cdmf:dashboard:details", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get device details of non-compliant devices which do not comply to a given policy.", + description = "Get device details of non-compliant devices which do not comply to a given policy.", + key = "cdmf:dashboard:feature-non-compliant", + permissions = {"/device-mgt/dashboard/view"} + ) + } +) @Path("/dashboard") @Api(value = "Device Analytics Dashboard", description = "Device Analytics Dashboard related information APIs are described here.") @@ -70,13 +137,12 @@ public interface Dashboard { notes = "Get the details of active, inactive, removed and total number of registered devices in" + " WSO2 IoT.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:count-overview") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -127,13 +193,12 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of unmonitored and non-compliant devices in WSO2 IoT.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:vulnerabilities") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -185,13 +250,12 @@ public interface Dashboard { value = "Get the number of devices that have not complied to a policy that was enforced on a " + "device.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -256,13 +320,12 @@ public interface Dashboard { value = "Get the number of devices for a given device type, such as connectivity status, " + "potential vulnerability, platform, and ownership.\n", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:by-groups") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -346,13 +409,12 @@ public interface Dashboard { value = "Get the number of devices that have not complied to a given policy based on a particular" + " device type.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:device-counts") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -426,13 +488,12 @@ public interface Dashboard { + "The device ownership type, such as BYOD or COPE.\n" + "The device platform.\n" + "The potential vulnerabilities faced by the devices.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:filtered-count") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -519,13 +580,12 @@ public interface Dashboard { value = "Get the number of devices that have not complied to a given policy over the total" + " number of devices registered with WSO2 IoT.\n", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant-count") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -595,13 +655,12 @@ public interface Dashboard { httpMethod = "GET", value = "Get device details of devices based on a particular device type.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:details") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -698,13 +757,12 @@ public interface Dashboard { httpMethod = "GET", value = "Get device details of non-compliant devices which do not comply to a given policy.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:feature-non-compliant") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index ed9290df4ca..3ea1cd7bf65 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -77,19 +77,19 @@ import javax.ws.rs.core.Response; name = "Getting Details of a Device", description = "Getting Details of a Device", key = "cdmf:devices:details", - permissions = {"/device-mgt/devices/owning-device/details"} + 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 = "cdmf:devices:delete", - permissions = {"/device-mgt/devices/owning-device/delete"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Feature Details of a Device", description = "Getting Feature Details of a Device", key = "cdmf:devices:features", - permissions = {"/device-mgt/devices/owning-device/features"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Advanced Search for Devices", @@ -101,25 +101,25 @@ import javax.ws.rs.core.Response; name = "Getting Installed Application Details of a Device", description = "Getting Installed Application Details of a Device", key = "cdmf:devices:applications", - permissions = {"/device-mgt/devices/owning-device/applications"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Device Operation Details", description = "Getting Device Operation Details", key = "cdmf:devices:operations", - permissions = {"/device-mgt/devices/owning-device/operations"} + 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 = "cdmf:devices:effective-policy", - permissions = {"/device-mgt/devices/owning-device/effective-policy"} + 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 = "cdmf:devices:compliance-data", - permissions = {"/device-mgt/devices/owning-device/compliance-data"} + permissions = {"/device-mgt/devices/owning-device/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java index 963edc84f75..eca9527f5f0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java @@ -61,13 +61,13 @@ import javax.ws.rs.core.Response; name = "Getting the Supported Device Platforms", description = "Getting the Supported Device Platforms", key = "cdmf:device-types:types", - permissions = {"/device-mgt/device-types/types"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Get Feature Details of a Device Type", description = "Get Feature Details of a Device Type", key = "cdmf:device-types:features", - permissions = {"/device-mgt/device-types/features"} + permissions = {"/device-mgt/devices/owning-device/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java index ab274b5a94f..d22b2883e9a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java @@ -82,13 +82,13 @@ import java.util.List; name = "Get the list of groups belongs to current user.", description = "Get the list of groups belongs to current user.", key = "cdmf:groups:groups", - permissions = {"/device-mgt/groups/groups"} + 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 = "cdmf:groups:count", - permissions = {"/device-mgt/groups/count"} + permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Add new device group to the system.", @@ -100,7 +100,7 @@ import java.util.List; name = "View group specified", description = "View group specified", key = "cdmf:groups:groups-view", - permissions = {"/device-mgt/groups/groups-view"} + permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Update a group", @@ -124,31 +124,43 @@ import java.util.List; name = "View list of roles of a device group", description = "View list of roles of a device group", key = "cdmf:groups:roles", - permissions = {"/device-mgt/groups/roles"} + 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 = "cdmf:groups:devices", - permissions = {"/device-mgt/groups/devices"} + 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 = "cdmf:groups:devices-count", - permissions = {"/device-mgt/groups/devices/devices-count"} + permissions = {"/device-mgt/groups/devices/view"} ), @Scope( name = "Add devices to group", description = "Add devices to group", key = "cdmf:groups:devices-add", - permissions = {"/device-mgt/groups/devices/devices-add"} + permissions = {"/device-mgt/groups/devices/add"} ), @Scope( name = "Remove devices from group", description = "Remove devices from group", key = "cdmf:groups:devices-remove", - permissions = {"/device-mgt/groups/devices/devices-remove"} + permissions = {"/device-mgt/groups/devices/remove"} + ), + @Scope( + name = "Assign devices to groups", + description = "Assign devices to groups", + key = "cdmf:groups:assign", + permissions = {"/device-mgt/groups/devices/add"} + ), + @Scope( + name = "List of groups that have the device", + description = "List of groups that have the device", + key = "cdmf:groups:device", + permissions = {"/device-mgt/groups/devices/view"} ) } ) @@ -837,12 +849,10 @@ public interface GroupManagementService { value = "Assign devices to groups", notes = "Add existing device to device groups.", tags = "Device Group Management", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/groups/devices/add", - description = "Add devices")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:assign") + }) } ) @ApiResponses(value = { @@ -891,12 +901,10 @@ public interface GroupManagementService { value = "List of groups that have the device", notes = "List of groups that have the device.", tags = "Device Group Management", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/groups/devices/view", - description = "Add devices")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:device") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java index a3d0d556f3b..04635942901 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java @@ -73,7 +73,7 @@ import javax.ws.rs.core.Response; name = "Updating the Device Notification Status", description = "Updating the Device Notification Status", key = "cdmf:notifications:mark-checked", - permissions = {"/device-mgt/notifications/mark-checked"} + permissions = {"/device-mgt/notifications/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java index 968d0ea0ea0..0b5ad17b49e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java @@ -75,49 +75,49 @@ import java.util.List; name = "Getting Details of Policies", description = "Getting Details of Policies", key = "cdmf:policies:get-details", - permissions = {"/device-mgt/policies/get-details"} + permissions = {"/device-mgt/policies/view"} ), @Scope( name = "Getting Details of a Policy", description = "Getting Details of a Policy", key = "cdmf:policies:get-policy-details", - permissions = {"/device-mgt/policies/get-policy-details"} + permissions = {"/device-mgt/policies/view"} ), @Scope( name = "Updating a Policy", description = "Updating a Policy", key = "cdmf:policies:update", - permissions = {"/device-mgt/policies/update"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Removing Multiple Policies", description = "Removing Multiple Policies", key = "cdmf:policies:remove", - permissions = {"/device-mgt/policies/remove"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Activating Policies", description = "Activating Policies", key = "cdmf:policies:activate", - permissions = {"/device-mgt/policies/activate"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Deactivating Policies", description = "Deactivating Policies", key = "cdmf:policies:deactivate", - permissions = {"/device-mgt/policies/deactivate"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Applying Changes on Policies", description = "Applying Changes on Policies", key = "cdmf:policies:changes", - permissions = {"/device-mgt/policies/changes"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Updating the Policy Priorities", description = "Updating the Policy Priorities", key = "cdmf:policies:priorities", - permissions = {"/device-mgt/policies/priorities"} + permissions = {"/device-mgt/policies/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java index b308ddc9702..383c40e1211 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java @@ -69,43 +69,43 @@ import java.util.List; name = "Getting Permission Details of a Role", description = "Getting Permission Details of a Role", key = "cdmf:roles:permissions", - permissions = {"/device-mgt/roles/permissions"} + permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Getting the List of Roles", description = "Getting the List of Roles", key = "cdmf:roles:details", - permissions = {"/device-mgt/roles/details"} + permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Adding a Role", description = "Adding a Role", key = "cdmf:roles:add", - permissions = {"/device-mgt/roles/add"} + permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Adding a combined Role", description = "Adding a combined Role", key = "cdmf:roles:create-combined-role", - permissions = {"/device-mgt/roles/create-combined-role"} + permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Updating Role Details", description = "Updating Role Details", key = "cdmf:roles:update", - permissions = {"/device-mgt/roles/update"} + permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Deleting a Role", description = "Deleting a Role", key = "cdmf:roles:delete", - permissions = {"/device-mgt/roles/delete"} + permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Adding Users to a Role", description = "Adding Users to a Role", key = "cdmf:roles:add-users", - permissions = {"/device-mgt/roles/add-users"} + permissions = {"/device-mgt/roles/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index f2ad567c6cc..b97270b19f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -30,15 +30,10 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Info; import io.swagger.annotations.ResponseHeader; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import org.apache.axis2.transport.http.HTTPConstants; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfo; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfoList; import org.wso2.carbon.device.mgt.jaxrs.beans.EnrollmentInvitation; @@ -46,6 +41,7 @@ import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.OldPasswordResetWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList; import org.wso2.carbon.device.mgt.jaxrs.beans.UserInfo; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -79,71 +75,71 @@ import java.util.List; ) @Scopes( scopes = { - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Adding a User", description = "Adding a User", key = "cdmf:users:add", - permissions = {"/device-mgt/users/add"} + permissions = {"/device-mgt/users/manage"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting Details of a User", description = "Getting Details of a User", key = "cdmf:users:details", - permissions = {"/device-mgt/users/details"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Updating Details of a User", description = "Updating Details of a User", key = "cdmf:users:update", - permissions = {"/device-mgt/policies/update"} + permissions = {"/device-mgt/users/manage"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Deleting a User", description = "Deleting a User", key = "cdmf:users:delete", - permissions = {"/device-mgt/policies/delete"} + permissions = {"/device-mgt/users/manage"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting the Role Details of a User", description = "Getting the Role Details of a User", key = "cdmf:users:roles", - permissions = {"/device-mgt/policies/roles"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting Details of Users", description = "Getting Details of Users", key = "cdmf:users:user-details", - permissions = {"/device-mgt/policies/user-details"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting the User Count", description = "Getting the User Count", key = "cdmf:users:count", - permissions = {"/device-mgt/policies/count"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting the User existence status", description = "Getting the User existence status", key = "cdmf:users:is-exist", - permissions = {"/device-mgt/policies/is-exist"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Searching for a User Name", description = "Searching for a User Name", key = "cdmf:users:search", - permissions = {"/device-mgt/policies/search"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Changing the User Password", description = "Adding a User", key = "cdmf:users:credentials", - permissions = {"/device-mgt/policies/credentials"} + permissions = {"/login"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Sending Enrollment Invitations to Users", description = "Sending Enrollment Invitations to Users", key = "cdmf:users:send-invitation", - permissions = {"/device-mgt/policies/send-invitation"} + permissions = {"/device-mgt/users/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 450b3a3778d..fdf51ec3584 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -67,13 +67,13 @@ import javax.ws.rs.core.Response; name = "Installing an Application (Internal API)", description = "Installing an Application (Internal API)", key = "cdmf:applications:install", - permissions = {"/device-mgt/applications/install"} + permissions = {"/device-mgt/applications/manage"} ), @Scope( name = "Uninstalling an Application (Internal API)", description = "Uninstalling an Application (Internal API)", key = "cdmf:applications:uninstall", - permissions = {"/device-mgt/applications/uninstall"} + permissions = {"/device-mgt/applications/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index 72ba18d5065..eb570819b49 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -67,7 +67,7 @@ import javax.ws.rs.core.Response; name = "Getting Details of a Device", description = "Getting Details of a Device", key = "cdmf:admin:devices:view", - permissions = {"/device-mgt/devices/admin/devices/view"} + permissions = {"/device-mgt/devices/owning-device/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java index 06d0842985f..0188425051f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -74,7 +74,7 @@ import javax.ws.rs.core.Response; name = "Count groups", description = "", key = "cdmf:admin-groups:count", - permissions = {"/device-mgt/admin/groups/count"} + permissions = {"/device-mgt/admin/groups/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java index fbb3603e569..bef81df1a12 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java @@ -60,7 +60,7 @@ import javax.ws.rs.core.Response; name = "View Users", description = "View Users", key = "cdmf:admin-users:view", - permissions = {"/device-mgt/admin/users/view"} + permissions = {"/device-mgt/users/manage"} ) } )