mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 00:06:38 +00:00
[management] use permission modules (#3622)
This commit is contained in:
@@ -3,6 +3,8 @@ package status
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/netbirdio/netbird/management/server/permissions/operations"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -98,6 +100,11 @@ func NewUserNotFoundError(userKey string) error {
|
||||
return Errorf(NotFound, "user: %s not found", userKey)
|
||||
}
|
||||
|
||||
// NewUserBlockedError creates a new Error with PermissionDenied type for a blocked user
|
||||
func NewUserBlockedError() error {
|
||||
return Errorf(PermissionDenied, "user is blocked")
|
||||
}
|
||||
|
||||
// NewPeerNotRegisteredError creates a new Error with NotFound type for a missing peer
|
||||
func NewPeerNotRegisteredError() error {
|
||||
return Errorf(Unauthenticated, "peer is not registered")
|
||||
@@ -212,3 +219,11 @@ func NewPATNotFoundError(patID string) error {
|
||||
func NewExtraSettingsNotFoundError() error {
|
||||
return ErrExtraSettingsNotFound
|
||||
}
|
||||
|
||||
func NewUserRoleNotFoundError(role string) error {
|
||||
return Errorf(NotFound, "user role: %s not found", role)
|
||||
}
|
||||
|
||||
func NewOperationNotFoundError(operation operations.Operation) error {
|
||||
return Errorf(NotFound, "operation: %s not found", operation)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user