diff options
author | Unknwon <u@gogs.io> | 2015-07-14 22:56:02 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-07-14 22:56:02 +0800 |
commit | 663c28beb61d5c1319665f195b7e2f4f370c3ea9 (patch) | |
tree | 2e2f8fd03f73fb63c6d507e152e3fa9745709d18 /models/access.go | |
parent | 92783bf6efe56b9aa328e86f432dcc744f4ac0ca (diff) | |
download | gitea-663c28beb61d5c1319665f195b7e2f4f370c3ea9.tar.gz gitea-663c28beb61d5c1319665f195b7e2f4f370c3ea9.zip |
#1279: Removing user from collaboration removes repositiory
Diffstat (limited to 'models/access.go')
-rw-r--r-- | models/access.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/models/access.go b/models/access.go index dd856afb71..51b60c9970 100644 --- a/models/access.go +++ b/models/access.go @@ -145,6 +145,25 @@ func (repo *Repository) refreshCollaboratorAccesses(e Engine, accessMap map[int6 for _, c := range collaborators { 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 } |