Sets user to suspended in the database for a specific amount of time. This prevents them from signing into the application @param ApplicationRoot Running context of application @param userId User Identifier of the to be suspended user @param numberOfMinutes Amount of minutes to suspend user @return
(String ApplicationRoot, String userId, int numberOfMinutes)
| 530 | * @return Returns true if statement succeeds without fatal error |
| 531 | */ |
| 532 | public static boolean suspendUser(String ApplicationRoot, String userId, int numberOfMinutes) |
| 533 | { |
| 534 | log.debug("*** Setter.suspendUser ***"); |
| 535 | |
| 536 | boolean result = false; |
| 537 | Connection conn = Database.getCoreConnection(ApplicationRoot); |
| 538 | try |
| 539 | { |
| 540 | log.debug("Prepairing suspendUser call"); |
| 541 | PreparedStatement callstmnt = conn.prepareCall("CALL suspendUser(?, ?)"); |
| 542 | callstmnt.setString(1, userId); |
| 543 | callstmnt.setInt(2, numberOfMinutes); |
| 544 | log.debug("Executing suspendUser statement on id '" + userId + "'"); |
| 545 | callstmnt.execute(); |
| 546 | result = true; |
| 547 | } |
| 548 | catch(SQLException e) |
| 549 | { |
| 550 | log.error("suspendUser Failure: " + e.toString()); |
| 551 | result = false; |
| 552 | } |
| 553 | Database.closeConnection(conn); |
| 554 | log.debug("*** END suspendUser ***"); |
| 555 | return result; |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * Revokes a suspension that may have been applied to a user |