neko/internal/member/dummy/provider.go

65 lines
1.6 KiB
Go
Raw Normal View History

2021-03-15 00:57:19 +13:00
package dummy
import (
2021-08-30 03:09:13 +12:00
"errors"
2021-03-15 01:06:33 +13:00
2021-03-15 00:57:19 +13:00
"demodesk/neko/internal/types"
)
2021-03-15 04:58:18 +13:00
func New() types.MemberProvider {
2021-03-17 03:38:51 +13:00
return &MemberProviderCtx{
profile: types.MemberProfile{
2021-11-04 09:59:38 +13:00
IsAdmin: true,
CanLogin: true,
CanConnect: true,
CanWatch: true,
CanHost: true,
CanAccessClipboard: true,
SendsInactiveCursor: true,
CanSeeInactiveCursors: true,
2021-03-17 03:38:51 +13:00
},
}
2021-03-15 00:57:19 +13:00
}
2021-03-17 03:38:51 +13:00
type MemberProviderCtx struct {
profile types.MemberProfile
}
2021-03-15 00:57:19 +13:00
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) Connect() error {
2021-03-15 00:57:19 +13:00
return nil
}
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) Disconnect() error {
2021-03-15 00:57:19 +13:00
return nil
}
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) Authenticate(username string, password string) (string, types.MemberProfile, error) {
2021-03-17 03:38:51 +13:00
provider.profile.Name = username
return username, provider.profile, nil
2021-03-15 00:57:19 +13:00
}
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) Insert(username string, password string, profile types.MemberProfile) (string, error) {
2021-08-30 03:09:13 +12:00
return "", errors.New("not implemented")
2021-03-15 00:57:19 +13:00
}
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) Select(id string) (types.MemberProfile, error) {
2021-03-17 03:38:51 +13:00
provider.profile.Name = id
return provider.profile, nil
2021-03-15 00:57:19 +13:00
}
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) SelectAll(limit int, offset int) (map[string]types.MemberProfile, error) {
2021-03-17 03:38:51 +13:00
return map[string]types.MemberProfile{}, nil
2021-03-15 00:57:19 +13:00
}
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.MemberProfile) error {
2021-03-17 03:38:51 +13:00
return nil
2021-03-15 00:57:19 +13:00
}
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) UpdatePassword(id string, password string) error {
2021-08-30 03:09:13 +12:00
return errors.New("not implemented")
2021-03-15 00:57:19 +13:00
}
2021-03-15 04:58:18 +13:00
func (provider *MemberProviderCtx) Delete(id string) error {
2021-03-17 03:38:51 +13:00
return nil
2021-03-15 00:57:19 +13:00
}