Code sanity fixes, added middlewares
Some checks failed
Tests / Run Tests (1.23.x) (push) Has been cancelled
Tests / Run Tests (1.24.x) (push) Has been cancelled
Tests / Lint Code (push) Has been cancelled
Tests / Build (push) Has been cancelled

This commit is contained in:
Hein
2025-12-08 08:28:43 +02:00
parent 2442589982
commit b741958895
19 changed files with 1911 additions and 94 deletions

View File

@@ -20,22 +20,22 @@ func NewCompositeSecurityProvider(
auth Authenticator,
colSec ColumnSecurityProvider,
rowSec RowSecurityProvider,
) *CompositeSecurityProvider {
) (*CompositeSecurityProvider, error) {
if auth == nil {
panic("authenticator cannot be nil")
return nil, fmt.Errorf("authenticator cannot be nil")
}
if colSec == nil {
panic("column security provider cannot be nil")
return nil, fmt.Errorf("column security provider cannot be nil")
}
if rowSec == nil {
panic("row security provider cannot be nil")
return nil, fmt.Errorf("row security provider cannot be nil")
}
return &CompositeSecurityProvider{
auth: auth,
colSec: colSec,
rowSec: rowSec,
}
}, nil
}
// Login delegates to the authenticator

View File

@@ -58,16 +58,16 @@ type SecurityList struct {
}
// NewSecurityList creates a new security list with the given provider
func NewSecurityList(provider SecurityProvider) *SecurityList {
func NewSecurityList(provider SecurityProvider) (*SecurityList, error) {
if provider == nil {
panic("security provider cannot be nil")
return nil, fmt.Errorf("security provider cannot be nil")
}
return &SecurityList{
provider: provider,
ColumnSecurity: make(map[string][]ColumnSecurity),
RowSecurity: make(map[string]RowSecurity),
}
}, nil
}
// Provider returns the underlying security provider