MCPcopy Create free account
hub / github.com/OWASP/SecurityShepherd / suspendUser

Method suspendUser

src/main/java/dbProcs/Setter.java:532–556  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 3

testSuspendUserMethod · 0.95
testUnSuspendUserMethod · 0.95
doPostMethod · 0.95

Calls 2

getCoreConnectionMethod · 0.95
closeConnectionMethod · 0.95

Tested by 2

testSuspendUserMethod · 0.76
testUnSuspendUserMethod · 0.76