Search in sources :

Example 6 with BwAuthUser

use of org.bedework.calfacade.svc.BwAuthUser in project bw-calendar-engine by Bedework.

the class PrincipalsAndPrefsDAO method getAuthUser.

public BwAuthUser getAuthUser(final String href) throws CalFacadeException {
    final HibSession sess = getSess();
    sess.createQuery(getUserQuery);
    sess.setString("userHref", href);
    return (BwAuthUser) sess.getUnique();
}
Also used : HibSession(org.bedework.calcorei.HibSession) BwAuthUser(org.bedework.calfacade.svc.BwAuthUser)

Example 7 with BwAuthUser

use of org.bedework.calfacade.svc.BwAuthUser in project bw-calendar-engine by Bedework.

the class AuthUserFieldRule method field.

/* (non-Javadoc)
   * @see org.bedework.dumprestore.restore.rules.EntityFieldRule#field(java.lang.String)
   */
@Override
public void field(final String name) throws Throwable {
    BwEventProperty ep = null;
    BwCalendar cal = null;
    try {
        if (top() instanceof BwEventProperty) {
            ep = (BwEventProperty) pop();
        } else if (top() instanceof BwCalendar) {
            cal = (BwCalendar) pop();
        }
        BwAuthUser au = (BwAuthUser) top();
        if (name.equals("id") || name.equals("seq")) {
            return;
        }
        if (name.equals("userHref")) {
            au.setUserHref(Util.buildPath(false, stringFld()));
        // } else if (name.equals("account")) {   old?
        // au.setUserHref(globals.rintf.getUser(stringFld()).getPrincipalRef());
        // } else if (name.equals("user")) {
        // // done above
        } else if (name.equals("usertype")) {
            int type = intFld();
            au.setUsertype(type);
        /* Prefs stuff next */
        } else if (name.equals("autoAdd")) {
            if (inCategoryPrefs) {
                getCategoryPrefs(au).setAutoAdd(booleanFld());
            } else if (inCollectionsPrefs) {
                getCalendarPrefs(au).setAutoAdd(booleanFld());
            } else if (inContactPrefs) {
                getContactPrefs(au).setAutoAdd(booleanFld());
            } else if (inLocationPrefs) {
                getLocationPrefs(au).setAutoAdd(booleanFld());
            } else {
                error("Not in any prefs for autoAdd");
            }
        } else if (name.equals("category")) {
            au.getPrefs().getCategoryPrefs().add((BwCategory) ep);
        } else if (name.equals("collection")) {
            au.getPrefs().getCalendarPrefs().add(cal);
        } else if (name.equals("contact")) {
            au.getPrefs().getContactPrefs().add((BwContact) ep);
        } else if (name.equals("location")) {
            au.getPrefs().getLocationPrefs().add((BwLocation) ep);
        } else if (name.equals("categoryPrefs")) {
            inCategoryPrefs = false;
        } else if (name.equals("calendarPrefs")) {
            inCollectionsPrefs = false;
        } else if (name.equals("contactPrefs")) {
            inContactPrefs = false;
        } else if (name.equals("locationPrefs")) {
            inLocationPrefs = false;
        } else if (name.equals("prefs")) {
        } else if (name.equals("byteSize")) {
        } else {
            unknownTag(name);
        }
    } catch (Throwable t) {
        handleException(t);
    }
}
Also used : BwAuthUser(org.bedework.calfacade.svc.BwAuthUser) BwCategory(org.bedework.calfacade.BwCategory) BwEventProperty(org.bedework.calfacade.BwEventProperty) BwCalendar(org.bedework.calfacade.BwCalendar) BwContact(org.bedework.calfacade.BwContact)

Example 8 with BwAuthUser

use of org.bedework.calfacade.svc.BwAuthUser in project bw-calendar-engine by Bedework.

the class AuthUserRule method end.

@Override
public void end(final String ns, final String name) throws Exception {
    final BwAuthUser au = (BwAuthUser) pop();
    globals.counts[globals.authusers]++;
    try {
        globals.rintf.restoreAuthUser(au);
    } catch (final Throwable t) {
        error("Error restoring " + au);
        throw new Exception(t);
    }
}
Also used : BwAuthUser(org.bedework.calfacade.svc.BwAuthUser)

