@Override public boolean isEventMatching(WatchListEvent event, String subscriber) { boolean isWatched = false; try { // The subscriber's watched users, since each event can be a composite event. Collection<String> watchedUsers = store.getWatchedElements(subscriber, WatchedElementType.USER); isWatched |= store.isWatched(event.getWiki(), subscriber, WatchedElementType.WIKI); isWatched |= store.isWatched(event.getPrefixedSpace(), subscriber, WatchedElementType.SPACE); isWatched |= store.isWatched(event.getPrefixedFullName(), subscriber, WatchedElementType.DOCUMENT); isWatched |= CollectionUtils.intersection(watchedUsers, event.getAuthors()).size() > 0; } catch (Exception e) { logger.error( "Failed to determine if an event for the document [{}] is interesting to [{}]", event.getDocumentReference(), subscriber, e); } return isWatched; }
@Override public boolean isEventViewable(WatchListEvent event, String subscriber) { DocumentReference userReference = resolver.resolve(subscriber); return authorizationManager.hasAccess(Right.VIEW, userReference, event.getDocumentReference()); }