|
|
@ -95,8 +95,11 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
@Path("/{roleName}/permissions")
|
|
|
|
@Path("/{roleName}/permissions")
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Response getPermissionsOfRole(
|
|
|
|
public Response getPermissionsOfRole(
|
|
|
|
@PathParam("roleName") String roleName,
|
|
|
|
@PathParam("roleName") String roleName, @QueryParam("user-store") String userStoreName,
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
|
|
|
|
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();
|
|
|
@ -164,11 +167,14 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
@GET
|
|
|
|
@GET
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Response getRole(@PathParam("roleName") String roleName,
|
|
|
|
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()) {
|
|
|
|
|
|
|
|
roleName = userStoreName + '/' + roleName;
|
|
|
|
|
|
|
|
}
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RoleInfo roleInfo = new RoleInfo();
|
|
|
|
RoleInfo roleInfo = new RoleInfo();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -248,8 +254,11 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
|
|
|
|
|
|
|
|
@PUT
|
|
|
|
@PUT
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Path("/{roleName}")
|
|
|
|
@Override
|
|
|
|
@Override public Response updateRole(@PathParam("roleName") String roleName, RoleInfo roleInfo,
|
|
|
|
public Response updateRole(@PathParam("roleName") String roleName, RoleInfo roleInfo) {
|
|
|
|
@QueryParam("user-store") String userStoreName) {
|
|
|
|
|
|
|
|
if (userStoreName != null && !userStoreName.isEmpty()) {
|
|
|
|
|
|
|
|
roleName = userStoreName + '/' + roleName;
|
|
|
|
|
|
|
|
}
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleName(roleName);
|
|
|
|
RequestValidationUtil.validateRoleDetails(roleInfo);
|
|
|
|
RequestValidationUtil.validateRoleDetails(roleInfo);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -372,7 +381,11 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Getting the list of user roles");
|
|
|
|
log.debug("Getting the list of user roles");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
roles = userStoreManager.getRoleNames(userStore+"/*", -1, false, true, true);
|
|
|
|
if (userStore.equals("all")) {
|
|
|
|
|
|
|
|
roles = userStoreManager.getRoleNames("*", -1, false, true, true);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
roles = userStoreManager.getRoleNames(userStore + "/*", -1, false, true, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
// removing all internal roles, roles created for Service-providers and application related roles.
|
|
|
|
// removing all internal roles, roles created for Service-providers and application related roles.
|
|
|
|
List<String> filteredRoles = new ArrayList<>();
|
|
|
|
List<String> filteredRoles = new ArrayList<>();
|
|
|
|
for (String role : roles) {
|
|
|
|
for (String role : roles) {
|
|
|
|