first commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package users
|
||||
|
||||
import (
|
||||
"nadir/internal/rbac"
|
||||
|
||||
"github.com/danielgtaylor/huma/v2"
|
||||
)
|
||||
|
||||
const ModuleID = "users"
|
||||
|
||||
type Module struct{}
|
||||
|
||||
func New() *Module { return &Module{} }
|
||||
|
||||
func (m *Module) ID() string { return ModuleID }
|
||||
func (m *Module) Name() string { return "Users" }
|
||||
|
||||
// Permissions: read to list/inspect accounts; write to create and change
|
||||
// passwords; root to delete (irreversible).
|
||||
func (m *Module) Permissions() []rbac.Permission {
|
||||
return []rbac.Permission{rbac.Read, rbac.Write, rbac.Root}
|
||||
}
|
||||
|
||||
func (m *Module) Register(api huma.API) {
|
||||
registerUsers(api)
|
||||
}
|
||||
|
||||
func op(permission string) map[string]any {
|
||||
return map[string]any{"module": ModuleID, "permission": permission}
|
||||
}
|
||||
Reference in New Issue
Block a user