feat(15-02): add Categories, Tags, and journal settings admin

Register the remaining YAML admin screens and the settings singleton
so a host can boot Posts, Categories, Tags, and Code journal. Posts
update and delete refuse other authors without access_other_posts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-10-06 18:42:29 +02:00
parent dea0934950
commit afd0a2cafc
17 changed files with 388 additions and 3 deletions

View File

@@ -174,9 +174,28 @@ func (c postsAdminController) FormBeforeUpdate(ctx context.Context, model any) e
if !ok || post == nil {
return errors.New("posts admin: form model is not a post")
}
if err := refuseOtherAuthor(ctx, post); err != nil {
return err
}
return preparePostWrite(ctx, post)
}
func (c postsAdminController) FormBeforeDelete(ctx context.Context, model any) error {
post, ok := model.(*models.Post)
if !ok || post == nil {
return errors.New("posts admin: form model is not a post")
}
return refuseOtherAuthor(ctx, post)
}
func refuseOtherAuthor(ctx context.Context, post *models.Post) error {
principal, _ := bouncer.User(ctx)
if post.CanEdit(principal) {
return nil
}
return &cabana.ForbiddenError{Message: "golem15.journal::lang.journal.access_other_posts"}
}
func preparePostWrite(ctx context.Context, post *models.Post) error {
if err := refuseUnpublishedWrite(ctx, post); err != nil {
return err