Skip to content

Commit

Permalink
Allow differential IMS updates
Browse files Browse the repository at this point in the history
It is opt-in though, because it doesn't always speed up performance.
This closes #757
  • Loading branch information
kwin committed Aug 2, 2024
1 parent a39360f commit 801533d
Show file tree
Hide file tree
Showing 9 changed files with 477 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ private void syncWithExternalGroupManagement(Collection<AuthorizableConfigBean>
return;
}
for (ExternalGroupManagement externalGroupManagement : externalGroupManagementServices) {
externalGroupManagement.updateGroups(groupConfigBeans);
installLog.addMessage(LOG, "Synchronized " + groupConfigBeans.size() + " groups with external user management " + externalGroupManagement.getLabel());
int numGroupsSynced = externalGroupManagement.updateGroups(groupConfigBeans);
installLog.addMessage(LOG, "Synchronized " + numGroupsSynced + " groups with external user management " + externalGroupManagement.getLabel());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
* Implementations of this service synchronize (i.e. create/update/delete) groups in an external directory (outside AEM).
*/
public interface ExternalGroupManagement {
void updateGroups(Collection<AuthorizableConfigBean> groupConfigs) throws IOException;
/**
* Updates the groups in the external directory.
* @param groupConfigs the groups to be updated
* @return the effective number of groups updated (may be less than the number of groups in {@code groupConfigs}) if some are considered up to date
* @throws IOException
*/
int updateGroups(Collection<AuthorizableConfigBean> groupConfigs) throws IOException;

/**
*
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/** General response format for UMAPI requests */
/** General response format for UMAPI action requests */
@JsonIgnoreProperties(ignoreUnknown = true)
public class ActionCommandResponse {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package biz.netcentric.cq.tools.actool.ims.response;

/*-
* #%L
* Access Control Tool Bundle
* %%
* Copyright (C) 2015 - 2024 Cognizant Netcentric
* %%
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* #L%
*/

import java.util.List;

import org.apache.http.client.methods.HttpRequestBase;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class GroupResponse {

@JsonProperty("lastPage")
public boolean isLastPage;

@JsonProperty("result")
public String result;

@JsonProperty("groups")
public List<IMSGroup> groups;

@JsonIgnore
public HttpRequestBase associatedRequest;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package biz.netcentric.cq.tools.actool.ims.response;

/*-
* #%L
* Access Control Tool Bundle
* %%
* Copyright (C) 2015 - 2024 Cognizant Netcentric
* %%
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* #L%
*/

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Represents either a user group or product profile in IMS. */
@JsonIgnoreProperties(ignoreUnknown = true)
public class IMSGroup {

@JsonProperty("type")
public String type;

@JsonProperty("memberCount")
public int memberCount;

@JsonProperty("adminGroupName")
public String adminGroupName;

@JsonProperty("groupName")
public String groupName;

@JsonProperty("groupId")
public long groupId;

@JsonProperty("userGroupName")
public String userGroupName;

@Override
public String toString() {
return "IMSGroup [type=" + type + ", memberCount=" + memberCount + ", adminGroupName=" + adminGroupName + ", groupName=" + groupName
+ ", groupId=" + groupId + ", userGroupName=" + userGroupName + "]";
}

public String getType() {
return type;
}

public int getMemberCount() {
return memberCount;
}

public String getAdminGroupName() {
return adminGroupName;
}

public String getGroupName() {
return groupName;
}

public long getGroupId() {
return groupId;
}

public String getUserGroupName() {
return userGroupName;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package biz.netcentric.cq.tools.actool.ims.response;

/*-
* #%L
* Access Control Tool Bundle
* %%
* Copyright (C) 2015 - 2024 Cognizant Netcentric
* %%
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* #L%
*/

import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class IMSUser {

@JsonProperty("type")
public String type;

@JsonProperty("email")
public String email;

@JsonProperty("status")
public String status;

@JsonProperty("groups")
public List<String> groups;

@JsonProperty("domain")
public String domain;

@JsonProperty("country")
public String country;

@JsonProperty("tags")
public List<String> tags;

@JsonProperty("username")
public String username;

@Override
public String toString() {
return "IMSUser [type=" + type + ", email=" + email + ", status=" + status + ", groups=" + groups + ", domain=" + domain
+ ", country=" + country + ", tags=" + tags + ", username=" + username + "]";
}

public String getType() {
return type;
}

public String getEmail() {
return email;
}

public String getStatus() {
return status;
}

public List<String> getGroups() {
return groups;
}

public String getDomain() {
return domain;
}

public String getCountry() {
return country;
}

public List<String> getTags() {
return tags;
}

public String getUsername() {
return username;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package biz.netcentric.cq.tools.actool.ims.response;

/*-
* #%L
* Access Control Tool Bundle
* %%
* Copyright (C) 2015 - 2024 Cognizant Netcentric
* %%
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* #L%
*/

import java.util.List;

import org.apache.http.client.methods.HttpRequestBase;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class UsersInGroupResponse {

@JsonProperty("lastPage")
public boolean isLastPage;

@JsonProperty("result")
public String result;

@JsonProperty("groupName")
public String groupName;

@JsonProperty("users")
public List<IMSUser> users;

@JsonIgnore
public HttpRequestBase associatedRequest;
}
Loading

0 comments on commit 801533d

Please sign in to comment.