]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Session/Model/UserSession.php
API: Accept "redirect_uris" as both array and string
[friendica.git] / src / Core / Session / Model / UserSession.php
index 79f5b2aaefb5c94cdf5860269a057f721b2592e6..a544487bd223fd5125fe7bc1c1ec46a4b75b4801 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -24,6 +24,7 @@ namespace Friendica\Core\Session\Model;
 use Friendica\Core\Session\Capability\IHandleSessions;
 use Friendica\Core\Session\Capability\IHandleUserSessions;
 use Friendica\Model\Contact;
+use Friendica\Model\User;
 
 /**
  * This class handles user sessions, which is directly extended from regular session
@@ -50,6 +51,16 @@ class UserSession implements IHandleUserSessions
                return false;
        }
 
+       /** {@inheritDoc} */
+       public function getLocalUserNickname()
+       {
+               if ($this->isAuthenticated()) {
+                       return $this->session->get('nickname');
+               }
+
+               return false;
+       }
+
        /** {@inheritDoc} */
        public function getPublicContactId()
        {
@@ -110,12 +121,24 @@ class UserSession implements IHandleUserSessions
                return array_search($cid, $this->session->get('remote'));
        }
 
+       /** {@inheritDoc} */
+       public function getMyUrl(): string
+       {
+               return $this->session->get('my_url', '');
+       }
+
        /** {@inheritDoc} */
        public function isAuthenticated(): bool
        {
                return $this->session->get('authenticated', false);
        }
 
+       /** {@inheritDoc} */
+       public function isSiteAdmin(): bool
+       {
+               return User::isSiteAdmin($this->getLocalUserId());
+       }
+
        /** {@inheritDoc} */
        public function setVisitorsContacts()
        {