3 * @copyright Copyright (C) 2010-2023, the Friendica project
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Core\Session\Capability;
25 * This interface handles UserSessions, which is directly extended from the global Session interface
27 interface IHandleUserSessions extends IHandleSessions
30 * Returns the user id of locally logged-in user or false.
32 * @return int|bool user id or false
34 public function getLocalUserId();
37 * Returns the user nickname of locally logged-in user.
39 * @return string|false User's nickname or false
41 public function getLocalUserNickname();
44 * Returns the public contact id of logged-in user or false.
46 * @return int|bool public contact id or false
48 public function getPublicContactId();
51 * Returns public contact id of authenticated site visitor or false
53 * @return int|bool visitor_id or false
55 public function getRemoteUserId();
58 * Return the user contact ID of a visitor for the given user ID they are visiting
60 * @param int $uid User ID
64 public function getRemoteContactID(int $uid): int;
67 * Returns User ID for given contact ID of the visitor
69 * @param int $cid Contact ID
71 * @return int User ID for given contact ID of the visitor
73 public function getUserIDForVisitorContactID(int $cid): int;
76 * Returns the account URL of the currently logged in user
80 public function getMyUrl(): string;
83 * Returns if the current visitor is authenticated
85 * @return bool "true" when visitor is either a local or remote user
87 public function isAuthenticated(): bool;
90 * Check if current user has admin role.
92 * @return bool true if user is an admin
94 public function isSiteAdmin(): bool;
97 * Check if current user is a moderator.
99 * @return bool true if user is a moderator
101 public function isModerator(): bool;
104 * Returns User ID of the managed user in case it's a different identity
106 * @return int|bool uid of the manager or false
108 public function getSubManagedUserId();
111 * Sets the User ID of the managed user in case it's a different identity
113 * @param int $managed_uid The user id of the managing user
115 public function setSubManagedUserId(int $managed_uid): void;
118 * Set the session variable that contains the contact IDs for the visitor's contact URL
120 * @param string $my_url
122 public function setVisitorsContacts(string $my_url);