feat(19-04): user authorizer, user.Deleting and handle backfill

Register lighthouse user:{id} if the namespace is free, fire user.Deleting before unscoped delete, and backfill missing handles.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-10-17 21:53:21 +02:00
parent 15b19c7021
commit c0770294a5
9 changed files with 190 additions and 5 deletions

View File

@@ -103,10 +103,13 @@ func (p *Plugin) Boot(app *backpack.App) error {
return err
}
trusted := surf.TrustedProxies(app.Config)
return reg.Register(p.ID(), "api_token", &usermiddleware.APITokenGuard{
if err := reg.Register(p.ID(), "api_token", &usermiddleware.APITokenGuard{
App: app, Prefix: prefix,
ClientIP: func(r *http.Request) string { return surf.ClientIP(r, trusted) },
})
}); err != nil {
return err
}
return classes.RegisterUserAuthorizer(app)
}
func (p *Plugin) startBlacklistSweep(bl bouncer.BlacklistStore) {
@@ -201,7 +204,7 @@ func (p *Plugin) MailLayouts() map[string]string {
}
func (p *Plugin) Commands() []bonfire.Command {
return append([]bonfire.Command{console.RequirePasswordChange(p.app)}, console.APITokenCommands(p.app)...)
return append([]bonfire.Command{console.RequirePasswordChange(p.app), console.BackfillHandles(p.app)}, console.APITokenCommands(p.app)...)
}
func (p *Plugin) Migrations() []*gormigrate.Migration { return updates.All() }