Class AgendaCalendarLinkServiceImpl
- All Implemented Interfaces:
org.exoplatform.agenda.service.AgendaCalendarLinkService
Managing (read the status, create or reset, delete) is
Utils.canPublishCalendar(org.exoplatform.social.core.manager.IdentityManager, org.exoplatform.social.core.space.spi.SpaceService, long, long): the owner of a personal calendar, a real manager of
the space for a space calendar.
Answering is decided again on every fetch, because the URL is
presented with no session: a link answers only while its creator still holds
the right that let them create it — a space calendar's creator is still a
manager of the space, a personal calendar's creator is still its owner — and
the creator's account is neither disabled nor deleted. The same predicate
sets CalendarLink.isActive() for the drawer, so the drawer and the
feed cannot disagree about a link.
Tokens: 32 bytes of SecureRandom, base64url without padding,
stored twice and never in clear. The SHA-256 digest is what a feed request is
found and compared by — no salt and no stretching are needed for a 256-bit
random secret, there is no dictionary to search. A copy encrypted with the
platform codec (CodecInitializer, the key every stored secret of the
instance is encrypted with) lets the link be shown again to whoever may manage
it; if that key is ever replaced, the copy no longer decrypts, the link can no
longer be displayed, and it keeps answering through its digest until someone
resets it. Neither the token, nor its digest, nor its copy is ever logged.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDays of future events the feed publishes.static final intMost events one document carries, occurrences counted.static final intMost links one listing returns.static final intMost managed spaces one listing looks at.static final intDays of past events the feed publishes. -
Constructor Summary
ConstructorsConstructorDescriptionAgendaCalendarLinkServiceImpl(CalendarLinkStorage calendarLinkStorage, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.web.security.codec.CodecInitializer codecInitializer) Builds the service. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteCalendarLink(long calendarId, String username) voiddeleteCalendarLinks(long calendarId) getCalendarFeed(String token) org.exoplatform.agenda.model.CalendarLinkgetCalendarLink(long calendarId, String username) List<org.exoplatform.agenda.model.CalendarLink> getCalendarLinks(String username) longgetFeedCalendarId(String token) saveCalendarLink(long calendarId, String username)
-
Field Details
-
PAST_DAYS
public static final int PAST_DAYSDays of past events the feed publishes.- See Also:
-
FUTURE_DAYS
public static final int FUTURE_DAYSDays of future events the feed publishes.- See Also:
-
MAX_EVENTS
public static final int MAX_EVENTSMost events one document carries, occurrences counted. A safety stop for a calendar with a dense recurring event, not a page: the earliest are kept. The writer adds a budget on the characters written.- See Also:
-
MAX_LISTED_LINKS
public static final int MAX_LISTED_LINKSMost links one listing returns.- See Also:
-
MAX_MANAGED_SPACES
public static final int MAX_MANAGED_SPACESMost managed spaces one listing looks at. Kept under a thousand with the user's own identity: the owners go into oneINlist, and Oracle refuses more than a thousand items there.- See Also:
-
-
Constructor Details
-
AgendaCalendarLinkServiceImpl
@Autowired public AgendaCalendarLinkServiceImpl(CalendarLinkStorage calendarLinkStorage, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.web.security.codec.CodecInitializer codecInitializer) Builds the service.- Parameters:
calendarLinkStorage- storage of calendar linksagendaCalendarService- reads calendarsagendaEventService- reads the events a feed publishes, re-applying the calendar ACL for the link's creatoridentityManager- resolves users and space identitiesspaceService- resolves space management rightscodecInitializer- the platform codec the displayable copy of a token is encrypted with
-
-
Method Details
-
getCalendarLink
public org.exoplatform.agenda.model.CalendarLink getCalendarLink(long calendarId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
getCalendarLinkin interfaceorg.exoplatform.agenda.service.AgendaCalendarLinkService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
getCalendarLinks
public List<org.exoplatform.agenda.model.CalendarLink> getCalendarLinks(String username) throws IllegalAccessException One query reads the links: the candidate calendars are those the user's own identity owns and those the spaces they manage own, and the links are joined to them in the database. Each link found is then checked again with the same rule every other method applies — so a space they stopped managing since the list of managed spaces was read is left out — and read the same way
getCalendarLink(long, java.lang.String)reads it. Space identities and calendars are read through the platform's cached services.- Specified by:
getCalendarLinksin interfaceorg.exoplatform.agenda.service.AgendaCalendarLinkService- Throws:
IllegalAccessException
-
saveCalendarLink
public String saveCalendarLink(long calendarId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
saveCalendarLinkin interfaceorg.exoplatform.agenda.service.AgendaCalendarLinkService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
deleteCalendarLink
public void deleteCalendarLink(long calendarId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
deleteCalendarLinkin interfaceorg.exoplatform.agenda.service.AgendaCalendarLinkService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
deleteCalendarLinks
public void deleteCalendarLinks(long calendarId) - Specified by:
deleteCalendarLinksin interfaceorg.exoplatform.agenda.service.AgendaCalendarLinkService
-
getCalendarFeed
public String getCalendarFeed(String token) throws org.exoplatform.commons.exception.ObjectNotFoundException Every refusal throws the same exception with the same message, and a malformed token is still digested and looked up before it is refused, so that the answer to an unknown token does not come back faster than the answer to a real one. A link whose creator lost their right costs the permission checks on top of that lookup before it is refused: only someone already holding a once-valid token can observe that difference.
- Specified by:
getCalendarFeedin interfaceorg.exoplatform.agenda.service.AgendaCalendarLinkService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
getFeedCalendarId
public long getFeedCalendarId(String token) throws org.exoplatform.commons.exception.ObjectNotFoundException - Specified by:
getFeedCalendarIdin interfaceorg.exoplatform.agenda.service.AgendaCalendarLinkService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-