Skip to content

Commit 4b094df

Browse files
export GetUnitPerms from routers/web/org package for reuse in future group route handlers
1 parent 0068a50 commit 4b094df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

routers/web/org/teams.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func NewTeam(ctx *context.Context) {
295295
// - Org owner need to click the permission for each unit, but can't just set a common "write" permission for all units.
296296
//
297297
// Ideally, "team.authorize=write" should mean the team has write access to all units including newly (future) added ones.
298-
func getUnitPerms(forms url.Values, teamPermission perm.AccessMode) map[unit_model.Type]perm.AccessMode {
298+
func GetUnitPerms(forms url.Values, teamPermission perm.AccessMode) map[unit_model.Type]perm.AccessMode {
299299
unitPerms := make(map[unit_model.Type]perm.AccessMode)
300300
for _, ut := range unit_model.AllRepoUnitTypes {
301301
// Default access mode is none
@@ -326,7 +326,7 @@ func NewTeamPost(ctx *context.Context) {
326326
form := web.GetForm(ctx).(*forms.CreateTeamForm)
327327
includesAllRepositories := form.RepoAccess == "all"
328328
teamPermission := perm.ParseAccessMode(form.Permission, perm.AccessModeNone, perm.AccessModeAdmin)
329-
unitPerms := getUnitPerms(ctx.Req.Form, teamPermission)
329+
unitPerms := GetUnitPerms(ctx.Req.Form, teamPermission)
330330

331331
t := &org_model.Team{
332332
OrgID: ctx.Org.Organization.ID,
@@ -492,7 +492,7 @@ func EditTeamPost(ctx *context.Context) {
492492
form := web.GetForm(ctx).(*forms.CreateTeamForm)
493493
t := ctx.Org.Team
494494
teamPermission := perm.ParseAccessMode(form.Permission, perm.AccessModeNone, perm.AccessModeAdmin)
495-
unitPerms := getUnitPerms(ctx.Req.Form, teamPermission)
495+
unitPerms := GetUnitPerms(ctx.Req.Form, teamPermission)
496496
isAuthChanged := false
497497
isIncludeAllChanged := false
498498
includesAllRepositories := form.RepoAccess == "all"

0 commit comments

Comments
 (0)