mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: make default workspace proxy editable (#7903)
* chore: add editing the default workspace proxy
This commit is contained in:
@@ -369,6 +369,11 @@ func (q *querier) DeleteLicense(ctx context.Context, id int32) (int32, error) {
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (q *querier) GetDefaultProxyConfig(ctx context.Context) (database.GetDefaultProxyConfigRow, error) {
|
||||
// No authz checks
|
||||
return q.db.GetDefaultProxyConfig(ctx)
|
||||
}
|
||||
|
||||
func (q *querier) GetDeploymentID(ctx context.Context) (string, error) {
|
||||
// No authz checks
|
||||
return q.db.GetDeploymentID(ctx)
|
||||
|
||||
@@ -335,6 +335,12 @@ func (s *MethodTestSuite) TestLicense() {
|
||||
s.Run("GetDeploymentID", s.Subtest(func(db database.Store, check *expects) {
|
||||
check.Args().Asserts().Returns("")
|
||||
}))
|
||||
s.Run("GetDefaultProxyConfig", s.Subtest(func(db database.Store, check *expects) {
|
||||
check.Args().Asserts().Returns(database.GetDefaultProxyConfigRow{
|
||||
DisplayName: "Default",
|
||||
IconUrl: "/emojis/1f3e1.png",
|
||||
})
|
||||
}))
|
||||
s.Run("GetLogoURL", s.Subtest(func(db database.Store, check *expects) {
|
||||
err := db.UpsertLogoURL(context.Background(), "value")
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
@@ -431,3 +431,10 @@ func (q *querier) GetWorkspaceProxyByHostname(ctx context.Context, params databa
|
||||
}
|
||||
return q.db.GetWorkspaceProxyByHostname(ctx, params)
|
||||
}
|
||||
|
||||
func (q *querier) UpsertDefaultProxy(ctx context.Context, arg database.UpsertDefaultProxyParams) error {
|
||||
if err := q.authorizeContext(ctx, rbac.ActionUpdate, rbac.ResourceSystem); err != nil {
|
||||
return err
|
||||
}
|
||||
return q.db.UpsertDefaultProxy(ctx, arg)
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ func (s *MethodTestSuite) TestSystemFunctions() {
|
||||
LoginType: database.LoginTypeGithub,
|
||||
}).Asserts(rbac.ResourceSystem, rbac.ActionUpdate).Returns(l)
|
||||
}))
|
||||
s.Run("UpsertDefaultProxy", s.Subtest(func(db database.Store, check *expects) {
|
||||
check.Args(database.UpsertDefaultProxyParams{}).Asserts(rbac.ResourceSystem, rbac.ActionUpdate).Returns()
|
||||
}))
|
||||
s.Run("GetUserLinkByLinkedID", s.Subtest(func(db database.Store, check *expects) {
|
||||
l := dbgen.UserLink(s.T(), db, database.UserLink{})
|
||||
check.Args(l.LinkedID).Asserts(rbac.ResourceSystem, rbac.ActionRead).Returns(l)
|
||||
|
||||
Reference in New Issue
Block a user