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;
}
Aggregations