Class CaldavShareRest

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

@RestController public class CaldavShareRest extends Object
Sharing a user's own eXo calendar, read-only, with colleagues connected to the same CalDAV server (EXO-90253).

The caller is read from the conversation state, never from the request, and the request names only an agenda calendar id and a colleague's login: the collection, the principals and the access list are all resolved and checked by CaldavCalendarShareService. This layer maps the outcome onto a status and nothing else: 404 for a calendar that does not exist, 403 for one the caller does not own, 400 with the message code for a request that cannot be honoured, and for a failure of the account or the server the code with whatever the server said (409 for a state of the account or the server, 502 when the server could not be reached or did not apply what it accepted).

  • Constructor Details

    • CaldavShareRest

      public CaldavShareRest()
  • Method Details

    • shareableCalendars

      @GetMapping("/calendars/shareable") @Secured("users") public ShareableCalendars shareableCalendars()
      The caller's calendars agenda may offer "Share" on.
      Returns:
      the calendar ids, empty whenever anything stands in the way
    • shares

      @GetMapping("/calendars/{calendarId}/shares") @Secured("users") public org.exoplatform.caldav.model.CalendarShares shares(@PathVariable("calendarId") long calendarId)
      Who a calendar is shared with, read from the server now.
      Parameters:
      calendarId - the agenda calendar
      Returns:
      the sharees
    • share

      @PostMapping("/calendars/{calendarId}/shares") @Secured("users") public org.exoplatform.caldav.model.CalendarShares share(@PathVariable("calendarId") long calendarId, @RequestBody(required=false) ShareCalendarRequest request)
      Gives a colleague read access to a calendar.
      Parameters:
      calendarId - the agenda calendar
      request - the colleague's login
      Returns:
      the sharees after the grant, as read back
    • unshare

      @DeleteMapping("/calendars/{calendarId}/shares/{username}") @Secured("users") public org.exoplatform.caldav.model.CalendarShares unshare(@PathVariable("calendarId") long calendarId, @PathVariable("username") String username)
      Takes a colleague's read access to a calendar away.
      Parameters:
      calendarId - the agenda calendar
      username - the colleague's login
      Returns:
      the sharees after the revoke, as read back
    • candidates

      @GetMapping("/calendars/{calendarId}/share-candidates") @Secured("users") public List<org.exoplatform.caldav.model.CalendarShares.ShareUser> candidates(@PathVariable("calendarId") long calendarId, @RequestParam(name="q",required=false) String query)
      The colleagues a calendar can be shared with.
      Parameters:
      calendarId - the agenda calendar
      query - text the login or full name must contain
      Returns:
      the candidates
    • onShareFailure

      @ExceptionHandler(CaldavShareException.class) public org.springframework.http.ResponseEntity<Map<String,Object>> onShareFailure(CaldavShareException failure)
      Maps a failure of the account or the server onto a status, keeping its code, and what the server said, in the body.
      Parameters:
      failure - what went wrong
      Returns:
      the response the browser receives