#1279: Removing user from collaboration removes repositiory

This commit is contained in:
Unknwon 2015-07-14 22:56:02 +08:00
parent 92783bf6ef
commit 663c28beb6
2 changed files with 21 additions and 2 deletions

View File

@ -14,7 +14,7 @@ watch_exts = [".go"]
build_delay = 1500 build_delay = 1500
cmds = [ cmds = [
#["go-bindata", "-o=modules/bindata/bindata.go", "-ignore=\\.DS_Store|README", "-pkg=bindata", "conf/..."], #["go-bindata", "-o=modules/bindata/bindata.go", "-ignore=\\.DS_Store|README", "-pkg=bindata", "conf/..."],
["go", "install", "-tags", "sqlite cert"],# redis memcache ["go", "install", "-tags", "sqlite"],# redis memcache cert pam
["go", "build", "-tags", "sqlite cert"], ["go", "build", "-tags", "sqlite"],
["./gogs", "web"] ["./gogs", "web"]
] ]

View File

@ -145,6 +145,25 @@ func (repo *Repository) refreshCollaboratorAccesses(e Engine, accessMap map[int6
for _, c := range collaborators { for _, c := range collaborators {
accessMap[c.Id] = ACCESS_MODE_WRITE accessMap[c.Id] = ACCESS_MODE_WRITE
} }
// Adds team members access.
if repo.Owner.IsOrganization() {
if err = repo.Owner.GetTeams(); err != nil {
return fmt.Errorf("GetTeams: %v", err)
}
for _, t := range repo.Owner.Teams {
if err = t.GetMembers(); err != nil {
return fmt.Errorf("GetMembers: %v", err)
}
for _, m := range t.Members {
if t.IsOwnerTeam() {
accessMap[m.Id] = ACCESS_MODE_OWNER
} else {
accessMap[m.Id] = maxAccessMode(accessMap[m.Id], t.Authorize)
}
}
}
}
return nil return nil
} }