def isEditable()

in riff-raff/app/restrictions/RestrictionChecker.scala [24:42]


  def isEditable(
      currentConfig: Option[RestrictionConfig],
      identity: UserIdentity,
      superusers: List[String]
  ): Either[Error, Boolean] = {
    currentConfig match {
      case None => Right(true)
      case Some(config)
          if !config.editingLocked || config.email == identity.email || superusers
            .contains(identity.email) =>
        Right(true)
      case Some(config) =>
        val superuserInfo =
          if (superusers.nonEmpty)
            s" - can also be modified by ${superusers.mkString(", ")}"
          else ""
        Left(Error(s"Locked by ${config.email}$superuserInfo"))
    }
  }