27 lines
522 B
Go
27 lines
522 B
Go
package module
|
|
|
|
import (
|
|
"nadir/internal/rbac"
|
|
|
|
"github.com/danielgtaylor/huma/v2"
|
|
)
|
|
|
|
type Module interface {
|
|
ID() string
|
|
Permissions() []rbac.Permission // permissions this module exposes (no "*")
|
|
Register(api huma.API)
|
|
}
|
|
|
|
// Title returns the display name for a module ID, capitalizing the first
|
|
// letter (modules are single lowercase words: "system" -> "System").
|
|
func Title(id string) string {
|
|
if id == "" {
|
|
return ""
|
|
}
|
|
b := id[0]
|
|
if b >= 'a' && b <= 'z' {
|
|
b -= 'a' - 'A'
|
|
}
|
|
return string(b) + id[1:]
|
|
}
|