Skip to content

Commit

Permalink
Remove duplicated AccountMemberRole
Browse files Browse the repository at this point in the history
`AccountMemberRole` is actually the same thing as `AccountRole` however
due to running across multiple branches, we needed this in both places.

This removes the duplication and leaves `AccountRole`.
  • Loading branch information
jacobbednarz committed Jun 29, 2018
1 parent 4b802d2 commit db2b323
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
17 changes: 1 addition & 16 deletions account_members.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type AccountMember struct {
Code string `json:"code"`
User AccountMemberUserDetails `json:"user"`
Status string `json:"status"`
Roles []AccountMemberRole `json:"roles"`
Roles []AccountRole `json:"roles"`
}

// AccountMemberUserDetails outlines all the personal information about
Expand All @@ -28,21 +28,6 @@ type AccountMemberUserDetails struct {
TwoFactorAuthenticationEnabled bool
}

// AccountMemberRole defines the roles that a member can have attached.
type AccountMemberRole struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Permissions map[string]AccountMemberRolePermission `json:"permissions"`
}

// AccountMemberRolePermission is the shared structure for all permissions
// that can be assigned to a member.
type AccountMemberRolePermission struct {
Read bool `json:"read"`
Edit bool `json:"edit"`
}

// AccountMembersListResponse represents the response from the list
// account members endpoint.
type AccountMembersListResponse struct {
Expand Down
12 changes: 6 additions & 6 deletions account_members_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ var expectedAccountMemberStruct = AccountMember{
TwoFactorAuthenticationEnabled: false,
},
Status: "accepted",
Roles: []AccountMemberRole{
Roles: []AccountRole{
{
ID: "3536bcfad5faccb999b47003c79917fb",
Name: "Account Administrator",
Description: "Administrative access to the entire Account",
Permissions: map[string]AccountMemberRolePermission{
Permissions: map[string]AccountRolePermission{
"analytics": {Read: true, Edit: true},
"billing": {Read: true, Edit: false},
},
Expand All @@ -40,12 +40,12 @@ var expectedNewAccountMemberStruct = AccountMember{
TwoFactorAuthenticationEnabled: false,
},
Status: "pending",
Roles: []AccountMemberRole{
Roles: []AccountRole{
{
ID: "3536bcfad5faccb999b47003c79917fb",
Name: "Account Administrator",
Description: "Administrative access to the entire Account",
Permissions: map[string]AccountMemberRolePermission{
Permissions: map[string]AccountRolePermission{
"analytics": {Read: true, Edit: true},
"billing": {Read: true, Edit: true},
},
Expand All @@ -64,12 +64,12 @@ var newUpdatedAccountMemberStruct = AccountMember{
TwoFactorAuthenticationEnabled: false,
},
Status: "accepted",
Roles: []AccountMemberRole{
Roles: []AccountRole{
{
ID: "3536bcfad5faccb999b47003c79917fb",
Name: "Account Administrator",
Description: "Administrative access to the entire Account",
Permissions: map[string]AccountMemberRolePermission{
Permissions: map[string]AccountRolePermission{
"analytics": {Read: true, Edit: true},
"billing": {Read: true, Edit: true},
},
Expand Down

0 comments on commit db2b323

Please sign in to comment.