Purpose

Applies To

User Account Display

Signature

    public void ucUAPostUpdate(
                 Connection dbconn,
                 SesameSession session,
                 String action,
                 SecurityUser su,
                 SecurityUser oldSu) { }

Notes

The action values used to call this method are:

add when adding users through the GUI
add_api When adding users through the API
edit When editing users through the GUI
delete When editing users through the GUI

Example

public void ucUAPostUpdate(Connection con,
                                    SesameSession session,
                                    String action,
                                    SecurityUser su,
                                    SecurityUser oldSu) {
        String u4New =su.getUserField4();
        String u4Old = null;
        if (oldSu != null)
            u4Old = oldSu.getUserField4();
        if (u4New == null && u4Old == null)
            return;

        if (u4New == null)  u4New = "";
        if (u4Old == null)  u4Old = "";
        
        if (u4New.equals(u4Old))
            return;
        if (!"DENY".equals(u4New) && !"DENY".equals(u4Old))
          return;

        String msg = null;
        if ("DENY".equalsIgnoreCase(u4New))  msg = "Account is on Administrative Hold.";
        
        PreparedStatement ps = null;
        ResultSet rs = null;
        String udfId = Z.dictionary.getUdfId("ACCOUNT_HOLD_STATUS");
        if (udfId == null)  {
            Z.log.writeToLog (Z.log.ERROR, "Missing UDF for ACCOUNT_HOLD_STATUS");
            return;
        }
        try {
            ps = con.prepareStatement ("select item_id from item where originator = ? 
                        and status != 'CLOSED'");
            ps.setString(1, su.getId());
            rs = ps.executeQuery();
            while (rs.next()) {
                String id = rs.getString(1);
                UcUtil.updateIssueUdfs (id, "u", udfId, "v", msg, session);
            }
            
            rs.close();
            ps.close();
        } catch (Exception e){
            ErrorWriter.write(e, ErrorWriter.LOGERR);
        } finally {
            try { if (rs != null)  rs.close(); } catch (Exception e) {}
            try { if (ps != null)  ps.close(); } catch (Exception e) {}
        }
    }