Skip to content

Commit

Permalink
N21-2136 feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
GordonNicholasCap committed Nov 7, 2024
1 parent 9ddacc5 commit 78a90a7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
5 changes: 5 additions & 0 deletions config/default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,11 @@
"type": "boolean",
"default": false,
"description": "Enables the rooms feature"
},
"FEATURE_EXTERNAL_SYSTEM_LOGOUT_ENABLED": {
"type": "boolean",
"default": false,
"description": "Enables the external system logout feature"
}
},
"allOf": [
Expand Down
4 changes: 1 addition & 3 deletions controllers/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,8 @@ router.get('/logout/external/', (req, res, next) => {
req.session.notification = {
type: 'danger',
message: res.$t('logout.text.externalLogoutFailed', { systemName: res.locals.systemName ?? '' }),
statusCode: 500,
timeToWait: Configuration.get('LOGIN_BLOCK_TIME'),
};
res.redirect(req.header('referrer') ?? '/dashboard');
res.redirect('/dashboard');
});
});

Expand Down
3 changes: 2 additions & 1 deletion helpers/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ const populateCurrentUser = async (req, res) => {

try {
const response = await api(req, { version: 'v3' }).get(`/systems/public/${decodedJwt.systemId}`);
res.locals.showExternalLogout = response.alias === 'SANIS';
res.locals.isExternalLogoutAllowed = Configuration.get('FEATURE_EXTERNAL_SYSTEM_LOGOUT_ENABLED')
&& response.alias === 'SANIS';
res.locals.systemName = response.displayName;
} catch (err) {
const metadata = { error: err.toString() };
Expand Down
10 changes: 5 additions & 5 deletions views/lib/topbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
<hr>
{{> "user/forms/language" language=@root.userLanguage }}
<li><a class="dropdown-item" data-testid="settings" href="/account/" role="menuitem" aria-label="{{$t 'lib.loggedin.tab_label.settings' }}">{{$t "lib.loggedin.tab_label.settings" }}</a></li>
{{#if showExternalLogout}}
<li><a class="dropdown-item localstorageclear"
data-testid="logout-external"
{{#if isExternalLogoutAllowed}}
<li><a class="dropdown-item"
data-testid="external-logout"
href="/logout/external/"
role="menuitem"
aria-label="{{$t 'lib.loggedin.tab_label.signOut'}} Bildungscloud & {{ systemName }}">
Expand All @@ -72,8 +72,8 @@
data-testid="logout"
role="menuitem"
href= {{#hasConfig "OAUTH2_LOGOUT_URI"}} {{getConfig "OAUTH2_LOGOUT_URI"}} {{else}} "/logout/" {{/hasConfig}}
aria-label="{{$t 'lib.loggedin.tab_label.signOut'}}{{#if showExternalLogout}} Bildungscloud{{/if}}">
{{$t 'lib.loggedin.tab_label.signOut'}}{{#if showExternalLogout}} Bildungscloud{{/if}}
aria-label="{{$t 'lib.loggedin.tab_label.signOut'}}{{#if isExternalLogoutAllowed}} Bildungscloud{{/if}}">
{{$t 'lib.loggedin.tab_label.signOut'}}{{#if isExternalLogoutAllowed}} Bildungscloud{{/if}}
</a></li>
</ul>
</div>
Expand Down

0 comments on commit 78a90a7

Please sign in to comment.