MCPcopy Index your code
hub / github.com/coder/coder / AsPrebuild

Method AsPrebuild

coderd/database/modelmethods.go:494–501  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

492// If the workspace is a prebuild, it returns a prebuilt_workspace RBAC object.
493// Otherwise, it returns a normal workspace RBAC object.
494func (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
503func (w WorkspaceTable) RBACObject() rbac.Object {
504 if w.DormantAt.Valid {

Callers

nothing calls this directly

Calls 6

IsPrebuildMethod · 0.95
RBACObjectMethod · 0.95
WithOwnerMethod · 0.80
InOrgMethod · 0.80
WithIDMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected