private Group doGetGroup(String uniqueGroupId, String domainName) throws IdentityStoreException, GroupNotFoundException { Cache<String, Group> groupCache = cacheManager.getCache(UNIQUE_GROUP_CACHE, String.class, Group.class); Group group = groupCache.get(uniqueGroupId.hashCode() + ":" + domainName.hashCode()); if (group == null) { group = identityStore.getGroup(uniqueGroupId); groupCache.put(group.getUniqueGroupId().hashCode() + ":" + group.getDomainName().hashCode(), group); group.setIdentityStore(this); return group; } group.setIdentityStore(this); return group; }
public Group build() { //TODO Add authorizationStore with M3 if (groupId == null || identityStore == null || domainName == null) { throw new StoreException("Required data missing for building group."); } Group group = new Group(groupId, domainName); group.setIdentityStore(identityStore); return group; } }
List<org.wso2.carbon.identity.mgt.User> userList = userStoreGroup.getUsers(); scimGroup.setId(userStoreGroup.getUniqueGroupId()); scimGroup.setLocation(SCIMCommonConstants.GROUPS_LOCATION + "/" + userStoreGroup.getUniqueGroupId());
scimUser.setGroup(null, group.getUniqueGroupId(), null);
private List<Object> listGroupsWithPagination(int startIndex, int count) throws CharonException { try { //get the group list according to the start index and the count values provided. //TODO : Add the domain of the store. List<org.wso2.carbon.identity.mgt.Group> groupList = identityStore.listGroups(startIndex, count); List<Object> groupObjectList = new ArrayList<>(); //we need to set the first item of the array to be the number of groups in the given domain. groupObjectList.add(groupList.size()); //convert identity store users to objects. for (org.wso2.carbon.identity.mgt.Group group : groupList) { //get the details of the users. //TODO:We need to pass the scim claim dialect for this method List<Claim> claimList = group.getClaims(); //TODO this is a temporary method. need to remove this once the claim management is completed. claimList = ClaimMapper.getInstance().convertToScimDialect(claimList); Group scimGroup = getSCIMGroup(group, claimList); groupObjectList.add(scimGroup); } return groupObjectList; } catch (IdentityStoreException | GroupNotFoundException e) { throw new CharonException("Error in getting the user list with start index :" + startIndex + " and " + "count of :" + count, e); } }
@Override public Group getGroup(String uniqueGroupId) throws IdentityStoreException, GroupNotFoundException { if (cacheStatus.get(UNIQUE_GROUP_CACHE) && !isNullOrEmpty(uniqueGroupId)) { return doGetGroup(uniqueGroupId, identityStore.getPrimaryDomainName()); } Group group = identityStore.getGroup(uniqueGroupId); group.setIdentityStore(this); return group; }
identityStore.updateUsersOfGroup(userStoreGroup.getUniqueGroupId(), userIds); return this.getGroup(userStoreGroup.getUniqueGroupId(), requiredAttributes);
@Override public Group getGroup(String groupId, Map<String, Boolean> requiredAttributes) throws NotImplementedException, BadRequestException, CharonException, NotFoundException { if (log.isDebugEnabled()) { log.debug("Retrieving group: " + groupId); } try { org.wso2.carbon.identity.mgt.Group userStoreGroup = identityStore.getGroup(groupId); //TODO:We need to pass the scim claim dialect for this method List<Claim> claimList = userStoreGroup.getClaims(); //TODO this is a temporary method. need to remove this once the claim management is completed. claimList = ClaimMapper.getInstance().convertGroupToScimDialect(claimList); Group scimGroup = getSCIMGroup(userStoreGroup, claimList); if (log.isDebugEnabled()) { log.debug("Group: " + scimGroup.getDisplayName() + " is retrieved through SCIM."); } return scimGroup; } catch (IdentityStoreException e) { throw new CharonException("Error in getting the group : " + groupId, e); } catch (GroupNotFoundException e) { throw new NotFoundException("Group with the id :" + groupId + " does not exists."); } }
List<Claim> claimList = group.getClaims();