From b59ed0927455fc8df452b59089db8829f2250fc3 Mon Sep 17 00:00:00 2001 From: Jamie V Date: Mon, 13 May 2024 15:36:07 -0700 Subject: [PATCH] changing how we pass in the options, so you can do one at a time, as well as return possible roles after login promise has resolved --- example/exampleUser/ExampleUserProvider.js | 2 +- example/exampleUser/plugin.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/example/exampleUser/ExampleUserProvider.js b/example/exampleUser/ExampleUserProvider.js index d80735abd0..73be9d3a9b 100644 --- a/example/exampleUser/ExampleUserProvider.js +++ b/example/exampleUser/ExampleUserProvider.js @@ -141,7 +141,7 @@ export default class ExampleUserProvider extends EventEmitter { } getPossibleRoles() { - return this.user.getRoles(); + return this.loginPromise.then(() => this.user.getRoles()); } getPossibleMissionActions() { diff --git a/example/exampleUser/plugin.js b/example/exampleUser/plugin.js index cd0469e2ed..9eaa65ca05 100644 --- a/example/exampleUser/plugin.js +++ b/example/exampleUser/plugin.js @@ -24,12 +24,11 @@ import ExampleUserProvider from './ExampleUserProvider.js'; const AUTO_LOGIN_USER = 'mct-user'; const STATUS_ROLES = ['flight', 'driver']; -export default function ExampleUserPlugin( - { autoLoginUser, statusRoles } = { - autoLoginUser: AUTO_LOGIN_USER, - statusRoles: STATUS_ROLES - } -) { +export default function ExampleUserPlugin(options = {}) { + const { + autoLoginUser = AUTO_LOGIN_USER, + statusRoles = STATUS_ROLES + } = options; return function install(openmct) { const userProvider = new ExampleUserProvider(openmct, { statusRoles