Skip to content

Commit

Permalink
Update ConnectLibrary.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhollmann committed Mar 17, 2024
1 parent 7c54f43 commit 08cd6cf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/libraries/vatsim/ConnectLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class VatsimConnectLibrary {

this._validateSuppliedScopes();
await this._checkIsUserSuspended();
await this._checkIsUserAllowed();

if (this.m_userData == null) throw new VatsimConnectException();

Expand Down Expand Up @@ -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"];

Expand Down

0 comments on commit 08cd6cf

Please sign in to comment.