Fixing bug in condition
Closes #33353 Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
parent
4bd29e257b
commit
8769fed585
1 changed files with 4 additions and 3 deletions
|
@ -207,7 +207,7 @@ public class InfinispanOrganizationProvider implements OrganizationProvider {
|
||||||
boolean isManaged = getDelegate().isManagedMember(organization, user);
|
boolean isManaged = getDelegate().isManagedMember(organization, user);
|
||||||
Long loaded = realmCache.getCache().getCurrentRevision(cacheKey);
|
Long loaded = realmCache.getCache().getCurrentRevision(cacheKey);
|
||||||
UserModel member = getDelegate().getMemberById(organization, user.getId());
|
UserModel member = getDelegate().getMemberById(organization, user.getId());
|
||||||
cached = new CachedMembership(loaded, cacheKeyMembership(realm, organization, user), realm, isManaged, member != null);
|
cached = new CachedMembership(loaded, cacheKey, realm, isManaged, member != null);
|
||||||
realmCache.getCache().addRevisioned(cached, realmCache.getStartupRevision());
|
realmCache.getCache().addRevisioned(cached, realmCache.getStartupRevision());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,11 +243,12 @@ public class InfinispanOrganizationProvider implements OrganizationProvider {
|
||||||
String cacheKey = cacheKeyMembership(getRealm(), organization, user);
|
String cacheKey = cacheKeyMembership(getRealm(), organization, user);
|
||||||
CachedMembership cached = realmCache.getCache().get(cacheKey, CachedMembership.class);
|
CachedMembership cached = realmCache.getCache().get(cacheKey, CachedMembership.class);
|
||||||
|
|
||||||
if (cached == null && !isInvalid(cacheKey)) {
|
if (cached == null || isInvalid(cacheKey)) {
|
||||||
|
// this will not cache the result as calling getMemberById() to have a full caching entry would lead to a recursion
|
||||||
return getDelegate().isManagedMember(organization, user);
|
return getDelegate().isManagedMember(organization, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cached == null ? false : cached.isManaged();
|
return cached.isManaged();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue