Skip to content

Commit

Permalink
Fix sandbox annotation api route (#7942)
Browse files Browse the repository at this point in the history
  • Loading branch information
fm3 authored Jul 24, 2024
1 parent 3ec2977 commit e3e975f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/models/annotation/AnnotationRestrictions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ class AnnotationRestrictionDefaults @Inject()(userService: UserService)(implicit
override def allowUpdate(user: Option[User]): Fox[Boolean] =
for {
accessAllowed <- allowAccess(user)
annotationOwner <- userService.findOneCached(annotation._user)(GlobalAccessContext)
annotationOwnerBox <- userService
.findOneCached(annotation._user)(GlobalAccessContext)
.futureBox // sandbox annotations have no owner
} yield
user.exists { user =>
(annotation._user == user._id || (accessAllowed && annotation.othersMayEdit)) &&
!(annotation.state == Finished) &&
!annotation.isLockedByOwner &&
annotationOwner._organization == user._organization
annotationOwnerBox.exists(_._organization == user._organization)
}

override def allowFinish(userOption: Option[User]): Fox[Boolean] =
Expand Down

0 comments on commit e3e975f

Please sign in to comment.