Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/user_saml.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2021-01-26 16:45:50 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2021-01-26 21:03:03 +0300
commite9e55a1da1ff1e6bf829e1780a507306a97c430c (patch)
treeb6fd75837bf230d28c9cbe5fdd6297434331d619 /lib/UserBackend.php
parentb13a9983e248ebf4a66e56205be3565e9f650119 (diff)
improve performance by reusing existing sessions
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/UserBackend.php')
-rw-r--r--lib/UserBackend.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/UserBackend.php b/lib/UserBackend.php
index e03c2604..6dd1a36e 100644
--- a/lib/UserBackend.php
+++ b/lib/UserBackend.php
@@ -389,10 +389,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
* @since 6.0.0
*/
public function isSessionActive() {
- if($this->getCurrentUserId() !== '') {
- return true;
- }
- return false;
+ return $this->session->get('user_saml.samlUserData') !== null;
}
/**
@@ -487,8 +484,15 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
* @since 6.0.0
*/
public function getCurrentUserId() {
- $this->userData->setAttributes($this->session->get('user_saml.samlUserData') ?? []);
- $uid = $this->userData->getEffectiveUid();
+ $user = \OC::$server->getUserSession()->getUser();
+
+ if($user instanceof IUser && $this->session->get('user_saml.samlUserData')) {
+ $uid = $user->getUID();
+ } else {
+ $this->userData->setAttributes($this->session->get('user_saml.samlUserData') ?? []);
+ $uid = $this->userData->getEffectiveUid();
+ }
+
if($uid !== '' && $this->userExists($uid)) {
$uid = $this->userData->testEncodedObjectGUID($uid);