File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,24 @@ func (w WorkspaceTable) DormantRBAC() rbac.Object {
264
264
WithOwner (w .OwnerID .String ())
265
265
}
266
266
267
+ // IsPrebuild returns true if the workspace is a prebuild workspace.
268
+ // A workspace is considered a prebuild if its owner is the prebuild system user.
269
+ func (w WorkspaceTable ) IsPrebuild () bool {
270
+ return w .OwnerID == PrebuildsSystemUserID
271
+ }
272
+
273
+ // AsPrebuild returns the RBAC object corresponding to the workspace type.
274
+ // If the workspace is a prebuild, it returns a prebuilt_workspace RBAC object.
275
+ // Otherwise, it returns a normal workspace RBAC object.
276
+ func (w WorkspaceTable ) AsPrebuild () rbac.Object {
277
+ if w .IsPrebuild () {
278
+ return rbac .ResourcePrebuiltWorkspace .WithID (w .ID ).
279
+ InOrg (w .OrganizationID ).
280
+ WithOwner (w .OwnerID .String ())
281
+ }
282
+ return w .RBACObject ()
283
+ }
284
+
267
285
func (m OrganizationMember ) RBACObject () rbac.Object {
268
286
return rbac .ResourceOrganizationMember .
269
287
WithID (m .UserID ).
You can’t perform that action at this time.
0 commit comments