return
}
+ // if user in an owner team
+ for _, team := range teams {
+ if team.Authorize >= AccessModeOwner {
+ perm.AccessMode = AccessModeOwner
+ perm.UnitsMode = nil
+ return
+ }
+ }
+
for _, u := range repo.Units {
var found bool
for _, team := range teams {
assert.True(t, perm.CanWrite(unit.Type))
}
+ // update team information and then check permission
+ team := AssertExistsAndLoadBean(t, &Team{ID: 5}).(*Team)
+ err = UpdateTeamUnits(team, nil)
+ assert.NoError(t, err)
+ perm, err = GetUserRepoPermission(repo, owner)
+ assert.NoError(t, err)
+ for _, unit := range repo.Units {
+ assert.True(t, perm.CanRead(unit.Type))
+ assert.True(t, perm.CanWrite(unit.Type))
+ }
+
// org member team tester
tester := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
perm, err = GetUserRepoPermission(repo, tester)