merge-requests/911/head
shamalka 2 years ago
commit eaad94b3e9

@ -254,7 +254,6 @@ public interface UserManagementService {
required = true) UserInfo user); required = true) UserInfo user);
@GET @GET
@Path("/{username}")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
@ -310,7 +309,7 @@ public interface UserManagementService {
value = "Provide the username of the user.", value = "Provide the username of the user.",
required = true, required = true,
defaultValue = "admin") defaultValue = "admin")
@PathParam("username") String username, @QueryParam("username") String username,
@ApiParam( @ApiParam(
name = "domain", name = "domain",
value = "The domain name of the user store.", value = "The domain name of the user store.",
@ -325,7 +324,6 @@ public interface UserManagementService {
@HeaderParam("If-Modified-Since") String ifModifiedSince); @HeaderParam("If-Modified-Since") String ifModifiedSince);
@PUT @PUT
@Path("/{username}")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
@ -380,7 +378,7 @@ public interface UserManagementService {
value = "The username of the user.", value = "The username of the user.",
required = true, required = true,
defaultValue = "admin") defaultValue = "admin")
@PathParam("username") String username, @QueryParam("username") String username,
@ApiParam( @ApiParam(
name = "domain", name = "domain",
value = "The domain name of the user store.", value = "The domain name of the user store.",
@ -393,7 +391,6 @@ public interface UserManagementService {
required = true) UserInfo userData); required = true) UserInfo userData);
@DELETE @DELETE
@Path("/{username}")
@Consumes(MediaType.WILDCARD) @Consumes(MediaType.WILDCARD)
@ApiOperation( @ApiOperation(
httpMethod = "DELETE", httpMethod = "DELETE",
@ -431,7 +428,7 @@ public interface UserManagementService {
"that user. Do not remove the admin user.", "that user. Do not remove the admin user.",
required = true, required = true,
defaultValue = "[Create a new user named Jim, and then try out this API.]") defaultValue = "[Create a new user named Jim, and then try out this API.]")
@PathParam("username") String username, @QueryParam("username") String username,
@ApiParam( @ApiParam(
name = "domain", name = "domain",
value = "The domain name of the user store.", value = "The domain name of the user store.",
@ -439,7 +436,7 @@ public interface UserManagementService {
@QueryParam("domain") String domain); @QueryParam("domain") String domain);
@GET @GET
@Path("/{username}/roles") @Path("/roles")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
@ -495,7 +492,7 @@ public interface UserManagementService {
value = "The username of the user.", value = "The username of the user.",
required = true, required = true,
defaultValue = "admin") defaultValue = "admin")
@PathParam("username") String username, @QueryParam("username") String username,
@ApiParam( @ApiParam(
name = "domain", name = "domain",
value = "The domain name of the user store.", value = "The domain name of the user store.",
@ -503,6 +500,7 @@ public interface UserManagementService {
@QueryParam("domain") String domain); @QueryParam("domain") String domain);
@GET @GET
@Path("/list")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
@ -573,7 +571,12 @@ public interface UserManagementService {
value = "Provide how many user details you require from the starting pagination index/offset.", value = "Provide how many user details you require from the starting pagination index/offset.",
required = false, required = false,
defaultValue = "5") defaultValue = "5")
@QueryParam("limit") int limit); @QueryParam("limit") int limit,
@ApiParam(
name = "domain",
value = "The domain name of the user store.",
required = false)
@QueryParam("domain") String domain);
@GET @GET
@Path(("/search")) @Path(("/search"))
@ -1034,7 +1037,7 @@ public interface UserManagementService {
@HeaderParam("If-Modified-Since") String ifModifiedSince); @HeaderParam("If-Modified-Since") String ifModifiedSince);
@PUT @PUT
@Path("/claims/{username}") @Path("/claims")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
@ -1082,14 +1085,19 @@ public interface UserManagementService {
value = "Provide the username of the user.", value = "Provide the username of the user.",
required = true, required = true,
defaultValue = "admin") defaultValue = "admin")
@PathParam("username") String username, @QueryParam("username") String username,
@ApiParam( @ApiParam(
name = "device list", name = "device list",
value = "Array of objects with device details", value = "Array of objects with device details",
required = true) JsonArray deviceList); required = true) JsonArray deviceList,
@ApiParam(
name = "domain",
value = "The domain name of the user store.",
required = false)
@QueryParam("domain") String domain);
@GET @GET
@Path("/claims/{username}") @Path("/claims")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
@ -1137,10 +1145,15 @@ public interface UserManagementService {
value = "Provide the username of the user.", value = "Provide the username of the user.",
required = true, required = true,
defaultValue = "admin") defaultValue = "admin")
@PathParam("username") String username); @QueryParam("username") String username,
@ApiParam(
name = "domain",
value = "The domain name of the user store.",
required = false)
@QueryParam("domain") String domain);
@DELETE @DELETE
@Path("/claims/{username}") @Path("/claims")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "DELETE", httpMethod = "DELETE",
@ -1188,7 +1201,12 @@ public interface UserManagementService {
value = "Provide the username of the user.", value = "Provide the username of the user.",
required = true, required = true,
defaultValue = "admin") defaultValue = "admin")
@PathParam("username") String username); @QueryParam("username") String username,
@ApiParam(
name = "domain",
value = "The domain name of the user store.",
required = false)
@QueryParam("domain") String domain);
@GET @GET
@Path("/current-user/permissions") @Path("/current-user/permissions")

