neko/internal/types/member.go

44 lines
1.4 KiB
Go
Raw Normal View History

2021-03-14 11:42:16 +13:00
package types
2021-08-30 03:09:13 +12:00
import "errors"
var (
ErrMemberAlreadyExists = errors.New("member already exists")
ErrMemberDoesNotExist = errors.New("member does not exist")
ErrMemberInvalidPassword = errors.New("invalid password")
)
2021-03-15 00:57:19 +13:00
type MemberProfile struct {
2021-11-04 09:59:38 +13:00
Name string `json:"name"`
IsAdmin bool `json:"is_admin"`
CanLogin bool `json:"can_login"`
CanConnect bool `json:"can_connect"`
CanWatch bool `json:"can_watch"`
CanHost bool `json:"can_host"`
2021-12-10 09:48:02 +13:00
CanShareMedia bool `json:"can_share_media"`
2021-11-04 09:59:38 +13:00
CanAccessClipboard bool `json:"can_access_clipboard"`
SendsInactiveCursor bool `json:"sends_inactive_cursor"`
CanSeeInactiveCursors bool `json:"can_see_inactive_cursors"`
2021-03-15 00:57:19 +13:00
}
2021-03-15 04:58:18 +13:00
type MemberProvider interface {
2021-03-14 11:42:16 +13:00
Connect() error
Disconnect() error
2021-03-15 00:57:19 +13:00
Authenticate(username string, password string) (string, MemberProfile, error)
Insert(username string, password string, profile MemberProfile) (string, error)
Select(id string) (MemberProfile, error)
SelectAll(limit int, offset int) (map[string]MemberProfile, error)
2021-03-15 02:44:03 +13:00
UpdateProfile(id string, profile MemberProfile) error
2021-03-15 04:23:14 +13:00
UpdatePassword(id string, password string) error
2021-03-14 11:42:16 +13:00
Delete(id string) error
}
2021-03-15 04:58:18 +13:00
type MemberManager interface {
MemberProvider
2021-03-15 07:59:34 +13:00
Login(username string, password string) (Session, string, error)
Logout(id string) error
2021-03-15 04:58:18 +13:00
}