mirror of
https://github.com/nasa/openmct.git
synced 2024-12-27 00:31:06 +00:00
Throw error on no provider
This commit is contained in:
parent
06f71412a6
commit
5a6755c3fb
@ -228,14 +228,13 @@ export default class StatusAPI extends EventEmitter {
|
||||
async canProvideStatusForCurrentUser() {
|
||||
const provider = this.#userAPI.getProvider();
|
||||
|
||||
if (provider.getStatusRoleForCurrentUser) {
|
||||
if (!provider) {
|
||||
return false;
|
||||
}
|
||||
const activeStatusRole = await this.#userAPI.getActiveRole();
|
||||
const canProvideStatus = await this.canProvideStatusForRole(activeStatusRole);
|
||||
|
||||
return canProvideStatus;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,14 +92,14 @@ class UserAPI extends EventEmitter {
|
||||
* that can be selected by the current user
|
||||
* @memberof module:openmct.UserAPI#
|
||||
* @returns {Array}
|
||||
* @throws Will throw an error if no user provider is set
|
||||
*/
|
||||
|
||||
getPossibleRoles() {
|
||||
if (!this.hasProvider()) {
|
||||
return Promise.resolve(undefined);
|
||||
} else {
|
||||
return this._provider.getPossibleRoles();
|
||||
this.error(NO_PROVIDER_ERROR);
|
||||
}
|
||||
return this._provider.getPossibleRoles();
|
||||
}
|
||||
/**
|
||||
* If a user provider is set, it will return the active role or null
|
||||
|
Loading…
Reference in New Issue
Block a user