improve performance by reusing existing sessions
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
b13a9983e2
commit
e9e55a1da1
|
@ -389,10 +389,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
||||||
* @since 6.0.0
|
* @since 6.0.0
|
||||||
*/
|
*/
|
||||||
public function isSessionActive() {
|
public function isSessionActive() {
|
||||||
if($this->getCurrentUserId() !== '') {
|
return $this->session->get('user_saml.samlUserData') !== null;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -487,8 +484,15 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
||||||
* @since 6.0.0
|
* @since 6.0.0
|
||||||
*/
|
*/
|
||||||
public function getCurrentUserId() {
|
public function getCurrentUserId() {
|
||||||
$this->userData->setAttributes($this->session->get('user_saml.samlUserData') ?? []);
|
$user = \OC::$server->getUserSession()->getUser();
|
||||||
$uid = $this->userData->getEffectiveUid();
|
|
||||||
|
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)) {
|
if($uid !== '' && $this->userExists($uid)) {
|
||||||
$uid = $this->userData->testEncodedObjectGUID($uid);
|
$uid = $this->userData->testEncodedObjectGUID($uid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue