Search in sources :

Example 1 with AccessUtilI

use of org.bedework.calfacade.util.AccessUtilI in project bw-calendar-engine by Bedework.

the class CalintfHelper method getEntityCollection.

protected BwCalendar getEntityCollection(final String path, final int nonSchedAccess, final boolean scheduling, final boolean alwaysReturn) throws CalFacadeException {
    final int desiredAccess;
    if (!scheduling) {
        desiredAccess = nonSchedAccess;
    } else {
        desiredAccess = privAny;
    }
    final BwCalendar cal = getCollection(path, desiredAccess, alwaysReturn | scheduling);
    if (cal == null) {
        return null;
    }
    if (!cal.getCalendarCollection()) {
        throwException(new CalFacadeAccessException());
    }
    if (!scheduling) {
        return cal;
    }
    CurrentAccess ca;
    final AccessUtilI access = ac.getAccessUtil();
    if ((cal.getCalType() == BwCalendar.calTypeInbox) || (cal.getCalType() == BwCalendar.calTypePendingInbox)) {
        ca = access.checkAccess(cal, privScheduleDeliver, true);
        if (!ca.getAccessAllowed()) {
            // try old style
            ca = access.checkAccess(cal, privScheduleRequest, alwaysReturn);
        }
    } else if (cal.getCalType() == BwCalendar.calTypeOutbox) {
        ca = access.checkAccess(cal, privScheduleSend, true);
        if (!ca.getAccessAllowed()) {
            // try old style
            ca = access.checkAccess(cal, privScheduleReply, alwaysReturn);
        }
    } else {
        throw new CalFacadeAccessException();
    }
    if (!ca.getAccessAllowed()) {
        return null;
    }
    return cal;
}
Also used : AccessUtilI(org.bedework.calfacade.util.AccessUtilI) CurrentAccess(org.bedework.access.Acl.CurrentAccess) BwCalendar(org.bedework.calfacade.BwCalendar) CalFacadeAccessException(org.bedework.calfacade.exc.CalFacadeAccessException)

Aggregations

CurrentAccess (org.bedework.access.Acl.CurrentAccess)1 BwCalendar (org.bedework.calfacade.BwCalendar)1 CalFacadeAccessException (org.bedework.calfacade.exc.CalFacadeAccessException)1 AccessUtilI (org.bedework.calfacade.util.AccessUtilI)1