mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-09 15:28:22 -05:00
rename IsAllRepositories to IncludesAllRepositories
This commit is contained in:
parent
a02aa18985
commit
8216a2a210
16 changed files with 111 additions and 111 deletions
|
@ -55,35 +55,35 @@ func TestAPITeam(t *testing.T) {
|
||||||
|
|
||||||
// Create team.
|
// Create team.
|
||||||
teamToCreate := &api.CreateTeamOption{
|
teamToCreate := &api.CreateTeamOption{
|
||||||
Name: "team1",
|
Name: "team1",
|
||||||
Description: "team one",
|
Description: "team one",
|
||||||
IsAllRepositories: true,
|
IncludesAllRepositories: true,
|
||||||
Permission: "write",
|
Permission: "write",
|
||||||
Units: []string{"repo.code", "repo.issues"},
|
Units: []string{"repo.code", "repo.issues"},
|
||||||
}
|
}
|
||||||
req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/orgs/%s/teams?token=%s", org.Name, token), teamToCreate)
|
req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/orgs/%s/teams?token=%s", org.Name, token), teamToCreate)
|
||||||
resp = session.MakeRequest(t, req, http.StatusCreated)
|
resp = session.MakeRequest(t, req, http.StatusCreated)
|
||||||
DecodeJSON(t, resp, &apiTeam)
|
DecodeJSON(t, resp, &apiTeam)
|
||||||
checkTeamResponse(t, &apiTeam, teamToCreate.Name, teamToCreate.Description, teamToCreate.IsAllRepositories,
|
checkTeamResponse(t, &apiTeam, teamToCreate.Name, teamToCreate.Description, teamToCreate.IncludesAllRepositories,
|
||||||
teamToCreate.Permission, teamToCreate.Units)
|
teamToCreate.Permission, teamToCreate.Units)
|
||||||
checkTeamBean(t, apiTeam.ID, teamToCreate.Name, teamToCreate.Description, teamToCreate.IsAllRepositories,
|
checkTeamBean(t, apiTeam.ID, teamToCreate.Name, teamToCreate.Description, teamToCreate.IncludesAllRepositories,
|
||||||
teamToCreate.Permission, teamToCreate.Units)
|
teamToCreate.Permission, teamToCreate.Units)
|
||||||
teamID := apiTeam.ID
|
teamID := apiTeam.ID
|
||||||
|
|
||||||
// Edit team.
|
// Edit team.
|
||||||
teamToEdit := &api.EditTeamOption{
|
teamToEdit := &api.EditTeamOption{
|
||||||
Name: "teamone",
|
Name: "teamone",
|
||||||
Description: "team 1",
|
Description: "team 1",
|
||||||
IsAllRepositories: false,
|
IncludesAllRepositories: false,
|
||||||
Permission: "admin",
|
Permission: "admin",
|
||||||
Units: []string{"repo.code", "repo.pulls", "repo.releases"},
|
Units: []string{"repo.code", "repo.pulls", "repo.releases"},
|
||||||
}
|
}
|
||||||
req = NewRequestWithJSON(t, "PATCH", fmt.Sprintf("/api/v1/teams/%d?token=%s", teamID, token), teamToEdit)
|
req = NewRequestWithJSON(t, "PATCH", fmt.Sprintf("/api/v1/teams/%d?token=%s", teamID, token), teamToEdit)
|
||||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
DecodeJSON(t, resp, &apiTeam)
|
DecodeJSON(t, resp, &apiTeam)
|
||||||
checkTeamResponse(t, &apiTeam, teamToEdit.Name, teamToEdit.Description, teamToEdit.IsAllRepositories,
|
checkTeamResponse(t, &apiTeam, teamToEdit.Name, teamToEdit.Description, teamToEdit.IncludesAllRepositories,
|
||||||
teamToEdit.Permission, teamToEdit.Units)
|
teamToEdit.Permission, teamToEdit.Units)
|
||||||
checkTeamBean(t, apiTeam.ID, teamToEdit.Name, teamToEdit.Description, teamToEdit.IsAllRepositories,
|
checkTeamBean(t, apiTeam.ID, teamToEdit.Name, teamToEdit.Description, teamToEdit.IncludesAllRepositories,
|
||||||
teamToEdit.Permission, teamToEdit.Units)
|
teamToEdit.Permission, teamToEdit.Units)
|
||||||
|
|
||||||
// Read team.
|
// Read team.
|
||||||
|
@ -91,7 +91,7 @@ func TestAPITeam(t *testing.T) {
|
||||||
req = NewRequestf(t, "GET", "/api/v1/teams/%d?token="+token, teamID)
|
req = NewRequestf(t, "GET", "/api/v1/teams/%d?token="+token, teamID)
|
||||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
DecodeJSON(t, resp, &apiTeam)
|
DecodeJSON(t, resp, &apiTeam)
|
||||||
checkTeamResponse(t, &apiTeam, teamRead.Name, teamRead.Description, teamRead.IsAllRepositories,
|
checkTeamResponse(t, &apiTeam, teamRead.Name, teamRead.Description, teamRead.IncludesAllRepositories,
|
||||||
teamRead.Authorize.String(), teamRead.GetUnitNames())
|
teamRead.Authorize.String(), teamRead.GetUnitNames())
|
||||||
|
|
||||||
// Delete team.
|
// Delete team.
|
||||||
|
@ -100,18 +100,18 @@ func TestAPITeam(t *testing.T) {
|
||||||
models.AssertNotExistsBean(t, &models.Team{ID: teamID})
|
models.AssertNotExistsBean(t, &models.Team{ID: teamID})
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkTeamResponse(t *testing.T, apiTeam *api.Team, name, description string, isAllRepositories bool, permission string, units []string) {
|
func checkTeamResponse(t *testing.T, apiTeam *api.Team, name, description string, includesAllRepositories bool, permission string, units []string) {
|
||||||
assert.Equal(t, name, apiTeam.Name, "name")
|
assert.Equal(t, name, apiTeam.Name, "name")
|
||||||
assert.Equal(t, description, apiTeam.Description, "description")
|
assert.Equal(t, description, apiTeam.Description, "description")
|
||||||
assert.Equal(t, isAllRepositories, apiTeam.IsAllRepositories, "isAllRepositories")
|
assert.Equal(t, includesAllRepositories, apiTeam.IncludesAllRepositories, "includesAllRepositories")
|
||||||
assert.Equal(t, permission, apiTeam.Permission, "permission")
|
assert.Equal(t, permission, apiTeam.Permission, "permission")
|
||||||
sort.StringSlice(units).Sort()
|
sort.StringSlice(units).Sort()
|
||||||
sort.StringSlice(apiTeam.Units).Sort()
|
sort.StringSlice(apiTeam.Units).Sort()
|
||||||
assert.EqualValues(t, units, apiTeam.Units, "units")
|
assert.EqualValues(t, units, apiTeam.Units, "units")
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkTeamBean(t *testing.T, id int64, name, description string, isAllRepositories bool, permission string, units []string) {
|
func checkTeamBean(t *testing.T, id int64, name, description string, includesAllRepositories bool, permission string, units []string) {
|
||||||
team := models.AssertExistsAndLoadBean(t, &models.Team{ID: id}).(*models.Team)
|
team := models.AssertExistsAndLoadBean(t, &models.Team{ID: id}).(*models.Team)
|
||||||
assert.NoError(t, team.GetUnits(), "GetUnits")
|
assert.NoError(t, team.GetUnits(), "GetUnits")
|
||||||
checkTeamResponse(t, convert.ToTeam(team), name, description, isAllRepositories, permission, units)
|
checkTeamResponse(t, convert.ToTeam(team), name, description, includesAllRepositories, permission, units)
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@ var migrations = []Migration{
|
||||||
// v84 -> v85
|
// v84 -> v85
|
||||||
NewMigration("add table to store original imported gpg keys", addGPGKeyImport),
|
NewMigration("add table to store original imported gpg keys", addGPGKeyImport),
|
||||||
// v85 -> v86
|
// v85 -> v86
|
||||||
NewMigration("add is_all_repositories to teams", addTeamIsAllRepositories),
|
NewMigration("add includes_all_repositories to teams", addTeamIncludesAllRepositories),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate database to current version
|
// Migrate database to current version
|
||||||
|
|
|
@ -8,18 +8,18 @@ import (
|
||||||
"github.com/go-xorm/xorm"
|
"github.com/go-xorm/xorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addTeamIsAllRepositories(x *xorm.Engine) error {
|
func addTeamIncludesAllRepositories(x *xorm.Engine) error {
|
||||||
|
|
||||||
type Team struct {
|
type Team struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64 `xorm:"pk autoincr"`
|
||||||
IsAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
|
IncludesAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := x.Sync2(new(Team)); err != nil {
|
if err := x.Sync2(new(Team)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := x.Exec("UPDATE `team` SET `is_all_repositories` = ? WHERE `name`=?",
|
_, err := x.Exec("UPDATE `team` SET `includes_all_repositories` = ? WHERE `name`=?",
|
||||||
true, "Owners")
|
true, "Owners")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,12 +152,12 @@ func CreateOrganization(org, owner *User) (err error) {
|
||||||
|
|
||||||
// Create default owner team.
|
// Create default owner team.
|
||||||
t := &Team{
|
t := &Team{
|
||||||
OrgID: org.ID,
|
OrgID: org.ID,
|
||||||
LowerName: strings.ToLower(ownerTeamName),
|
LowerName: strings.ToLower(ownerTeamName),
|
||||||
Name: ownerTeamName,
|
Name: ownerTeamName,
|
||||||
Authorize: AccessModeOwner,
|
Authorize: AccessModeOwner,
|
||||||
NumMembers: 1,
|
NumMembers: 1,
|
||||||
IsAllRepositories: true,
|
IncludesAllRepositories: true,
|
||||||
}
|
}
|
||||||
if _, err = sess.Insert(t); err != nil {
|
if _, err = sess.Insert(t); err != nil {
|
||||||
return fmt.Errorf("insert owner team: %v", err)
|
return fmt.Errorf("insert owner team: %v", err)
|
||||||
|
|
|
@ -21,18 +21,18 @@ const ownerTeamName = "Owners"
|
||||||
|
|
||||||
// Team represents a organization team.
|
// Team represents a organization team.
|
||||||
type Team struct {
|
type Team struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64 `xorm:"pk autoincr"`
|
||||||
OrgID int64 `xorm:"INDEX"`
|
OrgID int64 `xorm:"INDEX"`
|
||||||
LowerName string
|
LowerName string
|
||||||
Name string
|
Name string
|
||||||
Description string
|
Description string
|
||||||
Authorize AccessMode
|
Authorize AccessMode
|
||||||
Repos []*Repository `xorm:"-"`
|
Repos []*Repository `xorm:"-"`
|
||||||
Members []*User `xorm:"-"`
|
Members []*User `xorm:"-"`
|
||||||
NumRepos int
|
NumRepos int
|
||||||
NumMembers int
|
NumMembers int
|
||||||
Units []*TeamUnit `xorm:"-"`
|
Units []*TeamUnit `xorm:"-"`
|
||||||
IsAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
|
IncludesAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorFormat provides a basic color format for a Team
|
// ColorFormat provides a basic color format for a Team
|
||||||
|
@ -247,7 +247,7 @@ func (t *Team) RemoveRepository(repoID int64) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.IsAllRepositories {
|
if t.IncludesAllRepositories {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ func NewTeam(t *Team) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add all repositories to the team if it has access to all of them.
|
// Add all repositories to the team if it has access to all of them.
|
||||||
if t.IsAllRepositories {
|
if t.IncludesAllRepositories {
|
||||||
err = t.addAllRepositories(sess)
|
err = t.addAllRepositories(sess)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("addAllRepositories: %v", err)
|
return fmt.Errorf("addAllRepositories: %v", err)
|
||||||
|
@ -463,7 +463,7 @@ func UpdateTeam(t *Team, authChanged bool) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add all repositories to the team if it has access to all of them.
|
// Add all repositories to the team if it has access to all of them.
|
||||||
if t.IsAllRepositories {
|
if t.IncludesAllRepositories {
|
||||||
err = t.addAllRepositories(sess)
|
err = t.addAllRepositories(sess)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("addAllRepositories: %v", err)
|
return fmt.Errorf("addAllRepositories: %v", err)
|
||||||
|
|
|
@ -397,7 +397,7 @@ func TestAllRepositoriesTeams(t *testing.T) {
|
||||||
// Check Owner team.
|
// Check Owner team.
|
||||||
ownerTeam, err := org.GetOwnerTeam()
|
ownerTeam, err := org.GetOwnerTeam()
|
||||||
assert.NoError(t, err, "GetOwnerTeam")
|
assert.NoError(t, err, "GetOwnerTeam")
|
||||||
assert.True(t, ownerTeam.IsAllRepositories, "Owner team is all repositories")
|
assert.True(t, ownerTeam.IncludesAllRepositories, "Owner team includes all repositories")
|
||||||
|
|
||||||
// Create repos.
|
// Create repos.
|
||||||
repoIds := make([]int64, 0)
|
repoIds := make([]int64, 0)
|
||||||
|
@ -413,28 +413,28 @@ func TestAllRepositoriesTeams(t *testing.T) {
|
||||||
teams := []*Team{
|
teams := []*Team{
|
||||||
ownerTeam,
|
ownerTeam,
|
||||||
{
|
{
|
||||||
OrgID: org.ID,
|
OrgID: org.ID,
|
||||||
Name: "team one",
|
Name: "team one",
|
||||||
Authorize: AccessModeRead,
|
Authorize: AccessModeRead,
|
||||||
IsAllRepositories: true,
|
IncludesAllRepositories: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
OrgID: org.ID,
|
OrgID: org.ID,
|
||||||
Name: "team 2",
|
Name: "team 2",
|
||||||
Authorize: AccessModeRead,
|
Authorize: AccessModeRead,
|
||||||
IsAllRepositories: false,
|
IncludesAllRepositories: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
OrgID: org.ID,
|
OrgID: org.ID,
|
||||||
Name: "team three",
|
Name: "team three",
|
||||||
Authorize: AccessModeWrite,
|
Authorize: AccessModeWrite,
|
||||||
IsAllRepositories: true,
|
IncludesAllRepositories: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
OrgID: org.ID,
|
OrgID: org.ID,
|
||||||
Name: "team 4",
|
Name: "team 4",
|
||||||
Authorize: AccessModeWrite,
|
Authorize: AccessModeWrite,
|
||||||
IsAllRepositories: false,
|
IncludesAllRepositories: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
repoCounts := []int{3, 3, 0, 3, 0}
|
repoCounts := []int{3, 3, 0, 3, 0}
|
||||||
|
@ -447,8 +447,8 @@ func TestAllRepositoriesTeams(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update teams and check repo count.
|
// Update teams and check repo count.
|
||||||
teams[3].IsAllRepositories = false
|
teams[3].IncludesAllRepositories = false
|
||||||
teams[4].IsAllRepositories = true
|
teams[4].IncludesAllRepositories = true
|
||||||
repoCounts[4] = 3
|
repoCounts[4] = 3
|
||||||
for i, team := range teams {
|
for i, team := range teams {
|
||||||
assert.NoError(t, UpdateTeam(team, false), "team %d: UpdateTeam", i)
|
assert.NoError(t, UpdateTeam(team, false), "team %d: UpdateTeam", i)
|
||||||
|
|
|
@ -1361,7 +1361,7 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err
|
||||||
return fmt.Errorf("GetTeams: %v", err)
|
return fmt.Errorf("GetTeams: %v", err)
|
||||||
}
|
}
|
||||||
for _, t := range u.Teams {
|
for _, t := range u.Teams {
|
||||||
if t.IsAllRepositories {
|
if t.IncludesAllRepositories {
|
||||||
if err := t.addRepository(e, repo); err != nil {
|
if err := t.addRepository(e, repo); err != nil {
|
||||||
return fmt.Errorf("addRepository: %v", err)
|
return fmt.Errorf("addRepository: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,11 +56,11 @@ func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs binding.Error
|
||||||
|
|
||||||
// CreateTeamForm form for creating team
|
// CreateTeamForm form for creating team
|
||||||
type CreateTeamForm struct {
|
type CreateTeamForm struct {
|
||||||
TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
|
TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
|
||||||
Description string `binding:"MaxSize(255)"`
|
Description string `binding:"MaxSize(255)"`
|
||||||
Permission string
|
Permission string
|
||||||
Units []models.UnitType
|
Units []models.UnitType
|
||||||
IsAllRepositories bool
|
IncludesAllRepositories bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates the fields
|
// Validate validates the fields
|
||||||
|
|
|
@ -219,12 +219,12 @@ func ToOrganization(org *models.User) *api.Organization {
|
||||||
// ToTeam convert models.Team to api.Team
|
// ToTeam convert models.Team to api.Team
|
||||||
func ToTeam(team *models.Team) *api.Team {
|
func ToTeam(team *models.Team) *api.Team {
|
||||||
return &api.Team{
|
return &api.Team{
|
||||||
ID: team.ID,
|
ID: team.ID,
|
||||||
Name: team.Name,
|
Name: team.Name,
|
||||||
Description: team.Description,
|
Description: team.Description,
|
||||||
IsAllRepositories: team.IsAllRepositories,
|
IncludesAllRepositories: team.IncludesAllRepositories,
|
||||||
Permission: team.Authorize.String(),
|
Permission: team.Authorize.String(),
|
||||||
Units: team.GetUnitNames(),
|
Units: team.GetUnitNames(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,11 +126,11 @@ func CreateTeam(ctx *context.APIContext, form api.CreateTeamOption) {
|
||||||
// "201":
|
// "201":
|
||||||
// "$ref": "#/responses/Team"
|
// "$ref": "#/responses/Team"
|
||||||
team := &models.Team{
|
team := &models.Team{
|
||||||
OrgID: ctx.Org.Organization.ID,
|
OrgID: ctx.Org.Organization.ID,
|
||||||
Name: form.Name,
|
Name: form.Name,
|
||||||
Description: form.Description,
|
Description: form.Description,
|
||||||
IsAllRepositories: form.IsAllRepositories,
|
IncludesAllRepositories: form.IncludesAllRepositories,
|
||||||
Authorize: models.ParseAccessMode(form.Permission),
|
Authorize: models.ParseAccessMode(form.Permission),
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTypes := models.FindUnitTypes(form.Units...)
|
unitTypes := models.FindUnitTypes(form.Units...)
|
||||||
|
@ -183,7 +183,7 @@ func EditTeam(ctx *context.APIContext, form api.EditTeamOption) {
|
||||||
team := ctx.Org.Team
|
team := ctx.Org.Team
|
||||||
team.Name = form.Name
|
team.Name = form.Name
|
||||||
team.Description = form.Description
|
team.Description = form.Description
|
||||||
team.IsAllRepositories = form.IsAllRepositories
|
team.IncludesAllRepositories = form.IncludesAllRepositories
|
||||||
team.Authorize = models.ParseAccessMode(form.Permission)
|
team.Authorize = models.ParseAccessMode(form.Permission)
|
||||||
unitTypes := models.FindUnitTypes(form.Units...)
|
unitTypes := models.FindUnitTypes(form.Units...)
|
||||||
|
|
||||||
|
|
|
@ -182,11 +182,11 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Data["Units"] = models.Units
|
ctx.Data["Units"] = models.Units
|
||||||
|
|
||||||
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),
|
||||||
IsAllRepositories: form.IsAllRepositories,
|
IncludesAllRepositories: form.IncludesAllRepositories,
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.Authorize < models.AccessModeOwner {
|
if t.Authorize < models.AccessModeOwner {
|
||||||
|
@ -279,7 +279,7 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
t.Authorize = auth
|
t.Authorize = auth
|
||||||
}
|
}
|
||||||
|
|
||||||
t.IsAllRepositories = form.IsAllRepositories
|
t.IncludesAllRepositories = form.IncludesAllRepositories
|
||||||
}
|
}
|
||||||
t.Description = form.Description
|
t.Description = form.Description
|
||||||
if t.Authorize < models.AccessModeOwner {
|
if t.Authorize < models.AccessModeOwner {
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
{{if not (eq .Team.LowerName "owners")}}
|
{{if not (eq .Team.LowerName "owners")}}
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<label for="is_all_repositories">{{.i18n.Tr "org.teams.all_repositories"}}</label>
|
<label for="includes_all_repositories">{{.i18n.Tr "org.teams.all_repositories"}}</label>
|
||||||
<input id="is_all_repositories" name="is_all_repositories" type="checkbox" {{if .Team.IsAllRepositories}}checked{{end}}>
|
<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>
|
<span class="help">{{.i18n.Tr "org.teams.all_repositories_helper"}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{{template "org/team/sidebar" .}}
|
{{template "org/team/sidebar" .}}
|
||||||
<div class="ui ten wide column">
|
<div class="ui ten wide column">
|
||||||
{{template "org/team/navbar" .}}
|
{{template "org/team/navbar" .}}
|
||||||
{{$canAddRemove := and $.IsOrganizationOwner (not $.Team.IsAllRepositories)}}
|
{{$canAddRemove := and $.IsOrganizationOwner (not $.Team.IncludesAllRepositories)}}
|
||||||
{{if $canAddRemove}}
|
{{if $canAddRemove}}
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
<form class="ui form" id="add-repo-form" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/add" method="post">
|
<form class="ui form" id="add-repo-form" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/add" method="post">
|
||||||
|
|
|
@ -22,19 +22,19 @@
|
||||||
{{if eq .Team.LowerName "owners"}}
|
{{if eq .Team.LowerName "owners"}}
|
||||||
{{.i18n.Tr "org.teams.owners_permission_desc" | Str2html}}
|
{{.i18n.Tr "org.teams.owners_permission_desc" | Str2html}}
|
||||||
{{else if (eq .Team.Authorize 1)}}
|
{{else if (eq .Team.Authorize 1)}}
|
||||||
{{if .Team.IsAllRepositories}}
|
{{if .Team.IncludesAllRepositories}}
|
||||||
{{.i18n.Tr "org.teams.all_repositories_read_permission_desc" | Str2html}}
|
{{.i18n.Tr "org.teams.all_repositories_read_permission_desc" | Str2html}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{.i18n.Tr "org.teams.read_permission_desc" | Str2html}}
|
{{.i18n.Tr "org.teams.read_permission_desc" | Str2html}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else if (eq .Team.Authorize 2)}}
|
{{else if (eq .Team.Authorize 2)}}
|
||||||
{{if .Team.IsAllRepositories}}
|
{{if .Team.IncludesAllRepositories}}
|
||||||
{{.i18n.Tr "org.teams.all_repositories_write_permission_desc" | Str2html}}
|
{{.i18n.Tr "org.teams.all_repositories_write_permission_desc" | Str2html}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{.i18n.Tr "org.teams.write_permission_desc" | Str2html}}
|
{{.i18n.Tr "org.teams.write_permission_desc" | Str2html}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else if (eq .Team.Authorize 3)}}
|
{{else if (eq .Team.Authorize 3)}}
|
||||||
{{if .Team.IsAllRepositories}}
|
{{if .Team.IncludesAllRepositories}}
|
||||||
{{.i18n.Tr "org.teams.all_repositories_admin_permission_desc" | Str2html}}
|
{{.i18n.Tr "org.teams.all_repositories_admin_permission_desc" | Str2html}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{.i18n.Tr "org.teams.admin_permission_desc" | Str2html}}
|
{{.i18n.Tr "org.teams.admin_permission_desc" | Str2html}}
|
||||||
|
|
|
@ -7298,9 +7298,9 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "Description"
|
"x-go-name": "Description"
|
||||||
},
|
},
|
||||||
"is_all_repositories": {
|
"includes_all_repositories": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"x-go-name": "IsAllRepositories"
|
"x-go-name": "IncludesAllRepositories"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -7737,9 +7737,9 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "Description"
|
"x-go-name": "Description"
|
||||||
},
|
},
|
||||||
"is_all_repositories": {
|
"includes_all_repositories": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"x-go-name": "IsAllRepositories"
|
"x-go-name": "IncludesAllRepositories"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -9260,9 +9260,9 @@
|
||||||
"format": "int64",
|
"format": "int64",
|
||||||
"x-go-name": "ID"
|
"x-go-name": "ID"
|
||||||
},
|
},
|
||||||
"is_all_repositories": {
|
"includes_all_repositories": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"x-go-name": "IsAllRepositories"
|
"x-go-name": "IncludesAllRepositories"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
22
vendor/code.gitea.io/sdk/gitea/org_team.go
generated
vendored
22
vendor/code.gitea.io/sdk/gitea/org_team.go
generated
vendored
|
@ -7,11 +7,11 @@ package gitea
|
||||||
|
|
||||||
// Team represents a team in an organization
|
// Team represents a team in an organization
|
||||||
type Team struct {
|
type Team struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Organization *Organization `json:"organization"`
|
Organization *Organization `json:"organization"`
|
||||||
IsAllRepositories bool `json:"is_all_repositories"`
|
IncludesAllRepositories bool `json:"includes_all_repositories"`
|
||||||
// enum: none,read,write,admin,owner
|
// enum: none,read,write,admin,owner
|
||||||
Permission string `json:"permission"`
|
Permission string `json:"permission"`
|
||||||
// enum: repo.code,repo.issues,repo.ext_issues,repo.wiki,repo.pulls,repo.releases,repo.ext_wiki
|
// enum: repo.code,repo.issues,repo.ext_issues,repo.wiki,repo.pulls,repo.releases,repo.ext_wiki
|
||||||
|
@ -21,9 +21,9 @@ type Team struct {
|
||||||
// CreateTeamOption options for creating a team
|
// CreateTeamOption options for creating a team
|
||||||
type CreateTeamOption struct {
|
type CreateTeamOption struct {
|
||||||
// required: true
|
// required: true
|
||||||
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
|
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
|
||||||
Description string `json:"description" binding:"MaxSize(255)"`
|
Description string `json:"description" binding:"MaxSize(255)"`
|
||||||
IsAllRepositories bool `json:"is_all_repositories"`
|
IncludesAllRepositories bool `json:"includes_all_repositories"`
|
||||||
// enum: read,write,admin
|
// enum: read,write,admin
|
||||||
Permission string `json:"permission"`
|
Permission string `json:"permission"`
|
||||||
// enum: repo.code,repo.issues,repo.ext_issues,repo.wiki,repo.pulls,repo.releases,repo.ext_wiki
|
// enum: repo.code,repo.issues,repo.ext_issues,repo.wiki,repo.pulls,repo.releases,repo.ext_wiki
|
||||||
|
@ -33,9 +33,9 @@ type CreateTeamOption struct {
|
||||||
// EditTeamOption options for editing a team
|
// EditTeamOption options for editing a team
|
||||||
type EditTeamOption struct {
|
type EditTeamOption struct {
|
||||||
// required: true
|
// required: true
|
||||||
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
|
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
|
||||||
Description string `json:"description" binding:"MaxSize(255)"`
|
Description string `json:"description" binding:"MaxSize(255)"`
|
||||||
IsAllRepositories bool `json:"is_all_repositories"`
|
IncludesAllRepositories bool `json:"includes_all_repositories"`
|
||||||
// enum: read,write,admin
|
// enum: read,write,admin
|
||||||
Permission string `json:"permission"`
|
Permission string `json:"permission"`
|
||||||
// enum: repo.code,repo.issues,repo.ext_issues,repo.wiki,repo.pulls,repo.releases,repo.ext_wiki
|
// enum: repo.code,repo.issues,repo.ext_issues,repo.wiki,repo.pulls,repo.releases,repo.ext_wiki
|
||||||
|
|
Loading…
Reference in a new issue