mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
members: add multiuser profile.
This commit is contained in:
@ -38,34 +38,20 @@ func (provider *MemberProviderCtx) Authenticate(username string, password string
|
||||
|
||||
// if logged in as administrator
|
||||
if provider.config.AdminPassword == password {
|
||||
return id, types.MemberProfile{
|
||||
Name: username,
|
||||
IsAdmin: true,
|
||||
CanLogin: true,
|
||||
CanConnect: true,
|
||||
CanWatch: true,
|
||||
CanHost: true,
|
||||
CanShareMedia: true,
|
||||
CanAccessClipboard: true,
|
||||
SendsInactiveCursor: true,
|
||||
CanSeeInactiveCursors: true,
|
||||
}, nil
|
||||
profile := provider.config.AdminProfile
|
||||
if profile.Name == "" {
|
||||
profile.Name = username
|
||||
}
|
||||
return id, profile, nil
|
||||
}
|
||||
|
||||
// if logged in as user
|
||||
if provider.config.UserPassword == password {
|
||||
return id, types.MemberProfile{
|
||||
Name: username,
|
||||
IsAdmin: false,
|
||||
CanLogin: true,
|
||||
CanConnect: true,
|
||||
CanWatch: true,
|
||||
CanHost: true,
|
||||
CanShareMedia: true,
|
||||
CanAccessClipboard: true,
|
||||
SendsInactiveCursor: true,
|
||||
CanSeeInactiveCursors: false,
|
||||
}, nil
|
||||
profile := provider.config.UserProfile
|
||||
if profile.Name == "" {
|
||||
profile.Name = username
|
||||
}
|
||||
return id, profile, nil
|
||||
}
|
||||
|
||||
return "", types.MemberProfile{}, types.ErrMemberInvalidPassword
|
||||
|
@ -1,6 +1,10 @@
|
||||
package multiuser
|
||||
|
||||
import "github.com/demodesk/neko/pkg/types"
|
||||
|
||||
type Config struct {
|
||||
AdminPassword string
|
||||
UserPassword string
|
||||
AdminProfile types.MemberProfile
|
||||
UserProfile types.MemberProfile
|
||||
}
|
||||
|
Reference in New Issue
Block a user