forked from forgejo/forgejo
Add repo mirror and import
This commit is contained in:
parent
23bba7633b
commit
90f6aa8cd1
20 changed files with 271 additions and 125 deletions
|
@ -190,27 +190,3 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
|
|||
ctx.Data["IsRepositoryWatching"] = ctx.Repo.IsWatching
|
||||
}
|
||||
}
|
||||
|
||||
func WriteAccess() martini.Handler {
|
||||
return func(ctx *Context) {
|
||||
if ctx.Repo.Repository.IsPrivate {
|
||||
ctx.Repo.HasAccess = false
|
||||
ctx.Data["HasAccess"] = false
|
||||
if ctx.User == nil {
|
||||
ctx.Handle(404, "WriteAccess", nil)
|
||||
return
|
||||
}
|
||||
|
||||
hasAccess, err := models.HasAccess(ctx.User.Name, ctx.Repo.Owner.Name+"/"+ctx.Repo.Repository.Name, models.AU_WRITABLE)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "WriteAccess(HasAccess)", err)
|
||||
return
|
||||
} else if !hasAccess {
|
||||
ctx.Handle(404, "WriteAccess(HasAccess)", nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx.Repo.HasAccess = true
|
||||
ctx.Data["HasAccess"] = true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue