Class CaldavServerRest

java.lang.Object
org.exoplatform.caldav.rest.CaldavServerRest

@RestController @RequestMapping("/servers") public class CaldavServerRest extends Object
REST access to the CalDAV server registry. Reads are open to every authenticated user — the rows are credential-free by construction, and the browser needs the names and URLs to offer the connectors. Writes are for platform administrators; the ACL decision itself lives in the service, this layer only maps its exceptions onto statuses (404 for a missing object, 403 for a refused access, 400 with the message code for an invalid input — note the legacy JAX-RS resource of this add-on answers 401 where the org contract says 403; this new controller follows the contract).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.exoplatform.caldav.model.CaldavManagedMode
    clearManagedMode(jakarta.servlet.http.HttpServletRequest request)
    Switches managed mode off: users choose their own server again.
    org.exoplatform.caldav.model.CaldavServer
    createServer(jakarta.servlet.http.HttpServletRequest request, org.exoplatform.caldav.model.CaldavServer server)
    Declares a new CalDAV server.
    void
    deleteServer(jakarta.servlet.http.HttpServletRequest request, long serverId)
    Deletes a declared CalDAV server, refused with a 409 — carrying caldav.server.referenced:<count> — while connected accounts still reference it.
    org.exoplatform.caldav.model.CaldavManagedMode
    getManagedMode(jakarta.servlet.http.HttpServletRequest request)
    Whether this deployment chooses the CalDAV server on its users' behalf, and — for the caller specifically — whether that choice applies to them.
    What the last pass over each connected user's meeting copies found and moved.
    org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource>
    getServerImage(jakarta.servlet.http.HttpServletRequest request, long serverId)
    Serves the uploaded image of a declared CalDAV server — the icon the admin table and the connectors list render.
    List<org.exoplatform.caldav.model.CaldavServer>
    getServers(jakarta.servlet.http.HttpServletRequest request)
    Lists every declared CalDAV server, active or not — the admin section shows both, and nothing in a row is secret.
    org.exoplatform.caldav.model.CaldavSyncTuning
    How often and how widely eXo synchronises CalDAV accounts.
    org.exoplatform.caldav.model.CaldavManagedMode
    saveManagedMode(jakarta.servlet.http.HttpServletRequest request, long serverId)
    Records the server the instance synchronises everybody with.
    org.exoplatform.caldav.model.CaldavSyncTuning
    saveTuning(org.exoplatform.caldav.model.CaldavSyncTuning tuning)
    Records how often and how widely eXo synchronises.
    org.exoplatform.caldav.model.CaldavServer
    setServerActive(jakarta.servlet.http.HttpServletRequest request, long serverId, boolean active)
    Activates or deactivates a declared CalDAV server.
    org.exoplatform.caldav.model.CaldavServer
    updateServer(jakarta.servlet.http.HttpServletRequest request, long serverId, org.exoplatform.caldav.model.CaldavServer server)
    Updates a declared CalDAV server.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CaldavServerRest

      public CaldavServerRest()
  • Method Details

    • getTuning

      @GetMapping("/tuning") @Secured("users") public org.exoplatform.caldav.model.CaldavSyncTuning getTuning()
      How often and how widely eXo synchronises CalDAV accounts.

      Readable by any authenticated user because nothing here is secret and the administration screen renders before it knows who is looking; writing is another matter.

      Returns:
      the tuning in force
    • saveTuning

      @PutMapping("/tuning") @Secured("administrators") public org.exoplatform.caldav.model.CaldavSyncTuning saveTuning(@RequestBody org.exoplatform.caldav.model.CaldavSyncTuning tuning)
      Records how often and how widely eXo synchronises.

      Takes effect on the next synchronisation, not on the next restart: the engine reads these where it uses them rather than capturing them when its beans are built.

      Parameters:
      tuning - the values to store
      Returns:
      the tuning now in force
    • getManagedMode

      @GetMapping("/managed") @Secured("users") public org.exoplatform.caldav.model.CaldavManagedMode getManagedMode(jakarta.servlet.http.HttpServletRequest request)
      Whether this deployment chooses the CalDAV server on its users' behalf, and — for the caller specifically — whether that choice applies to them.

      Readable by every authenticated user because every authenticated user acts on it: this is what the browser reads before deciding whether to offer connecting an account at all. The managedForMe half is computed per viewer in the service, so that the group exclusions planned next change one service method and not one front-end component per screen.

      Parameters:
      request - the HTTP request, carrying the authenticated user
      Returns:
      the mode as it stands for the caller
    • saveManagedMode

      @PutMapping("/managed") @Secured("administrators") public org.exoplatform.caldav.model.CaldavManagedMode saveManagedMode(jakarta.servlet.http.HttpServletRequest request, @RequestParam("serverId") long serverId)
      Records the server the instance synchronises everybody with.

      Switching managed mode on takes the connect and disconnect affordances away from every user, so the row has to be one they could actually have connected to: an unknown or deactivated registration is refused with the message code the drawer renders.

      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration to manage with
      Returns:
      the mode now in force, as it stands for the calling administrator
    • clearManagedMode

      @DeleteMapping("/managed") @Secured("administrators") public org.exoplatform.caldav.model.CaldavManagedMode clearManagedMode(jakarta.servlet.http.HttpServletRequest request)
      Switches managed mode off: users choose their own server again.

      Nothing is severed by this and nothing was severed by switching it on — the mode governs which affordances are offered, never the connections that already exist.

      Parameters:
      request - the HTTP request, carrying the authenticated user
      Returns:
      the mode now in force, which names no server
    • getMirrorReports

      @GetMapping("/mirror/reports") @Secured("administrators") public List<MirrorPassReport> getMirrorReports()
      What the last pass over each connected user's meeting copies found and moved.

      Administrators only, and for a reason the reads above do not have: a row here names a user and says something about the state of their calendar. Nothing in it is a credential, but it is not the sort of thing every authenticated caller has any business enumerating.

      In memory and therefore empty after a restart, until each account synchronises again. That is stated in the screen rather than hidden here.

      Returns:
      the last pass of every user that has had one, newest first
    • getServers

      @GetMapping @Secured("users") public List<org.exoplatform.caldav.model.CaldavServer> getServers(jakarta.servlet.http.HttpServletRequest request)
      Lists every declared CalDAV server, active or not — the admin section shows both, and nothing in a row is secret.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      Returns:
      every registration
    • createServer

      @PostMapping @Secured("administrators") public org.exoplatform.caldav.model.CaldavServer createServer(jakarta.servlet.http.HttpServletRequest request, @RequestBody org.exoplatform.caldav.model.CaldavServer server)
      Declares a new CalDAV server.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      server - registration to create
      Returns:
      the created registration, carrying its id and provider name
    • updateServer

      @PutMapping("/{serverId}") @Secured("administrators") public org.exoplatform.caldav.model.CaldavServer updateServer(jakarta.servlet.http.HttpServletRequest request, @PathVariable("serverId") long serverId, @RequestBody org.exoplatform.caldav.model.CaldavServer server)
      Updates a declared CalDAV server.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration
      server - new values of the registration
      Returns:
      the updated registration
    • setServerActive

      @PatchMapping("/{serverId}/status") @Secured("administrators") public org.exoplatform.caldav.model.CaldavServer setServerActive(jakarta.servlet.http.HttpServletRequest request, @PathVariable("serverId") long serverId, @RequestParam("active") boolean active)
      Activates or deactivates a declared CalDAV server.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration
      active - whether users may connect to this server
      Returns:
      the updated registration
    • deleteServer

      @DeleteMapping("/{serverId}") @Secured("administrators") public void deleteServer(jakarta.servlet.http.HttpServletRequest request, @PathVariable("serverId") long serverId)
      Deletes a declared CalDAV server, refused with a 409 — carrying caldav.server.referenced:<count> — while connected accounts still reference it.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration
    • getServerImage

      @GetMapping("/{serverId}/image") @Secured("users") public org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> getServerImage(jakarta.servlet.http.HttpServletRequest request, @PathVariable("serverId") long serverId)
      Serves the uploaded image of a declared CalDAV server — the icon the admin table and the connectors list render.
      Parameters:
      request - the HTTP request, carrying the authenticated user
      serverId - technical identifier of the registration
      Returns:
      the image bytes as PNG