Skip to content
Prev Previous commit
Next Next commit
Merge branch 'main' into jon/keyschema
  • Loading branch information
sreya committed Sep 17, 2024
commit aed56d6af72838c25fe2f0e1097c923c2087d79e
6 changes: 6 additions & 0 deletions coderd/database/dbgen/dbgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,12 @@ func CryptoKey(t testing.TB, db database.Store, seed database.CryptoKey) databas
return key
}

func ProvisionerJobTimings(t testing.TB, db database.Store, seed database.InsertProvisionerJobTimingsParams) []database.ProvisionerJobTiming {
timings, err := db.InsertProvisionerJobTimings(genCtx, seed)
require.NoError(t, err, "insert provisioner job timings")
return timings
}

func must[V any](v V, err error) V {
if err != nil {
panic(err)
Expand Down
7 changes: 7 additions & 0 deletions coderd/rbac/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,11 @@ var RBACPermissions = map[string]PermissionDefinition{
ActionCreate: actDef("create crypto keys"),
},
},
// idpsync_settings should always be org scoped
"idpsync_settings": {
Actions: map[Action]ActionDefinition{
ActionRead: actDef("read IdP sync settings"),
ActionUpdate: actDef("update IdP sync settings"),
},
},
}
14 changes: 14 additions & 0 deletions coderd/rbac/roles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,20 @@ func TestRolePermissions(t *testing.T) {
false: {setOtherOrg, setOrgNotMe, memberMe, orgMemberMe, templateAdmin, userAdmin},
},
},
{
Name: "IDPSyncSettings",
Actions: []policy.Action{policy.ActionRead, policy.ActionUpdate},
Resource: rbac.ResourceIdpsyncSettings.InOrg(orgID),
AuthorizeMap: map[bool][]hasAuthSubjects{
true: {owner, orgAdmin},
false: {
orgMemberMe, otherOrgAdmin,
memberMe, userAdmin, templateAdmin,
orgAuditor, orgUserAdmin, orgTemplateAdmin,
otherOrgMember, otherOrgAuditor, otherOrgUserAdmin, otherOrgTemplateAdmin,
},
},
},
}

// We expect every permission to be tested above.
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.