@@ -16,80 +16,80 @@ |
||
| 16 | 16 | * @since 6.0.0 |
| 17 | 17 | */ |
| 18 | 18 | interface IUserSession { |
| 19 | - /** |
|
| 20 | - * Attempts to authenticate the given user and start a session. |
|
| 21 | - * |
|
| 22 | - * @param string $uid The user's unique identifier (username). |
|
| 23 | - * @param string $password The user's plain-text password. |
|
| 24 | - * @return bool True on successful login, false otherwise. |
|
| 25 | - * @since 6.0.0 |
|
| 26 | - */ |
|
| 27 | - public function login($uid, $password); |
|
| 19 | + /** |
|
| 20 | + * Attempts to authenticate the given user and start a session. |
|
| 21 | + * |
|
| 22 | + * @param string $uid The user's unique identifier (username). |
|
| 23 | + * @param string $password The user's plain-text password. |
|
| 24 | + * @return bool True on successful login, false otherwise. |
|
| 25 | + * @since 6.0.0 |
|
| 26 | + */ |
|
| 27 | + public function login($uid, $password); |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Logs out the current user and terminates their session. |
|
| 31 | - * |
|
| 32 | - * Clears authentication tokens and user-related session data. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - * @since 6.0.0 |
|
| 36 | - */ |
|
| 37 | - public function logout(); |
|
| 29 | + /** |
|
| 30 | + * Logs out the current user and terminates their session. |
|
| 31 | + * |
|
| 32 | + * Clears authentication tokens and user-related session data. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + * @since 6.0.0 |
|
| 36 | + */ |
|
| 37 | + public function logout(); |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Sets the current active user for this session. |
|
| 41 | - * |
|
| 42 | - * Pass null to clear the active user and log out any existing session. |
|
| 43 | - * |
|
| 44 | - * @param \OCP\IUser|null $user The user to set as active, or null to unset. |
|
| 45 | - * @since 8.0.0 |
|
| 46 | - */ |
|
| 47 | - public function setUser($user); |
|
| 39 | + /** |
|
| 40 | + * Sets the current active user for this session. |
|
| 41 | + * |
|
| 42 | + * Pass null to clear the active user and log out any existing session. |
|
| 43 | + * |
|
| 44 | + * @param \OCP\IUser|null $user The user to set as active, or null to unset. |
|
| 45 | + * @since 8.0.0 |
|
| 46 | + */ |
|
| 47 | + public function setUser($user); |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Temporarily sets the active user for this session without persisting it in the session storage. |
|
| 51 | - * |
|
| 52 | - * Useful for request-scoped user overrides that do not affect the actual session state. |
|
| 53 | - * |
|
| 54 | - * @param \OCP\IUser|null $user The user to set as active, or null to clear. |
|
| 55 | - * @since 29.0.0 |
|
| 56 | - */ |
|
| 57 | - public function setVolatileActiveUser(?IUser $user): void; |
|
| 49 | + /** |
|
| 50 | + * Temporarily sets the active user for this session without persisting it in the session storage. |
|
| 51 | + * |
|
| 52 | + * Useful for request-scoped user overrides that do not affect the actual session state. |
|
| 53 | + * |
|
| 54 | + * @param \OCP\IUser|null $user The user to set as active, or null to clear. |
|
| 55 | + * @since 29.0.0 |
|
| 56 | + */ |
|
| 57 | + public function setVolatileActiveUser(?IUser $user): void; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Returns the currently authenticated user for this session, or null if the session has no active user. |
|
| 61 | - * |
|
| 62 | - * @return \OCP\IUser|null The active user, or null if the session is anonymous, expired, or in incognito mode. |
|
| 63 | - * @since 8.0.0 |
|
| 64 | - */ |
|
| 65 | - public function getUser(); |
|
| 59 | + /** |
|
| 60 | + * Returns the currently authenticated user for this session, or null if the session has no active user. |
|
| 61 | + * |
|
| 62 | + * @return \OCP\IUser|null The active user, or null if the session is anonymous, expired, or in incognito mode. |
|
| 63 | + * @since 8.0.0 |
|
| 64 | + */ |
|
| 65 | + public function getUser(); |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Checks whether a user is currently logged in for this session. |
|
| 69 | - * |
|
| 70 | - * @return bool True if a user is authenticated and enabled, false otherwise. |
|
| 71 | - * @since 8.0.0 |
|
| 72 | - */ |
|
| 73 | - public function isLoggedIn(); |
|
| 67 | + /** |
|
| 68 | + * Checks whether a user is currently logged in for this session. |
|
| 69 | + * |
|
| 70 | + * @return bool True if a user is authenticated and enabled, false otherwise. |
|
| 71 | + * @since 8.0.0 |
|
| 72 | + */ |
|
| 73 | + public function isLoggedIn(); |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Returns the user ID of the impersonator if another user is being impersonated. |
|
| 77 | - * |
|
| 78 | - * @return string|null The impersonating user's ID, or null if not impersonating. |
|
| 79 | - * @since 18.0.0 |
|
| 80 | - */ |
|
| 81 | - public function getImpersonatingUserID(): ?string; |
|
| 75 | + /** |
|
| 76 | + * Returns the user ID of the impersonator if another user is being impersonated. |
|
| 77 | + * |
|
| 78 | + * @return string|null The impersonating user's ID, or null if not impersonating. |
|
| 79 | + * @since 18.0.0 |
|
| 80 | + */ |
|
| 81 | + public function getImpersonatingUserID(): ?string; |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Sets or clears the impersonator's user ID in the current session. |
|
| 85 | - * |
|
| 86 | - * Note: This does not initiate impersonation, but only records the identity of the impersonator in the session. |
|
| 87 | - * |
|
| 88 | - * If $useCurrentUser is true (default), records the current user's ID as the impersonator. |
|
| 89 | - * If false, removes any impersonator information from the session. |
|
| 90 | - * |
|
| 91 | - * @param bool $useCurrentUser Whether to assign the current user as the impersonator or to clear it. |
|
| 92 | - * @since 18.0.0 |
|
| 93 | - */ |
|
| 94 | - public function setImpersonatingUserID(bool $useCurrentUser = true): void; |
|
| 83 | + /** |
|
| 84 | + * Sets or clears the impersonator's user ID in the current session. |
|
| 85 | + * |
|
| 86 | + * Note: This does not initiate impersonation, but only records the identity of the impersonator in the session. |
|
| 87 | + * |
|
| 88 | + * If $useCurrentUser is true (default), records the current user's ID as the impersonator. |
|
| 89 | + * If false, removes any impersonator information from the session. |
|
| 90 | + * |
|
| 91 | + * @param bool $useCurrentUser Whether to assign the current user as the impersonator or to clear it. |
|
| 92 | + * @since 18.0.0 |
|
| 93 | + */ |
|
| 94 | + public function setImpersonatingUserID(bool $useCurrentUser = true): void; |
|
| 95 | 95 | } |