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() {
|
async canProvideStatusForCurrentUser() {
|
||||||
const provider = this.#userAPI.getProvider();
|
const provider = this.#userAPI.getProvider();
|
||||||
|
|
||||||
if (provider.getStatusRoleForCurrentUser) {
|
if (!provider) {
|
||||||
const activeStatusRole = await this.#userAPI.getActiveRole();
|
|
||||||
const canProvideStatus = await this.canProvideStatusForRole(activeStatusRole);
|
|
||||||
|
|
||||||
return canProvideStatus;
|
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const activeStatusRole = await this.#userAPI.getActiveRole();
|
||||||
|
const canProvideStatus = await this.canProvideStatusForRole(activeStatusRole);
|
||||||
|
|
||||||
|
return canProvideStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,14 +92,14 @@ class UserAPI extends EventEmitter {
|
|||||||
* that can be selected by the current user
|
* that can be selected by the current user
|
||||||
* @memberof module:openmct.UserAPI#
|
* @memberof module:openmct.UserAPI#
|
||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
|
* @throws Will throw an error if no user provider is set
|
||||||
*/
|
*/
|
||||||
|
|
||||||
getPossibleRoles() {
|
getPossibleRoles() {
|
||||||
if (!this.hasProvider()) {
|
if (!this.hasProvider()) {
|
||||||
return Promise.resolve(undefined);
|
this.error(NO_PROVIDER_ERROR);
|
||||||
} else {
|
|
||||||
return this._provider.getPossibleRoles();
|
|
||||||
}
|
}
|
||||||
|
return this._provider.getPossibleRoles();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* If a user provider is set, it will return the active role or null
|
* If a user provider is set, it will return the active role or null
|
||||||
|
Loading…
Reference in New Issue
Block a user