diff --git a/lib/user/manager.php b/lib/user/manager.php index 3b6d4bcfe5..9adf66c825 100644 --- a/lib/user/manager.php +++ b/lib/user/manager.php @@ -43,6 +43,8 @@ class Manager extends PublicEmitter { } /** + * register a user backend + * * @param \OC_User_Backend $backend */ public function registerBackend($backend) { @@ -50,6 +52,8 @@ class Manager extends PublicEmitter { } /** + * remove a user backend + * * @param \OC_User_Backend $backend */ public function removeBackend($backend) { @@ -58,16 +62,21 @@ class Manager extends PublicEmitter { } } + /** + * remove all user backends + */ public function clearBackends() { $this->backends = array(); } /** + * get a user by user id + * * @param string $uid * @return \OC\User\User */ public function get($uid) { - if (isset($this->cachedUsers[$uid])) { + if (isset($this->cachedUsers[$uid])) { //check the cache first to prevent having to loop over the backends return $this->cachedUsers[$uid]; } foreach ($this->backends as $backend) { @@ -78,6 +87,13 @@ class Manager extends PublicEmitter { return null; } + /** + * get or construct the user object + * + * @param string $uid + * @param \OC_User_Backend $backend + * @return \OC\User\User + */ protected function getUserObject($uid, $backend) { if (isset($this->cachedUsers[$uid])) { return $this->cachedUsers[$uid]; @@ -87,6 +103,8 @@ class Manager extends PublicEmitter { } /** + * check if a user exists + * * @param string $uid * @return bool */ diff --git a/lib/user/session.php b/lib/user/session.php index 5406275170..cf93d9593a 100644 --- a/lib/user/session.php +++ b/lib/user/session.php @@ -71,6 +71,8 @@ class Session implements Emitter { } /** + * get the manager object + * * @return \OC\User\Manager */ public function getManager() { @@ -110,6 +112,13 @@ class Session implements Emitter { } } + /** + * try to login with the provided credentials + * + * @param string $uid + * @param string $password + * @return bool + */ public function login($uid, $password) { $this->manager->emit('\OC\User', 'preLogin', array($uid, $password)); $user = $this->manager->get($uid); @@ -127,6 +136,9 @@ class Session implements Emitter { } } + /** + * logout the user from the session + */ public function logout() { $this->manager->emit('\OC\User', 'logout'); $this->setUser(null); @@ -148,7 +160,7 @@ class Session implements Emitter { } /** - * @brief Remove cookie for "remember username" + * Remove cookie for "remember username" */ public function unsetMagicInCookie() { unset($_COOKIE["oc_username"]); //TODO: DI diff --git a/lib/user/user.php b/lib/user/user.php index 05d5a0935b..1d52b90e81 100644 --- a/lib/user/user.php +++ b/lib/user/user.php @@ -56,6 +56,8 @@ class User { } /** + * get the user id + * * @return string */ public function getUID() { @@ -63,6 +65,8 @@ class User { } /** + * get the displayname for the user, if no specific displayname is set it will fallback to the user id + * * @return string */ public function getDisplayName() { @@ -70,6 +74,8 @@ class User { } /** + * set the displayname for the user + * * @param string $displayName * @return bool */ @@ -83,6 +89,8 @@ class User { } /** + * Delete the user + * * @return bool */ public function delete() { @@ -97,6 +105,8 @@ class User { } /** + * Check if the password is valid for the user + * * @param $password * @return bool */ @@ -113,6 +123,8 @@ class User { } /** + * Set the password of the user + * * @param string $password * @param string $recoveryPassword for the encryption app to reset encryption keys * @return bool @@ -145,6 +157,8 @@ class User { } /** + * check if the backend supports changing passwords + * * @return bool */ public function canChangePassword() { @@ -152,6 +166,8 @@ class User { } /** + * check if the backend supports changing display names + * * @return bool */ public function canChangeDisplayName() { @@ -159,6 +175,8 @@ class User { } /** + * check if the user is enabled + * * @return bool */ public function isEnabled() { @@ -166,6 +184,8 @@ class User { } /** + * set the enabled status for the user + * * @param bool $enabled */ public function setEnabled($enabled) {