Skip to content

Commit 78fd2c2

Browse files
committed
fix owner team permission
1 parent e197fc7 commit 78fd2c2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

models/organization/org.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,15 @@ func CreateOrganization(org *Organization, owner *user_model.User) (err error) {
342342
// insert units for team
343343
units := make([]TeamUnit, 0, len(unit.AllRepoUnitTypes))
344344
for _, tp := range unit.AllRepoUnitTypes {
345+
up := perm.AccessModeOwner
346+
if tp == unit.TypeExternalTracker || tp == unit.TypeExternalWiki {
347+
up = perm.AccessModeRead
348+
}
345349
units = append(units, TeamUnit{
346350
OrgID: org.ID,
347351
TeamID: t.ID,
348352
Type: tp,
349-
AccessMode: perm.AccessModeOwner,
353+
AccessMode: up,
350354
})
351355
}
352356

tests/integration/api_org_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ func TestAPIOrgCreate(t *testing.T) {
6060

6161
for _, ut := range unit_model.AllRepoUnitTypes {
6262
// WIP: need to confirm
63+
up := perm.AccessModeOwner
6364
if ut == unit_model.TypeExternalTracker || ut == unit_model.TypeExternalWiki {
64-
continue
65+
up = perm.AccessModeRead
6566
}
6667
unittest.AssertExistsAndLoadBean(t, &org_model.TeamUnit{
6768
OrgID: apiOrg.ID,
6869
TeamID: ownerTeam.ID,
6970
Type: ut,
70-
AccessMode: perm.AccessModeOwner,
71+
AccessMode: up,
7172
})
7273
}
7374

0 commit comments

Comments
 (0)