mongo

package module
v0.0.0-...-1be267e Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthUser

type AuthUser struct {
	Username       string            `bson:"username"`
	Nickname       string            `bson:"nickname"`
	HashedPassword string            `bson:"hashed_password"`
	Permissions    models.Permission `bson:"permissions"`
	MaxOwnedSevers uint              `bson:"max_owned_severs"`
	Email          string            `bson:"email"`
}

type Image

type Image struct {
	Id       string `bson:"id"`
	Registry string `bson:"registry"`
	Tag      string `bson:"tag"`
}

type InviteToken

type InviteToken struct {
	Email       string            `bson:"email"`
	Token       string            `bson:"token"`
	Permissions models.Permission `bson:"permissions"`
}

type InviteTokenDbHandler

type InviteTokenDbHandler struct {
	dbhandler.InviteTokenDbHandler
	// contains filtered or unexported fields
}

func NewInviteTokenDbHandler

func NewInviteTokenDbHandler(config models.MongoDBConfig) (*InviteTokenDbHandler, error)

func (*InviteTokenDbHandler) GetInviteToken

func (i *InviteTokenDbHandler) GetInviteToken(ctx context.Context, token string) (*dbhandler.InviteToken, error)

func (*InviteTokenDbHandler) SaveInviteToken

func (i *InviteTokenDbHandler) SaveInviteToken(ctx context.Context, email string, permissions models.Permission) (string, error)

type Port

type Port struct {
	PublicPort    uint16              `bson:"public_port"`
	ContainerPort uint16              `bson:"container_port"`
	Protocol      models.PortProtocol `bson:"protocol"`
}

type Server

type Server struct {
	Id       string `bson:"id"`
	Owner    string `bson:"owner"`
	Image    Image  `bson:"image"`
	Nickname string `bson:"nickname"`
	Command  string `bson:"command"`
	Ports    []Port `bson:"ports"`
}

type ServerPermissions

type ServerPermissions struct {
	Username    string            `bson:"username"`
	ServerId    string            `bson:"server_id"`
	Permissions models.Permission `bson:"permissions"`
}

type ServersAuthorizationDbHandler

type ServersAuthorizationDbHandler struct {
	dbhandler.ServersAuthorizationDbHandler
	// contains filtered or unexported fields
}

func NewServersAuthorizationHandler

func NewServersAuthorizationHandler(config models.MongoDBConfig) (*ServersAuthorizationDbHandler, error)

func (*ServersAuthorizationDbHandler) AddPermissions

func (self *ServersAuthorizationDbHandler) AddPermissions(ctx context.Context, username string, serverId string, permissions models.Permission) error

func (*ServersAuthorizationDbHandler) GetPermissions

func (self *ServersAuthorizationDbHandler) GetPermissions(ctx context.Context, username string, serverId string) (models.Permission, error)

func (*ServersAuthorizationDbHandler) RemovePermissions

func (self *ServersAuthorizationDbHandler) RemovePermissions(ctx context.Context, username string, serverId string, permissions models.Permission) error

func (*ServersAuthorizationDbHandler) RemoveServer

func (self *ServersAuthorizationDbHandler) RemoveServer(ctx context.Context, serverId string) error

func (*ServersAuthorizationDbHandler) RemoveUser

func (self *ServersAuthorizationDbHandler) RemoveUser(ctx context.Context, username string) error

func (*ServersAuthorizationDbHandler) SetPermissions

func (self *ServersAuthorizationDbHandler) SetPermissions(ctx context.Context, username string, serverId string, permissions models.Permission) error

type ServersDbHandler

type ServersDbHandler struct {
	dbhandler.ServersDbHandler
	// contains filtered or unexported fields
}

func NewServersDbHandler

func NewServersDbHandler(config models.MongoDBConfig) (*ServersDbHandler, error)

func (*ServersDbHandler) CreateServer

func (dbh *ServersDbHandler) CreateServer(ctx context.Context, server dbhandler.Server) error

func (*ServersDbHandler) DeleteServer

func (dbh *ServersDbHandler) DeleteServer(ctx context.Context, serverId string) error

func (*ServersDbHandler) GetServer

func (dbh *ServersDbHandler) GetServer(ctx context.Context, serverId string) (*dbhandler.Server, error)

func (*ServersDbHandler) ListServers

func (dbh *ServersDbHandler) ListServers(ctx context.Context) ([]dbhandler.Server, error)

func (*ServersDbHandler) UpdateServer

func (dbh *ServersDbHandler) UpdateServer(ctx context.Context, serverId string, updateParams dbhandler.ServerUpdateRequest) error

type UserPassAuthenticationDbHandler

type UserPassAuthenticationDbHandler struct {
	dbhandler.UserPassAuthanticationDbHandler
	// contains filtered or unexported fields
}

func (*UserPassAuthenticationDbHandler) AuthenticateUser

func (i *UserPassAuthenticationDbHandler) AuthenticateUser(ctx context.Context, username string, password string) (*models.User, error)

func (*UserPassAuthenticationDbHandler) CountUsers

func (*UserPassAuthenticationDbHandler) CreateUser

func (i *UserPassAuthenticationDbHandler) CreateUser(
	ctx context.Context,
	username string,
	password string,
	permissions models.Permission,
	email string,
	maxOwnedServers uint,
) error

func (*UserPassAuthenticationDbHandler) ListUsers

func (*UserPassAuthenticationDbHandler) RemoveUser

func (i *UserPassAuthenticationDbHandler) RemoveUser(ctx context.Context, username string) error

func (*UserPassAuthenticationDbHandler) SetPermissions

func (i *UserPassAuthenticationDbHandler) SetPermissions(
	ctx context.Context,
	username string,
	permissions models.Permission,
) error

Jump to

Keyboard shortcuts

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