Updates a USER's role @param ApplicationRoot The current running context of the application @param playerId The identifier of the player to update @param newRole Must be "player" or "admin" @return The user name of the user updated
(String ApplicationRoot, String playerId, String newRole)
| 829 | * @return The user name of the user updated |
| 830 | */ |
| 831 | public static String updateUserRole(String ApplicationRoot, String playerId, String newRole) |
| 832 | { |
| 833 | log.debug("*** Setter.updateUserRole ***"); |
| 834 | |
| 835 | String result = null; |
| 836 | Connection conn = Database.getCoreConnection(ApplicationRoot); |
| 837 | try |
| 838 | { |
| 839 | log.debug("Preparing userUpdateRole call"); |
| 840 | CallableStatement callstmnt = conn.prepareCall("call userUpdateRole(?, ?)"); |
| 841 | callstmnt.setString(1, playerId); |
| 842 | callstmnt.setString(2, newRole); |
| 843 | log.debug("Executing userUpdateRole"); |
| 844 | ResultSet resultSet = callstmnt.executeQuery(); |
| 845 | resultSet.next(); |
| 846 | result = resultSet.getString(1); |
| 847 | } |
| 848 | catch(SQLException e) |
| 849 | { |
| 850 | log.error("userUpdateRole Failure: " + e.toString()); |
| 851 | result = null; |
| 852 | } |
| 853 | Database.closeConnection(conn); |
| 854 | log.debug("*** END updateUserRole ***"); |
| 855 | return result; |
| 856 | } |
| 857 | |
| 858 | /** |
| 859 | * Used by many functions to create players or admins |