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

Method findAdminById

src/main/java/dbProcs/Getter.java:1963–1988  ·  view source on GitHub ↗

Used to decipher whether or not a user exists as an admin @param userId The user identifier of the admin to be found @return A boolean reflecting the state of existence of the admin

(String ApplicationRoot, String userId)

Source from the content-addressed store, hash-verified

1961 * @return A boolean reflecting the state of existence of the admin
1962 */
1963 public static boolean findAdminById (String ApplicationRoot, String userId)
1964 {
1965 log.debug("*** Getter.findAdminById ***");
1966 boolean userFound = false;
1967 //Get connection
1968 Connection conn = Database.getCoreConnection(ApplicationRoot);
1969 try
1970 {
1971 CallableStatement callstmt = conn.prepareCall("call adminFindById(?)");
1972 log.debug("Gathering adminFindById ResultSet");
1973 callstmt.setString(1, userId);
1974 ResultSet userFind = callstmt.executeQuery();
1975 log.debug("Opening Result Set from adminFindById");
1976 userFind.next(); //This will throw an exception if player not found
1977 log.debug("Admin Found: " + userFind.getString(1)); //This line will not execute if admin not found
1978 userFound = true;
1979 }
1980 catch(Exception e)
1981 {
1982 log.error("Admin does not exist: " + e.toString());
1983 userFound = false;
1984 }
1985 Database.closeConnection(conn);
1986 log.debug("*** END findAdminById ***");
1987 return userFound;
1988 }
1989}

Callers 2

testFindAdminByIdMethod · 0.95
doPostMethod · 0.95

Calls 2

getCoreConnectionMethod · 0.95
closeConnectionMethod · 0.95

Tested by 1

testFindAdminByIdMethod · 0.76