@Override public Map<String, List<String>> getAttributes() { return delegate.getAttributes(); }
@Override public Map<String, List<String>> getAttributes() { return delegate.getAttributes(); }
@Override public Map<String, List<String>> getAttributes() { if (updated != null) return updated.getAttributes(); return cached.getAttributes(modelSupplier); }
@Override public Map<String, List<String>> getAttributes() { if (updated != null) return updated.getAttributes(); return cached.getAttributes(); }
public ProfileBean(UserModel user) { this.user = user; if (user.getAttributes() != null) { for (Map.Entry<String, List<String>> attr : user.getAttributes().entrySet()) { List<String> attrValue = attr.getValue(); if (attrValue != null && attrValue.size() > 0) { attributes.put(attr.getKey(), attrValue.get(0)); } if (attrValue != null && attrValue.size() > 1) { logger.warnf("There are more values for attribute '%s' of user '%s' . Will display just first value", attr.getKey(), user.getUsername()); } } } }
public AccountBean(UserModel user, MultivaluedMap<String, String> profileFormData) { this.user = user; this.profileFormData = profileFormData; for (Map.Entry<String, List<String>> attr : user.getAttributes().entrySet()) { List<String> attrValue = attr.getValue(); if (attrValue.size() > 0) { attributes.put(attr.getKey(), attrValue.get(0)); } if (attrValue.size() > 1) { logger.warnf("There are more values for attribute '%s' of user '%s' . Will display just first value", attr.getKey(), user.getUsername()); } } if (profileFormData != null) { for (String key : profileFormData.keySet()) { if (key.startsWith("user.attributes.")) { String attribute = key.substring("user.attributes.".length()); attributes.put(attribute, profileFormData.getFirst(key)); } } } }
public CachedUser(Long revision, RealmModel realm, UserModel user, int notBefore) { super(revision, user.getId()); this.realm = realm.getId(); this.username = user.getUsername(); this.createdTimestamp = user.getCreatedTimestamp(); this.firstName = user.getFirstName(); this.lastName = user.getLastName(); this.email = user.getEmail(); this.emailVerified = user.isEmailVerified(); this.enabled = user.isEnabled(); this.federationLink = user.getFederationLink(); this.serviceAccountClientLink = user.getServiceAccountClientLink(); this.notBefore = notBefore; this.requiredActions = new DefaultLazyLoader<>(UserModel::getRequiredActions, Collections::emptySet); this.attributes = new DefaultLazyLoader<>(userModel -> new MultivaluedHashMap<>(userModel.getAttributes()), MultivaluedHashMap::new); this.roleMappings = new DefaultLazyLoader<>(userModel -> userModel.getRoleMappings().stream().map(RoleModel::getId).collect(Collectors.toSet()), Collections::emptySet); this.groups = new DefaultLazyLoader<>(userModel -> userModel.getGroups().stream().map(GroupModel::getId).collect(Collectors.toCollection(LinkedHashSet::new)), LinkedHashSet::new); }
public static UserRepresentation toRepresentation(UserModel user) { UserRepresentation rep = new UserRepresentation(); rep.setId(user.getId()); rep.setUsername(user.getUsername()); rep.setCreatedTimestamp(user.getCreatedTimestamp()); rep.setLastName(user.getLastName()); rep.setFirstName(user.getFirstName()); rep.setEmail(user.getEmail()); rep.setEnabled(user.isEnabled()); rep.setEmailVerified(user.isEmailVerified()); rep.setTotp(user.isOtpEnabled()); rep.setFederationLink(user.getFederationLink()); List<String> reqActions = new ArrayList<String>(); Set<String> requiredActions = user.getRequiredActions(); for (String ra : requiredActions){ reqActions.add(ra); } rep.setRequiredActions(reqActions); if (user.getAttributes() != null && !user.getAttributes().isEmpty()) { Map<String, Object> attrs = new HashMap<>(); attrs.putAll(user.getAttributes()); rep.setAttributes(attrs); } return rep; }
public CachedUser(RealmModel realm, UserModel user) { this.id = user.getId(); this.realm = realm.getId(); this.username = user.getUsername(); this.createdTimestamp = user.getCreatedTimestamp(); this.firstName = user.getFirstName(); this.lastName = user.getLastName(); this.attributes.putAll(user.getAttributes()); this.email = user.getEmail(); this.emailVerified = user.isEmailVerified(); this.credentials.addAll(user.getCredentialsDirectly()); this.enabled = user.isEnabled(); this.totp = user.isOtpEnabled(); this.federationLink = user.getFederationLink(); this.serviceAccountClientLink = user.getServiceAccountClientLink(); this.requiredActions.addAll(user.getRequiredActions()); for (RoleModel role : user.getRoleMappings()) { roleMappings.add(role.getId()); } Set<GroupModel> groupMappings = user.getGroups(); if (groupMappings != null) { for (GroupModel group : groupMappings) { groups.add(group.getId()); } } }
userEntity.setAttributes(userModel.getAttributes());