Skip to content

Commit

Permalink
fix owner team permission
Browse files Browse the repository at this point in the history
  • Loading branch information
yp05327 committed Apr 13, 2023
1 parent e197fc7 commit 78fd2c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion models/organization/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,15 @@ func CreateOrganization(org *Organization, owner *user_model.User) (err error) {
// insert units for team
units := make([]TeamUnit, 0, len(unit.AllRepoUnitTypes))
for _, tp := range unit.AllRepoUnitTypes {
up := perm.AccessModeOwner
if tp == unit.TypeExternalTracker || tp == unit.TypeExternalWiki {
up = perm.AccessModeRead
}
units = append(units, TeamUnit{
OrgID: org.ID,
TeamID: t.ID,
Type: tp,
AccessMode: perm.AccessModeOwner,
AccessMode: up,
})
}

Expand Down
5 changes: 3 additions & 2 deletions tests/integration/api_org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ func TestAPIOrgCreate(t *testing.T) {

for _, ut := range unit_model.AllRepoUnitTypes {
// WIP: need to confirm
up := perm.AccessModeOwner
if ut == unit_model.TypeExternalTracker || ut == unit_model.TypeExternalWiki {
continue
up = perm.AccessModeRead
}
unittest.AssertExistsAndLoadBean(t, &org_model.TeamUnit{
OrgID: apiOrg.ID,
TeamID: ownerTeam.ID,
Type: ut,
AccessMode: perm.AccessModeOwner,
AccessMode: up,
})
}

Expand Down

0 comments on commit 78fd2c2

Please sign in to comment.