From 62d79b05f6b2e301923b18e0667a99ed38431f6c Mon Sep 17 00:00:00 2001 From: Torsten Juergeleit Date: Wed, 10 Jul 2024 16:31:40 +0200 Subject: [PATCH] adds page ID as group attribute --- .../mappers/confluence/ConfluenceGroupLDAPStorageMapper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/vaulttec/keycloak/ldap/mappers/confluence/ConfluenceGroupLDAPStorageMapper.java b/src/main/java/org/vaulttec/keycloak/ldap/mappers/confluence/ConfluenceGroupLDAPStorageMapper.java index 15ee16a..ce093f9 100644 --- a/src/main/java/org/vaulttec/keycloak/ldap/mappers/confluence/ConfluenceGroupLDAPStorageMapper.java +++ b/src/main/java/org/vaulttec/keycloak/ldap/mappers/confluence/ConfluenceGroupLDAPStorageMapper.java @@ -24,6 +24,7 @@ public class ConfluenceGroupLDAPStorageMapper extends AbstractLDAPStorageMapper { private static final Logger LOG = Logger.getLogger(ConfluenceGroupLDAPStorageMapper.class); + public static final String ATTRIBUTE_CONFLUENCE_PAGE_ID = "confluencePageID"; public static final String ATTRIBUTE_CONFLUENCE_PAGE_URL = "confluencePageURL"; private final ConfluenceGroupMapperConfig mapperConfig; private final ConfluenceContentConfig contentConfig; @@ -94,6 +95,7 @@ private void updateKeycloakGroup(RealmModel realm, ConfluencePage page, GroupMod } private void updateAttributesOfKCGroup(GroupModel kcGroup, ConfluencePage page) { + kcGroup.setSingleAttribute(ATTRIBUTE_CONFLUENCE_PAGE_ID, page.getId()); kcGroup.setSingleAttribute(ATTRIBUTE_CONFLUENCE_PAGE_URL, contentConfig.getBaseUrl() + page.getRelativeUrl()); } @@ -114,7 +116,7 @@ public UserModel proxy(LDAPObject ldapUser, UserModel delegate, RealmModel realm @Override public void leaveGroup(GroupModel group) { - if (group.getFirstAttribute(ATTRIBUTE_CONFLUENCE_PAGE_URL) != null) { + if (group.getFirstAttribute(ATTRIBUTE_CONFLUENCE_PAGE_ID) != null) { throw new ModelException("Not possible to leave group maintained by Confluence mapper"); } else { super.leaveGroup(group);