Skip to content

Commit

Permalink
Merge pull request #306 from ministicraft/registry-permissions
Browse files Browse the repository at this point in the history
Add Manage Providers and Modules permissions
  • Loading branch information
brandonc authored Feb 11, 2022
2 parents ed64432 + 41553ff commit ad3525a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,8 @@ func createTeam(t *testing.T, client *Client, org *Organization) (*Team, func())
OrganizationAccess: &OrganizationAccessOptions{
ManagePolicies: Bool(true),
ManagePolicyOverrides: Bool(true),
ManageProviders: Bool(true),
ManageModules: Bool(true),
},
})
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions team.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type OrganizationAccess struct {
ManagePolicyOverrides bool `jsonapi:"attr,manage-policy-overrides"`
ManageWorkspaces bool `jsonapi:"attr,manage-workspaces"`
ManageVCSSettings bool `jsonapi:"attr,manage-vcs-settings"`
ManageProviders bool `jsonapi:"attr,manage-providers"`
ManageModules bool `jsonapi:"attr,manage-modules"`
}

// TeamPermissions represents the current user's permissions on the team.
Expand Down Expand Up @@ -122,6 +124,8 @@ type OrganizationAccessOptions struct {
ManagePolicyOverrides *bool `json:"manage-policy-overrides,omitempty"`
ManageWorkspaces *bool `json:"manage-workspaces,omitempty"`
ManageVCSSettings *bool `json:"manage-vcs-settings,omitempty"`
ManageProviders *bool `json:"manage-providers,omitempty"`
ManageModules *bool `json:"manage-modules,omitempty"`
}

func (o TeamCreateOptions) valid() error {
Expand Down
10 changes: 10 additions & 0 deletions team_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ func TestTeamsUpdate(t *testing.T) {
ManagePolicies: Bool(false),
ManageVCSSettings: Bool(true),
ManagePolicyOverrides: Bool(true),
ManageProviders: Bool(true),
ManageModules: Bool(false),
},
Visibility: String("organization"),
}
Expand Down Expand Up @@ -214,6 +216,14 @@ func TestTeamsUpdate(t *testing.T) {
*options.OrganizationAccess.ManagePolicyOverrides,
item.OrganizationAccess.ManagePolicyOverrides,
)
assert.Equal(t,
*options.OrganizationAccess.ManageProviders,
item.OrganizationAccess.ManageProviders,
)
assert.Equal(t,
*options.OrganizationAccess.ManageModules,
item.OrganizationAccess.ManageModules,
)
}
})

Expand Down

0 comments on commit ad3525a

Please sign in to comment.