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();
}
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";
}
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();
}
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";
}
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";
}
Aggregations