Skip to content

Commit

Permalink
adds page ID as group attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
tjuerge committed Jul 10, 2024
1 parent 529a435 commit 62d79b0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

Expand All @@ -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);
Expand Down

0 comments on commit 62d79b0

Please sign in to comment.