added some logs

This commit is contained in:
Michael Jerger 2023-10-27 12:12:31 +02:00
parent 3dbcf34a16
commit 64abf87fb0
2 changed files with 5 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
) )
// Repository function returns the Repository actor for a repo // Repository function returns the Repository actor for a repo
@ -26,6 +27,7 @@ func Repository(ctx *context.APIContext) {
// "200": // "200":
// "$ref": "#/responses/ActivityPub" // "$ref": "#/responses/ActivityPub"
log.Error("Repository")
ctx.Status(http.StatusNoContent) ctx.Status(http.StatusNoContent)
} }

View file

@ -8,6 +8,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo" repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
) )
// RepositoryIDAssignmentAPI returns a middleware to handle context-repo assignment for api routes // RepositoryIDAssignmentAPI returns a middleware to handle context-repo assignment for api routes
@ -16,6 +17,8 @@ func RepositoryIDAssignmentAPI() func(ctx *context.APIContext) {
// TODO: enough validation for security? // TODO: enough validation for security?
repositoryID := ctx.ParamsInt64(":repository-id") repositoryID := ctx.ParamsInt64(":repository-id")
log.Info("RepositoryIDAssignmentAPI: %v", repositoryID)
//TODO: check auth here ? //TODO: check auth here ?
if !ctx.Repo.HasAccess() && !ctx.IsUserSiteAdmin() { if !ctx.Repo.HasAccess() && !ctx.IsUserSiteAdmin() {
ctx.Error(http.StatusForbidden, "reqAnyRepoReader", "user should have any permission to read repository or permissions of site admin") ctx.Error(http.StatusForbidden, "reqAnyRepoReader", "user should have any permission to read repository or permissions of site admin")