]> 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 959ca1af2d405c4d8bb5654eb2e764d38011e029..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()
        {
@@ -122,6 +133,12 @@ class UserSession implements IHandleUserSessions
                return $this->session->get('authenticated', false);
        }
 
+       /** {@inheritDoc} */
+       public function isSiteAdmin(): bool
+       {
+               return User::isSiteAdmin($this->getLocalUserId());
+       }
+
        /** {@inheritDoc} */
        public function setVisitorsContacts()
        {