some serious new feature implementation:
- cookie-based persistent logins - expanded activity reporting - "top" and "fixed" left menus are now dynamically generated from XML config, not hard coded - error reporting enhanced and protection increased - "About Venice" page first draft - new means of "framing" static content within the Venice "frame" - base page now includes the "footer" itself, "content" pages don't anymore - general cleanup of some heavyweight old containers, replaced with faster Collections framework containers - probably more, there's a LOT of stuff in here
This commit is contained in:
@@ -19,7 +19,6 @@ package com.silverwrist.venice.security;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.venice.db.SQLUtil;
|
||||
import com.silverwrist.venice.core.AuditData;
|
||||
import com.silverwrist.venice.core.DataException;
|
||||
@@ -34,9 +33,9 @@ public class AuditRecord implements AuditData
|
||||
|
||||
static class DescrStringCache
|
||||
{
|
||||
private Hashtable descr_cache = new Hashtable();
|
||||
private Hashtable uname_cache = new Hashtable();
|
||||
private Hashtable signame_cache = new Hashtable();
|
||||
private HashMap descr_cache = new HashMap();
|
||||
private HashMap uname_cache = new HashMap();
|
||||
private HashMap signame_cache = new HashMap();
|
||||
private Statement stmt;
|
||||
|
||||
DescrStringCache(Connection conn) throws SQLException
|
||||
@@ -363,7 +362,7 @@ public class AuditRecord implements AuditData
|
||||
public static List getAuditRecords(Connection conn, int sigid, int offset, int count)
|
||||
throws SQLException, DataException
|
||||
{
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
DescrStringCache cache = new DescrStringCache(conn);
|
||||
|
||||
Statement stmt = conn.createStatement();
|
||||
@@ -380,7 +379,7 @@ public class AuditRecord implements AuditData
|
||||
|
||||
} // end while
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getAuditRecords
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package com.silverwrist.venice.security;
|
||||
|
||||
import java.util.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
|
||||
public class Role implements Comparable, SecLevels
|
||||
{
|
||||
@@ -31,12 +30,24 @@ public class Role implements Comparable, SecLevels
|
||||
private static Role no_access = null;
|
||||
private static Role unrestricted_user = null;
|
||||
private static Role sig_host = null;
|
||||
private static Vector global_low = null;
|
||||
private static Vector global_high = null;
|
||||
private static Vector sig_low = null;
|
||||
private static Vector sig_high = null;
|
||||
private static Vector conf_low = null;
|
||||
private static Vector conf_high = null;
|
||||
private static ArrayList global_low = null;
|
||||
private static ArrayList global_high = null;
|
||||
private static ArrayList sig_low = null;
|
||||
private static ArrayList sig_high = null;
|
||||
private static ArrayList conf_low = null;
|
||||
private static ArrayList conf_high = null;
|
||||
|
||||
private static List sigreadlist_rc = null;
|
||||
private static List sigwritelist_rc = null;
|
||||
private static List sigcreatelist_rc = null;
|
||||
private static List sigdeletelist_rc = null;
|
||||
private static List sigjoinlist_rc = null;
|
||||
private static List sig_member_levels = null;
|
||||
private static List confreadlist_rc = null;
|
||||
private static List confpostlist_rc = null;
|
||||
private static List confhidelist_rc = null;
|
||||
private static List confdeletelist_rc = null;
|
||||
private static List conf_member_levels = null;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
@@ -58,80 +69,6 @@ public class Role implements Comparable, SecLevels
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal functions
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static void initAllSets()
|
||||
{
|
||||
if (not_in_list==null)
|
||||
not_in_list = new Role(0,"(not in list)");
|
||||
|
||||
if (no_access==null)
|
||||
no_access = new Role(NO_ACCESS,"No Access");
|
||||
|
||||
if (unrestricted_user==null)
|
||||
unrestricted_user = new Role(UNRESTRICTED_USER,"'Unrestricted' User");
|
||||
|
||||
if (global_low==null)
|
||||
{ // initialize the "global lowband" vector
|
||||
global_low = new Vector(3);
|
||||
global_low.addElement(new Role(GLOBAL_ANONYMOUS,"Anonymous User"));
|
||||
global_low.addElement(new Role(GLOBAL_UNVERIFIED,"Unauthenticated User"));
|
||||
global_low.addElement(new Role(GLOBAL_NORMAL,"Normal User"));
|
||||
global_low.trimToSize();
|
||||
|
||||
} // end if
|
||||
|
||||
if (global_high==null)
|
||||
{ // initialize the "global highband" vector
|
||||
global_high = new Vector(3);
|
||||
global_high.addElement(new Role(GLOBAL_ANYADMIN,"Any System Administrator"));
|
||||
global_high.addElement(new Role(GLOBAL_PFY,"System Assistant Administrator"));
|
||||
global_high.addElement(new Role(GLOBAL_BOFH,"Global System Administrator"));
|
||||
global_high.trimToSize();
|
||||
|
||||
} // end if
|
||||
|
||||
if (sig_low==null)
|
||||
{ // initialize the "SIG lowband" vector
|
||||
sig_low = new Vector(1);
|
||||
sig_low.addElement(new Role(SIG_MEMBER,"SIG Member"));
|
||||
sig_low.trimToSize();
|
||||
|
||||
} // end if
|
||||
|
||||
if (sig_high==null)
|
||||
{ // initialize the "SIG highband" vector
|
||||
sig_high = new Vector(3);
|
||||
sig_high.addElement(new Role(SIG_ANYADMIN,"Any SIG Administrator"));
|
||||
sig_high.addElement(new Role(SIG_COHOST,"SIG Co-Host"));
|
||||
sig_host = new Role(SIG_HOST,"SIG Host");
|
||||
sig_high.addElement(sig_host);
|
||||
sig_high.trimToSize();
|
||||
|
||||
} // end if
|
||||
|
||||
if (conf_low==null)
|
||||
{ // initialize the "conference lowband" vector
|
||||
conf_low = new Vector(1);
|
||||
conf_low.addElement(new Role(CONFERENCE_MEMBER,"Conference Member"));
|
||||
conf_low.trimToSize();
|
||||
|
||||
} // end if
|
||||
|
||||
if (conf_high==null)
|
||||
{ // initialize the "conference highband" vector
|
||||
conf_high = new Vector(2);
|
||||
conf_high.addElement(new Role(CONFERENCE_ANYADMIN,"Any Conference Administrator"));
|
||||
conf_high.addElement(new Role(CONFERENCE_HOST,"Conference Host"));
|
||||
conf_high.trimToSize();
|
||||
|
||||
} // end if
|
||||
|
||||
} // end initAllSets
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
@@ -196,69 +133,95 @@ public class Role implements Comparable, SecLevels
|
||||
|
||||
public static List getSIGReadList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.firstElement());
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sigreadlist_rc==null)
|
||||
{ // create the returned list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.get(0));
|
||||
sigreadlist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sigreadlist_rc;
|
||||
|
||||
} // end getSIGReadList
|
||||
|
||||
public static List getSIGWriteList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sigwritelist_rc==null)
|
||||
{ // build the return value
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
sigwritelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sigwritelist_rc;
|
||||
|
||||
} // end getSIGWriteList
|
||||
|
||||
public static List getSIGCreateList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.add(global_low.lastElement());
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.firstElement());
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sigcreatelist_rc==null)
|
||||
{ // create the return list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.add(global_low.get(global_low.size()-1));
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.get(0));
|
||||
sigcreatelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sigcreatelist_rc;
|
||||
|
||||
} // end getSIGCreateList
|
||||
|
||||
public static List getSIGDeleteList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
rc.add(no_access);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sigdeletelist_rc==null)
|
||||
{ // create the return list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
rc.add(no_access);
|
||||
sigdeletelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sigdeletelist_rc;
|
||||
|
||||
} // end getSIGDeleteList
|
||||
|
||||
public static List getSIGJoinList()
|
||||
{
|
||||
initAllSets();
|
||||
return new ReadOnlyVector(global_low);
|
||||
if (sigjoinlist_rc==null)
|
||||
sigjoinlist_rc = Collections.unmodifiableList(global_low);
|
||||
return sigjoinlist_rc;
|
||||
|
||||
} // end getSIGJoinList
|
||||
|
||||
public static List getSIGMemberLevelChoices()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.add(not_in_list);
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.remove(rc.size()-1);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sig_member_levels==null)
|
||||
{ // figure out the member levels list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.add(not_in_list);
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.remove(rc.size()-1);
|
||||
sig_member_levels = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sig_member_levels;
|
||||
|
||||
} // end getSIGMemberLevelChoices
|
||||
|
||||
@@ -270,26 +233,36 @@ public class Role implements Comparable, SecLevels
|
||||
|
||||
public static List getConferenceReadList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (confreadlist_rc==null)
|
||||
{ // precalculate the conference read list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
confreadlist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return confreadlist_rc;
|
||||
|
||||
} // end getConferenceReadList
|
||||
|
||||
public static List getConferencePostList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(conf_high);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (confpostlist_rc==null)
|
||||
{ // precalculate the post list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(conf_high);
|
||||
confpostlist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return confpostlist_rc;
|
||||
|
||||
} // return getConferencePostList
|
||||
|
||||
@@ -301,12 +274,17 @@ public class Role implements Comparable, SecLevels
|
||||
|
||||
public static List getConferenceHideList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(conf_high);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.firstElement());
|
||||
return new ReadOnlyVector(rc);
|
||||
if (confhidelist_rc==null)
|
||||
{ // precalculate the hide list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(conf_high);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.get(0));
|
||||
confhidelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return confhidelist_rc;
|
||||
|
||||
} // end getConferenceHideList
|
||||
|
||||
@@ -324,27 +302,88 @@ public class Role implements Comparable, SecLevels
|
||||
|
||||
public static List getConferenceDeleteList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
rc.add(no_access);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (confdeletelist_rc==null)
|
||||
{ // precalculate the delete list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
rc.add(no_access);
|
||||
confdeletelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return confdeletelist_rc;
|
||||
|
||||
} // end getConferenceDeleteList
|
||||
|
||||
public static List getConferenceMemberLevelChoices()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.add(not_in_list);
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.add(conf_high.lastElement());
|
||||
return new ReadOnlyVector(rc);
|
||||
if (conf_member_levels==null)
|
||||
{ // precalculate the list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.add(not_in_list);
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.add(conf_high.get(conf_high.size()-1));
|
||||
conf_member_levels = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return conf_member_levels;
|
||||
|
||||
} // end getConferenceMemberLevelChoices
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static initializer
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static
|
||||
{
|
||||
not_in_list = new Role(0,"(not in list)");
|
||||
no_access = new Role(NO_ACCESS,"No Access");
|
||||
unrestricted_user = new Role(UNRESTRICTED_USER,"'Unrestricted' User");
|
||||
|
||||
// initialize the "global lowband" vector
|
||||
global_low = new ArrayList(3);
|
||||
global_low.add(new Role(GLOBAL_ANONYMOUS,"Anonymous User"));
|
||||
global_low.add(new Role(GLOBAL_UNVERIFIED,"Unauthenticated User"));
|
||||
global_low.add(new Role(GLOBAL_NORMAL,"Normal User"));
|
||||
global_low.trimToSize();
|
||||
|
||||
// initialize the "global highband" vector
|
||||
global_high = new ArrayList(3);
|
||||
global_high.add(new Role(GLOBAL_ANYADMIN,"Any System Administrator"));
|
||||
global_high.add(new Role(GLOBAL_PFY,"System Assistant Administrator"));
|
||||
global_high.add(new Role(GLOBAL_BOFH,"Global System Administrator"));
|
||||
global_high.trimToSize();
|
||||
|
||||
// initialize the "SIG lowband" vector
|
||||
sig_low = new ArrayList(1);
|
||||
sig_low.add(new Role(SIG_MEMBER,"SIG Member"));
|
||||
sig_low.trimToSize();
|
||||
|
||||
// initialize the "SIG highband" vector
|
||||
sig_high = new ArrayList(3);
|
||||
sig_high.add(new Role(SIG_ANYADMIN,"Any SIG Administrator"));
|
||||
sig_high.add(new Role(SIG_COHOST,"SIG Co-Host"));
|
||||
sig_host = new Role(SIG_HOST,"SIG Host");
|
||||
sig_high.add(sig_host);
|
||||
sig_high.trimToSize();
|
||||
|
||||
// initialize the "conference lowband" vector
|
||||
conf_low = new ArrayList(1);
|
||||
conf_low.add(new Role(CONFERENCE_MEMBER,"Conference Member"));
|
||||
conf_low.trimToSize();
|
||||
|
||||
// initialize the "conference highband" vector
|
||||
conf_high = new ArrayList(2);
|
||||
conf_high.add(new Role(CONFERENCE_ANYADMIN,"Any Conference Administrator"));
|
||||
conf_high.add(new Role(CONFERENCE_HOST,"Conference Host"));
|
||||
conf_high.trimToSize();
|
||||
|
||||
} // end static initializer
|
||||
|
||||
} // end class Role
|
||||
|
||||
Reference in New Issue
Block a user