2
0

feat(secrets): add secret promotion between scopes

Adds ability to promote secrets from repository to organization scope, or from repository/organization to global scope. Includes conflict detection to prevent duplicate names at target scope, permission checks (org owner for repo→org, system admin for →global), and UI buttons with confirmation dialogs. Implements MoveSecret model method and PerformSecretsPromote handler.
This commit is contained in:
2026-02-01 21:39:45 -05:00
parent 8182b1be81
commit 7b34e295eb
10 changed files with 157 additions and 5 deletions

View File

@@ -130,6 +130,11 @@ func DeleteSecretByName(ctx context.Context, ownerID, repoID int64, name string)
return deleteSecret(ctx, s[0])
}
// PromoteSecret moves a secret to a new scope (org or global).
func PromoteSecret(ctx context.Context, secretID, newOwnerID, newRepoID int64) error {
return secret_model.MoveSecret(ctx, secretID, newOwnerID, newRepoID)
}
func deleteSecret(ctx context.Context, s *secret_model.Secret) error {
if _, err := db.DeleteByID[secret_model.Secret](ctx, s.ID); err != nil {
return err