mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
feat(API): add secret deletion functionality for repository (#26808)
- Modify the `CreateOrUpdateSecret` function in `api.go` to include a `Delete` operation for the secret - Modify the `DeleteOrgSecret` function in `action.go` to include a `DeleteSecret` operation for the organization - Modify the `DeleteSecret` function in `action.go` to include a `DeleteSecret` operation for the repository - Modify the `v1_json.tmpl` template file to update the `operationId` and `summary` for the `deleteSecret` operation in both the organization and repository sections --------- Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -125,8 +125,8 @@ func CreateOrUpdateSecret(ctx *context.APIContext) {
|
||||
ctx.Status(http.StatusNoContent)
|
||||
}
|
||||
|
||||
// DeleteOrgSecret delete one secret of the organization
|
||||
func DeleteOrgSecret(ctx *context.APIContext) {
|
||||
// DeleteSecret delete one secret of the organization
|
||||
func DeleteSecret(ctx *context.APIContext) {
|
||||
// swagger:operation DELETE /orgs/{org}/actions/secrets/{secretname} organization deleteOrgSecret
|
||||
// ---
|
||||
// summary: Delete a secret in an organization
|
||||
@@ -151,6 +151,10 @@ func DeleteOrgSecret(ctx *context.APIContext) {
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
secretName := ctx.Params(":secretname")
|
||||
if err := actions.NameRegexMatch(secretName); err != nil {
|
||||
ctx.Error(http.StatusBadRequest, "DeleteSecret", err)
|
||||
return
|
||||
}
|
||||
err := secret_model.DeleteSecret(
|
||||
ctx, ctx.Org.Organization.ID, 0, secretName,
|
||||
)
|
||||
|
Reference in New Issue
Block a user