summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorDavid Svantesson <davidsvantesson@gmail.com>2019-11-06 10:37:14 +0100
committerLauris BH <lauris@nix.lv>2019-11-06 11:37:14 +0200
commit72aa5a20ecf8aa3f7c110fd51c37994d950e0ba8 (patch)
tree3ac89c3c7b28572737b20dfe8cbeed259184d91b /modules
parent0109229928d8603ebedc2364943538f788635370 (diff)
downloadgitea-72aa5a20ecf8aa3f7c110fd51c37994d950e0ba8.tar.gz
gitea-72aa5a20ecf8aa3f7c110fd51c37994d950e0ba8.zip
Add team option to grant rights for all organization repositories (#8688)
* Add field IsAllRepositories to team * Add AllRepositories to team UI * Manage team with access to all repositories * Add field IsAllRepositories to team API * put backticks around table/column names * rename IsAllRepositories to IncludesAllRepositories * do not reload slice if already loaded * add repo to teams with access to all repositories when changing repo owner * improve tests for teams with access to all repositories * Merge branch 'master' * Change code for adding all repositories Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * fmt after merge * Change code in API EditTeam similar to EditTeamPost web interface Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Clarify that all repositories will be added Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * All repositories option under Permissions headline * New setting group 'Repository access' * Move check IncludeAllRepositories to removeRepository. * Revert "Move check IncludeAllRepositories to removeRepository." and add comment instead. This reverts commit 753b7d205be260b8be465b5291a02975a81f3093. * Clarify help text what options do.
Diffstat (limited to 'modules')
-rw-r--r--modules/auth/org.go1
-rw-r--r--modules/structs/org_team.go19
2 files changed, 12 insertions, 8 deletions
diff --git a/modules/auth/org.go b/modules/auth/org.go
index 94e659cb5b..509358882a 100644
--- a/modules/auth/org.go
+++ b/modules/auth/org.go
@@ -62,6 +62,7 @@ type CreateTeamForm struct {
Description string `binding:"MaxSize(255)"`
Permission string
Units []models.UnitType
+ RepoAccess string
}
// Validate validates the fields
diff --git a/modules/structs/org_team.go b/modules/structs/org_team.go
index bea4a10ad4..5053468b4a 100644
--- a/modules/structs/org_team.go
+++ b/modules/structs/org_team.go
@@ -7,10 +7,11 @@ package structs
// Team represents a team in an organization
type Team struct {
- ID int64 `json:"id"`
- Name string `json:"name"`
- Description string `json:"description"`
- Organization *Organization `json:"organization"`
+ ID int64 `json:"id"`
+ Name string `json:"name"`
+ Description string `json:"description"`
+ Organization *Organization `json:"organization"`
+ IncludesAllRepositories bool `json:"includes_all_repositories"`
// enum: none,read,write,admin,owner
Permission string `json:"permission"`
// example: ["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.ext_wiki"]
@@ -20,8 +21,9 @@ type Team struct {
// CreateTeamOption options for creating a team
type CreateTeamOption struct {
// required: true
- Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
- Description string `json:"description" binding:"MaxSize(255)"`
+ Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
+ Description string `json:"description" binding:"MaxSize(255)"`
+ IncludesAllRepositories bool `json:"includes_all_repositories"`
// enum: read,write,admin
Permission string `json:"permission"`
// example: ["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.ext_wiki"]
@@ -31,8 +33,9 @@ type CreateTeamOption struct {
// EditTeamOption options for editing a team
type EditTeamOption struct {
// required: true
- Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
- Description string `json:"description" binding:"MaxSize(255)"`
+ Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
+ Description string `json:"description" binding:"MaxSize(255)"`
+ IncludesAllRepositories bool `json:"includes_all_repositories"`
// enum: read,write,admin
Permission string `json:"permission"`
// example: ["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.ext_wiki"]