- Notifications
You must be signed in to change notification settings - Fork915
feat: allow TemplateAdmin to delete prebuilds via auth layer (POC)#18333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
e05480d
todb80b4d
Comparedb80b4d
to2ba15c5
Comparecoderd/database/modelmethods.go Outdated
func (w Workspace) IsPrebuild() bool { | ||
// TODO: avoid import cycle | ||
return w.OwnerID == uuid.MustParse("c42fdf75-3097-471c-8c33-fb52454d81c0") | ||
} | ||
func (w Workspace) PrebuildRBAC() rbac.Object { | ||
if w.IsPrebuild() { | ||
return rbac.ResourcePrebuiltWorkspace.WithID(w.ID). | ||
InOrg(w.OrganizationID). | ||
WithOwner(w.OwnerID.String()) | ||
} | ||
return w.RBACObject() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
🤔 what about
func (w Workspace) AsPrebuild (rbac.Object, bool) {}if pb, ok := obj.AsPrebuild(); ok { ...}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
🤔 In this case, I think having a separateIsPrebuild()
andAsPrebuild()
keeps things a bit clearer. Combining them might actually make the logic harder to follow in places likeauthorizeWorkspace()
or the fallback auth checks. But let me know what you think!
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
POC (Do not Merge)
Support TemplateAdmin to delete prebuild workspaces via the authorization layer