mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
parent
e3f31b30c3
commit
656e526b3e
|
@ -561,14 +561,16 @@ export class GitHubServer implements IGitHubServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._type === AuthProviderType.github) {
|
if (this._type === AuthProviderType.github) {
|
||||||
return await this.checkEduDetails(token);
|
return await this.checkUserDetails(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GHES
|
// GHES
|
||||||
await this.checkEnterpriseVersion(token);
|
await this.checkEnterpriseVersion(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async checkEduDetails(token: string): Promise<void> {
|
private async checkUserDetails(token: string): Promise<void> {
|
||||||
|
let edu: string | undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await fetching('https://education.github.com/api/user', {
|
const result = await fetching('https://education.github.com/api/user', {
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -580,24 +582,33 @@ export class GitHubServer implements IGitHubServer {
|
||||||
|
|
||||||
if (result.ok) {
|
if (result.ok) {
|
||||||
const json: { student: boolean; faculty: boolean } = await result.json();
|
const json: { student: boolean; faculty: boolean } = await result.json();
|
||||||
|
edu = json.student
|
||||||
/* __GDPR__
|
? 'student'
|
||||||
"session" : {
|
: json.faculty
|
||||||
"owner": "TylerLeonhardt",
|
? 'faculty'
|
||||||
"isEdu": { "classification": "NonIdentifiableDemographicInfo", "purpose": "FeatureInsight" }
|
: 'none';
|
||||||
}
|
|
||||||
*/
|
|
||||||
this._telemetryReporter.sendTelemetryEvent('session', {
|
|
||||||
isEdu: json.student
|
|
||||||
? 'student'
|
|
||||||
: json.faculty
|
|
||||||
? 'faculty'
|
|
||||||
: 'none'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// No-op
|
// No-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let managed: string | undefined;
|
||||||
|
try {
|
||||||
|
const user = await this.getUserInfo(token);
|
||||||
|
// Apparently, this is how you tell if a user is an EMU...
|
||||||
|
managed = user.accountName.includes('_') ? 'true' : 'false';
|
||||||
|
} catch (e) {
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
|
|
||||||
|
if (edu === undefined && managed === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._telemetryReporter.sendTelemetryEvent('session', {
|
||||||
|
isEdu: edu ?? 'unknown',
|
||||||
|
isManaged: managed ?? 'unknown'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async checkEnterpriseVersion(token: string): Promise<void> {
|
private async checkEnterpriseVersion(token: string): Promise<void> {
|
||||||
|
|
Loading…
Reference in a new issue