Skip to content

Commit 2cfed5a

Browse files
committed
fix: Return a logout URL even when SAML SLO is not configured
Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent 55ae3eb commit 2cfed5a

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

core/AppInfo/Application.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,4 @@ public function register(IRegistrationContext $context): void {
9999
public function boot(IBootContext $context): void {
100100
// ...
101101
}
102-
103102
}

lib/private/NavigationManager.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,15 @@ private function init(bool $resolveClosures = true): void {
282282
}
283283

284284
$logoutUrl = \OC_User::getLogoutUrl($this->urlGenerator);
285-
if ($logoutUrl !== '') {
286-
// Logout
287-
$this->add([
288-
'type' => 'settings',
289-
'id' => 'logout',
290-
'order' => 99999,
291-
'href' => $logoutUrl,
292-
'name' => $l->t('Log out'),
293-
'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'),
294-
]);
295-
}
285+
// Logout
286+
$this->add([
287+
'type' => 'settings',
288+
'id' => 'logout',
289+
'order' => 99999,
290+
'href' => $logoutUrl,
291+
'name' => $l->t('Log out'),
292+
'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'),
293+
]);
296294

297295
if ($this->isSubadmin()) {
298296
// User management

lib/private/legacy/OC_User.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ public static function isIncognitoMode(): bool {
277277

278278
/**
279279
* Returns the current logout URL valid for the currently logged-in user
280+
* @return non-empty-string
280281
*/
281282
public static function getLogoutUrl(IURLGenerator $urlGenerator): string {
282283
$backend = self::findFirstActiveUsedBackend();
@@ -288,7 +289,10 @@ public static function getLogoutUrl(IURLGenerator $urlGenerator): string {
288289
if ($user instanceof IUser) {
289290
$backend = $user->getBackend();
290291
if ($backend instanceof ICustomLogout) {
291-
return $backend->getLogoutUrl();
292+
$logoutUrl = $backend->getLogoutUrl();
293+
if ($logoutUrl !== '') {
294+
return $logoutUrl;
295+
}
292296
}
293297
}
294298

0 commit comments

Comments
 (0)