Search in sources :

Example 11 with UserAudit

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

the class AuditMgrConsole method getAuthZs.

/**
 */
void getAuthZs() {
    ReaderUtil.clearScreen();
    try {
        UserAudit uAudit = new UserAudit();
        System.out.println("Enter userId to search Audit AuthZs with:");
        String val = ReaderUtil.readLn();
        if (StringUtils.isNotEmpty(val)) {
            uAudit.setUserId(val);
            System.out.println("size=" + val.length() + " val=" + val);
        } else {
            System.out.println("val is empty or null");
        }
        System.out.println("Check for failed only? (Enter 'Y' for yes or 'N' for no");
        val = ReaderUtil.readLn();
        if (val.equalsIgnoreCase("Y"))
            uAudit.setFailedOnly(true);
        List<AuthZ> list = am.getUserAuthZs(uAudit);
        printAuthZs(list);
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("getUserAuthZs caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}
Also used : UserAudit(org.apache.directory.fortress.core.model.UserAudit) AuthZ(org.apache.directory.fortress.core.model.AuthZ)

Example 12 with UserAudit

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

the class AuditMgrConsole method findBinds.

/**
 */
void findBinds() {
    ReaderUtil.clearScreen();
    try {
        System.out.println("Enter userId value to search Audit Binds with or null to retrieve all:");
        String val = ReaderUtil.readLn();
        UserAudit uAudit = new UserAudit();
        uAudit.setUserId(val);
        List<Bind> list = am.searchBinds(uAudit);
        printAuthNs(list);
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("findBinds caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}
Also used : Bind(org.apache.directory.fortress.core.model.Bind) UserAudit(org.apache.directory.fortress.core.model.UserAudit)

Example 13 with UserAudit

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

the class AuditMgrConsole method getModReport.

/**
 */
void getModReport() {
    ReaderUtil.clearScreen();
    try {
        UserAudit uAudit = new UserAudit();
        System.out.println("Enter userId to search Audit Mods with:");
        String val = ReaderUtil.readLn();
        if (StringUtils.isNotEmpty(val)) {
            uAudit.setUserId(val);
            System.out.println("size=" + val.length() + " val=" + val);
        } else {
            System.out.println("val is empty or null");
        }
        System.out.println("Check within the last n hours?  Enter number of hours or null for unlimited");
        val = ReaderUtil.readLn();
        if (val != null && val.length() > 0) {
            int hours = Integer.parseInt(val);
            Date date = new Date();
            long millis = date.getTime();
            millis = millis - (1000 * 60 * 60 * hours);
            Date date2 = new Date(millis);
            uAudit.setBeginDate(date2);
        }
        List<Mod> list = am.searchUserSessions(uAudit);
        printMods(list);
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("getModReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}
Also used : Mod(org.apache.directory.fortress.core.model.Mod) UserAudit(org.apache.directory.fortress.core.model.UserAudit) Date(java.util.Date)

Example 14 with UserAudit

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

the class AuditMgrConsole method getAdminModReport.

void getAdminModReport() {
    ReaderUtil.clearScreen();
    try {
        UserAudit uAudit = new UserAudit();
        System.out.println("Enter userId to search Audit Mods with or NULL for skip:");
        String val = ReaderUtil.readLn();
        if (StringUtils.isNotEmpty(val)) {
            uAudit.setUserId(val);
            System.out.println("size=" + val.length() + " val=" + val);
        }
        System.out.println("Check within the last n hours?  Enter number of hours or null for unlimited");
        val = ReaderUtil.readLn();
        if (val != null && val.length() > 0) {
            int hours = Integer.parseInt(val);
            Date date = new Date();
            long millis = date.getTime();
            millis = millis - (1000 * 60 * 60 * hours);
            Date date2 = new Date(millis);
            uAudit.setBeginDate(date2);
        }
        /*
            System.out.println("Enter begin time and date - format YYYYMMDDHHMM or null for unlimited");
            val = ReaderUtil.readLn();
            if (val != null && val.length() > 0)
            {
                //int hours = Integer.parseInt(val);
                int year = new Integer(val.substring(0, 3));
                int month = new Integer(val.substring(0, 3));
                int day = new Integer(val.substring(0, 3));


                Date date = new Date();
                java.sql.Date date2 = new java.sql.Date(2011, 11, 25);
                date2.getTime();
                long millis = date.getTime();
                millis = millis - (1000 * 60 * 60 * hours);
                Date date2 = new Date(millis);
                uAudit.setBeginDate(date2);
            } */
        System.out.println("Enter admin object name to search Audit Mods with or NULL for skip:");
        val = ReaderUtil.readLn();
        if (StringUtils.isNotEmpty(val)) {
            uAudit.setObjName(val);
            System.out.println("size=" + val.length() + " val=" + val);
        }
        System.out.println("Enter admin operation name to search Audit Mods with or NULL for skip:");
        val = ReaderUtil.readLn();
        if (StringUtils.isNotEmpty(val)) {
            uAudit.setOpName(val);
            System.out.println("size=" + val.length() + " val=" + val);
        }
        List<Mod> list = am.searchAdminMods(uAudit);
        printMods(list);
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("getAdminModReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}
Also used : Mod(org.apache.directory.fortress.core.model.Mod) UserAudit(org.apache.directory.fortress.core.model.UserAudit) Date(java.util.Date)

Aggregations

UserAudit (org.apache.directory.fortress.core.model.UserAudit)14 AuthZ (org.apache.directory.fortress.core.model.AuthZ)7 AuditMgr (org.apache.directory.fortress.core.AuditMgr)6 SecurityException (org.apache.directory.fortress.core.SecurityException)6 Date (java.util.Date)5 User (org.apache.directory.fortress.core.model.User)5 Mod (org.apache.directory.fortress.core.model.Mod)4 Bind (org.apache.directory.fortress.core.model.Bind)3