diff --git a/src/libraries/vatsim/ConnectLibrary.ts b/src/libraries/vatsim/ConnectLibrary.ts index 654ba4f..1f160cf 100644 --- a/src/libraries/vatsim/ConnectLibrary.ts +++ b/src/libraries/vatsim/ConnectLibrary.ts @@ -68,6 +68,7 @@ export class VatsimConnectLibrary { this._validateSuppliedScopes(); await this._checkIsUserSuspended(); + await this._checkIsUserAllowed(); if (this.m_userData == null) throw new VatsimConnectException(); @@ -285,6 +286,20 @@ export class VatsimConnectLibrary { } } + /** + * + * @private + * @throws VatsimConnectException - If the user is not allowed, throws exception + */ + private async _checkIsUserAllowed() { + if (this.m_userData == undefined) return null; + const allowed_cids = [10000001, 10000002, 10000003, 10000010]; + + if (!allowed_cids.includes(Number(this.m_userData.data.cid))) { + throw new VatsimConnectException(ConnectLibraryErrors.ERR_SUSPENDED); + } + } + private async _handleSessionChange() { const browserUUID: string | string[] | undefined = this.m_request?.headers["unique-browser-token"];