mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-01-03 02:14:25 +00:00
Code sanity fixes, added middlewares
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user