Skip to content

Commit

Permalink
#815 : corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhar16 authored and yurem committed Aug 9, 2018
1 parent e0a6d5b commit a6642cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
Expand Up @@ -232,7 +232,7 @@ public String update() {
try {
this.gluuStatus = this.person.getStatus();
List <String> oxexternal = this.person.getOxExternalUid();
String oxOTPDevices = this.person.getOxOTPDevices();
OTPDevice oxOTPDevices = this.person.getOxOTPDevices();
externalAuthCustomAttributes = new ArrayList<String>();
String oxMobileDevices = this.person.getOxMobileDevices();
if(oxexternal != null && oxexternal.size()>0){
Expand Down Expand Up @@ -269,10 +269,10 @@ public String update() {
}
}

if (oxOTPDevices != null && !oxOTPDevices.trim().equals("")) {
/*if (oxOTPDevices != null && !oxOTPDevices.trim().equals("")) {
ObjectMapper mapper = new ObjectMapper();
OTPDevice oTPDevice = mapper.readValue(oxOTPDevices, OTPDevice.class);
ArrayList<Device> devices = oTPDevice.getDevices();
OTPDevice oTPDevice = mapper.readValue(oxOTPDevices, OTPDevice.class);*/
ArrayList<Device> devices = oxOTPDevices.getDevices();

if (devices != null && devices.size() > 0) {
for (Device device : devices) {
Expand All @@ -285,7 +285,7 @@ public String update() {
deviceDataMap.add(gluuDeviceDataBean);
}
}
}
//}

if (oxMobileDevices != null && !oxMobileDevices.trim().equals("")) {
ObjectMapper mapper = new ObjectMapper();
Expand Down Expand Up @@ -610,26 +610,27 @@ public void removeDevice(GluuDeviceDataBean deleteDeviceData){
}
}

String oxOTPDevices = this.person.getOxOTPDevices();
if (oxOTPDevices != null && !oxOTPDevices.trim().equals("")) {
OTPDevice oxOTPDevices = this.person.getOxOTPDevices();
/*if (oxOTPDevices != null && !oxOTPDevices.trim().equals("")) {
ObjectMapper mapper = new ObjectMapper();
OTPDevice oTPDevice = mapper.readValue(oxOTPDevices, OTPDevice.class);
ArrayList<Device> devices = oTPDevice.getDevices();
OTPDevice oTPDevice = mapper.readValue(oxOTPDevices, OTPDevice.class);*/
ArrayList<Device> devices = oxOTPDevices.getDevices();

if (devices != null && devices.size() > 0) {
for (Device device : devices) {
if(deleteDeviceData.getId().equals(device.getId())){
deviceDataMap.remove(deleteDeviceData);
devices.remove(device);
Map<String, ArrayList<Device>> map= new HashMap<String, ArrayList<Device>>();
/*Map<String, ArrayList<Device>> map= new HashMap<String, ArrayList<Device>>();
map.put("devices", devices);
String jsonInString = mapper.writeValueAsString(map);
this.person.setOxOTPDevices(jsonInString);
String jsonInString = mapper.writeValueAsString(map);*/
oxOTPDevices.setDevices(devices);
this.person.setOxOTPDevices(oxOTPDevices);
return;
}
}
}
}
//}

String oxMobileDevices = this.person.getOxMobileDevices();
if (oxMobileDevices != null && !oxMobileDevices.trim().equals("")) {
Expand Down
Expand Up @@ -22,6 +22,7 @@
import org.codehaus.jackson.map.ObjectMapper;
import org.gluu.site.ldap.persistence.annotation.LdapAttribute;
import org.gluu.site.ldap.persistence.annotation.LdapEntry;
import org.gluu.site.ldap.persistence.annotation.LdapJsonObject;
import org.gluu.site.ldap.persistence.annotation.LdapObjectClass;
import org.xdi.ldap.model.GluuBoolean;
import org.xdi.ldap.model.GluuStatus;
Expand Down Expand Up @@ -58,11 +59,13 @@ public class GluuCustomPerson extends User
@LdapAttribute(name = "oxPPID")
private List<String> oxPPID;

// @LdapJsonObject
@LdapAttribute(name = "oxExternalUid")
private List<String> oxExternalUid;

@LdapJsonObject
@LdapAttribute(name = "oxOTPDevices")
private String oxOTPDevices;
private OTPDevice oxOTPDevices;

@LdapAttribute(name = "oxMobileDevices")
private String oxMobileDevices;
Expand All @@ -75,11 +78,11 @@ public void setOxMobileDevices(String oxMobileDevices) {
this.oxMobileDevices = oxMobileDevices;
}

public String getOxOTPDevices() {
public OTPDevice getOxOTPDevices() {
return oxOTPDevices;
}

public void setOxOTPDevices(String oxOTPDevices) {
public void setOxOTPDevices(OTPDevice oxOTPDevices) {
this.oxOTPDevices = oxOTPDevices;
}

Expand Down

0 comments on commit a6642cc

Please sign in to comment.