diff --git a/modules/auth/org.go b/modules/auth/org.go index 028b05427a..509358882a 100644 --- a/modules/auth/org.go +++ b/modules/auth/org.go @@ -58,11 +58,11 @@ func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs binding.Error // CreateTeamForm form for creating team type CreateTeamForm struct { - TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"` - Description string `binding:"MaxSize(255)"` - Permission string - Units []models.UnitType - IncludesAllRepositories bool + TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"` + Description string `binding:"MaxSize(255)"` + Permission string + Units []models.UnitType + RepoAccess string } // Validate validates the fields diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 8e83213fd7..33c6ebc9b5 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1495,6 +1495,7 @@ team_name = Team Name team_desc = Description team_name_helper = Team names should be short and memorable. team_desc_helper = Describe the purpose or role of the team. +team_access_desc = Repository access team_permission_desc = Permission team_unit_desc = Allow Access to Repository Sections @@ -1568,6 +1569,8 @@ teams.add_nonexistent_repo = "The repository you're trying to add does not exist teams.add_duplicate_users = User is already a team member. teams.repos.none = No repositories could be accessed by this team. teams.members.none = No members on this team. +teams.specific_repositories = Specific repositories +teams.specific_repositories_helper = Members will only have access to repositories explicitly added to the team. teams.all_repositories = All repositories teams.all_repositories_helper = Team has access to all repositories. Note that setting this will add all existing repositories to the team. teams.all_repositories_read_permission_desc = This team grants Read access to all repositories: members can view and clone repositories. diff --git a/routers/org/teams.go b/routers/org/teams.go index 689dd17288..24612459a4 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -181,13 +181,14 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) { ctx.Data["PageIsOrgTeams"] = true ctx.Data["PageIsOrgTeamsNew"] = true ctx.Data["Units"] = models.Units + var includesAllRepositories = (form.RepoAccess == "all") t := &models.Team{ OrgID: ctx.Org.Organization.ID, Name: form.TeamName, Description: form.Description, Authorize: models.ParseAccessMode(form.Permission), - IncludesAllRepositories: form.IncludesAllRepositories, + IncludesAllRepositories: includesAllRepositories, } if t.Authorize < models.AccessModeOwner { @@ -271,6 +272,7 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) { isAuthChanged := false isIncludeAllChanged := false + var includesAllRepositories = (form.RepoAccess == "all") if !t.IsOwnerTeam() { // Validate permission level. auth := models.ParseAccessMode(form.Permission) @@ -281,9 +283,9 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) { t.Authorize = auth } - if t.IncludesAllRepositories != form.IncludesAllRepositories { + if t.IncludesAllRepositories != includesAllRepositories { isIncludeAllChanged = true - t.IncludesAllRepositories = form.IncludesAllRepositories + t.IncludesAllRepositories = includesAllRepositories } } t.Description = form.Description diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl index f2dd3f47dc..e50a1777d2 100644 --- a/templates/org/team/new.tmpl +++ b/templates/org/team/new.tmpl @@ -24,6 +24,24 @@ {{.i18n.Tr "org.team_desc_helper"}} {{if not (eq .Team.LowerName "owners")}} +
+ +
+
+
+ + + {{.i18n.Tr "org.teams.specific_repositories_helper"}} +
+
+
+
+ + + {{.i18n.Tr "org.teams.all_repositories_helper"}} +
+
+

@@ -48,13 +66,6 @@ {{.i18n.Tr "org.teams.admin_access_helper"}}
-
-
- - - {{.i18n.Tr "org.teams.all_repositories_helper"}} -
-