Example 9 with BwAuthUser

use of org.bedework.calfacade.svc.BwAuthUser in project bw-calendar-engine by Bedework.

the class AuthUserRule method begin.

@Override
public void begin(final String ns, final String name, final Attributes att) throws Exception {
    super.begin(ns, name, att);
    BwAuthUser au = (BwAuthUser) top();
    BwAuthUserPrefs prefs = au.getPrefs();
    if (prefs == null) {
        prefs = new BwAuthUserPrefs();
        au.setPrefs(prefs);
    }
    if (prefs.getCalendarPrefs() == null) {
        prefs.setCalendarPrefs(new CalendarPref());
    }
    if (prefs.getContactPrefs() == null) {
        prefs.setContactPrefs(new ContactPref());
    }
    if (prefs.getLocationPrefs() == null) {
        prefs.setLocationPrefs(new LocationPref());
    }
    if (prefs.getCategoryPrefs() == null) {
        prefs.setCategoryPrefs(new CategoryPref());
    }
}
Also used : BwAuthUser(org.bedework.calfacade.svc.BwAuthUser) CategoryPref(org.bedework.calfacade.svc.prefs.CategoryPref) ContactPref(org.bedework.calfacade.svc.prefs.ContactPref) CalendarPref(org.bedework.calfacade.svc.prefs.CalendarPref) BwAuthUserPrefs(org.bedework.calfacade.svc.prefs.BwAuthUserPrefs) LocationPref(org.bedework.calfacade.svc.prefs.LocationPref)

Example 10 with BwAuthUser

use of org.bedework.calfacade.svc.BwAuthUser in project bw-calendar-engine by Bedework.

the class Calendars method getHomePath.

@Override
public String getHomePath() throws CalFacadeException {
    if (isGuest()) {
        return publicCalendarRootPath;
    }
    if (isPublicAdmin()) {
        if (!getSyspars().getWorkflowEnabled()) {
            return publicCalendarRootPath;
        }
        final BwAuthUser au = getSvc().getUserAuth().getUser(getPars().getAuthUser());
        final boolean isApprover = isSuper() || (au != null) && au.isApproverUser();
        // Do they have approver status?
        if (isApprover) {
            return publicCalendarRootPath;
        }
        return Util.buildPath(colPathEndsWithSlash, // "/",
        getSyspars().getWorkflowRoot());
    // getPrincipal().getAccountNoSlash());
    }
    return getSvc().getPrincipalInfo().getCalendarHomePath();
}
Also used : BwAuthUser(org.bedework.calfacade.svc.BwAuthUser)

Aggregations

BwAuthUser (org.bedework.calfacade.svc.BwAuthUser)11 BwCalendar (org.bedework.calfacade.BwCalendar)2 BwCategory (org.bedework.calfacade.BwCategory)2 BwPrincipal (org.bedework.calfacade.BwPrincipal)2 BwAuthUserPrefs (org.bedework.calfacade.svc.prefs.BwAuthUserPrefs)2 CalendarPref (org.bedework.calfacade.svc.prefs.CalendarPref)2 CategoryPref (org.bedework.calfacade.svc.prefs.CategoryPref)2 ContactPref (org.bedework.calfacade.svc.prefs.ContactPref)2 LocationPref (org.bedework.calfacade.svc.prefs.LocationPref)2 ArrayList (java.util.ArrayList)1 Ace (org.bedework.access.Ace)1 AceWho (org.bedework.access.AceWho)1 Acl (org.bedework.access.Acl)1 Privilege (org.bedework.access.Privilege)1 HibSession (org.bedework.calcorei.HibSession)1 BwContact (org.bedework.calfacade.BwContact)1 BwEventProperty (org.bedework.calfacade.BwEventProperty)1 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)1 BwAdminGroup (org.bedework.calfacade.svc.BwAdminGroup)1 UserAuth (org.bedework.calfacade.svc.UserAuth)1