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

This commit is contained in:
Jamie V 2024-05-13 15:36:07 -07:00
parent 810d580b18
commit b59ed09274
2 changed files with 6 additions and 7 deletions

View File

@ -141,7 +141,7 @@ export default class ExampleUserProvider extends EventEmitter {
}
getPossibleRoles() {
return this.user.getRoles();
return this.loginPromise.then(() => this.user.getRoles());
}
getPossibleMissionActions() {

View File

@ -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