Search in sources :

Example 6 with AuditMgr

use of org.apache.directory.fortress.core.AuditMgr in project directory-fortress-core by apache.

the class AuditMgrImplTest method searchAdminMods.

/**
 * @param msg
 * @param uArray
 */
private static void searchAdminMods(String msg, String[][] uArray, String[][] oArray, String[][] opArray) {
    LogUtil.logIt(msg);
    try {
        AuditMgr auditMgr = getManagedAuditMgr();
        for (String[] usr : uArray) {
            User user = UserTestData.getUser(usr);
            // now search for successful session creation events:
            UserAudit uAudit = new UserAudit();
            uAudit.setUserId(user.getUserId());
            for (String[] obj : oArray) {
                String objName = AdminUtil.getObjName(PermTestData.getName(obj));
                uAudit.setObjName(objName);
                for (String[] op : opArray) {
                    uAudit.setOpName(PermTestData.getName(op));
                    List<Mod> mods = auditMgr.searchAdminMods(uAudit);
                    assertNotNull(mods);
                    assertTrue(CLS_NM + "searchAdminMods failed search for successful authentication user [" + user.getUserId() + "] object [" + objName + "] operation [" + PermTestData.getName(op) + "]", mods.size() > 0 || !isAudit(objName, PermTestData.getName(op)));
                    boolean result = mods.size() > 0 || !isAudit(objName, PermTestData.getName(op));
                    LOG.debug("searchAdminMods search user [" + user.getUserId() + "] object [" + objName + "] operation [" + PermTestData.getName(op) + "] result: " + result);
                // System.out.println("searchAdminMods search user [" + user.getUserId() + "] object [" + objName + "] operation [" + PermTestData.getName(op) + "] result: " + result);
                }
            }
        }
        LOG.debug("searchAdminMods successful");
    } catch (SecurityException ex) {
        LOG.error("searchAdminMods: failed with SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : User(org.apache.directory.fortress.core.model.User) Mod(org.apache.directory.fortress.core.model.Mod) UserAudit(org.apache.directory.fortress.core.model.UserAudit) AuditMgr(org.apache.directory.fortress.core.AuditMgr) SecurityException(org.apache.directory.fortress.core.SecurityException)

Aggregations

AuditMgr (org.apache.directory.fortress.core.AuditMgr)6 SecurityException (org.apache.directory.fortress.core.SecurityException)6 UserAudit (org.apache.directory.fortress.core.model.UserAudit)6 User (org.apache.directory.fortress.core.model.User)5 AuthZ (org.apache.directory.fortress.core.model.AuthZ)3 Mod (org.apache.directory.fortress.core.model.Mod)2 Bind (org.apache.directory.fortress.core.model.Bind)1