Search in sources :

Example 11 with BwAuthUser

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

the class ProcessAuthUser method process.

@Override
boolean process() throws Throwable {
    final String wd = word();
    if (wd == null) {
        return false;
    }
    if ("help".equals(wd)) {
        pstate.addInfo("authuser <account> <action>\n" + "   carry out action on given user(s)\n" + "account may be '*' for all users\n" + "action may be\n" + "   approver|publicevents|content=false/true");
        return true;
    }
    final boolean all = "*".equals(wd);
    final String wd1 = word();
    Boolean val = null;
    if (wd1 != null) {
        if (!utypes.contains(wd1) || !testToken('=')) {
            pstate.addError("Expected <action>=\"");
            return false;
        }
        val = boolFor(wd1);
        if (val == null) {
            return false;
        }
    }
    try {
        open();
        if (!all) {
            final UserAuth ua = getSvci().getUserAuth();
            final BwAuthUser au = ua.getUser(wd);
            if (au == null) {
                pstate.addError("Unknown auth user " + wd);
                return false;
            }
            doUser(au, wd1, val);
            return true;
        }
        for (final BwAuthUser au : getSvci().getUserAuth().getAll()) {
            doUser(au, wd1, val);
        }
        return true;
    } finally {
        close();
    }
}
Also used : BwAuthUser(org.bedework.calfacade.svc.BwAuthUser) UserAuth(org.bedework.calfacade.svc.UserAuth)

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