feat: Remove organization and user scoped parameters (#2007)

* feat: Remove organization and user scoped parameters

Signed-off-by: Spike Curtis <spike@coder.com>

* Fixup dump.sql

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix dump.sql again

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix down migration

Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
Spike Curtis
2022-06-03 11:49:58 -07:00
committed by GitHub
parent 582d636e54
commit d8c440188e
11 changed files with 90 additions and 112 deletions

View File

@ -60,15 +60,6 @@ func Compute(ctx context.Context, db database.Store, scope ComputeScope, options
compute.parameterSchemasByName[parameterSchema.Name] = parameterSchema
}
// Organization parameters come first!
err = compute.injectScope(ctx, database.GetParameterValuesByScopeParams{
Scope: database.ParameterScopeOrganization,
ScopeID: scope.OrganizationID,
})
if err != nil {
return nil, err
}
// Job parameters come second!
err = compute.injectScope(ctx, database.GetParameterValuesByScopeParams{
Scope: database.ParameterScopeImportJob,
@ -123,15 +114,6 @@ func Compute(ctx context.Context, db database.Store, scope ComputeScope, options
}
}
// User parameters come fourth!
err = compute.injectScope(ctx, database.GetParameterValuesByScopeParams{
Scope: database.ParameterScopeUser,
ScopeID: scope.UserID,
})
if err != nil {
return nil, err
}
if scope.WorkspaceID.Valid {
// Workspace parameters come last!
err = compute.injectScope(ctx, database.GetParameterValuesByScopeParams{
@ -194,9 +176,8 @@ func (c *compute) injectSingle(scopedParameter database.ParameterValue, defaultV
_, hasParameterValue := c.computedParameterByName[scopedParameter.Name]
if hasParameterValue {
if !parameterSchema.AllowOverrideSource &&
// Users and workspaces cannot override anything on a template!
(scopedParameter.Scope == database.ParameterScopeUser ||
scopedParameter.Scope == database.ParameterScopeWorkspace) {
// Workspaces cannot override anything on a template!
scopedParameter.Scope == database.ParameterScopeWorkspace {
return nil
}
}