basicly implement acl crud ops with roles and resources

This commit is contained in:
2025-12-20 17:38:15 +02:00
parent c188b46519
commit 904f446447
18 changed files with 1607 additions and 324 deletions

20
internal/server/error.go Normal file
View File

@@ -0,0 +1,20 @@
package server
import (
"encoding/json"
"net/http"
)
type ErrorResponse struct {
Error string `json:"error"`
Details string `json:"details,omitempty"`
}
func WriteError(w http.ResponseWriter, error, details string, statusCode int) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(statusCode)
json.NewEncoder(w).Encode(ErrorResponse{
Error: error,
Details: details,
})
}