Search in sources :

Example 11 with Kontrol

use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.

the class UsersKtrl method deleteUser.

@Kontrol(path = "/manage/deleteUser", method = MethodType.GET)
public String deleteUser() throws ServletException {
    try {
        if (user.getId() != null && !user.getId().equals(AuthUtil.getUserId(getRequest().getSession()))) {
            UserDB.deleteUser(user.getId());
            PublicKeyDB.deleteUserPublicKeys(user.getId());
            RefreshAuthKeyUtil.refreshAllSystems();
        }
    } catch (SQLException | GeneralSecurityException ex) {
        log.error(ex.toString(), ex);
        throw new ServletException(ex.toString(), ex);
    }
    return "redirect:/manage/viewUsers.ktrl?sortedSet.orderByDirection=" + sortedSet.getOrderByDirection() + "&sortedSet.orderByField=" + sortedSet.getOrderByField();
}
Also used : ServletException(javax.servlet.ServletException) SQLException(java.sql.SQLException) GeneralSecurityException(java.security.GeneralSecurityException) Kontrol(loophole.mvc.annotation.Kontrol)

Example 12 with Kontrol

use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.

the class UserSettingsKtrl method themeSubmit.

@Kontrol(path = "/admin/themeSubmit", method = MethodType.POST)
public String themeSubmit() throws ServletException {
    userSettings.setTheme(userSettings.getTheme());
    userSettings.setPlane(userSettings.getPlane());
    try {
        UserThemeDB.saveTheme(AuthUtil.getUserId(getRequest().getSession()), userSettings);
    } catch (SQLException | GeneralSecurityException ex) {
        log.error(ex.toString(), ex);
        throw new ServletException(ex.toString(), ex);
    }
    return "redirect:/admin/menu.html";
}
Also used : ServletException(javax.servlet.ServletException) SQLException(java.sql.SQLException) GeneralSecurityException(java.security.GeneralSecurityException) Kontrol(loophole.mvc.annotation.Kontrol)

Example 13 with Kontrol

use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.

the class ScriptKtrl method deleteScript.

@Kontrol(path = "/admin/deleteScript", method = MethodType.GET)
public String deleteScript() throws ServletException {
    if (script.getId() != null) {
        try {
            Long userId = AuthUtil.getUserId(getRequest().getSession());
            ScriptDB.deleteScript(script.getId(), userId);
        } catch (SQLException | GeneralSecurityException ex) {
            log.error(ex.toString(), ex);
            throw new ServletException(ex.toString(), ex);
        }
    }
    return "redirect:/admin/viewScripts.ktrl?sortedSet.orderByDirection=" + sortedSet.getOrderByDirection() + "&sortedSet.orderByField=" + sortedSet.getOrderByField();
}
Also used : ServletException(javax.servlet.ServletException) SQLException(java.sql.SQLException) GeneralSecurityException(java.security.GeneralSecurityException) Kontrol(loophole.mvc.annotation.Kontrol)

Example 14 with Kontrol

use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.

the class ScriptKtrl method viewScripts.

@Kontrol(path = "/admin/viewScripts", method = MethodType.GET)
public String viewScripts() throws ServletException {
    try {
        Long userId = AuthUtil.getUserId(getRequest().getSession());
        sortedSet = ScriptDB.getScriptSet(sortedSet, userId);
    } catch (SQLException | GeneralSecurityException ex) {
        log.error(ex.toString(), ex);
        throw new ServletException(ex.toString(), ex);
    }
    return "/admin/view_scripts.html";
}
Also used : ServletException(javax.servlet.ServletException) SQLException(java.sql.SQLException) GeneralSecurityException(java.security.GeneralSecurityException) Kontrol(loophole.mvc.annotation.Kontrol)

Example 15 with Kontrol

use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.

the class SecureShellKtrl method getNextPendingSystemForTerms.

@Kontrol(path = "/admin/getNextPendingSystemForTerms", method = MethodType.GET)
public String getNextPendingSystemForTerms() throws ServletException {
    Long userId;
    try {
        userId = AuthUtil.getUserId(getRequest().getSession());
        currentSystemStatus = SystemStatusDB.getSystemStatus(pendingSystemStatus.getId(), userId);
        currentSystemStatus.setErrorMsg("Auth fail");
        currentSystemStatus.setStatusCd(HostSystem.GENERIC_FAIL_STATUS);
        SystemStatusDB.updateSystemStatus(currentSystemStatus, userId);
        SystemDB.updateSystem(currentSystemStatus);
        pendingSystemStatus = SystemStatusDB.getNextPendingSystem(userId);
        // set system list if no pending systems
        if (pendingSystemStatus == null) {
            setSystemList(userId, AuthUtil.getSessionId(getRequest().getSession()));
        }
    } catch (SQLException | GeneralSecurityException ex) {
        log.error(ex.toString(), ex);
        throw new ServletException(ex.toString(), ex);
    }
    return "/admin/secure_shell.html";
}
Also used : ServletException(javax.servlet.ServletException) SQLException(java.sql.SQLException) GeneralSecurityException(java.security.GeneralSecurityException) Kontrol(loophole.mvc.annotation.Kontrol)

Aggregations

GeneralSecurityException (java.security.GeneralSecurityException)29 ServletException (javax.servlet.ServletException)29 Kontrol (loophole.mvc.annotation.Kontrol)29 SQLException (java.sql.SQLException)25 SortedSet (io.bastillion.manage.model.SortedSet)5 SchSession (io.bastillion.manage.model.SchSession)3 IOException (java.io.IOException)3 User (io.bastillion.manage.model.User)2 UserSchSessions (io.bastillion.manage.model.UserSchSessions)2 File (java.io.File)2 Gson (com.google.gson.Gson)1 EncodeHintType (com.google.zxing.EncodeHintType)1 WriterException (com.google.zxing.WriterException)1 BitMatrix (com.google.zxing.common.BitMatrix)1 QRCodeWriter (com.google.zxing.qrcode.QRCodeWriter)1 ChannelShell (com.jcraft.jsch.ChannelShell)1 HostSystem (io.bastillion.manage.model.HostSystem)1 Graphics2D (java.awt.Graphics2D)1 BufferedImage (java.awt.image.BufferedImage)1 Calendar (java.util.Calendar)1