members object provider default from config.

This commit is contained in:
Miroslav Šedivý 2021-03-14 13:11:26 +01:00
parent 00586baffc
commit 8f277c61c9

View File

@ -22,7 +22,35 @@ type MemberManagerCtx struct {
}
func (manager *MemberManagerCtx) Connect() error {
return nil
var err error
if manager.config.AdminPassword != "" {
// create default admin account at startup
_, err = manager.Insert("admin", manager.config.AdminPassword, types.MemberProfile{
Name: "Administrator",
IsAdmin: true,
CanLogin: true,
CanConnect: true,
CanWatch: true,
CanHost: true,
CanAccessClipboard: true,
})
}
if manager.config.UserPassword != "" {
// create default user account at startup
_, err = manager.Insert("user", manager.config.UserPassword, types.MemberProfile{
Name: "User",
IsAdmin: false,
CanLogin: true,
CanConnect: true,
CanWatch: true,
CanHost: true,
CanAccessClipboard: true,
})
}
return err
}
func (manager *MemberManagerCtx) Disconnect() error {