Skip to content

Commit

Permalink
SAK-23634 - Add User Auditing Log that tracks when users were added/r…
Browse files Browse the repository at this point in the history
…emoved/updated from a site - edited the sql in the code to match the case sensitivity of the SQL

git-svn-id: https://source.sakaiproject.org/svn/userauditservice/trunk@133336 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
gjthomas committed Jan 16, 2014
1 parent c9b050f commit 4453975
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,16 @@ private void getEvents()
{
conn = sqlService.borrowConnection();
statement = conn.createStatement();
sql = "select USER_ID, ROLE_NAME, ACTION_TAKEN, AUDIT_STAMP, SOURCE, ACTION_USER_ID from USER_AUDITS_LOG where SITE_ID = '" + siteId + "' order by AUDIT_STAMP desc";
sql = "select user_id, role_name, action_taken, audit_stamp, source, action_user_id from user_audits_log where site_id = '" + siteId + "' order by audit_stamp desc";
result = statement.executeQuery(sql);
while (result.next())
{
String userId = result.getString("USER_ID");
String roleName = result.getString("ROLE_NAME");
String actionTaken = result.getString("ACTION_TAKEN");
Timestamp auditStamp = result.getTimestamp("AUDIT_STAMP");
String source = result.getString("SOURCE");
String actionUserId = result.getString("ACTION_USER_ID");
String userId = result.getString("user_id");
String roleName = result.getString("role_name");
String actionTaken = result.getString("action_taken");
Timestamp auditStamp = result.getTimestamp("audit_stamp");
String source = result.getString("source");
String actionUserId = result.getString("action_user_id");

User cachedUser;
if (userMap.containsKey(userId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ public void addToUserAuditing(List<String[]> userAuditList)
Object fields[] = new Object[7];
if ("oracle".equals(sqlVendor))
{
sql = "insert into USER_AUDITS_LOG (ID,SITE_ID,USER_ID,ROLE_NAME,ACTION_TAKEN,AUDIT_STAMP,SOURCE,ACTION_USER_ID) values (USER_AUDITS_LOG_SEQ.nextval,?,?,?,?,to_date(?,'YYYY-MM-DD HH24:MI:SS'),?,?)";
sql = "insert into user_audits_log (id,site_id,user_id,role_name,action_taken,audit_stamp,source,action_user_id) values (user_audits_log_seq.nextval,?,?,?,?,to_date(?,'YYYY-MM-DD HH24:MI:SS'),?,?)";
}
else
{
sql = "insert into USER_AUDITS_LOG (SITE_ID,USER_ID,ROLE_NAME,ACTION_TAKEN,AUDIT_STAMP,SOURCE,ACTION_USER_ID) values (?,?,?,?,?,?,?)";
sql = "insert into user_audits_log (site_id,user_id,role_name,action_taken,audit_stamp,source,action_user_id) values (?,?,?,?,?,?,?)";
}
fields[0] = siteId;
fields[1] = username;
Expand All @@ -186,7 +186,7 @@ public void addToUserAuditing(List<String[]> userAuditList)
/** Method to delete all the user auditing log entries for a site. Used when deleting a site */
public void deleteUserAuditingFromSite(String siteId)
{
String sql = "delete from USER_AUDITS_LOG where SITE_ID = ?";
String sql = "delete from user_audits_log where site_id = ?";

Object fields[] = new Object[1];

Expand Down

0 comments on commit 4453975

Please sign in to comment.