diff --git a/modules/auth/org.go b/modules/auth/org.go index d51ab75d3a..25963a5a07 100644 --- a/modules/auth/org.go +++ b/modules/auth/org.go @@ -56,10 +56,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 + TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"` + Description string `binding:"MaxSize(255)"` + Permission string + Units []models.UnitType + IsAllRepositories bool } // Validate validates the fields diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index eedede2a05..178fc5a075 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1452,6 +1452,11 @@ 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.all_repositories = All repositories +teams.all_repositories_helper = Team has access to all repositories. +teams.all_repositories_read_permission_desc = This team grants Read access to all repositories: members can view and clone repositories. +teams.all_repositories_write_permission_desc = This team grants Write access to all repositories: members can read from and push to repositories. +teams.all_repositories_admin_permission_desc = This team grants Admin access to all repositories: members can read from, push to and add collaborators to repositories. [admin] dashboard = Dashboard diff --git a/routers/org/teams.go b/routers/org/teams.go index 27db14e4b5..dc52fb5b0e 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -1,4 +1,5 @@ // Copyright 2014 The Gogs Authors. All rights reserved. +// Copyright 2019 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. @@ -181,10 +182,11 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) { ctx.Data["Units"] = models.Units t := &models.Team{ - OrgID: ctx.Org.Organization.ID, - Name: form.TeamName, - Description: form.Description, - Authorize: models.ParseAccessMode(form.Permission), + OrgID: ctx.Org.Organization.ID, + Name: form.TeamName, + Description: form.Description, + Authorize: models.ParseAccessMode(form.Permission), + IsAllRepositories: form.IsAllRepositories, } if t.Authorize < models.AccessModeOwner { @@ -276,6 +278,8 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) { isAuthChanged = true t.Authorize = auth } + + t.IsAllRepositories = form.IsAllRepositories } t.Description = form.Description if t.Authorize < models.AccessModeOwner { diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl index fb79c9b7fb..c32b482224 100644 --- a/templates/org/team/new.tmpl +++ b/templates/org/team/new.tmpl @@ -24,6 +24,13 @@ {{.i18n.Tr "org.team_desc_helper"}} {{if not (eq .Team.LowerName "owners")}} +