You've already forked woodpecker
							
							
				mirror of
				https://github.com/woodpecker-ci/woodpecker.git
				synced 2025-10-30 23:27:39 +02:00 
			
		
		
		
	add chown command to switch repo owner
This commit is contained in:
		| @@ -103,6 +103,7 @@ func Load(middleware ...gin.HandlerFunc) http.Handler { | ||||
| 			// requires push permissions | ||||
| 			repo.PATCH("", session.MustPush, server.PatchRepo) | ||||
| 			repo.DELETE("", session.MustPush, server.DeleteRepo) | ||||
| 			repo.POST("/chown", session.MustPush, server.ChownRepo) | ||||
|  | ||||
| 			repo.POST("/builds/:number", session.MustPush, server.PostBuild) | ||||
| 			repo.DELETE("/builds/:number/:job", session.MustPush, server.DeleteBuild) | ||||
|   | ||||
| @@ -136,6 +136,19 @@ func PatchRepo(c *gin.Context) { | ||||
| 	c.JSON(http.StatusOK, repo) | ||||
| } | ||||
|  | ||||
| func ChownRepo(c *gin.Context) { | ||||
| 	repo := session.Repo(c) | ||||
| 	user := session.User(c) | ||||
| 	repo.UserID = user.ID | ||||
|  | ||||
| 	err := store.UpdateRepo(c, repo) | ||||
| 	if err != nil { | ||||
| 		c.AbortWithError(http.StatusInternalServerError, err) | ||||
| 		return | ||||
| 	} | ||||
| 	c.JSON(http.StatusOK, repo) | ||||
| } | ||||
|  | ||||
| func GetRepo(c *gin.Context) { | ||||
| 	c.JSON(http.StatusOK, session.Repo(c)) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user