AsPrebuild returns the RBAC object corresponding to the workspace type. If the workspace is a prebuild, it returns a prebuilt_workspace RBAC object. Otherwise, it returns a normal workspace RBAC object.
()
| 492 | // If the workspace is a prebuild, it returns a prebuilt_workspace RBAC object. |
| 493 | // Otherwise, it returns a normal workspace RBAC object. |
| 494 | func (w Workspace) AsPrebuild() rbac.Object { |
| 495 | if w.IsPrebuild() { |
| 496 | return rbac.ResourcePrebuiltWorkspace.WithID(w.ID). |
| 497 | InOrg(w.OrganizationID). |
| 498 | WithOwner(w.OwnerID.String()) |
| 499 | } |
| 500 | return w.RBACObject() |
| 501 | } |
| 502 | |
| 503 | func (w WorkspaceTable) RBACObject() rbac.Object { |
| 504 | if w.DormantAt.Valid { |
nothing calls this directly
no test coverage detected