Skip to content

Commit

Permalink
Merge branch 'feature/bulk-roi-bugs' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanStonebraker committed Apr 17, 2024
2 parents ab5c4fc + 24ae44f commit f86e57a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
15 changes: 15 additions & 0 deletions api/ws/handlers/roi.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,18 @@ func createROI(roi *protos.ROIItem, hctx wsHelpers.HandlerContext, needMistEntry
// We need to create an ownership item along with it
ownerItem := wsHelpers.MakeOwnerForWrite(id, protos.ObjectType_OT_ROI, hctx.SessUser.User.Id, hctx.Svcs.TimeStamper.GetTimeNowSec())
if editors != nil {
if ownerItem.Editors == nil {
ownerItem.Editors = &protos.UserGroupList{}
}

ownerItem.Editors.UserIds = editors.UserIds
ownerItem.Editors.GroupIds = editors.GroupIds
}

if viewers != nil {
if ownerItem.Viewers == nil {
ownerItem.Viewers = &protos.UserGroupList{}
}
ownerItem.Viewers.UserIds = viewers.UserIds
ownerItem.Viewers.GroupIds = viewers.GroupIds
}
Expand Down Expand Up @@ -262,11 +269,19 @@ func updateROI(roi *protos.ROIItem, hctx wsHelpers.HandlerContext, editors *prot
// Check if we need to update the ownership
if editors != nil || viewers != nil {
if editors != nil {
if owner.Editors == nil {
owner.Editors = &protos.UserGroupList{}
}

owner.Editors.UserIds = editors.UserIds
owner.Editors.GroupIds = editors.GroupIds
}

if viewers != nil {
if owner.Viewers == nil {
owner.Viewers = &protos.UserGroupList{}
}

owner.Viewers.UserIds = viewers.UserIds
owner.Viewers.GroupIds = viewers.GroupIds
}
Expand Down
9 changes: 0 additions & 9 deletions api/ws/wsHelpers/ownership.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,10 @@ func MakeOwnerForWrite(objectId string, objectType protos.ObjectType, creatorUse
ObjectType: objectType,
CreatedUnixSec: uint32(createTimeUnixSec),
CreatorUserId: "",
Editors: &protos.UserGroupList{
UserIds: []string{},
GroupIds: []string{},
},
Viewers: &protos.UserGroupList{
UserIds: []string{},
GroupIds: []string{},
},
}

if len(creatorUserId) > 0 {
ownerItem.CreatorUserId = creatorUserId
//ownerItem.Viewers
ownerItem.Editors = &protos.UserGroupList{
UserIds: []string{creatorUserId},
}
Expand Down

0 comments on commit f86e57a

Please sign in to comment.