Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow differential IMS updates #760

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading