mirror of
https://github.com/h44z/wg-portal.git
synced 2026-03-24 00:56:26 +00:00
feat: Implement LDAP interface-specific provisioning filters (#642)
* Implement LDAP filter-based access control for interface provisioning * test: add unit tests for LDAP interface filtering logic * smaller improvements / cleanup --------- Co-authored-by: jc <37738506+theguy147@users.noreply.github.com> Co-authored-by: Christoph Haas <christoph.h@sprinternet.at>
This commit is contained in:
@@ -39,6 +39,11 @@ type PeerDatabaseRepo interface {
|
||||
GetUserPeers(ctx context.Context, id domain.UserIdentifier) ([]domain.Peer, error)
|
||||
}
|
||||
|
||||
type InterfaceDatabaseRepo interface {
|
||||
// SaveInterface saves the interface with the given identifier.
|
||||
SaveInterface(ctx context.Context, id domain.InterfaceIdentifier, updateFunc func(i *domain.Interface) (*domain.Interface, error)) error
|
||||
}
|
||||
|
||||
type EventBus interface {
|
||||
// Publish sends a message to the message bus.
|
||||
Publish(topic string, args ...any)
|
||||
@@ -50,22 +55,27 @@ type EventBus interface {
|
||||
type Manager struct {
|
||||
cfg *config.Config
|
||||
|
||||
bus EventBus
|
||||
users UserDatabaseRepo
|
||||
peers PeerDatabaseRepo
|
||||
bus EventBus
|
||||
users UserDatabaseRepo
|
||||
peers PeerDatabaseRepo
|
||||
interfaces InterfaceDatabaseRepo
|
||||
}
|
||||
|
||||
// NewUserManager creates a new user manager instance.
|
||||
func NewUserManager(cfg *config.Config, bus EventBus, users UserDatabaseRepo, peers PeerDatabaseRepo) (
|
||||
*Manager,
|
||||
error,
|
||||
) {
|
||||
func NewUserManager(
|
||||
cfg *config.Config,
|
||||
bus EventBus,
|
||||
users UserDatabaseRepo,
|
||||
peers PeerDatabaseRepo,
|
||||
interfaces InterfaceDatabaseRepo,
|
||||
) (*Manager, error) {
|
||||
m := &Manager{
|
||||
cfg: cfg,
|
||||
bus: bus,
|
||||
|
||||
users: users,
|
||||
peers: peers,
|
||||
users: users,
|
||||
peers: peers,
|
||||
interfaces: interfaces,
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user