add username to our trip
This commit is contained in:
@@ -70,7 +70,7 @@ func (ao *CollaborativeArea) Clear(peerID string) {
|
||||
ao.CollaborativeAreaRule.CreatedAt = time.Now().UTC()
|
||||
}
|
||||
|
||||
func (ao *CollaborativeArea) VerifyAuth(peerID string, groups []string) bool {
|
||||
func (ao *CollaborativeArea) VerifyAuth(username string, peerID string, groups []string) bool {
|
||||
if ao.AllowedPeersGroup != nil || config.GetConfig().Whitelist {
|
||||
if grps, ok := ao.AllowedPeersGroup[peerID]; ok || config.GetConfig().Whitelist {
|
||||
fmt.Println("grps", grps, "ok", ok, "config.GetConfig().Whitelist", config.GetConfig().Whitelist)
|
||||
@@ -87,8 +87,8 @@ func (ao *CollaborativeArea) VerifyAuth(peerID string, groups []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (d *CollaborativeArea) GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
|
||||
return New(tools.COLLABORATIVE_AREA, peerID, groups, caller) // Create a new instance of the accessor
|
||||
func (d *CollaborativeArea) GetAccessor(username string, peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
|
||||
return New(tools.COLLABORATIVE_AREA, username, peerID, groups, caller) // Create a new instance of the accessor
|
||||
}
|
||||
|
||||
func (d *CollaborativeArea) Trim() *CollaborativeArea {
|
||||
|
@@ -26,7 +26,7 @@ type collaborativeAreaMongoAccessor struct {
|
||||
ruleAccessor utils.Accessor
|
||||
}
|
||||
|
||||
func New(t tools.DataType, peerID string, groups []string, caller *tools.HTTPCaller) *collaborativeAreaMongoAccessor {
|
||||
func New(t tools.DataType, username string, peerID string, groups []string, caller *tools.HTTPCaller) *collaborativeAreaMongoAccessor {
|
||||
return &collaborativeAreaMongoAccessor{
|
||||
AbstractAccessor: utils.AbstractAccessor{
|
||||
Logger: logs.CreateLogger(t.String()), // Create a logger with the data type
|
||||
@@ -35,10 +35,10 @@ func New(t tools.DataType, peerID string, groups []string, caller *tools.HTTPCal
|
||||
Groups: groups, // Set the caller
|
||||
Type: t,
|
||||
},
|
||||
workspaceAccessor: (&workspace.Workspace{}).GetAccessor(peerID, groups, nil),
|
||||
workflowAccessor: (&w.Workflow{}).GetAccessor(peerID, groups, nil),
|
||||
peerAccessor: (&peer.Peer{}).GetAccessor(peerID, groups, nil),
|
||||
ruleAccessor: (&rule.Rule{}).GetAccessor(peerID, groups, nil),
|
||||
workspaceAccessor: (&workspace.Workspace{}).GetAccessor(username, peerID, groups, nil),
|
||||
workflowAccessor: (&w.Workflow{}).GetAccessor(username, peerID, groups, nil),
|
||||
peerAccessor: (&peer.Peer{}).GetAccessor(username, peerID, groups, nil),
|
||||
ruleAccessor: (&rule.Rule{}).GetAccessor(username, peerID, groups, nil),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,6 @@ func (r *Rule) GenerateID() {
|
||||
r.UUID = uuid.New().String()
|
||||
}
|
||||
|
||||
func (d *Rule) GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
|
||||
return New(tools.RULE, peerID, groups, caller)
|
||||
func (d *Rule) GetAccessor(username string, peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
|
||||
return New(tools.RULE, username, peerID, groups, caller)
|
||||
}
|
||||
|
@@ -13,13 +13,14 @@ type ruleMongoAccessor struct {
|
||||
}
|
||||
|
||||
// New creates a new instance of the ruleMongoAccessor
|
||||
func New(t tools.DataType, peerID string, groups []string, caller *tools.HTTPCaller) *ruleMongoAccessor {
|
||||
func New(t tools.DataType, username string, peerID string, groups []string, caller *tools.HTTPCaller) *ruleMongoAccessor {
|
||||
return &ruleMongoAccessor{
|
||||
AbstractAccessor: utils.AbstractAccessor{
|
||||
Logger: logs.CreateLogger(t.String()), // Create a logger with the data type
|
||||
Caller: caller,
|
||||
PeerID: peerID,
|
||||
Groups: groups, // Set the caller
|
||||
User: username,
|
||||
Type: t,
|
||||
},
|
||||
}
|
||||
|
@@ -18,6 +18,6 @@ type ShallowCollaborativeArea struct {
|
||||
Rules []string `json:"rules,omitempty" bson:"rules,omitempty"`
|
||||
}
|
||||
|
||||
func (d *ShallowCollaborativeArea) GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
|
||||
return New(tools.COLLABORATIVE_AREA, peerID, groups, caller)
|
||||
func (d *ShallowCollaborativeArea) GetAccessor(username string, peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
|
||||
return New(tools.COLLABORATIVE_AREA, username, peerID, groups, caller)
|
||||
}
|
||||
|
@@ -11,13 +11,14 @@ type shallowSharedWorkspaceMongoAccessor struct {
|
||||
utils.AbstractAccessor
|
||||
}
|
||||
|
||||
func New(t tools.DataType, peerID string, groups []string, caller *tools.HTTPCaller) *shallowSharedWorkspaceMongoAccessor {
|
||||
func New(t tools.DataType, username string, peerID string, groups []string, caller *tools.HTTPCaller) *shallowSharedWorkspaceMongoAccessor {
|
||||
return &shallowSharedWorkspaceMongoAccessor{
|
||||
AbstractAccessor: utils.AbstractAccessor{
|
||||
Logger: logs.CreateLogger(t.String()), // Create a logger with the data type
|
||||
Caller: caller,
|
||||
PeerID: peerID,
|
||||
Groups: groups, // Set the caller
|
||||
User: username, // Set the caller
|
||||
Groups: groups, // Set the caller
|
||||
Type: t,
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user