@@ -1108,15 +1108,15 @@ func (q *querier) GetProvisionerLogsAfterID(ctx context.Context, arg database.Ge
1108
1108
}
1109
1109
1110
1110
func (q * querier ) GetQuotaAllowanceForUser (ctx context.Context , userID uuid.UUID ) (int64 , error ) {
1111
- err := q .authorizeContext (ctx , rbac .ActionRead , rbac .ResourceUser . WithID (userID ))
1111
+ err := q .authorizeContext (ctx , rbac .ActionRead , rbac .ResourceUserObject (userID ))
1112
1112
if err != nil {
1113
1113
return - 1 , err
1114
1114
}
1115
1115
return q .db .GetQuotaAllowanceForUser (ctx , userID )
1116
1116
}
1117
1117
1118
1118
func (q * querier ) GetQuotaConsumedForUser (ctx context.Context , userID uuid.UUID ) (int64 , error ) {
1119
- err := q .authorizeContext (ctx , rbac .ActionRead , rbac .ResourceUser . WithID (userID ))
1119
+ err := q .authorizeContext (ctx , rbac .ActionRead , rbac .ResourceUserObject (userID ))
1120
1120
if err != nil {
1121
1121
return - 1 , err
1122
1122
}
@@ -1390,7 +1390,7 @@ func (q *querier) GetUsers(ctx context.Context, arg database.GetUsersParams) ([]
1390
1390
// itself.
1391
1391
func (q * querier ) GetUsersByIDs (ctx context.Context , ids []uuid.UUID ) ([]database.User , error ) {
1392
1392
for _ , uid := range ids {
1393
- if err := q .authorizeContext (ctx , rbac .ActionRead , rbac .ResourceUser . WithID (uid )); err != nil {
1393
+ if err := q .authorizeContext (ctx , rbac .ActionRead , rbac .ResourceUserObject (uid )); err != nil {
1394
1394
return nil , err
1395
1395
}
1396
1396
}
@@ -1899,7 +1899,7 @@ func (q *querier) InsertUserGroupsByName(ctx context.Context, arg database.Inser
1899
1899
1900
1900
// TODO: Should this be in system.go?
1901
1901
func (q * querier ) InsertUserLink (ctx context.Context , arg database.InsertUserLinkParams ) (database.UserLink , error ) {
1902
- if err := q .authorizeContext (ctx , rbac .ActionUpdate , rbac .ResourceUser . WithID (arg .UserID )); err != nil {
1902
+ if err := q .authorizeContext (ctx , rbac .ActionUpdate , rbac .ResourceUserObject (arg .UserID )); err != nil {
1903
1903
return database.UserLink {}, err
1904
1904
}
1905
1905
return q .db .InsertUserLink (ctx , arg )
@@ -2614,24 +2614,24 @@ func (q *querier) GetAuthorizedTemplates(ctx context.Context, arg database.GetTe
2614
2614
}
2615
2615
2616
2616
func (q * querier ) GetTemplateGroupRoles (ctx context.Context , id uuid.UUID ) ([]database.TemplateGroup , error ) {
2617
- // An actor is authorized to read template group roles if they are authorized to read the template.
2617
+ // An actor is authorized to read template group roles if they are authorized to update the template.
2618
2618
template , err := q .db .GetTemplateByID (ctx , id )
2619
2619
if err != nil {
2620
2620
return nil , err
2621
2621
}
2622
- if err := q .authorizeContext (ctx , rbac .ActionRead , template ); err != nil {
2622
+ if err := q .authorizeContext (ctx , rbac .ActionUpdate , template ); err != nil {
2623
2623
return nil , err
2624
2624
}
2625
2625
return q .db .GetTemplateGroupRoles (ctx , id )
2626
2626
}
2627
2627
2628
2628
func (q * querier ) GetTemplateUserRoles (ctx context.Context , id uuid.UUID ) ([]database.TemplateUser , error ) {
2629
- // An actor is authorized to query template user roles if they are authorized to read the template.
2629
+ // An actor is authorized to query template user roles if they are authorized to update the template.
2630
2630
template , err := q .db .GetTemplateByID (ctx , id )
2631
2631
if err != nil {
2632
2632
return nil , err
2633
2633
}
2634
- if err := q .authorizeContext (ctx , rbac .ActionRead , template ); err != nil {
2634
+ if err := q .authorizeContext (ctx , rbac .ActionUpdate , template ); err != nil {
2635
2635
return nil , err
2636
2636
}
2637
2637
return q .db .GetTemplateUserRoles (ctx , id )
0 commit comments