Search in sources :

Example 1 with CalSvcIPars

use of org.bedework.calsvci.CalSvcIPars in project bw-calendar-engine by Bedework.

the class AbstractScheduler method getSvci.

/**
 * Get an svci object as a different user.
 *
 * @param principalHref
 * @return CalSvcI
 * @throws CalFacadeException
 */
protected CalSvcI getSvci(final String principalHref) throws CalFacadeException {
    CalSvcI svci;
    /* account is what we authenticated with.
     * user, if non-null, is the user calendar we want to access.
     */
    CalSvcIPars runAsPars = CalSvcIPars.getServicePars("scheduler", // principal.getAccount(),
    principalHref, // publicAdmin
    false, // allow SuperUser
    "/principals/users/root".equals(principalHref));
    svci = new CalSvcFactoryDefault().getSvc(runAsPars);
    setSvc(svci);
    svci.open();
    svci.beginTransaction();
    return svci;
}
Also used : CalSvcFactoryDefault(org.bedework.calsvci.CalSvcFactoryDefault) CalSvcIPars(org.bedework.calsvci.CalSvcIPars) CalSvcI(org.bedework.calsvci.CalSvcI)

Example 2 with CalSvcIPars

use of org.bedework.calsvci.CalSvcIPars in project bw-calendar-engine by Bedework.

the class BwDumpRestore method getSvci.

/**
 * Get an svci object and return it. Also embed it in this object.
 *
 * @return svci object
 * @throws CalFacadeException on fatal error
 */
private CalSvcI getSvci(final String owner, final boolean publick) throws CalFacadeException {
    if ((svci != null) && svci.isOpen()) {
        return svci;
    }
    boolean publicAdmin = false;
    if ((curSvciOwner == null) || !curSvciOwner.equals(owner)) {
        svci = null;
        curSvciOwner = owner;
        publicAdmin = publick;
    }
    if (svci == null) {
        final CalSvcIPars pars = CalSvcIPars.getIndexerPars(curSvciOwner, publicAdmin);
        // CalSvcIPars pars = CalSvcIPars.getServicePars(curSvciOwner,
        // publicAdmin,   // publicAdmin
        // true);   // Allow super user
        svci = new CalSvcFactoryDefault().getSvc(pars);
    }
    svci.open();
    svci.beginTransaction();
    return svci;
}
Also used : CalSvcFactoryDefault(org.bedework.calsvci.CalSvcFactoryDefault) CalSvcIPars(org.bedework.calsvci.CalSvcIPars)

Example 3 with CalSvcIPars

use of org.bedework.calsvci.CalSvcIPars in project bw-calendar-engine by Bedework.

the class BwSysIntfImpl method getSvci.

private CalSvcI getSvci(final String account, final String runAs, final boolean service, final boolean publicAdmin, final String clientId, final boolean allowCreateEprops) throws WebdavException {
    try {
        /* account is what we authenticated with.
       * user, if non-null, is the user calendar we want to access.
       */
        final boolean possibleSuperUser = // allow SuperUser
        "root".equals(account) || "admin".equals(account);
        String runAsUser = null;
        String clientIdent = null;
        if (possibleSuperUser) {
            runAsUser = runAs;
            clientIdent = clientId;
        }
        final CalSvcIPars pars = CalSvcIPars.getCaldavPars("bwcaldav", account, runAsUser, clientIdent, // allow SuperUser
        possibleSuperUser, service, publicAdmin, allowCreateEprops);
        svci = new CalSvcFactoryDefault().getSvc(pars);
        svci.open();
        svci.beginTransaction();
        trans = new IcalTranslator(svci.getIcalCallback());
    } catch (Throwable t) {
        throw new WebdavException(t);
    }
    return svci;
}
Also used : CalSvcFactoryDefault(org.bedework.calsvci.CalSvcFactoryDefault) CalSvcIPars(org.bedework.calsvci.CalSvcIPars) WebdavException(org.bedework.webdav.servlet.shared.WebdavException) IcalTranslator(org.bedework.icalendar.IcalTranslator)

Example 4 with CalSvcIPars

use of org.bedework.calsvci.CalSvcIPars in project bw-calendar-engine by Bedework.

the class SystemConf method getSvci.

/* ====================================================================
   *                   Private methods
   * ==================================================================== */
/**
 * Get an svci object and return it. Also embed it in this object.
 *
 * @return svci object
 * @throws org.bedework.calfacade.exc.CalFacadeException
 */
private CalSvcI getSvci() throws CalFacadeException {
    if (getConfig() == null) {
        return null;
    }
    if ((svci != null) && svci.isOpen()) {
        return svci;
    }
    if (getRootUsers() == null) {
        return null;
    }
    final String[] rootUsers = getRootUsers().split(",");
    if ((rootUsers.length == 0) || (rootUsers[0] == null)) {
        return null;
    }
    final CalSvcIPars pars = CalSvcIPars.getServicePars(getServiceName(), rootUsers[0], // publicAdmin
    true, // Allow super user
    true);
    svci = new CalSvcFactoryDefault().getSvc(pars);
    svci.open();
    svci.beginTransaction();
    return svci;
}
Also used : CalSvcFactoryDefault(org.bedework.calsvci.CalSvcFactoryDefault) CalSvcIPars(org.bedework.calsvci.CalSvcIPars)

Example 5 with CalSvcIPars

use of org.bedework.calsvci.CalSvcIPars in project bw-calendar-engine by Bedework.

the class NotificationConf method getSvci.

/* ====================================================================
   *                   Private methods
   * ==================================================================== */
/**
 * Get an svci object and return it. Also embed it in this object.
 *
 * @param account of user to run as
 * @return svci object
 * @throws org.bedework.calfacade.exc.CalFacadeException
 */
private CalSvcI getSvci(final String account) throws CalFacadeException {
    if ((svci != null) && svci.isOpen()) {
        return svci;
    }
    if (svci == null) {
        final CalSvcIPars pars = CalSvcIPars.getServicePars("notifications", account, // publicAdmin
        false, // Allow super user
        true);
        svci = new CalSvcFactoryDefault().getSvc(pars);
    }
    svci.open();
    svci.beginTransaction();
    return svci;
}
Also used : CalSvcFactoryDefault(org.bedework.calsvci.CalSvcFactoryDefault) CalSvcIPars(org.bedework.calsvci.CalSvcIPars)

Aggregations

CalSvcFactoryDefault (org.bedework.calsvci.CalSvcFactoryDefault)5 CalSvcIPars (org.bedework.calsvci.CalSvcIPars)5 CalSvcI (org.bedework.calsvci.CalSvcI)1 IcalTranslator (org.bedework.icalendar.IcalTranslator)1 WebdavException (org.bedework.webdav.servlet.shared.WebdavException)1