@@ -215,7 +215,7 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
215
215
authorizer .AlwaysReturn = rbac .ForbiddenWithInternal (xerrors .New ("fake implementation" ), nil , nil )
216
216
217
217
// Some quick reused objects
218
- workspaceRBACObj := rbac .ResourceWorkspace .InOrg (organization .ID ).WithID ( workspace . ID . String ()). WithOwner (workspace .OwnerID .String ())
218
+ workspaceRBACObj := rbac .ResourceWorkspace .InOrg (organization .ID ).WithOwner (workspace .OwnerID .String ())
219
219
220
220
// skipRoutes allows skipping routes from being checked.
221
221
skipRoutes := map [string ]string {
@@ -342,107 +342,107 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
342
342
"GET:/api/v2/organizations/{organization}/templates" : {
343
343
StatusCode : http .StatusOK ,
344
344
AssertAction : rbac .ActionRead ,
345
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
345
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
346
346
},
347
347
"POST:/api/v2/organizations/{organization}/templates" : {
348
348
AssertAction : rbac .ActionCreate ,
349
349
AssertObject : rbac .ResourceTemplate .InOrg (organization .ID ),
350
350
},
351
351
"DELETE:/api/v2/templates/{template}" : {
352
352
AssertAction : rbac .ActionDelete ,
353
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
353
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
354
354
},
355
355
"GET:/api/v2/templates/{template}" : {
356
356
AssertAction : rbac .ActionRead ,
357
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
357
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
358
358
},
359
359
"POST:/api/v2/files" : {AssertAction : rbac .ActionCreate , AssertObject : rbac .ResourceFile },
360
360
"GET:/api/v2/files/{fileHash}" : {
361
361
AssertAction : rbac .ActionRead ,
362
- AssertObject : rbac .ResourceFile .WithOwner (admin .UserID .String ()). WithID ( file . Hash ) ,
362
+ AssertObject : rbac .ResourceFile .WithOwner (admin .UserID .String ()),
363
363
},
364
364
"GET:/api/v2/templates/{template}/versions" : {
365
365
AssertAction : rbac .ActionRead ,
366
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
366
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
367
367
},
368
368
"PATCH:/api/v2/templates/{template}/versions" : {
369
369
AssertAction : rbac .ActionUpdate ,
370
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
370
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
371
371
},
372
372
"GET:/api/v2/templates/{template}/versions/{templateversionname}" : {
373
373
AssertAction : rbac .ActionRead ,
374
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
374
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
375
375
},
376
376
"GET:/api/v2/templateversions/{templateversion}" : {
377
377
AssertAction : rbac .ActionRead ,
378
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
378
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
379
379
},
380
380
"PATCH:/api/v2/templateversions/{templateversion}/cancel" : {
381
381
AssertAction : rbac .ActionUpdate ,
382
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
382
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
383
383
},
384
384
"GET:/api/v2/templateversions/{templateversion}/logs" : {
385
385
AssertAction : rbac .ActionRead ,
386
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
386
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
387
387
},
388
388
"GET:/api/v2/templateversions/{templateversion}/parameters" : {
389
389
AssertAction : rbac .ActionRead ,
390
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
390
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
391
391
},
392
392
"GET:/api/v2/templateversions/{templateversion}/resources" : {
393
393
AssertAction : rbac .ActionRead ,
394
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
394
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
395
395
},
396
396
"GET:/api/v2/templateversions/{templateversion}/schema" : {
397
397
AssertAction : rbac .ActionRead ,
398
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
398
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
399
399
},
400
400
"POST:/api/v2/templateversions/{templateversion}/dry-run" : {
401
401
// The first check is to read the template
402
402
AssertAction : rbac .ActionRead ,
403
- AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ). WithID ( template . ID . String ()) ,
403
+ AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ),
404
404
},
405
405
"GET:/api/v2/templateversions/{templateversion}/dry-run/{templateversiondryrun}" : {
406
406
AssertAction : rbac .ActionRead ,
407
- AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ). WithID ( template . ID . String ()) ,
407
+ AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ),
408
408
},
409
409
"GET:/api/v2/templateversions/{templateversion}/dry-run/{templateversiondryrun}/resources" : {
410
410
AssertAction : rbac .ActionRead ,
411
- AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ). WithID ( template . ID . String ()) ,
411
+ AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ),
412
412
},
413
413
"GET:/api/v2/templateversions/{templateversion}/dry-run/{templateversiondryrun}/logs" : {
414
414
AssertAction : rbac .ActionRead ,
415
- AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ). WithID ( template . ID . String ()) ,
415
+ AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ),
416
416
},
417
417
"PATCH:/api/v2/templateversions/{templateversion}/dry-run/{templateversiondryrun}/cancel" : {
418
418
AssertAction : rbac .ActionRead ,
419
- AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ). WithID ( template . ID . String ()) ,
419
+ AssertObject : rbac .ResourceTemplate .InOrg (version .OrganizationID ),
420
420
},
421
421
"GET:/api/v2/provisionerdaemons" : {
422
422
StatusCode : http .StatusOK ,
423
- AssertObject : rbac .ResourceProvisionerDaemon . WithID ( provisionerds [ 0 ]. ID . String ()) ,
423
+ AssertObject : rbac .ResourceProvisionerDaemon ,
424
424
},
425
425
426
426
"POST:/api/v2/parameters/{scope}/{id}" : {
427
427
AssertAction : rbac .ActionUpdate ,
428
- AssertObject : rbac .ResourceTemplate . WithID ( template . ID . String ()) ,
428
+ AssertObject : rbac .ResourceTemplate ,
429
429
},
430
430
"GET:/api/v2/parameters/{scope}/{id}" : {
431
431
AssertAction : rbac .ActionRead ,
432
- AssertObject : rbac .ResourceTemplate . WithID ( template . ID . String ()) ,
432
+ AssertObject : rbac .ResourceTemplate ,
433
433
},
434
434
"DELETE:/api/v2/parameters/{scope}/{id}/{name}" : {
435
435
AssertAction : rbac .ActionUpdate ,
436
- AssertObject : rbac .ResourceTemplate . WithID ( template . ID . String ()) ,
436
+ AssertObject : rbac .ResourceTemplate ,
437
437
},
438
438
"GET:/api/v2/organizations/{organization}/templates/{templatename}" : {
439
439
AssertAction : rbac .ActionRead ,
440
- AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ). WithID ( template . ID . String ()) ,
440
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ),
441
441
},
442
442
"POST:/api/v2/organizations/{organization}/workspaces" : {
443
443
AssertAction : rbac .ActionCreate ,
444
444
// No ID when creating
445
- AssertObject : workspaceRBACObj . WithID ( "" ) ,
445
+ AssertObject : workspaceRBACObj ,
446
446
},
447
447
"GET:/api/v2/workspaces/{workspace}/watch" : {
448
448
AssertAction : rbac .ActionRead ,
0 commit comments