@@ -171,7 +171,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
171
171
traceWI ( ctx , { workspaceId } ) ;
172
172
173
173
this . requireEELicense ( Feature . FeatureSetTimeout ) ;
174
- const user = this . checkUser ( "setWorkspaceTimeout" ) ;
174
+ const user = this . checkUser ( arguments . callee . name ) ;
175
175
176
176
if ( ! WorkspaceTimeoutValues . includes ( duration ) ) {
177
177
throw new ResponseError ( ErrorCodes . PERMISSION_DENIED , "Invalid duration" )
@@ -222,7 +222,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
222
222
// Allowed in the free version, because it is read only.
223
223
// this.requireEELicense(Feature.FeatureSetTimeout);
224
224
225
- const user = this . checkUser ( "getWorkspaceTimeout" ) ;
225
+ const user = this . checkUser ( arguments . callee . name ) ;
226
226
227
227
const canChange = await this . maySetTimeout ( user ) ;
228
228
@@ -307,7 +307,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
307
307
traceWI ( ctx , { workspaceId } ) ;
308
308
309
309
this . requireEELicense ( Feature . FeatureSnapshot ) ;
310
- const user = this . checkAndBlockUser ( "takeSnapshot" ) ;
310
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
311
311
312
312
const workspace = await this . guardSnaphotAccess ( ctx , user . id , workspaceId ) ;
313
313
@@ -360,7 +360,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
360
360
traceAPIParams ( ctx , { snapshotId } ) ;
361
361
362
362
this . requireEELicense ( Feature . FeatureSnapshot ) ;
363
- const user = this . checkAndBlockUser ( "waitForSnapshot" ) ;
363
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
364
364
365
365
const snapshot = await this . workspaceDb . trace ( ctx ) . findSnapshotById ( snapshotId ) ;
366
366
if ( ! snapshot ) {
@@ -386,7 +386,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
386
386
// Allowed in the free version, because it is read only.
387
387
// this.requireEELicense(Feature.FeatureSnapshot);
388
388
389
- const user = this . checkAndBlockUser ( "getSnapshots" ) ;
389
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
390
390
391
391
const workspace = await this . workspaceDb . trace ( ctx ) . findById ( workspaceId ) ;
392
392
if ( ! workspace || workspace . ownerId !== user . id ) {
@@ -722,7 +722,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
722
722
723
723
// TODO(gpl) This is not part of our API interface, nor can I find any clients. Remove or re-surrect?
724
724
// async getLicenseInfo(ctx: TraceContext): Promise<GetLicenseInfoResult> {
725
- // const user = this.checkAndBlockUser("getLicenseInfo" );
725
+ // const user = this.checkAndBlockUser(arguments.callee.name );
726
726
727
727
// const { key } = await this.licenseKeySource.getKey();
728
728
// const { validUntil, seats } = this.licenseEvaluator.inspect();
@@ -744,7 +744,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
744
744
async licenseIncludesFeature ( ctx : TraceContext , licenseFeature : LicenseFeature ) : Promise < boolean > {
745
745
traceAPIParams ( ctx , { licenseFeature } ) ;
746
746
747
- this . checkAndBlockUser ( "licenseIncludesFeature" ) ;
747
+ this . checkAndBlockUser ( arguments . callee . name ) ;
748
748
749
749
let feature : Feature | undefined ;
750
750
switch ( licenseFeature ) {
@@ -763,13 +763,13 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
763
763
public async getAccountStatement ( ctx : TraceContext , options : GitpodServer . GetAccountStatementOptions ) : Promise < AccountStatement > {
764
764
traceAPIParams ( ctx , { options } ) ;
765
765
766
- const user = this . checkUser ( "getAccountStatement" ) ;
766
+ const user = this . checkUser ( arguments . callee . name ) ;
767
767
const now = options . date || new Date ( ) . toISOString ( ) ;
768
768
return this . accountStatementProvider . getAccountStatement ( user . id , now ) ;
769
769
}
770
770
771
771
public async getRemainingUsageHours ( ctx : TraceContext ) : Promise < number > {
772
- const user = this . checkUser ( "getRemainingUsageHours" ) ;
772
+ const user = this . checkUser ( arguments . callee . name ) ;
773
773
const runningInstancesPromise = this . workspaceDb . trace ( ctx ) . findRegularRunningInstances ( user . id ) ;
774
774
return this . accountStatementProvider . getRemainingUsageHours ( user . id , new Date ( ) . toISOString ( ) , runningInstancesPromise ) ;
775
775
}
@@ -798,7 +798,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
798
798
}
799
799
800
800
public async isStudent ( ctx : TraceContext ) : Promise < boolean > {
801
- const user = this . checkUser ( "isStudent" ) ;
801
+ const user = this . checkUser ( arguments . callee . name ) ;
802
802
return this . eligibilityService . isStudent ( user ) ;
803
803
}
804
804
@@ -1342,7 +1342,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1342
1342
async adminGetAccountStatement ( ctx : TraceContext , userId : string ) : Promise < AccountStatement > {
1343
1343
traceAPIParams ( ctx , { userId } ) ;
1344
1344
1345
- const user = this . checkAndBlockUser ( "adminGetAccountStatement" ) ;
1345
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
1346
1346
if ( ! this . authorizationService . hasPermission ( user , Permission . ADMIN_USERS ) ) {
1347
1347
throw new ResponseError ( ErrorCodes . PERMISSION_DENIED , "not allowed" ) ;
1348
1348
}
@@ -1353,7 +1353,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1353
1353
async adminSetProfessionalOpenSource ( ctx : TraceContext , userId : string , shouldGetProfOSS : boolean ) : Promise < void > {
1354
1354
traceAPIParams ( ctx , { userId, shouldGetProfOSS } ) ;
1355
1355
1356
- const user = this . checkAndBlockUser ( "adminSetProfessionalOpenSource" ) ;
1356
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
1357
1357
if ( ! this . authorizationService . hasPermission ( user , Permission . ADMIN_USERS ) ) {
1358
1358
throw new ResponseError ( ErrorCodes . PERMISSION_DENIED , "not allowed" ) ;
1359
1359
}
@@ -1368,7 +1368,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1368
1368
async adminIsStudent ( ctx : TraceContext , userId : string ) : Promise < boolean > {
1369
1369
traceAPIParams ( ctx , { userId } ) ;
1370
1370
1371
- const user = this . checkAndBlockUser ( "adminIsStudent" ) ;
1371
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
1372
1372
if ( ! this . authorizationService . hasPermission ( user , Permission . ADMIN_USERS ) ) {
1373
1373
throw new ResponseError ( ErrorCodes . PERMISSION_DENIED , "not allowed" ) ;
1374
1374
}
@@ -1379,7 +1379,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1379
1379
async adminAddStudentEmailDomain ( ctx : TraceContext , userId : string , domain : string ) : Promise < void > {
1380
1380
traceAPIParams ( ctx , { userId, domain } ) ;
1381
1381
1382
- const user = this . checkAndBlockUser ( "adminAddStudentEmailDomain" ) ;
1382
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
1383
1383
if ( ! this . authorizationService . hasPermission ( user , Permission . ADMIN_USERS ) ) {
1384
1384
throw new ResponseError ( ErrorCodes . PERMISSION_DENIED , "not allowed" ) ;
1385
1385
}
@@ -1393,7 +1393,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1393
1393
async adminGrantExtraHours ( ctx : TraceContext , userId : string , extraHours : number ) : Promise < void > {
1394
1394
traceAPIParams ( ctx , { userId, extraHours } ) ;
1395
1395
1396
- const user = this . checkAndBlockUser ( "adminGrantExtraHours" ) ;
1396
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
1397
1397
if ( ! this . authorizationService . hasPermission ( user , Permission . ADMIN_USERS ) ) {
1398
1398
throw new ResponseError ( ErrorCodes . PERMISSION_DENIED , "not allowed" ) ;
1399
1399
}
@@ -1405,7 +1405,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1405
1405
async sendFeedback ( ctx : TraceContext , feedback : string ) : Promise < string | undefined > {
1406
1406
traceAPIParams ( ctx , { } ) ; // feedback is not interesting here, any may contain names
1407
1407
1408
- const user = this . checkUser ( "sendFeedback" ) ;
1408
+ const user = this . checkUser ( arguments . callee . name ) ;
1409
1409
const now = new Date ( ) . toISOString ( ) ;
1410
1410
const remainingUsageHours = await this . getRemainingUsageHours ( ctx ) ;
1411
1411
const stillEnoughCredits = remainingUsageHours > Math . max ( ...Accounting . LOW_CREDIT_WARNINGS_IN_HOURS ) ;
@@ -1421,7 +1421,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1421
1421
async getProviderRepositoriesForUser ( ctx : TraceContext , params : { provider : string , hints ?: object } ) : Promise < ProviderRepository [ ] > {
1422
1422
traceAPIParams ( ctx , { params } ) ;
1423
1423
1424
- const user = this . checkAndBlockUser ( "getProviderRepositoriesForUser" ) ;
1424
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
1425
1425
1426
1426
const repositories : ProviderRepository [ ] = [ ] ;
1427
1427
const providerHost = params . provider ;
@@ -1445,7 +1445,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1445
1445
async triggerPrebuild ( ctx : TraceContext , projectId : string , branchName : string | null ) : Promise < StartPrebuildResult > {
1446
1446
traceAPIParams ( ctx , { projectId, branchName } ) ;
1447
1447
1448
- const user = this . checkAndBlockUser ( "triggerPrebuild" ) ;
1448
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
1449
1449
1450
1450
const project = await this . projectsService . getProject ( projectId ) ;
1451
1451
if ( ! project ) {
@@ -1491,7 +1491,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
1491
1491
async cancelPrebuild ( ctx : TraceContext , projectId : string , prebuildId : string ) : Promise < void > {
1492
1492
traceAPIParams ( ctx , { projectId, prebuildId } ) ;
1493
1493
1494
- const user = this . checkAndBlockUser ( "cancelPrebuild" ) ;
1494
+ const user = this . checkAndBlockUser ( arguments . callee . name ) ;
1495
1495
1496
1496
const project = await this . projectsService . getProject ( projectId ) ;
1497
1497
if ( ! project ) {
0 commit comments