add username to our trip

This commit is contained in:
mr
2024-12-04 11:33:08 +01:00
parent 6681c455d8
commit fd01f535a1
30 changed files with 129 additions and 113 deletions

View File

@@ -38,7 +38,7 @@ type AbstractResource struct {
Currency string `json:"currency,omitempty" bson:"currency,omitempty"` // Currency is the currency of the price
}
func (ao *AbstractResource) GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
func (ao *AbstractResource) GetAccessor(username string, peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
return nil
}
@@ -46,7 +46,7 @@ func (abs *AbstractResource) SetResourceModel(model *ResourceModel) {
abs.ResourceModel = model
}
func (abs *AbstractResource) VerifyAuth(peerID string, groups []string) bool {
func (abs *AbstractResource) VerifyAuth(username string, peerID string, groups []string) bool {
if grps, ok := abs.AllowedPeersGroup[peerID]; ok || config.GetConfig().Whitelist {
if (ok && slices.Contains(grps, "*")) || (!ok && config.GetConfig().Whitelist) {
return true
@@ -135,16 +135,17 @@ func (d *ResourceModel) GetName() string {
return d.UUID
}
func (abs *ResourceModel) VerifyAuth(peerID string, groups []string) bool {
func (abs *ResourceModel) VerifyAuth(username string, peerID string, groups []string) bool {
return true
}
func (d *ResourceModel) GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
func (d *ResourceModel) GetAccessor(username string, peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
return &ResourceModelMongoAccessor{
utils.AbstractAccessor{
Type: tools.RESOURCE_MODEL,
PeerID: peerID,
Groups: groups,
User: username,
Caller: caller,
},
}