acl

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasswordPlainText = "plaintext"
	PasswordSHA256    = "SHA256"
)

Variables

This section is empty.

Functions

func Commands

func Commands() []internal.Command

func GetPasswordType

func GetPasswordType(password string) string

func RemoveDuplicateEntries

func RemoveDuplicateEntries(entries []string, allAlias string) (res []string)

Types

type ACL

type ACL struct {
	Users        []*User                  // List of ACL user profiles
	UsersMutex   sync.RWMutex             // RWMutex for concurrency control when accessing ACL profile list
	Connections  map[*net.Conn]Connection // Connections to the echovault that are currently registered with the ACL module
	Config       config.Config            // SugarDB configuration that contains the relevant ACL config options
	GlobPatterns map[string]glob.Glob
}

func NewACL

func NewACL(config config.Config) *ACL

func (*ACL) AuthenticateConnection

func (acl *ACL) AuthenticateConnection(_ context.Context, conn *net.Conn, cmd []string) error

func (*ACL) AuthorizeConnection

func (acl *ACL) AuthorizeConnection(conn *net.Conn, cmd []string, command internal.Command, subCommand internal.SubCommand) error

func (*ACL) CompileGlobs

func (acl *ACL) CompileGlobs()

func (*ACL) DeleteUser

func (acl *ACL) DeleteUser(_ context.Context, usernames []string) error

func (*ACL) LockUsers

func (acl *ACL) LockUsers()

func (*ACL) RLockUsers

func (acl *ACL) RLockUsers()

func (*ACL) RUnlockUsers

func (acl *ACL) RUnlockUsers()

func (*ACL) RegisterConnection

func (acl *ACL) RegisterConnection(conn *net.Conn)

func (*ACL) SetUser

func (acl *ACL) SetUser(cmd []string) error

func (*ACL) UnlockUsers

func (acl *ACL) UnlockUsers()

type Connection

type Connection struct {
	Authenticated bool  // Whether the connection has been authenticated
	User          *User // The user the connection is associated with
}

type Password

type Password struct {
	PasswordType  string `json:"PasswordType" yaml:"PasswordType"` // plaintext, SHA256
	PasswordValue string `json:"PasswordValue" yaml:"PasswordValue"`
}

type User

type User struct {
	Username   string `json:"Username" yaml:"Username"`
	Enabled    bool   `json:"Enabled" yaml:"Enabled"`
	NoPassword bool   `json:"NoPassword" yaml:"NoPassword"`
	NoKeys     bool   `json:"NoKeys" yaml:"NoKeys"`

	Passwords []Password `json:"Passwords" yaml:"Passwords"`

	IncludedCategories []string `json:"IncludedCategories" yaml:"IncludedCategories"`
	ExcludedCategories []string `json:"ExcludedCategories" yaml:"ExcludedCategories"`

	IncludedCommands []string `json:"IncludedCommands" yaml:"IncludedCommands"`
	ExcludedCommands []string `json:"ExcludedCommands" yaml:"ExcludedCommands"`

	IncludedReadKeys  []string `json:"IncludedReadKeys" yaml:"IncludedReadKeys"`
	IncludedWriteKeys []string `json:"IncludedWriteKeys" yaml:"IncludedWriteKeys"`

	IncludedPubSubChannels []string `json:"IncludedPubSubChannels" yaml:"IncludedPubSubChannels"`
	ExcludedPubSubChannels []string `json:"ExcludedPubSubChannels" yaml:"ExcludedPubSubChannels"`
}

func CreateUser

func CreateUser(username string) *User

func (*User) Merge

func (user *User) Merge(new *User)

func (*User) Normalise

func (user *User) Normalise()

func (*User) Replace

func (user *User) Replace(new *User)

func (*User) UpdateUser

func (user *User) UpdateUser(cmd []string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL