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

Improve scim attribute update #527

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 @@ -63,7 +63,6 @@
import org.wso2.carbon.user.core.UserStoreManager;
import org.wso2.carbon.user.core.claim.ClaimManager;
import org.wso2.carbon.user.core.common.AbstractUserStoreManager;
import org.wso2.carbon.user.core.common.Claim;
import org.wso2.carbon.user.core.constants.UserCoreClaimConstants;
import org.wso2.carbon.user.core.constants.UserCoreErrorConstants;
import org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager;
Expand Down Expand Up @@ -2664,10 +2663,9 @@ public Group createGroup(Group group, Map<String, Boolean> requiredAttributes)
}
}
}
Map<String, String> claimsInLocalDialect =
SCIMCommonUtils.convertSCIMtoLocalDialect(AttributeMapper.getClaimsMap(group));
// From SCIM we only need to generate the role name. Other attributes are handled by the user core.
org.wso2.carbon.user.core.common.Group createdGroup =
carbonUM.addGroup(roleNameWithDomain, members, buildGroupMetaClaimsList(claimsInLocalDialect));
carbonUM.addGroup(roleNameWithDomain, members, null);
group = buildGroup(createdGroup);
if (log.isDebugEnabled()) {
log.debug("Group: " + group.getDisplayName() + " is created through SCIM.");
Expand All @@ -2693,26 +2691,6 @@ public Group createGroup(Group group, Map<String, Boolean> requiredAttributes)
return group;
}

/**
* Convert the claimsInLocalDialect to a list of Claims. NOTE: This method drops the RESOURCE_TYPE_CLAIM claim
* dialect being added to the returned claims list.
*
* @param claimsInLocalDialect Map of claims in local dialect.
* @return List of claims.
*/
private List<Claim> buildGroupMetaClaimsList(Map<String, String> claimsInLocalDialect) {

List<Claim> claimsList = new ArrayList<>();
for (Map.Entry<String, String> entry : claimsInLocalDialect.entrySet()) {
String claimUri = entry.getKey();
if (RESOURCE_TYPE_CLAIM.equals(claimUri)) {
continue;
}
claimsList.add(new Claim(entry.getKey(), entry.getValue()));
}
return claimsList;
}

@Override
public Group getGroup(String id, Map<String, Boolean> requiredAttributes) throws CharonException {

Expand Down
Loading
Loading