| @@ 267-277 (lines=11) @@ | ||
| 264 | * @param string $displayName |
|
| 265 | * @return bool Whether the display name could get set |
|
| 266 | */ |
|
| 267 | public static function setDisplayName($uid, $displayName = null) { |
|
| 268 | if (is_null($displayName)) { |
|
| 269 | $displayName = $uid; |
|
| 270 | } |
|
| 271 | $user = \OC::$server->getUserManager()->get($uid); |
|
| 272 | if ($user) { |
|
| 273 | return $user->setDisplayName($displayName); |
|
| 274 | } else { |
|
| 275 | return false; |
|
| 276 | } |
|
| 277 | } |
|
| 278 | ||
| 279 | /** |
|
| 280 | * Check if the user is logged in, considers also the HTTP basic credentials |
|
| @@ 424-431 (lines=8) @@ | ||
| 421 | * Check if the password is correct without logging in the user |
|
| 422 | * returns the user id or false |
|
| 423 | */ |
|
| 424 | public static function checkPassword($uid, $password) { |
|
| 425 | $manager = \OC::$server->getUserManager(); |
|
| 426 | $username = $manager->checkPassword($uid, $password); |
|
| 427 | if ($username !== false) { |
|
| 428 | return $username->getUID(); |
|
| 429 | } |
|
| 430 | return false; |
|
| 431 | } |
|
| 432 | ||
| 433 | /** |
|
| 434 | * @param string $uid The username |
|