Search in sources :

Example 1 with UserAuth

use of org.bedework.calfacade.svc.UserAuth 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)1 UserAuth (org.bedework.calfacade.svc.UserAuth)1