|
|
@ -93,12 +93,10 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
@GET
|
|
|
|
@Path("/{roleName}/permissions")
|
|
|
|
@Path("/{roleName}/permissions")
|
|
|
|
@Override
|
|
|
|
@Override public Response getPermissionsOfRole(@PathParam("roleName") String roleName,
|
|
|
|
public Response getPermissionsOfRole(
|
|
|
|
@QueryParam("user-store") String userStoreName, @HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
@PathParam("roleName") String roleName, @QueryParam("user-store") String userStoreName,
|
|
|
|
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
roleName = userStoreName + '/' + roleName;
|
|
|
|
roleName = userStoreName + "/" + roleName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -168,12 +166,12 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Response getRole(@PathParam("roleName") String roleName, @QueryParam("user-store") String userStoreName,
|
|
|
|
public Response getRole(@PathParam("roleName") String roleName, @QueryParam("user-store") String userStoreName,
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Getting the list of user roles");
|
|
|
|
log.debug("Getting the list of user roles");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
roleName = userStoreName + '/' + roleName;
|
|
|
|
roleName = userStoreName + "/" + roleName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RoleInfo roleInfo = new RoleInfo();
|
|
|
|
RoleInfo roleInfo = new RoleInfo();
|
|
|
@ -254,10 +252,11 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
|
|
|
|
|
|
|
|
@PUT
|
|
|
|
@PUT
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Override public Response updateRole(@PathParam("roleName") String roleName, RoleInfo roleInfo,
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Response updateRole(@PathParam("roleName") String roleName, RoleInfo roleInfo,
|
|
|
|
@QueryParam("user-store") String userStoreName) {
|
|
|
|
@QueryParam("user-store") String userStoreName) {
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
roleName = userStoreName + '/' + roleName;
|
|
|
|
roleName = userStoreName + "/" + roleName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleDetails(roleInfo);
|
|
|
|
RequestValidationUtil.validateRoleDetails(roleInfo);
|
|
|
@ -315,7 +314,10 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
@DELETE
|
|
|
|
@DELETE
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Response deleteRole(@PathParam("roleName") String roleName) {
|
|
|
|
public Response deleteRole(@PathParam("roleName") String roleName, @QueryParam("user-store") String userStoreName) {
|
|
|
|
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
|
|
|
|
roleName = userStoreName + "/" + roleName;
|
|
|
|
|
|
|
|
}
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
final UserRealm userRealm = DeviceMgtAPIUtils.getUserRealm();
|
|
|
|
final UserRealm userRealm = DeviceMgtAPIUtils.getUserRealm();
|
|
|
@ -346,7 +348,11 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
@PUT
|
|
|
|
@PUT
|
|
|
|
@Path("/{roleName}/users")
|
|
|
|
@Path("/{roleName}/users")
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Response updateUsersOfRole(@PathParam("roleName") String roleName, List<String> users) {
|
|
|
|
public Response updateUsersOfRole(@PathParam("roleName") String roleName,
|
|
|
|
|
|
|
|
@QueryParam("user-store") String userStoreName, List<String> users) {
|
|
|
|
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
|
|
|
|
roleName = userStoreName + "/" + roleName;
|
|
|
|
|
|
|
|
}
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateUsers(users);
|
|
|
|
RequestValidationUtil.validateUsers(users);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|