/*
(non-Javadoc)

@see org.openengsb.connector.userprojects.ldap.internal.ldap.ModelManager#findUsers()
425927
@Override
    public List<User> findUsers() {
        List<User> userList;
        try {
            userList = createUsers(ldapDao.getDirectChildren(DnFactory.users()));
        } catch (NoSuchNodeException | MissingParentException e) {
            LOGGER.error("LDAP exception", e);
            throw new LdapRuntimeException(e);
        }
        return userList;
    }
392353
public java.util.List<User> getUsers() {
        if (users == null) {
            users = new com.amazonaws.internal.SdkInternalList<User>();
        }
        return users;
    }
137167
public void setUserProfiles(java.util.Collection<UserProfileSummary> userProfiles) {
        if (userProfiles == null) {
            this.userProfiles = null;
            return;
        }

        this.userProfiles = new java.util.ArrayList<UserProfileSummary>(userProfiles);
    }
520618
@Override
    public List<Assignment> findAssignments() {
        List<Assignment> assignmentList;
        try {
            assignmentList = createAssignments(ldapDao.getDirectChildren(DnFactory.assignments()));
        } catch (NoSuchNodeException | MissingParentException e) {
            LOGGER.error("LDAP exception", e);
            throw new LdapRuntimeException(e);
        }
        return assignmentList;
    }
1106060
@Action(
            domainEvent = FindUsersByNameDomainEvent.class,
            semantics = SemanticsOf.SAFE
    )
    @MemberOrder(sequence = "100.10.2")
    public List<ApplicationUser> findUsers(
            final @ParameterLayout(named = "Search") String search) {
        return applicationUserRepository.find(search);
    }
953329
public function getUsers()
    {
        if(!$this->isPropertyAvailable('Users')){
            $this->setProperty("Users", new UserCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath() , "Users")));
        }
        return $this->getProperty("Users");
    }
20919
public User findUser(final String userIdentifier)
    {
        User result = null;
        User user;
        
        for(int i = 0; (result == null) && (i < this.getUsers().size()); i++)
        {
            user = this.getUsers().get(i);
            
            if(user.getIdentifier().equals(userIdentifier))
            {
                result = user;
            }
        }
        
        return result;
    }
79859
function getUsers(done) {
  return getModels(function(m) {
    return m.collections.user.find().exec(done);
  });
}
242881
public Iterable<DConnection> queryByUserRoles(java.lang.String userRoles) {
    return queryByField(null, DConnectionMapper.Field.USERROLES.getFieldName(), userRoles);
  }
1074979
@Override
    public Set<Node> getGroupsForUser(Node user) {
        Set<Node> groups = new TreeSet<>();
        try {
            String query = "(& (objectClass=" + groupObjectClass + ") (" + groupMemberAttribut + "=" + ((LdapUser) user).getDn() + "))";
            SearchResult searchResult;
            Attributes attributes;
            SearchControls controls = new SearchControls();
            controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
            NamingEnumeration<SearchResult> results = ctx.search("", query, controls);
            queryCount++;
            Node group;
            while (results.hasMore()) {
                searchResult = results.next();
                attributes = searchResult.getAttributes();
                group = getGroup(getAttributeOrNa(attributes, groupIdentifyer));
                group.setDn(searchResult.getNameInNamespace());
                groups.add(group);
            }
        } catch (NamingException ex) {
            handleNamingException(user, ex);
        }
        return groups;
    }
1372823
@Override
    public Set<Node> findGroups(final String cn) {
        QueryBuilder qb = new LdapQueryBuilder();
        if ("*".equals(cn)) {
            qb.append(LdapKeys.OBJECT_CLASS, groupObjectClass);
        } else {
            qb.append(LdapKeys.OBJECT_CLASS, groupObjectClass);
            qb.append(groupIdentifyer, cn + "*");
        }
        return findGroups(qb);
    }
462522
public void setUsers(final List<User> users)
    {
        synchronized(this.getUsers())
        {
            if(users != this.getUsers())
            {
                this.getUsers().clear();
                
                if(users != null)
                {
                    this.getUsers().addAll(users);
                }
            }
        }
    }
1115353
public function getUsers() : array
    {
        /** @var \Adldap\Query\Builder $query */
        $query = Resolver::query();

        if ($filter = $this->option('filter')) {
            // If the filter option was given, we'll
            // insert it into our search query.
            $query->rawFilter($filter);
        }

        if ($user = $this->argument('user')) {
            $users = [$query->findOrFail($user)];
        } else {
            // Retrieve all users. We'll paginate our search in case we
            // hit the 1000 record hard limit of active directory.
            $users = $query->paginate()->getResults();
        }

        // We need to filter our results to make sure they are
        // only users. In some cases, Contact models may be
        // returned due the possibility of them
        // existing in the same scope.
        return array_filter($users, function ($user) {
            return $user instanceof User;
        });
    }
380056
public java.util.List<String> getUserIds() {
        if (userIds == null) {
            userIds = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return userIds;
    }
201868
public UserEntities getUsers(Map<String, String> queryParams) {
		UserEntities userEntities = restClient.get("users", UserEntities.class, queryParams);
		return userEntities;
	}
400224
public List<CmsUser> searchUsers(CmsRequestContext requestContext, CmsUserSearchParameters searchParams)
    throws CmsException {

        CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext);
        try {
            return m_driverManager.searchUsers(dbc, searchParams);
        } catch (Exception e) {
            dbc.report(null, Messages.get().container(Messages.ERR_SEARCH_USERS_0), e);
            return null;
        } finally {
            dbc.clear();
        }
    }
68687
private Map getUsers() throws NamingException {

        String filter = "(" + roleNameRDN + "=*)";

        HashMap users = new HashMap();

        NamingEnumeration results = this.search(roleBase, filter, new String[]{roleMemberRDN});
        while (results != null && results.hasMore()) {

            SearchResult roleResult = (SearchResult) results.next();

            String roleResultName = roleResult.getName();
            if ("".equals(roleResultName)) {
                continue;
            }

            String roleResultValue = (roleResultName.split("="))[1];

            Attributes roleAttrs = roleResult.getAttributes();

            Attribute roleAttr = roleAttrs.get(roleMemberRDN);
            NamingEnumeration valueEnum = roleAttr.getAll();
            while (valueEnum != null && valueEnum.hasMore()) {
                String value = (String) valueEnum.next();

                String name;
                if (value.endsWith("," + userBase)) {
                    name = value.substring(0, value.length() - userBase.length() - 1);
                    name = name.split("=")[1];
                } else {
                    log.debug("found unrecognized DN: " + value);
                    continue;
                }

                if (users.containsKey(name)) {
                    HashSet roles = (HashSet) users.get(name);
                    roles.add(roleResultValue);
                } else {
                    HashSet roles = new HashSet();
                    roles.add(roleResultValue);
                    users.put(name, roles);
                }
            }
        }
        return users;

    }