Commit 7ef27f28 authored by Matija Obreza's avatar Matija Obreza

Fix: AclObjectIdentityExt cannot serialize OAuthClient#roles

parent 26c64dc0
......@@ -29,6 +29,7 @@ import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.PostLoad;
......@@ -127,7 +128,7 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
/** The roles. */
@JsonView(JsonViews.Protected.class)
@ElementCollection
@ElementCollection(fetch = FetchType.EAGER)
@Enumerated(EnumType.STRING)
@CollectionTable(name = "oauthclientrole", joinColumns = @JoinColumn(name = "clientId"))
@Column(name = "oauthclientrole")
......
......@@ -394,6 +394,8 @@ public class CustomAclServiceImpl implements CustomAclService {
if (objectIdentity != null) {
objectIdentity = getObjectIdentity(objectIdentity.getId());
AclObjectIdentityExt _aclObjectIdentity = new AclObjectIdentityExt(objectIdentity);
// lazy load SIDs for AclEntries
objectIdentity.getAclEntries().forEach(entry -> entry.getAclSid().getId());
List<AclEntry> inheritedEntries = inherited(objectIdentity.getParentObject(), new ArrayList<>(), new HashSet<>());
......@@ -410,6 +412,10 @@ public class CustomAclServiceImpl implements CustomAclService {
if (objectIdentity == null || handled.contains(objectIdentity)) {
return aclEntries;
}
// lazy load SIDs for AclEntries
objectIdentity.getAclEntries().forEach(entry -> entry.getAclSid().getId());
aclEntries.addAll(objectIdentity.getAclEntries());
handled.add(objectIdentity);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment