| @@ 243-253 (lines=11) @@ | ||
| 240 | * @param string $displayName |
|
| 241 | * @return bool Whether the display name could get set |
|
| 242 | */ |
|
| 243 | public static function setDisplayName($uid, $displayName = null) { |
|
| 244 | if (is_null($displayName)) { |
|
| 245 | $displayName = $uid; |
|
| 246 | } |
|
| 247 | $user = \OC::$server->getUserManager()->get($uid); |
|
| 248 | if ($user) { |
|
| 249 | return $user->setDisplayName($displayName); |
|
| 250 | } else { |
|
| 251 | return false; |
|
| 252 | } |
|
| 253 | } |
|
| 254 | ||
| 255 | /** |
|
| 256 | * Check if the user is logged in, considers also the HTTP basic credentials |
|
| @@ 388-395 (lines=8) @@ | ||
| 385 | * Check if the password is correct without logging in the user |
|
| 386 | * returns the user id or false |
|
| 387 | */ |
|
| 388 | public static function checkPassword($uid, $password) { |
|
| 389 | $manager = \OC::$server->getUserManager(); |
|
| 390 | $username = $manager->checkPassword($uid, $password); |
|
| 391 | if ($username !== false) { |
|
| 392 | return $username->getUID(); |
|
| 393 | } |
|
| 394 | return false; |
|
| 395 | } |
|
| 396 | ||
| 397 | /** |
|
| 398 | * @param string $uid The username |
|