Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ReadWorkspaces and ReadProjects to Orgs #614

Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Enhancements
* Adds `BaseURL` and `BaseRegistryURL` methods to `Client` to expose its configuration by @brandonc [#638](https://github.com/hashicorp/go-tfe/pull/638)
* Adds `ReadWorkspaces` and `ReadProjects` permissions to `Organizations` by @JuliannaTetreault [#614](https://github.com/hashicorp/go-tfe/pull/614)

## Bug Fixes

Expand Down
4 changes: 4 additions & 0 deletions team.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ type OrganizationAccess struct {
ManageRunTasks bool `jsonapi:"attr,manage-run-tasks"`
// **Note: This field is still in BETA and subject to change.**
ManageProjects bool `jsonapi:"attr,manage-projects"`
ReadWorkspaces bool `jsonapi:"attr,read-workspaces"`
ReadProjects bool `jsonapi:"attr,read-projects"`
}

// TeamPermissions represents the current user's permissions on the team.
Expand Down Expand Up @@ -151,6 +153,8 @@ type OrganizationAccessOptions struct {
ManageRunTasks *bool `json:"manage-run-tasks,omitempty"`
// **Note: This field is still in BETA and subject to change.**
ManageProjects *bool `json:"manage-projects,omitempty"`
ReadWorkspaces *bool `json:"read-workspaces,omitempty"`
ReadProjects *bool `json:"read-projects,omitempty"`
}

// List all the teams of the given organization.
Expand Down
4 changes: 4 additions & 0 deletions team_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ func TestTeam_Unmarshal(t *testing.T) {
"manage-workspaces": true,
"manage-vcs-settings": true,
"manage-projects": true,
"read-workspaces": true,
"read-projects": true,
},
"permissions": map[string]interface{}{
"can-destroy": true,
Expand All @@ -341,6 +343,8 @@ func TestTeam_Unmarshal(t *testing.T) {
assert.Equal(t, team.OrganizationAccess.ManageVCSSettings, true)
assert.Equal(t, team.OrganizationAccess.ManagePolicies, true)
assert.Equal(t, team.OrganizationAccess.ManageProjects, true)
assert.Equal(t, team.OrganizationAccess.ReadWorkspaces, true)
assert.Equal(t, team.OrganizationAccess.ReadProjects, true)
assert.Equal(t, team.Permissions.CanDestroy, true)
assert.Equal(t, team.Permissions.CanUpdateMembership, true)
}
Expand Down