mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Fix package access for admins and inactive users (#21580)
I noticed an admin is not allowed to upload packages for other users because `ctx.IsSigned` was not set. I added a check for `user.IsActive` and `user.ProhibitLogin` too because both was not checked. Tests enforce this now. Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
		| @@ -58,6 +58,7 @@ func Routes(ctx gocontext.Context) *web.Route { | ||||
| 	authGroup := auth.NewGroup(authMethods...) | ||||
| 	r.Use(func(ctx *context.Context) { | ||||
| 		ctx.Doer = authGroup.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session) | ||||
| 		ctx.IsSigned = ctx.Doer != nil | ||||
| 	}) | ||||
|  | ||||
| 	r.Group("/{username}", func() { | ||||
| @@ -316,6 +317,7 @@ func ContainerRoutes(ctx gocontext.Context) *web.Route { | ||||
| 	authGroup := auth.NewGroup(authMethods...) | ||||
| 	r.Use(func(ctx *context.Context) { | ||||
| 		ctx.Doer = authGroup.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session) | ||||
| 		ctx.IsSigned = ctx.Doer != nil | ||||
| 	}) | ||||
|  | ||||
| 	r.Get("", container.ReqContainerAccess, container.DetermineSupport) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user