added admin functions for viewing audit records; gave users the ability

to set their default language and time zone preferences; added footer text
and account signup accept/decline rules; added additional implementation
of dictyionary code for future; minor cleanup of rendering config; and
so forth
This commit is contained in:
Eric J. Bowersox
2001-03-25 08:10:07 +00:00
parent a258f6ee80
commit 15a7fa56d2
31 changed files with 1315 additions and 62 deletions
@@ -17,8 +17,12 @@
*/
package com.silverwrist.venice.core;
import java.util.List;
public interface AdminOperations
{
// TODO: fill this in
public abstract List getAuditRecords(int offset, int count) throws DataException;
public abstract int getAuditRecordCount() throws DataException;
} // end interface AdminOperations
@@ -0,0 +1,47 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.core;
import java.util.Date;
import com.silverwrist.venice.security.Audit;
public interface AuditData extends Audit
{
public static final int DATA_COUNT = 4;
public abstract long getRecord();
public abstract Date getDateTime();
public abstract int getType();
public abstract int getUID();
public abstract int getSIGID();
public abstract String getIPAddress();
public abstract String getData(int ndx);
public abstract String getDescription();
public abstract String getUserName();
public abstract String getSIGName();
} // end interface AuditData
@@ -167,4 +167,8 @@ public interface SIGContext extends SearchMode
public abstract boolean canSendInvitation();
public abstract List getAuditRecords(int offset, int count) throws AccessError, DataException;
public abstract int getAuditRecordCount() throws AccessError, DataException;
} // end interface SIGContext
@@ -75,4 +75,6 @@ public interface VeniceEngine extends SearchMode
public abstract List getPublishedMessages(boolean all) throws DataException;
public abstract int getNumAuditRecordsPerPage();
} // end interface VeniceEngine
@@ -18,9 +18,11 @@
package com.silverwrist.venice.core.impl;
import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.AuditRecord;
class AdminOperationsImpl implements AdminOperations
{
@@ -58,4 +60,60 @@ class AdminOperationsImpl implements AdminOperations
*--------------------------------------------------------------------------------
*/
public List getAuditRecords(int offset, int count) throws DataException
{
Connection conn = null;
List rc = null;
try
{ // retrieve a connection from the data pool and get the audit records
conn = datapool.getConnection();
rc = AuditRecord.getAuditRecords(conn,-1,offset,count);
} // end try
catch (SQLException e)
{ // database error - this is a DataException
logger.error("error loading audit records: " + e.getMessage(),e);
throw new DataException("unable to load audit records: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return rc;
} // end getAuditRecords
public int getAuditRecordCount() throws DataException
{
Connection conn = null;
int rc = -1;
try
{ // retrieve a connection from the data pool and get the audit records
conn = datapool.getConnection();
rc = AuditRecord.getAuditRecordCount(conn,-1);
} // end try
catch (SQLException e)
{ // database error - this is a DataException
logger.error("error loading audit record count: " + e.getMessage(),e);
throw new DataException("unable to load audit record count: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return rc;
} // end getAuditRecordCount
} // end class AdminOperationsImpl
@@ -37,6 +37,7 @@ public interface EngineBackend
public static final int IP_MAXSIGMEMBERDISPLAY = 3;
public static final int IP_MAXCONFMEMBERDISPLAY = 4;
public static final int IP_NUMFRONTPAGEPOSTS = 5;
public static final int IP_NUMAUDITRECSPERPAGE = 6;
public abstract SimpleEmailer createEmailer();
@@ -22,6 +22,7 @@ import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.AuditRecord;
import com.silverwrist.venice.security.Capability;
import com.silverwrist.venice.security.DefaultLevels;
import com.silverwrist.venice.core.*;
@@ -1271,6 +1272,78 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
} // end canSendInvitation
public List getAuditRecords(int offset, int count) throws AccessError, DataException
{
SIGData sd = getSIGData();
if (!sd.canDeleteSIG(level) && !sd.canModifySIGProfile(level) && !sd.canCreateSIGSubObjects(level))
{ // user not permitted to retrieve audit records - naughty naughty
logger.error("user not permitted to retrieve audit records for SIG");
throw new AccessError("You are not permitted to retrieve audit records for this SIG.");
} // end if
Connection conn = null;
List rc = null;
try
{ // retrieve a connection from the data pool and get the audit records
conn = datapool.getConnection();
rc = AuditRecord.getAuditRecords(conn,sigid,offset,count);
} // end try
catch (SQLException e)
{ // database error - this is a DataException
logger.error("error loading audit records: " + e.getMessage(),e);
throw new DataException("unable to load audit records: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return rc;
} // end getAuditRecords
public int getAuditRecordCount() throws AccessError, DataException
{
SIGData sd = getSIGData();
if (!sd.canDeleteSIG(level) && !sd.canModifySIGProfile(level) && !sd.canCreateSIGSubObjects(level))
{ // user not permitted to retrieve audit records - naughty naughty
logger.error("user not permitted to retrieve audit records for SIG");
throw new AccessError("You are not permitted to retrieve audit records for this SIG.");
} // end if
Connection conn = null;
int rc = -1;
try
{ // retrieve a connection from the data pool and get the audit records
conn = datapool.getConnection();
rc = AuditRecord.getAuditRecordCount(conn,sigid);
} // end try
catch (SQLException e)
{ // database error - this is a DataException
logger.error("error loading audit record count: " + e.getMessage(),e);
throw new DataException("unable to load audit record count: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return rc;
} // end getAuditRecordCount
/*--------------------------------------------------------------------------------
* Implementations from interface UserBackend
*--------------------------------------------------------------------------------
@@ -336,7 +336,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
{
final String query =
"SELECT posts_per_page, old_posts_at_top, max_search_page, max_sig_mbr_page, max_conf_mbr_page, "
+ "fp_posts FROM globals;";
+ "fp_posts, num_audit_page FROM globals;";
ResultSet rs = stmt.executeQuery(query);
if (!(rs.next()))
throw new DataException("Globals table does not appear to be loaded!");
@@ -348,6 +348,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
gp_ints[IP_MAXSIGMEMBERDISPLAY] = rs.getInt(4);
gp_ints[IP_MAXCONFMEMBERDISPLAY] = rs.getInt(5);
gp_ints[IP_NUMFRONTPAGEPOSTS] = rs.getInt(6);
gp_ints[IP_NUMAUDITRECSPERPAGE] = rs.getInt(7);
} // end loadDefaults
@@ -492,7 +493,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end catch
// Allocate the global parameter arrays.
gp_ints = new int[6];
gp_ints = new int[7];
// initialize anything that requires us to pull from the database
Connection conn = null;
@@ -1436,6 +1437,12 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end getPublishedMessages
public int getNumAuditRecordsPerPage()
{
return gp_ints[IP_NUMAUDITRECSPERPAGE];
} // end getNumAuditRecordsPerPage
/*--------------------------------------------------------------------------------
* Implementations from interface EngineBackend
*--------------------------------------------------------------------------------