Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: assigneeGroupValue (#2982)

p0ny79cdd2e1abc0
diff --git a/api/policy.go b/api/policy.go
index 196be60ef3..f3f28a9038 100644
--- a/api/policy.go
+++ b/api/policy.go
@@ -41,6 +41,8 @@ const (
// PipelineApprovalValueManualAlways means the pipeline should be manually approved by user to proceed.
PipelineApprovalValueManualAlways PipelineApprovalValue = "MANUAL_APPROVAL_ALWAYS"
+ // AssigneeGroupValueWorkspaceOwnerOrDBA means the assignee can be selected from the workspace owners and DBAs.
+ AssigneeGroupValueWorkspaceOwnerOrDBA AssigneeGroupValue = "WORKSPACE_OWNER_OR_DBA"
// AssigneeGroupValueProjectOwner means the assignee can be selected from the project owners.
AssigneeGroupValueProjectOwner AssigneeGroupValue = "PROJECT_OWNER"
diff --git a/server/task.go b/server/task.go
index 1a8b99b056..9652ca3126 100644
--- a/server/task.go
+++ b/server/task.go
@@ -529,9 +529,9 @@ func (s *Server) canPrincipalBeAssignee(ctx context.Context, principalID int, en
break
}
}
- if groupValue == nil {
+ if groupValue == nil || *groupValue == api.AssigneeGroupValueWorkspaceOwnerOrDBA {
// no value is set, fallback to default.
- // the assignee group is the workspace owner and DBA.
+ // the assignee group is the workspace owner or DBA.
principal, err := s.store.GetPrincipalByID(ctx, principalID)
if err != nil {
return false, common.Wrapf(err, common.Internal, "failed to get principal by ID %d", principalID)
@@ -835,7 +835,7 @@ func (s *Server) getDefaultAssigneeID(ctx context.Context, environmentID int, pr
break
}
}
- if groupValue == nil {
+ if groupValue == nil || *groupValue == api.AssigneeGroupValueWorkspaceOwnerOrDBA {
member, err := s.getAnyWorkspaceOwnerOrDBA(ctx)
if err != nil {
return api.UnknownID, errors.Wrap(err, "failed to get a workspace owner or DBA")