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

Skip updating group last modified date for secondary userstores #603

Closed
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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2025, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2017-2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -3646,7 +3646,8 @@ private void doPatchGroup(String groupId, String currentGroupName, Map<String, L
carbonUM.updateGroupName(currentGroupName, newGroupName);

// Update the last modified time of the group.
if (!carbonUM.isUniqueGroupIdEnabled() && groupLastUpdatedTime != null) {
if (!isSecondaryUserStoreDomain(userStoreDomainForGroup) &&
PasinduYeshan marked this conversation as resolved.
Show resolved Hide resolved
!carbonUM.isUniqueGroupIdEnabled() && groupLastUpdatedTime != null) {
Map<String, String> attributes = new HashMap<>();
attributes.put(SCIMConstants.CommonSchemaConstants.LAST_MODIFIED_URI,
AttributeUtil.formatDateTime(groupLastUpdatedTime.toInstant()));
Expand Down Expand Up @@ -4572,6 +4573,20 @@ private boolean isNotInternalOrApplicationGroup(String userStoreDomain) {
return !isInternalOrApplicationGroup(userStoreDomain);
}

/**
* Checks if the given user store domain is a secondary user store.
*
* @param userStoreDomain The user store domain to check.
* @return {@code true} if it is a secondary user store; {@code false} otherwise.
*/
private boolean isSecondaryUserStoreDomain(String userStoreDomain) {

return StringUtils.isNotBlank(userStoreDomain) &&
!SCIMCommonConstants.DEFAULT.equalsIgnoreCase(userStoreDomain) &&
!SCIMCommonConstants.PRIMARY.equalsIgnoreCase(userStoreDomain) &&
isNotInternalOrApplicationGroup(userStoreDomain);
}

/**
* This is used to add domain name to the members of a group
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2024, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2017-2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -39,6 +39,7 @@ public class SCIMCommonConstants {
public static final String SERVICE_PROVIDER_CONFIG = "/ServiceProviderConfig";
public static final String RESOURCE_TYPE = "/ResourceTypes";
public static final String DEFAULT = "default";
public static final String PRIMARY = "primary";

public static final int USER = 1;
public static final int GROUP = 2;
Expand Down