mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
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:
parent
5db5e16ab6
commit
fd6034aaf2
18 changed files with 366 additions and 113 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue