| @@ 255-265 (lines=11) @@ | ||
| 252 | * @param string $displayName |
|
| 253 | * @return bool Whether the display name could get set |
|
| 254 | */ |
|
| 255 | public static function setDisplayName($uid, $displayName = null) { |
|
| 256 | if (is_null($displayName)) { |
|
| 257 | $displayName = $uid; |
|
| 258 | } |
|
| 259 | $user = \OC::$server->getUserManager()->get($uid); |
|
| 260 | if ($user) { |
|
| 261 | return $user->setDisplayName($displayName); |
|
| 262 | } else { |
|
| 263 | return false; |
|
| 264 | } |
|
| 265 | } |
|
| 266 | ||
| 267 | /** |
|
| 268 | * Check if the user is logged in, considers also the HTTP basic credentials |
|
| @@ 461-468 (lines=8) @@ | ||
| 458 | * Check if the password is correct without logging in the user |
|
| 459 | * returns the user id or false |
|
| 460 | */ |
|
| 461 | public static function checkPassword($uid, $password) { |
|
| 462 | $manager = \OC::$server->getUserManager(); |
|
| 463 | $username = $manager->checkPassword($uid, $password); |
|
| 464 | if ($username !== false) { |
|
| 465 | return $username->getUID(); |
|
| 466 | } |
|
| 467 | return false; |
|
| 468 | } |
|
| 469 | ||
| 470 | /** |
|
| 471 | * @param string $uid The username |
|