aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/serv.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-05-18 22:54:24 +0800
committerGitHub <noreply@github.com>2017-05-18 22:54:24 +0800
commitfd6034aaf23af1ce03bcba0babcbe7675ce093ee (patch)
tree9720f416facdef02a76bd56ca50669cc1f17eb88 /cmd/serv.go
parent5db5e16ab61f25f21cb17ee4895679b9830641a5 (diff)
downloadgitea-fd6034aaf23af1ce03bcba0babcbe7675ce093ee.tar.gz
gitea-fd6034aaf23af1ce03bcba0babcbe7675ce093ee.zip
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
Diffstat (limited to 'cmd/serv.go')
-rw-r--r--cmd/serv.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/serv.go b/cmd/serv.go
index def19fc555..0b1ddc3277 100644
--- a/cmd/serv.go
+++ b/cmd/serv.go
@@ -143,8 +143,10 @@ func runServ(c *cli.Context) error {
reponame := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))
isWiki := false
+ unitType := models.UnitTypeCode
if strings.HasSuffix(reponame, ".wiki") {
isWiki = true
+ unitType = models.UnitTypeWiki
reponame = reponame[:len(reponame)-5]
}
@@ -248,6 +250,12 @@ func runServ(c *cli.Context) error {
user.Name, requestedMode, repoPath)
}
+ if !repo.CheckUnitUser(user.ID, unitType) {
+ fail("You do not have allowed for this action",
+ "User %s does not have allowed access to repository %s 's code",
+ user.Name, repoPath)
+ }
+
os.Setenv(models.EnvPusherName, user.Name)
os.Setenv(models.EnvPusherID, fmt.Sprintf("%d", user.ID))
}