mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
telemetry for tde user actions (#22474)
* telemetry for user actions * remove unused action * try catch around admin function
This commit is contained in:
@@ -13,6 +13,7 @@ import * as constants from '../constants/strings';
|
||||
import { logError, TelemetryViews } from '../telemetry';
|
||||
import { AdsMigrationStatus } from '../dashboard/tabBase';
|
||||
import { getMigrationMode, getMigrationStatus, getMigrationTargetType, hasRestoreBlockingReason, PipelineStatusCodes } from '../constants/helper';
|
||||
import * as os from 'os';
|
||||
|
||||
export type TargetServerType = azure.SqlVMServer | azureResource.AzureSqlManagedInstance | azure.AzureSqlDatabaseServer;
|
||||
|
||||
@@ -923,3 +924,20 @@ export async function promptUserForFolder(): Promise<string> {
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
export function isWindows(): boolean { return (os.platform() === 'win32') }
|
||||
|
||||
export async function isAdmin(): Promise<boolean> {
|
||||
let isAdmin: boolean = false;
|
||||
try {
|
||||
if (isWindows()) {
|
||||
isAdmin = (await import('native-is-elevated'))();
|
||||
} else {
|
||||
isAdmin = process.getuid() === 0;
|
||||
}
|
||||
} catch (e) {
|
||||
//Ignore error and return false;
|
||||
}
|
||||
|
||||
return isAdmin;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user