Skip to content

Commit

Permalink
fix(account): Operator.AllWritableWorkspaces should include maintaini…
Browse files Browse the repository at this point in the history
…ng workspaces
  • Loading branch information
rot1024 committed Aug 3, 2023
1 parent 373da8b commit 6fb13c1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions account/accountusecase/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ func (o *Operator) AllReadableWorkspaces() accountdomain.WorkspaceIDList {
}

func (o *Operator) AllWritableWorkspaces() accountdomain.WorkspaceIDList {
return append(o.WritableWorkspaces, o.AllOwningWorkspaces()...)
return append(o.WritableWorkspaces, o.AllMaintainingWorkspaces()...)
}

func (o *Operator) AllMaintainingWorkspaces() accountdomain.WorkspaceIDList {
return append(o.MaintainableWorkspaces, o.AllOwningWorkspaces()...)
}

func (o *Operator) AllOwningWorkspaces() accountdomain.WorkspaceIDList {
Expand All @@ -51,14 +55,12 @@ func (o *Operator) IsWritableWorkspace(ws ...accountdomain.WorkspaceID) bool {
return o.AllWritableWorkspaces().Intersect(ws).Len() > 0
}

func (o *Operator) IsOwningWorkspace(ws ...accountdomain.WorkspaceID) bool {
return o.AllOwningWorkspaces().Intersect(ws).Len() > 0
}
func (o *Operator) IsMaintainingWorkspace(workspace ...accountdomain.WorkspaceID) bool {
return o.AllMaintainingWorkspaces().Intersect(workspace).Len() > 0
}
func (o *Operator) AllMaintainingWorkspaces() accountdomain.WorkspaceIDList {
return append(o.MaintainableWorkspaces, o.AllOwningWorkspaces()...)

func (o *Operator) IsOwningWorkspace(ws ...accountdomain.WorkspaceID) bool {
return o.AllOwningWorkspaces().Intersect(ws).Len() > 0
}

func (o *Operator) AddNewWorkspace(ws accountdomain.WorkspaceID) {
Expand Down

0 comments on commit 6fb13c1

Please sign in to comment.