From f5d57210aec9e8ac1333904a8efd6f5f1c77f3a9 Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Mon, 8 May 2023 14:08:37 -0500 Subject: [PATCH] Add additional test roles to example user --- example/exampleUser/plugin.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/example/exampleUser/plugin.js b/example/exampleUser/plugin.js index 64471466bb..c54bb6f368 100644 --- a/example/exampleUser/plugin.js +++ b/example/exampleUser/plugin.js @@ -21,14 +21,20 @@ *****************************************************************************/ import ExampleUserProvider from './ExampleUserProvider'; +const AUTO_LOGIN_USER = 'guest'; +const STATUS_ROLES = ['test-role-1', 'test-role-2', 'test-role-3']; +const DEFAULT_STATUS_ROLE = STATUS_ROLES[2]; -export default function ExampleUserPlugin({autoLoginUser, defaultStatusRole} = { - autoLoginUser: 'guest', - defaultStatusRole: 'test-role' +export default function ExampleUserPlugin({autoLoginUser, statusRoles, defaultStatusRole} = { + autoLoginUser: AUTO_LOGIN_USER, + statusRoles: STATUS_ROLES, + defaultStatusRole: DEFAULT_STATUS_ROLE }) { return function install(openmct) { + const defaultStatusRoleOrFirstItem = statusRoles.includes(defaultStatusRole) ? defaultStatusRole : statusRoles[0]; const userProvider = new ExampleUserProvider(openmct, { - defaultStatusRole + statusRoles, + defaultStatusRole: defaultStatusRoleOrFirstItem }); if (autoLoginUser !== undefined) {