Class AgendaCalendarShareRest

java.lang.Object
org.exoplatform.agenda.rest.AgendaCalendarShareRest

@RestController public class AgendaCalendarShareRest extends Object
Sharing a personal calendar with colleagues, and reading the calendars shared with oneself (EXO-90357).

No rule lives here. Who may share, with whom, and what a sharee reads are AgendaCalendarShareService's; this resource maps its exceptions to statuses — not found, then forbidden, then bad request — and names the people its answers carry. The asking user comes from the session, never from a parameter.

  • Constructor Summary

    Constructors
    Constructor
    Description
    AgendaCalendarShareRest(org.exoplatform.agenda.service.AgendaCalendarShareService calendarShareService, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.social.core.manager.IdentityManager identityManager)
    Builds the resource.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.ResponseEntity<Map<Long,Long>>
    getShareCounts(jakarta.servlet.http.HttpServletRequest request)
    How many colleagues each of the user's calendars is shared with: what draws the shared sign on the personal calendar rows with one request.
    org.springframework.http.ResponseEntity<List<SharedCalendarEntity>>
    getSharedWithMe(jakarta.servlet.http.HttpServletRequest request)
    The calendars shared with the user, hidden ones included.
    org.springframework.http.ResponseEntity<Map<String,Object>>
    getShares(jakarta.servlet.http.HttpServletRequest request, long calendarId)
    The colleagues a calendar is shared with, and the shares of it that exist on a channel's server without an eXo record.
    org.springframework.http.ResponseEntity<Void>
    removeExternalShare(jakarta.servlet.http.HttpServletRequest request, long calendarId, String channelId, String externalId)
    Removes a share that exists on a channel's server without an eXo record.
    org.springframework.http.ResponseEntity<Void>
    setHidden(jakarta.servlet.http.HttpServletRequest request, long calendarId, Map<String,Object> body)
    Hides, or shows again, a calendar shared with the user.
    org.springframework.http.ResponseEntity<Void>
    setLevel(jakarta.servlet.http.HttpServletRequest request, long calendarId, long shareeIdentityId, Map<String,String> body)
    Changes what a colleague may do with a calendar shared with them (EXO-90378).
    org.springframework.http.ResponseEntity<CalendarShareeEntity>
    share(jakarta.servlet.http.HttpServletRequest request, long calendarId, Map<String,String> body)
    Shares a calendar with a colleague.
    org.springframework.http.ResponseEntity<Void>
    unshare(jakarta.servlet.http.HttpServletRequest request, long calendarId, long shareeIdentityId)
    Stops sharing a calendar with a colleague.

    Methods inherited from class java.lang.Object

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

    • AgendaCalendarShareRest

      @Autowired public AgendaCalendarShareRest(org.exoplatform.agenda.service.AgendaCalendarShareService calendarShareService, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.social.core.manager.IdentityManager identityManager)
      Builds the resource.
      Parameters:
      calendarShareService - holder of every sharing rule
      agendaCalendarService - reads the calendars a listing names
      identityManager - names the people an answer carries
  • Method Details

    • getShares

      @GetMapping("calendars/{calendarId}/shares") @Secured("users") public org.springframework.http.ResponseEntity<Map<String,Object>> getShares(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId)
      The colleagues a calendar is shared with, and the shares of it that exist on a channel's server without an eXo record.
      Parameters:
      request - the authenticated request
      calendarId - technical identifier of the calendar
      Returns:
      the shares under shares, the external ones under externalShares
    • share

      @PostMapping("calendars/{calendarId}/shares") @Secured("users") public org.springframework.http.ResponseEntity<CalendarShareeEntity> share(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId, @RequestBody Map<String,String> body)
      Shares a calendar with a colleague.
      Parameters:
      request - the authenticated request
      calendarId - technical identifier of the calendar
      body - {"username": "..."}
      Returns:
      the share, naming the channel that also carries it when one does
    • setLevel

      @PutMapping("calendars/{calendarId}/shares/{shareeIdentityId}") @Secured("users") public org.springframework.http.ResponseEntity<Void> setLevel(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId, @PathVariable("shareeIdentityId") long shareeIdentityId, @RequestBody Map<String,String> body)
      Changes what a colleague may do with a calendar shared with them (EXO-90378).
      Parameters:
      request - the authenticated request
      calendarId - technical identifier of the calendar
      shareeIdentityId - identity identifier of the colleague
      body - {"access": "VIEW"|"EDIT"}
      Returns:
      no content
    • unshare

      @DeleteMapping("calendars/{calendarId}/shares/{shareeIdentityId}") @Secured("users") public org.springframework.http.ResponseEntity<Void> unshare(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId, @PathVariable("shareeIdentityId") long shareeIdentityId)
      Stops sharing a calendar with a colleague.
      Parameters:
      request - the authenticated request
      calendarId - technical identifier of the calendar
      shareeIdentityId - identity identifier of the colleague
      Returns:
      no content
    • removeExternalShare

      @DeleteMapping("calendars/{calendarId}/external-shares/{channelId}/{externalId}") @Secured("users") public org.springframework.http.ResponseEntity<Void> removeExternalShare(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId, @PathVariable("channelId") String channelId, @PathVariable("externalId") String externalId)
      Removes a share that exists on a channel's server without an eXo record.
      Parameters:
      request - the authenticated request
      calendarId - technical identifier of the calendar
      channelId - the channel that listed the share
      externalId - the channel's identifier of the share
      Returns:
      no content
    • getShareCounts

      @GetMapping("calendars/share-counts") @Secured("users") public org.springframework.http.ResponseEntity<Map<Long,Long>> getShareCounts(jakarta.servlet.http.HttpServletRequest request)
      How many colleagues each of the user's calendars is shared with: what draws the shared sign on the personal calendar rows with one request.
      Parameters:
      request - the authenticated request
      Returns:
      sharee counts by calendar identifier, absent when zero
    • getSharedWithMe

      @GetMapping("calendars/shared-with-me") @Secured("users") public org.springframework.http.ResponseEntity<List<SharedCalendarEntity>> getSharedWithMe(jakarta.servlet.http.HttpServletRequest request)
      The calendars shared with the user, hidden ones included.
      Parameters:
      request - the authenticated request
      Returns:
      the calendars, newest share first
    • setHidden

      @PutMapping("calendars/shared-with-me/{calendarId}/hidden") @Secured("users") public org.springframework.http.ResponseEntity<Void> setHidden(jakarta.servlet.http.HttpServletRequest request, @PathVariable("calendarId") long calendarId, @RequestBody Map<String,Object> body)
      Hides, or shows again, a calendar shared with the user.
      Parameters:
      request - the authenticated request
      calendarId - technical identifier of the calendar
      body - {"hidden": true|false}
      Returns:
      no content