mirror of https://github.com/go-gitea/gitea.git
New setting group 'Repository access'
This commit is contained in:
parent
5f6a7016bc
commit
c4546cd90b
|
@ -62,7 +62,7 @@ type CreateTeamForm struct {
|
||||||
Description string `binding:"MaxSize(255)"`
|
Description string `binding:"MaxSize(255)"`
|
||||||
Permission string
|
Permission string
|
||||||
Units []models.UnitType
|
Units []models.UnitType
|
||||||
IncludesAllRepositories bool
|
RepoAccess string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates the fields
|
// Validate validates the fields
|
||||||
|
|
|
@ -1495,6 +1495,7 @@ team_name = Team Name
|
||||||
team_desc = Description
|
team_desc = Description
|
||||||
team_name_helper = Team names should be short and memorable.
|
team_name_helper = Team names should be short and memorable.
|
||||||
team_desc_helper = Describe the purpose or role of the team.
|
team_desc_helper = Describe the purpose or role of the team.
|
||||||
|
team_access_desc = Repository access
|
||||||
team_permission_desc = Permission
|
team_permission_desc = Permission
|
||||||
team_unit_desc = Allow Access to Repository Sections
|
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.add_duplicate_users = User is already a team member.
|
||||||
teams.repos.none = No repositories could be accessed by this team.
|
teams.repos.none = No repositories could be accessed by this team.
|
||||||
teams.members.none = No members on 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 = 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_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 <strong>Read</strong> access to <strong>all repositories</strong>: members can view and clone repositories.
|
teams.all_repositories_read_permission_desc = This team grants <strong>Read</strong> access to <strong>all repositories</strong>: members can view and clone repositories.
|
||||||
|
|
|
@ -181,13 +181,14 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Data["PageIsOrgTeams"] = true
|
ctx.Data["PageIsOrgTeams"] = true
|
||||||
ctx.Data["PageIsOrgTeamsNew"] = true
|
ctx.Data["PageIsOrgTeamsNew"] = true
|
||||||
ctx.Data["Units"] = models.Units
|
ctx.Data["Units"] = models.Units
|
||||||
|
var includesAllRepositories = (form.RepoAccess == "all")
|
||||||
|
|
||||||
t := &models.Team{
|
t := &models.Team{
|
||||||
OrgID: ctx.Org.Organization.ID,
|
OrgID: ctx.Org.Organization.ID,
|
||||||
Name: form.TeamName,
|
Name: form.TeamName,
|
||||||
Description: form.Description,
|
Description: form.Description,
|
||||||
Authorize: models.ParseAccessMode(form.Permission),
|
Authorize: models.ParseAccessMode(form.Permission),
|
||||||
IncludesAllRepositories: form.IncludesAllRepositories,
|
IncludesAllRepositories: includesAllRepositories,
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.Authorize < models.AccessModeOwner {
|
if t.Authorize < models.AccessModeOwner {
|
||||||
|
@ -271,6 +272,7 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
|
|
||||||
isAuthChanged := false
|
isAuthChanged := false
|
||||||
isIncludeAllChanged := false
|
isIncludeAllChanged := false
|
||||||
|
var includesAllRepositories = (form.RepoAccess == "all")
|
||||||
if !t.IsOwnerTeam() {
|
if !t.IsOwnerTeam() {
|
||||||
// Validate permission level.
|
// Validate permission level.
|
||||||
auth := models.ParseAccessMode(form.Permission)
|
auth := models.ParseAccessMode(form.Permission)
|
||||||
|
@ -281,9 +283,9 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
t.Authorize = auth
|
t.Authorize = auth
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.IncludesAllRepositories != form.IncludesAllRepositories {
|
if t.IncludesAllRepositories != includesAllRepositories {
|
||||||
isIncludeAllChanged = true
|
isIncludeAllChanged = true
|
||||||
t.IncludesAllRepositories = form.IncludesAllRepositories
|
t.IncludesAllRepositories = includesAllRepositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.Description = form.Description
|
t.Description = form.Description
|
||||||
|
|
|
@ -24,6 +24,24 @@
|
||||||
<span class="help">{{.i18n.Tr "org.team_desc_helper"}}</span>
|
<span class="help">{{.i18n.Tr "org.team_desc_helper"}}</span>
|
||||||
</div>
|
</div>
|
||||||
{{if not (eq .Team.LowerName "owners")}}
|
{{if not (eq .Team.LowerName "owners")}}
|
||||||
|
<div class="grouped field">
|
||||||
|
<label>{{.i18n.Tr "org.team_access_desc"}}</label>
|
||||||
|
<br>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui radio checkbox">
|
||||||
|
<input type="radio" name="repo_access" value="specific" {{if not .Team.IncludesAllRepositories}}checked{{end}}>
|
||||||
|
<label>{{.i18n.Tr "org.teams.specific_repositories"}}</label>
|
||||||
|
<span class="help">{{.i18n.Tr "org.teams.specific_repositories_helper"}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui radio checkbox">
|
||||||
|
<input type="radio" name="repo_access" value="all" {{if .Team.IncludesAllRepositories}}checked{{end}}>
|
||||||
|
<label>{{.i18n.Tr "org.teams.all_repositories"}}</label>
|
||||||
|
<span class="help">{{.i18n.Tr "org.teams.all_repositories_helper"}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="grouped field">
|
<div class="grouped field">
|
||||||
<label>{{.i18n.Tr "org.team_permission_desc"}}</label>
|
<label>{{.i18n.Tr "org.team_permission_desc"}}</label>
|
||||||
<br>
|
<br>
|
||||||
|
@ -48,13 +66,6 @@
|
||||||
<span class="help">{{.i18n.Tr "org.teams.admin_access_helper"}}</span>
|
<span class="help">{{.i18n.Tr "org.teams.admin_access_helper"}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field">
|
|
||||||
<div class="ui checkbox">
|
|
||||||
<label for="includes_all_repositories">{{.i18n.Tr "org.teams.all_repositories"}}</label>
|
|
||||||
<input id="includes_all_repositories" name="includes_all_repositories" type="checkbox" {{if .Team.IncludesAllRepositories}}checked{{end}}>
|
|
||||||
<span class="help">{{.i18n.Tr "org.teams.all_repositories_helper"}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue