Peer Manipulation
This commit is contained in:
@@ -63,7 +63,12 @@ func (a *collaborativeAreaMongoAccessor) UpdateOne(set utils.DBObject, id string
|
||||
|
||||
// StoreOne stores a collaborative area in the database, it automatically share to peers if the workspace is shared
|
||||
func (a *collaborativeAreaMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||
_, id := (&peer.Peer{}).IsMySelf() // get the local peer
|
||||
id, err := utils.GetMySelf((&peer.Peer{}).GetAccessor(&tools.APIRequest{
|
||||
Admin: true,
|
||||
})) // get the local peer
|
||||
if err != nil {
|
||||
return data, 404, err
|
||||
}
|
||||
data.(*CollaborativeArea).Clear(id) // set the creator
|
||||
// retrieve or proper peer
|
||||
if data.(*CollaborativeArea).CollaborativeAreaRule != nil {
|
||||
@@ -271,7 +276,9 @@ func (a *collaborativeAreaMongoAccessor) contactPeer(shared *CollaborativeArea,
|
||||
|
||||
paccess := (&peer.Peer{})
|
||||
for k := range shared.AllowedPeersGroup {
|
||||
if ok, _ := (&peer.Peer{AbstractObject: utils.AbstractObject{UUID: k}}).IsMySelf(); ok || (shared.IsSent && meth == tools.POST) || (!shared.IsSent && meth != tools.POST) {
|
||||
if ok, _ := utils.IsMySelf(k, (&peer.Peer{}).GetAccessor(&tools.APIRequest{
|
||||
Admin: true,
|
||||
})); ok || (shared.IsSent && meth == tools.POST) || (!shared.IsSent && meth != tools.POST) {
|
||||
continue
|
||||
}
|
||||
shared.IsSent = meth == tools.POST
|
||||
|
||||
Reference in New Issue
Block a user