mirror of
https://github.com/go-gitea/terraform-provider-gitea.git
synced 2026-07-01 21:03:59 -04:00
feat: add unit support for teams (#124)
Reviewed-on: https://gitea.com/gitea/terraform-provider-gitea/pulls/124 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com> Co-authored-by: Egor Davydov <evdavydov@gmail.com> Co-committed-by: Egor Davydov <evdavydov@gmail.com>
This commit is contained in:
committed by
techknowlogick
parent
8a845513a6
commit
1e2743510f
@@ -60,7 +60,7 @@ resource "gitea_team" "test_team_restricted" {
|
||||
Can be `none`, `read`, `write`, `admin` or `owner`
|
||||
- `repositories` (List of String) List of Repositories that should be part of this team
|
||||
- `units` (String) List of types of Repositories that should be allowed to be created from Team members.
|
||||
Can be `repo.code`, `repo.issues`, `repo.ext_issues`, `repo.wiki`, `repo.pulls`, `repo.releases`, `repo.projects` and/or `repo.ext_wiki`
|
||||
Can be `repo.code`, `repo.issues`, `repo.ext_issues`, `repo.wiki`, `repo.pulls`, `repo.releases`, `repo.projects`, `repo.ext_wiki` and/or `repo.actions`
|
||||
|
||||
### Read-Only
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ func resourceTeamCreate(d *schema.ResourceData, meta interface{}) (err error) {
|
||||
if strings.Contains(d.Get(TeamUnits).(string), "repo.projects") {
|
||||
units = append(units, gitea.RepoUnitProjects)
|
||||
}
|
||||
if strings.Contains(d.Get(TeamUnits).(string), "repo.actions") {
|
||||
units = append(units, gitea.RepoUnitActions)
|
||||
}
|
||||
|
||||
includeAllRepos := d.Get(TeamIncludeAllReposFlag).(bool)
|
||||
|
||||
@@ -153,6 +156,9 @@ func resourceTeamUpdate(d *schema.ResourceData, meta interface{}) (err error) {
|
||||
if strings.Contains(d.Get(TeamUnits).(string), "repo.projects") {
|
||||
units = append(units, gitea.RepoUnitProjects)
|
||||
}
|
||||
if strings.Contains(d.Get(TeamUnits).(string), "repo.actions") {
|
||||
units = append(units, gitea.RepoUnitActions)
|
||||
}
|
||||
|
||||
opts := gitea.EditTeamOption{
|
||||
Name: d.Get(TeamName).(string),
|
||||
@@ -277,9 +283,9 @@ func resourceGiteaTeam() *schema.Resource {
|
||||
Type: schema.TypeString,
|
||||
Required: false,
|
||||
Optional: true,
|
||||
Default: "[repo.code, repo.issues, repo.ext_issues, repo.wiki, repo.pulls, repo.releases, repo.projects, repo.ext_wiki]",
|
||||
Default: "[repo.code, repo.issues, repo.ext_issues, repo.wiki, repo.pulls, repo.releases, repo.projects, repo.ext_wiki, repo.actions]",
|
||||
Description: "List of types of Repositories that should be allowed to be created from Team members.\n" +
|
||||
"Can be `repo.code`, `repo.issues`, `repo.ext_issues`, `repo.wiki`, `repo.pulls`, `repo.releases`, `repo.projects` and/or `repo.ext_wiki`",
|
||||
"Can be `repo.code`, `repo.issues`, `repo.ext_issues`, `repo.wiki`, `repo.pulls`, `repo.releases`, `repo.projects`, `repo.ext_wiki` and/or `repo.actions`",
|
||||
},
|
||||
"repositories": {
|
||||
Type: schema.TypeList,
|
||||
|
||||
Reference in New Issue
Block a user