@ -74,7 +74,7 @@ import javax.ws.rs.core.Response;
public interface UserManagementAdminService { public interface UserManagementAdminService {
@POST @POST
@Path("/{username}/credentials") @Path("/credentials")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
@ -115,7 +115,7 @@ public interface UserManagementAdminService {
value = "The username of the user." + value = "The username of the user." +
"INFO: Add a new user using the POST /users API that is under User Management.", "INFO: Add a new user using the POST /users API that is under User Management.",
required = true) required = true)
@PathParam("username") @QueryParam("username")
@Size(max = 45) @Size(max = 45)
String username, String username,
@ApiParam( @ApiParam(
@ -131,7 +131,7 @@ public interface UserManagementAdminService {
@DELETE @DELETE
@Path("/{username}/devices") @Path("/devices")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ApiOperation( @ApiOperation(
@ -183,7 +183,7 @@ public interface UserManagementAdminService {
name = "username", name = "username",
value = "Username of the users devices to be deleted.", value = "Username of the users devices to be deleted.",
required = true) required = true)
@PathParam("username") String username); @QueryParam("username") String username);

@ -278,9 +278,8 @@ public class UserManagementServiceImpl implements UserManagementService {
} }
@GET @GET
@Path("/{username}")
@Override @Override
public Response getUser(@PathParam("username") String username, @QueryParam("domain") String domain, public Response getUser(@QueryParam("username") String username, @QueryParam("domain") String domain,
@HeaderParam("If-Modified-Since") String ifModifiedSince) { @HeaderParam("If-Modified-Since") String ifModifiedSince) {
if (domain != null && !domain.isEmpty()) { if (domain != null && !domain.isEmpty()) {
username = domain + '/' + username; username = domain + '/' + username;
@ -307,9 +306,8 @@ public class UserManagementServiceImpl implements UserManagementService {
} }
@PUT @PUT
@Path("/{username}")
@Override @Override
public Response updateUser(@PathParam("username") String username, @QueryParam("domain") String domain, UserInfo userInfo) { public Response updateUser(@QueryParam("username") String username, @QueryParam("domain") String domain, UserInfo userInfo) {
if (domain != null && !domain.isEmpty()) { if (domain != null && !domain.isEmpty()) {
username = domain + '/' + username; username = domain + '/' + username;
} }
@ -386,10 +384,9 @@ public class UserManagementServiceImpl implements UserManagementService {
} }
@DELETE @DELETE
@Path("/{username}")
@Consumes(MediaType.WILDCARD) @Consumes(MediaType.WILDCARD)
@Override @Override
public Response removeUser(@PathParam("username") String username, @QueryParam("domain") String domain) { public Response removeUser(@QueryParam("username") String username, @QueryParam("domain") String domain) {
if (domain != null && !domain.isEmpty()) { if (domain != null && !domain.isEmpty()) {
username = domain + '/' + username; username = domain + '/' + username;
} }
@ -421,9 +418,9 @@ public class UserManagementServiceImpl implements UserManagementService {
} }
@GET @GET
@Path("/{username}/roles") @Path("/roles")
@Override @Override
public Response getRolesOfUser(@PathParam("username") String username, @QueryParam("domain") String domain) { public Response getRolesOfUser(@QueryParam("username") String username, @QueryParam("domain") String domain) {
if (domain != null && !domain.isEmpty()) { if (domain != null && !domain.isEmpty()) {
username = domain + '/' + username; username = domain + '/' + username;
} }
@ -450,10 +447,11 @@ public class UserManagementServiceImpl implements UserManagementService {
} }
@GET @GET
@Path("/list")
@Override @Override
public Response getUsers(@QueryParam("filter") String filter, @HeaderParam("If-Modified-Since") String timestamp, public Response getUsers(@QueryParam("filter") String filter, @HeaderParam("If-Modified-Since") String timestamp,
@QueryParam("offset") int offset, @QueryParam("offset") int offset, @QueryParam("limit") int limit,
@QueryParam("limit") int limit) { @QueryParam("domain") String domain) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting the list of users with all user-related information"); log.debug("Getting the list of users with all user-related information");
} }
@ -472,8 +470,11 @@ public class UserManagementServiceImpl implements UserManagementService {
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
//As the listUsers function accepts limit only to accommodate offset we are passing offset + limit //As the listUsers function accepts limit only to accommodate offset we are passing offset + limit
String[] users = userStoreManager.listUsers(appliedFilter, appliedLimit); List<String> users = Arrays.asList(userStoreManager.listUsers(appliedFilter, appliedLimit));
userList = new ArrayList<>(users.length); if (domain != null && !domain.isEmpty()) {
users = getUsersFromDomain(domain, users);
}
userList = new ArrayList<>(users.size());
BasicUserInfo user; BasicUserInfo user;
for (String username : users) { for (String username : users) {
user = getBasicUserInfo(username); user = getBasicUserInfo(username);
@ -495,7 +496,7 @@ public class UserManagementServiceImpl implements UserManagementService {
} }
BasicUserInfoList result = new BasicUserInfoList(); BasicUserInfoList result = new BasicUserInfoList();
result.setList(offsetList); result.setList(offsetList);
result.setCount(users.length); result.setCount(userList.size());
return Response.status(Response.Status.OK).entity(result).build(); return Response.status(Response.Status.OK).entity(result).build();
} catch (UserStoreException e) { } catch (UserStoreException e) {
@ -515,7 +516,7 @@ public class UserManagementServiceImpl implements UserManagementService {
@QueryParam("limit") int limit) { @QueryParam("limit") int limit) {
if (RequestValidationUtil.isNonFilterRequest(username,firstName, lastName, emailAddress)) { if (RequestValidationUtil.isNonFilterRequest(username,firstName, lastName, emailAddress)) {
return getUsers(null, timestamp, offset, limit); return getUsers(null, timestamp, offset, limit, null);
} }
RequestValidationUtil.validatePaginationParameters(offset, limit); RequestValidationUtil.validatePaginationParameters(offset, limit);
@ -701,7 +702,12 @@ public class UserManagementServiceImpl implements UserManagementService {
List<UserInfo> userList; List<UserInfo> userList;
try { try {
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
String[] users = userStoreManager.listUsers(userStoreDomain + "/" + filter + "*", limit); String[] users;
if (userStoreDomain.equals("all")) {
users = userStoreManager.listUsers(filter + "*", limit);
} else {
users = userStoreManager.listUsers(userStoreDomain + "/" + filter + "*", limit);
}
userList = new ArrayList<>(); userList = new ArrayList<>();
UserInfo user; UserInfo user;
for (String username : users) { for (String username : users) {
@ -927,25 +933,29 @@ public class UserManagementServiceImpl implements UserManagementService {
@PUT @PUT
@Override @Override
@Path("/claims/{username}") @Path("/claims")
public Response updateUserClaimsForDevices( public Response updateUserClaimsForDevices(
@PathParam("username") String username, @QueryParam("username") String username, JsonArray deviceList,
JsonArray deviceList) { @QueryParam("domain") String domain) {
try { try {
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
if (domain != null && !domain.isEmpty()) {
username = domain + Constants.FORWARD_SLASH + username;
} else {
RealmConfiguration realmConfiguration = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getUserRealm()
.getRealmConfiguration();
domain = realmConfiguration
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
if (!StringUtils.isBlank(domain)) {
username = domain + Constants.FORWARD_SLASH + username;
}
}
if (!userStoreManager.isExistingUser(username)) { if (!userStoreManager.isExistingUser(username)) {
String msg = "User by username: " + username + " does not exist."; String msg = "User by username: " + username + " does not exist.";
log.error(msg); log.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} }
RealmConfiguration realmConfiguration = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getUserRealm()
.getRealmConfiguration();
String domain = realmConfiguration
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
if (!StringUtils.isBlank(domain)) {
username = domain + Constants.FORWARD_SLASH + username;
}
ClaimMetadataManagementAdminService ClaimMetadataManagementAdminService
claimMetadataManagementAdminService = new ClaimMetadataManagementAdminService(); claimMetadataManagementAdminService = new ClaimMetadataManagementAdminService();
//Get all available claim URIs //Get all available claim URIs
@ -989,25 +999,29 @@ public class UserManagementServiceImpl implements UserManagementService {
@GET @GET
@Override @Override
@Path("/claims/{username}") @Path("/claims")
public Response getUserClaimsForDevices( public Response getUserClaimsForDevices(
@PathParam("username") String username) { @QueryParam("username") String username, @QueryParam("domain") String domain) {
try { try {
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
Map<String, String> claims = new HashMap<>(); Map<String, String> claims = new HashMap<>();
if (domain != null && !domain.isEmpty()) {
username = domain + Constants.FORWARD_SLASH + username;
} else {
RealmConfiguration realmConfiguration = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getUserRealm()
.getRealmConfiguration();
domain = realmConfiguration
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
if (!StringUtils.isBlank(domain)) {
username = domain + Constants.FORWARD_SLASH + username;
}
}
if (!userStoreManager.isExistingUser(username)) { if (!userStoreManager.isExistingUser(username)) {
String msg = "User by username: " + username + " does not exist."; String msg = "User by username: " + username + " does not exist.";
log.error(msg); log.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} }
RealmConfiguration realmConfiguration = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getUserRealm()
.getRealmConfiguration();
String domain = realmConfiguration
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
if (!StringUtils.isBlank(domain)) {
username = domain + Constants.FORWARD_SLASH + username;
}
String[] allUserClaims = userStoreManager.getClaimManager().getAllClaimUris(); String[] allUserClaims = userStoreManager.getClaimManager().getAllClaimUris();
if (!Arrays.asList(allUserClaims).contains(Constants.USER_CLAIM_DEVICES)) { if (!Arrays.asList(allUserClaims).contains(Constants.USER_CLAIM_DEVICES)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -1027,25 +1041,29 @@ public class UserManagementServiceImpl implements UserManagementService {
@DELETE @DELETE
@Override @Override
@Path("/claims/{username}") @Path("/claims")
public Response deleteUserClaimsForDevices( public Response deleteUserClaimsForDevices(
@PathParam("username") String username) { @QueryParam("username") String username, @QueryParam("domain") String domain) {
try { try {
String[] claimArray = new String[1]; String[] claimArray = new String[1];
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
if (domain != null && !domain.isEmpty()) {
username = domain + Constants.FORWARD_SLASH + username;
} else {
RealmConfiguration realmConfiguration = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getUserRealm()
.getRealmConfiguration();
domain = realmConfiguration
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
if (!StringUtils.isBlank(domain)) {
username = domain + Constants.FORWARD_SLASH + username;
}
}
if (!userStoreManager.isExistingUser(username)) { if (!userStoreManager.isExistingUser(username)) {
String msg = "User by username: " + username + " does not exist."; String msg = "User by username: " + username + " does not exist.";
log.error(msg); log.error(msg);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} }
RealmConfiguration realmConfiguration = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getUserRealm()
.getRealmConfiguration();
String domain = realmConfiguration
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
if (!StringUtils.isBlank(domain)) {
username = domain + Constants.FORWARD_SLASH + username;
}
String[] allUserClaims = userStoreManager.getClaimManager().getAllClaimUris(); String[] allUserClaims = userStoreManager.getClaimManager().getAllClaimUris();
if (!Arrays.asList(allUserClaims).contains(Constants.USER_CLAIM_DEVICES)) { if (!Arrays.asList(allUserClaims).contains(Constants.USER_CLAIM_DEVICES)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -1314,4 +1332,23 @@ public class UserManagementServiceImpl implements UserManagementService {
userStoreList.setCount(userStores.size()); userStoreList.setCount(userStores.size());
return Response.status(Response.Status.OK).entity(userStoreList).build(); return Response.status(Response.Status.OK).entity(userStoreList).build();
} }
/**
* Iterates through the list of all users and returns a list of users from the specified user store domain
* @param domain user store domain name
* @param users list of all users from UserStoreManager
* @return list of users from specified user store domain
*/
public List<String> getUsersFromDomain(String domain, List<String> users) {
List<String> userList = new ArrayList<>();
for(String username : users) {
String[] domainName = username.split("/");
if(domain.equals(Constants.PRIMARY_USER_STORE) && domainName.length == 1) {
userList.add(username);
} else if (domainName[0].equals(domain) && domainName.length > 1) {
userList.add(username);
}
}
return userList;
}
} }

@ -40,9 +40,9 @@ public class UserManagementAdminServiceImpl implements UserManagementAdminServic
private static final Log log = LogFactory.getLog(UserManagementAdminServiceImpl.class); private static final Log log = LogFactory.getLog(UserManagementAdminServiceImpl.class);
@POST @POST
@Path("/{username}/credentials") @Path("/credentials")
@Override @Override
public Response resetUserPassword(@PathParam("username") public Response resetUserPassword(@QueryParam("username")
@Size(max = 45) @Size(max = 45)
String user, @QueryParam("domain") String domain, PasswordResetWrapper credentials) { String user, @QueryParam("domain") String domain, PasswordResetWrapper credentials) {
if (domain != null && !domain.isEmpty()) { if (domain != null && !domain.isEmpty()) {
@ -52,9 +52,9 @@ public class UserManagementAdminServiceImpl implements UserManagementAdminServic
} }
@DELETE @DELETE
@Path("/{username}/devices") @Path("/devices")
@Override @Override
public Response deleteDeviceOfUser(@PathParam("username") String username) { public Response deleteDeviceOfUser(@QueryParam("username") String username) {
try { try {
DeviceMgtAPIUtils.getPrivacyComplianceProvider().deleteDevicesOfUser(username); DeviceMgtAPIUtils.getPrivacyComplianceProvider().deleteDevicesOfUser(username);
return Response.status(Response.Status.OK).build(); return Response.status(Response.Status.OK).build();

@ -258,7 +258,7 @@ public class UserManagementServiceImplTest {
public void testGetUsers() { public void testGetUsers() {
PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getUserStoreManager")) PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getUserStoreManager"))
.toReturn(userStoreManager); .toReturn(userStoreManager);
Response response = userManagementService.getUsers(null, "00", 0, 10); Response response = userManagementService.getUsers(null, "00", 0, 10, null);
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), "GetUsers request failed"); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), "GetUsers request failed");
} }
@ -383,7 +383,7 @@ public class UserManagementServiceImplTest {
.getUserClaimValue(Mockito.any(), Mockito.any(), Mockito.any()); .getUserClaimValue(Mockito.any(), Mockito.any(), Mockito.any());
Mockito.doThrow(new UserStoreException()).when(userStoreManager) Mockito.doThrow(new UserStoreException()).when(userStoreManager)
.listUsers(Mockito.anyString(), Mockito.anyInt()); .listUsers(Mockito.anyString(), Mockito.anyInt());
Response response = userManagementService.getUsers(TEST_USERNAME, "00", 0, 10); Response response = userManagementService.getUsers(TEST_USERNAME, "00", 0, 10, null);
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
"Response returned successful for a users retrieval request."); "Response returned successful for a users retrieval request.");
response = userManagementService.getUserCount(); response = userManagementService.getUserCount();

@ -199,7 +199,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT DM_DEVICE.ID AS DEVICE_ID, DEVICE_IDENTIFICATION, DESCRIPTION, DM_DEVICE.NAME AS DEVICE_NAME, DM_DEVICE_TYPE.NAME AS DEVICE_TYPE,\n" + String sql = "SELECT DM_DEVICE.ID AS DEVICE_ID, DEVICE_IDENTIFICATION, DESCRIPTION, DM_DEVICE.NAME AS DEVICE_NAME, DM_DEVICE_TYPE.NAME AS DEVICE_TYPE,\n" +
"DM_ENROLMENT.ID AS ENROLMENT_ID, DATE_OF_ENROLMENT,OWNER, OWNERSHIP,IS_TRANSFERRED, STATUS, DATE_OF_LAST_UPDATE, LAST_BILLED_DATE,\n" + "DM_ENROLMENT.ID AS ENROLMENT_ID, DATE_OF_ENROLMENT,OWNER, OWNERSHIP,IS_TRANSFERRED, STATUS, DATE_OF_LAST_UPDATE, LAST_BILLED_DATE,\n" +
"TIMESTAMPDIFF('DAY', DATE_OF_ENROLMENT, CURDATE()) as DAYS_SINCE_ENROLLED FROM DM_DEVICE JOIN DM_ENROLMENT\n" + "TIMESTAMPDIFF(DAY, DATE_OF_ENROLMENT, CURDATE()) as DAYS_SINCE_ENROLLED FROM DM_DEVICE JOIN DM_ENROLMENT\n" +
"ON (DM_DEVICE.ID = DM_ENROLMENT.DEVICE_ID) JOIN DM_DEVICE_TYPE ON (DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID) WHERE DM_ENROLMENT.TENANT_ID=?"; "ON (DM_DEVICE.ID = DM_ENROLMENT.DEVICE_ID) JOIN DM_DEVICE_TYPE ON (DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID) WHERE DM_ENROLMENT.TENANT_ID=?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);

@ -26,9 +26,9 @@
<LoginCacheCapacity>10000</LoginCacheCapacity> <LoginCacheCapacity>10000</LoginCacheCapacity>
<Billing> <Billing>
<HideBillGenerationInSuperTenant>false</HideBillGenerationInSuperTenant> <HideBillGenerationInSuperTenant>false</HideBillGenerationInSuperTenant>
<HideBillGenerationInSubTenant>false</HideBillGenerationInSubTenant> <HideBillGenerationInSubTenant>true</HideBillGenerationInSubTenant>
<HideTotalCalculationInSuperTenant>false</HideTotalCalculationInSuperTenant> <HideTotalCalculationInSuperTenant>false</HideTotalCalculationInSuperTenant>
<HideTotalCalculationInSubTenant>false</HideTotalCalculationInSubTenant> <HideTotalCalculationInSubTenant>true</HideTotalCalculationInSubTenant>
<HideDomainSelectionInSuperTenant>false</HideDomainSelectionInSuperTenant> <HideDomainSelectionInSuperTenant>false</HideDomainSelectionInSuperTenant>
<HideDomainSelectionInSubTenant>true</HideDomainSelectionInSubTenant> <HideDomainSelectionInSubTenant>true</HideDomainSelectionInSubTenant>
</Billing> </Billing>
@ -209,6 +209,8 @@
<Scope>perm:windows:lock-reset</Scope> <Scope>perm:windows:lock-reset</Scope>
<Scope>perm:windows:reboot</Scope> <Scope>perm:windows:reboot</Scope>
<Scope>perm:windows:location</Scope> <Scope>perm:windows:location</Scope>
<Scope>perm:admin:tenant:view</Scope>
<Scope>perm:admin:metadata:view</Scope>
</Scopes> </Scopes>
<SSOConfiguration> <SSOConfiguration>
<Issuer>device-mgt</Issuer> <Issuer>device-mgt</Issuer>

@ -35,6 +35,39 @@
<LoginCacheCapacity>10000</LoginCacheCapacity> <LoginCacheCapacity>10000</LoginCacheCapacity>
{% endif %} {% endif %}
<Billing>
{% if mdm_ui_conf.hide_bill_generation_in_super_tenant is defined %}
<HideBillGenerationInSuperTenant>{{mdm_ui_conf.hide_bill_generation_in_super_tenant}}</HideBillGenerationInSuperTenant>
{% else %}
<HideBillGenerationInSuperTenant>false</HideBillGenerationInSuperTenant>
{% endif %}
{% if mdm_ui_conf.hide_bill_generation_in_sub_tenant is defined %}
<HideBillGenerationInSubTenant>{{mdm_ui_conf.hide_bill_generation_in_sub_tenant}}</HideBillGenerationInSubTenant>
{% else %}
<HideBillGenerationInSubTenant>true</HideBillGenerationInSubTenant>
{% endif %}
{% if mdm_ui_conf.hide_total_calculation_in_super_tenant is defined %}
<HideTotalCalculationInSuperTenant>{{mdm_ui_conf.hide_total_calculation_in_super_tenant}}</HideTotalCalculationInSuperTenant>
{% else %}
<HideTotalCalculationInSuperTenant>false</HideTotalCalculationInSuperTenant>
{% endif %}
{% if mdm_ui_conf.hide_total_calculation_in_sub_tenant is defined %}
<HideTotalCalculationInSubTenant>{{mdm_ui_conf.hide_total_calculation_in_sub_tenant}}</HideTotalCalculationInSubTenant>
{% else %}
<HideTotalCalculationInSubTenant>true</HideTotalCalculationInSubTenant>
{% endif %}
{% if mdm_ui_conf.hide_domain_selection_in_super_tenant is defined %}
<HideDomainSelectionInSuperTenant>{{mdm_ui_conf.hide_domain_selection_in_super_tenant}}</HideDomainSelectionInSuperTenant>
{% else %}
<HideDomainSelectionInSuperTenant>false</HideDomainSelectionInSuperTenant>
{% endif %}
{% if mdm_ui_conf.hide_domain_selection_in_sub_tenant is defined %}
<HideDomainSelectionInSubTenant>{{mdm_ui_conf.hide_domain_selection_in_sub_tenant}}</HideDomainSelectionInSubTenant>
{% else %}
<HideDomainSelectionInSubTenant>true</HideDomainSelectionInSubTenant>
{% endif %}
</Billing>
<AppRegistration> <AppRegistration>
<Tags> <Tags>
{% if mdm_ui_conf.app_registration.tags is defined %} {% if mdm_ui_conf.app_registration.tags is defined %}
@ -231,6 +264,8 @@
<Scope>perm:windows:lock-reset</Scope> <Scope>perm:windows:lock-reset</Scope>
<Scope>perm:windows:reboot</Scope> <Scope>perm:windows:reboot</Scope>
<Scope>perm:windows:location</Scope> <Scope>perm:windows:location</Scope>
<Scope>perm:admin:tenant:view</Scope>
<Scope>perm:admin:metadata:view</Scope>
<Scope>perm:android:authenticate-account</Scope> <Scope>perm:android:authenticate-account</Scope>
{% if mdm_ui_conf.scopes is defined %} {% if mdm_ui_conf.scopes is defined %}
{%- for scope in mdm_ui_conf.scopes -%} {%- for scope in mdm_ui_conf.scopes -%}

Loading…
Cancel
Save