Lines Matching defs:user
32 * // warn user about expiring password this many days in advance:
63 * @var array user listing cache
114 // trust the incoming user
148 * Check user+password [required auth function]
150 * Checks if the given user exists and the given
155 * @param string $user
159 public function checkPass($user, $pass)
163 $INPUT->server->str('REMOTE_USER') == $user &&
167 $adldap = $this->initAdLdap($this->getUserDomain($user));
171 return $adldap->authenticate($this->getUserName($user), $pass);
179 * Return user info [required auth function]
181 * Returns info about the given user needs to contain
184 * name string full name of the user
185 * mail string email address of the user
186 * grps array list of groups the user is in
199 * @param string $user
203 public function getUserData($user, $requireGroups = true)
209 $adldap = $this->initAdLdap($this->getUserDomain($user));
211 if ($user == '') return false;
220 //get info for given user
221 $result = $adldap->user()->info($this->getUserName($user), $fields);
226 //general user info
245 $info['grps'] = $adldap->user()->groups($this->getUserName($user), (bool) $this->opts['recursive_groups']);
260 // add the user's domain to the groups
261 $domain = $this->getUserDomain($user);
269 $expiry = $adldap->user()->passwordExpiry($user);
274 // if this is the current user, warn him (once per request only)
276 ($INPUT->server->str('REMOTE_USER') == $user) &&
316 * Sanitize user names
318 * Normalizes domain parts, does not modify the user name itself (unlike cleanGroup)
321 * @param string $user
324 public function cleanUser($user)
329 [$dom, $user] = sexplode('\\', $user, 2, '');
330 if (!$user) $user = $dom;
332 [$user, $dom] = sexplode('@', $user, 2, '');
337 $user = PhpString::strtolower(trim($user));
348 if ($domain) $user = "$user@$domain";
349 return $user;
380 if (isset($filter['user'])) {
381 $result .= ')(samAccountName=*' . $adldapUtils->ldapSlashes($filter['user']) . '*';
382 unset($filter['user']);
393 * Return a count of the number of user which meet $filter criteria
406 $result = $adldap->user()->all();
409 $result = $adldap->user()->all(false, $searchString);
452 if (isset($filter['user'])) {
453 $result .= 'user-' . $filter['user'];
488 foreach ($this->users as $user => &$info) {
493 $info = $this->getUserData($user);
495 if ($this->filter($user, $info)) {
496 $this->grpsusers[$this->filterToString($filter)][$user] = $info;
504 * Bulk retrieval of user data
508 * @param int $start index of first user to be returned
519 //get info for given user
520 $result = $adldap->user()->all(false, $this->constructSearchString($filter));
534 foreach ($this->users as $user => &$info) {
539 $info = $this->getUserData($user);
541 $result[$user] = $info;
562 foreach ($this->grpsusers[$this->filterToString($filter)] as $user => &$info) {
566 $result[$user] = $info;
574 * Modify user data
576 * @param string $user nick of the user to be changed
580 public function modifyUser($user, $changes)
583 $adldap = $this->initAdLdap($this->getUserDomain($user));
592 $return = $adldap->user()->password($this->getUserName($user), $changes['pass']);
600 // changing user data
614 $return &= $adldap->user()->modify($this->getUserName($user), $adchanges);
629 * Eg. the one of the logged in user. It falls back to the default
659 * Get the domain part from a user
661 * @param string $user
664 public function getUserDomain($user)
666 [, $domain] = sexplode('@', $user, 2, '');
671 * Get the user part from a user
673 * When an account suffix is set, we strip the domain part from the user
675 * @param string $user
678 public function getUserName($user)
681 [$user] = explode('@', $user, 2);
683 return $user;
725 // adLDAP expects empty user/pass as NULL, we're less strict FS#2781
729 // user listing needs admin priviledges
766 * Check provided user and userinfo for matching patterns
772 * @param string $user
776 protected function filter($user, $info)
779 if ($item == 'user') {
780 if (!preg_match($pattern, $user)) return false;