mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt
This commit is contained in:
commit
c32d12e0cc
@ -475,7 +475,8 @@ public class UserManagementServiceImpl implements UserManagementService {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/checkUser")
|
@Path("/checkUser")
|
||||||
@Override public Response isUserExists(@QueryParam("username") String userName) {
|
@Override
|
||||||
|
public Response isUserExists(@QueryParam("username") String userName) {
|
||||||
try {
|
try {
|
||||||
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
|
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
|
||||||
boolean userExists = false;
|
boolean userExists = false;
|
||||||
@ -505,14 +506,17 @@ public class UserManagementServiceImpl implements UserManagementService {
|
|||||||
if (domain != null && !domain.isEmpty()) {
|
if (domain != null && !domain.isEmpty()) {
|
||||||
userStoreDomain = domain;
|
userStoreDomain = domain;
|
||||||
}
|
}
|
||||||
|
if (limit == 0){
|
||||||
|
//If there is no limit is passed, then return all.
|
||||||
|
limit = -1;
|
||||||
|
}
|
||||||
List<UserInfo> userList;
|
List<UserInfo> userList;
|
||||||
try {
|
try {
|
||||||
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
|
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
|
||||||
String[] users = userStoreManager.listUsers(userStoreDomain + "/*", -1);
|
String[] users = userStoreManager.listUsers(userStoreDomain + "/" + filter + "*", limit);
|
||||||
userList = new ArrayList<>();
|
userList = new ArrayList<>();
|
||||||
UserInfo user;
|
UserInfo user;
|
||||||
for (String username : users) {
|
for (String username : users) {
|
||||||
if (username.contains(filter)) {
|
|
||||||
user = new UserInfo();
|
user = new UserInfo();
|
||||||
user.setUsername(username);
|
user.setUsername(username);
|
||||||
user.setEmailAddress(getClaimValue(username, Constants.USER_CLAIM_EMAIL_ADDRESS));
|
user.setEmailAddress(getClaimValue(username, Constants.USER_CLAIM_EMAIL_ADDRESS));
|
||||||
@ -520,7 +524,6 @@ public class UserManagementServiceImpl implements UserManagementService {
|
|||||||
user.setLastname(getClaimValue(username, Constants.USER_CLAIM_LAST_NAME));
|
user.setLastname(getClaimValue(username, Constants.USER_CLAIM_LAST_NAME));
|
||||||
userList.add(user);
|
userList.add(user);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return Response.status(Response.Status.OK).entity(userList).build();
|
return Response.status(Response.Status.OK).entity(userList).build();
|
||||||
} catch (UserStoreException e) {
|
} catch (UserStoreException e) {
|
||||||
String msg = "Error occurred while retrieving the list of users using the filter : " + filter;
|
String msg = "Error occurred while retrieving the list of users using the filter : " + filter;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user