Fixed issues in RoleManagementService

revert-70aa11f8
mharindu 9 years ago
parent d65174d026
commit ce557266ec

@ -170,6 +170,10 @@ public class RoleManagementServiceImpl implements RoleManagementService {
@POST
@Override
public Response addRole(RoleWrapper roleWrapper) {
if (roleWrapper == null) {
log.error("Request body is incorrect or empty");
return Response.status(Response.Status.BAD_REQUEST).build();
}
try {
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
if (log.isDebugEnabled()) {
@ -197,6 +201,10 @@ public class RoleManagementServiceImpl implements RoleManagementService {
@Path("/{roleName}")
@Override
public Response updateRole(@PathParam("roleName") String roleName, RoleWrapper roleWrapper) {
if (roleWrapper == null) {
log.error("Request body is incorrect or empty");
return Response.status(Response.Status.BAD_REQUEST).build();
}
String newRoleName = roleWrapper.getRoleName();
try {
final UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
@ -256,10 +264,14 @@ public class RoleManagementServiceImpl implements RoleManagementService {
return Response.status(Response.Status.OK).build();
}
@POST
@PUT
@Path("/{roleName}/users")
@Override
public Response updateUsersOfRole(@PathParam("roleName") String roleName, List<String> users) {
if (users == null || users.size() == 0) {
log.error("No users are found");
return Response.status(Response.Status.BAD_REQUEST).build();
}
try {
final UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
if (log.isDebugEnabled()) {

@ -460,7 +460,7 @@
<Permission>
<name>List roles</name>
<path>/device-mgt/admin/roles/list</path>
<url>/roles/permissions</url>
<url>/roles/*/permissions</url>
<method>GET</method>
</Permission>
@ -481,22 +481,14 @@
<Permission>
<name>Update role</name>
<path>/device-mgt/admin/roles/update</path>
<url>/roles</url>
<url>/roles/*</url>
<method>PUT</method>
</Permission>
<!--<Permission>-->
<!--<name>Update a specific role</name>-->
<!--<path>/device-mgt/roles/update</path>-->
<!--<url>/roles/*</url>-->
<!--<method>PUT</method>-->
<!---->
<!--</Permission>-->
<Permission>
<name>Update role</name>
<path>/device-mgt/admin/roles/update</path>
<url>/roles/users</url>
<url>/roles/*/users</url>
<method>PUT</method>
</Permission>
@ -510,7 +502,7 @@
<Permission>
<name>Remove role</name>
<path>/device-mgt/admin/roles/remove</path>
<url>/roles</url>
<url>/roles/*</url>
<method>DELETE</method>
</Permission>

Loading…
Cancel
Save