1
0
Fork 0
forked from forgejo/forgejo

Add units to team (#947)

* add units to team

* fix lint

* finish team setting backend

* finished permission controll on routes

* fix import blank line

* add unit check on ssh/http pull and push and fix test failed

* fix fixtures data

* remove unused code
This commit is contained in:
Lunny Xiao 2017-05-18 22:54:24 +08:00 committed by GitHub
parent 5db5e16ab6
commit fd6034aaf2
18 changed files with 366 additions and 113 deletions

View file

@ -77,8 +77,10 @@ func HTTP(ctx *context.Context) {
}
isWiki := false
var unitType = models.UnitTypeCode
if strings.HasSuffix(reponame, ".wiki") {
isWiki = true
unitType = models.UnitTypeWiki
reponame = reponame[:len(reponame)-5]
}
@ -204,6 +206,12 @@ func HTTP(ctx *context.Context) {
}
}
if !repo.CheckUnitUser(authUser.ID, unitType) {
ctx.HandleText(http.StatusForbidden, fmt.Sprintf("User %s does not have allowed access to repository %s 's code",
authUser.Name, repo.RepoPath()))
return
}
environ = []string{
models.EnvRepoUsername + "=" + username,
models.EnvRepoName + "=" + reponame,