@Override public boolean hasRight(MailboxPath mailboxPath, Right right, MailboxSession session) throws MailboxException { return storeRightManager.hasRight(mailboxPath, right, session); }
private boolean userHasLookupRightsOn(Mailbox mailbox, MailboxSession session) throws MailboxException { return storeRightManager.hasRight(mailbox, Right.Lookup, session); }
@Override public boolean hasRight(MailboxId mailboxId, Right right, MailboxSession session) throws MailboxException { return storeRightManager.hasRight(mailboxId, right, session); }
@Override public MailboxCounters getMailboxCounters(MailboxSession mailboxSession) throws MailboxException { if (storeRightManager.hasRight(mailbox, MailboxACL.Right.Read, mailboxSession)) { return mapperFactory.createMessageMapper(mailboxSession).getMailboxCounters(mailbox); } return ZERO_MAILBOX_COUNTERS; }
private List<MailboxMetaData> searchMailboxes(MailboxQuery mailboxExpression, MailboxSession session, Right right) throws MailboxException { MailboxMapper mailboxMapper = mailboxSessionMapperFactory.getMailboxMapper(session); Stream<Mailbox> baseMailboxes = mailboxMapper .findMailboxWithPathLike(getPathLike(mailboxExpression, session)) .stream(); Stream<Mailbox> delegatedMailboxes = getDelegatedMailboxes(mailboxMapper, mailboxExpression, right, session); List<Mailbox> mailboxes = Stream.concat(baseMailboxes, delegatedMailboxes) .distinct() .filter(Throwing.predicate(mailbox -> storeRightManager.hasRight(mailbox, right, session))) .collect(Guavate.toImmutableList()); return mailboxes .stream() .filter(mailbox -> mailboxExpression.isPathMatch(mailbox.generateAssociatedPath())) .map(mailbox -> toMailboxMetadata(session, mailboxes, mailbox)) .sorted(new StandardMailboxMetaDataComparator()) .collect(Guavate.toImmutableList()); }
public MailboxId checkThenGetMailboxId(MailboxPath path, MailboxSession session) throws MailboxException { MailboxMapper mailboxMapper = mailboxSessionMapperFactory.getMailboxMapper(session); Mailbox mailbox = mailboxMapper.findMailboxByPath(path); if (!rightManager.hasRight(mailbox, Right.Read, session)) { throw new InsufficientRightsException("Not enough rights on " + path); } return mailbox.getMailboxId(); }
@Override public MetaData getMetaData(boolean resetRecent, MailboxSession mailboxSession, MetaData.FetchGroup fetchGroup) throws MailboxException { MailboxACL resolvedAcl = storeRightManager.getResolvedMailboxACL(mailbox, mailboxSession); boolean hasReadRight = storeRightManager.hasRight(mailbox, MailboxACL.Right.Read, mailboxSession); if (!hasReadRight) { return MailboxMetaData.sensibleInformationFree(resolvedAcl, getMailboxEntity().getUidValidity(), isWriteable(mailboxSession), isModSeqPermanent(mailboxSession));