Skip to content

Commit

Permalink
Feat: refactor team role assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerHeber committed Apr 15, 2024
1 parent f5f06ea commit 3ebdfc4
Show file tree
Hide file tree
Showing 18 changed files with 464 additions and 826 deletions.
12 changes: 3 additions & 9 deletions client/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ type ApiClientInterface interface {
TeamCreate(payload TeamCreatePayload) (Team, error)
TeamUpdate(id string, payload TeamUpdatePayload) (Team, error)
TeamDelete(id string) error
TeamProjectAssignmentCreateOrUpdate(payload *TeamProjectAssignmentPayload) (*TeamProjectAssignment, error)
TeamProjectAssignmentDelete(projectId string, teamId string) error
TeamProjectAssignments(projectId string) ([]TeamProjectAssignment, error)
Environments() ([]Environment, error)
ProjectEnvironments(projectId string) ([]Environment, error)
Environment(id string) (Environment, error)
Expand Down Expand Up @@ -138,12 +135,6 @@ type ApiClientInterface interface {
AssignUserRoleToEnvironment(payload *AssignUserRoleToEnvironmentPayload) (*UserRoleEnvironmentAssignment, error)
RemoveUserRoleFromEnvironment(environmentId string, userId string) error
UserRoleEnvironmentAssignments(environmentId string) ([]UserRoleEnvironmentAssignment, error)
AssignTeamRoleToEnvironment(payload *AssignTeamRoleToEnvironmentPayload) (*TeamRoleEnvironmentAssignment, error)
RemoveTeamRoleFromEnvironment(environmentId string, teamId string) error
TeamRoleEnvironmentAssignments(environmentId string) ([]TeamRoleEnvironmentAssignment, error)
AssignOrganizationRoleToTeam(payload *AssignOrganizationRoleToTeamPayload) (*OrganizationRoleTeamAssignment, error)
RemoveOrganizationRoleFromTeam(teamId string) error
OrganizationRoleTeamAssignments() ([]OrganizationRoleTeamAssignment, error)
ApprovalPolicies(name string) ([]ApprovalPolicy, error)
ApprovalPolicyAssign(assignment *ApprovalPolicyAssignment) (*ApprovalPolicyAssignment, error)
ApprovalPolicyUnassign(scope string, scopeId string) error
Expand All @@ -156,6 +147,9 @@ type ApiClientInterface interface {
PutEnvironmentDiscovery(projectId string, payload *EnvironmentDiscoveryPutPayload) (*EnvironmentDiscoveryPayload, error)
GetEnvironmentDiscovery(projectId string) (*EnvironmentDiscoveryPayload, error)
DeleteEnvironmentDiscovery(projectId string) error
TeamRoleAssignmentCreateOrUpdate(payload *TeamRoleAssignmentCreateOrUpdatePayload) (*TeamRoleAssignmentPayload, error)
TeamRoleAssignmentDelete(payload *TeamRoleAssignmentDeletePayload) error
TeamRoleAssignments(payload *TeamRoleAssignmentListPayload) ([]TeamRoleAssignmentPayload, error)
}

func NewApiClient(client http.HttpClientInterface, defaultOrganizationId string) ApiClientInterface {
Expand Down
128 changes: 20 additions & 108 deletions client/api_client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions client/builtin_roles.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package client

const (
Admin string = "Admin"
Deployer string = "Deployer"
Planner string = "Planner"
Viewer string = "Viewer"
)

func IsBuiltinProjectRole(role string) bool {
return role == Admin || role == Deployer || role == Planner || role == Viewer
}
37 changes: 0 additions & 37 deletions client/team_environment_assignment.go

This file was deleted.

136 changes: 0 additions & 136 deletions client/team_environment_assignment_test.go

This file was deleted.

Loading

0 comments on commit 3ebdfc4

Please sign in to comment.