| @@ 253-263 (lines=11) @@ | ||
| 250 | * @param string $displayName |
|
| 251 | * @return bool Whether the display name could get set |
|
| 252 | */ |
|
| 253 | public static function setDisplayName($uid, $displayName = null) { |
|
| 254 | if (is_null($displayName)) { |
|
| 255 | $displayName = $uid; |
|
| 256 | } |
|
| 257 | $user = \OC::$server->getUserManager()->get($uid); |
|
| 258 | if ($user) { |
|
| 259 | return $user->setDisplayName($displayName); |
|
| 260 | } else { |
|
| 261 | return false; |
|
| 262 | } |
|
| 263 | } |
|
| 264 | ||
| 265 | /** |
|
| 266 | * Check if the user is logged in, considers also the HTTP basic credentials |
|
| @@ 399-406 (lines=8) @@ | ||
| 396 | * Check if the password is correct without logging in the user |
|
| 397 | * returns the user id or false |
|
| 398 | */ |
|
| 399 | public static function checkPassword($uid, $password) { |
|
| 400 | $manager = \OC::$server->getUserManager(); |
|
| 401 | $username = $manager->checkPassword($uid, $password); |
|
| 402 | if ($username !== false) { |
|
| 403 | return $username->getUID(); |
|
| 404 | } |
|
| 405 | return false; |
|
| 406 | } |
|
| 407 | ||
| 408 | /** |
|
| 409 | * @param string $uid The username |
|