removed almost all of UserBackend
This commit is contained in:
parent
4162065c2b
commit
e7857d5501
|
@ -163,12 +163,11 @@ class AdminOperationsImpl implements AdminOperations
|
|||
base_role = env.getDefaultRole("Global.NewUser");
|
||||
|
||||
// Create the user account.
|
||||
ReturnNewUser rnu = UserContextImpl.createAccount(env,env.getUser().userRemoteAddress(),username,
|
||||
password,reminder,verify_email,lockout,0,base_role,
|
||||
description);
|
||||
ReturnNewUser rnu = UserContextImpl.createAccount(env,env.getRemoteAddress(),username,password,reminder,
|
||||
verify_email,lockout,0,base_role,description);
|
||||
|
||||
// Need to create a normal user context here for just a minute to autojoin the communities.
|
||||
UserContextImpl rc = new UserContextImpl(env);
|
||||
UserContextImpl rc = new UserContextImpl(env.getGlobalSite(),env);
|
||||
rc.loadNewUser("0.0.0.0",rnu.getUserID(),base_role.getLevel(),username,0,rnu.getCreationDate(),
|
||||
rnu.getCreationDate());
|
||||
rc.autoJoinCommunities();
|
||||
|
|
|
@ -2109,7 +2109,7 @@ class CommunityCoreData implements CommunityData, PropertyProvider
|
|||
env.getEngine().registerNewCommunity(comm);
|
||||
|
||||
// create an audit record indicating we were successful
|
||||
ar = new AuditRecord(AuditRecord.CREATE_COMMUNITY,host_uid,env.getUser().userRemoteAddress(),new_cid,
|
||||
ar = new AuditRecord(AuditRecord.CREATE_COMMUNITY,host_uid,env.getRemoteAddress(),new_cid,
|
||||
"name=" + name,"alias=" + alias);
|
||||
|
||||
} // end try
|
||||
|
|
|
@ -110,7 +110,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
|||
logger.debug("CommunityUserContextImpl constructor:ordinary");
|
||||
this.env = new EnvCommunity(env,this);
|
||||
this.cid = cid;
|
||||
this.level = env.getUser().realBaseLevel();
|
||||
this.level = env.getUserBaseLevel();
|
||||
this.is_member = false;
|
||||
this.show_admin = false;
|
||||
this.locked = false;
|
||||
|
@ -144,7 +144,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
|||
logger.debug("setMemberValues(" + String.valueOf(granted_level) + ", " + String.valueOf(member)
|
||||
+ ", " + String.valueOf(locked) + ")");
|
||||
|
||||
this.level = Math.max(env.getUser().realBaseLevel(),granted_level);
|
||||
this.level = Math.max(env.getUserBaseLevel(),granted_level);
|
||||
this.is_member = member;
|
||||
this.show_admin = env.isLevelAdmin(granted_level);
|
||||
this.locked = locked;
|
||||
|
@ -1219,7 +1219,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
|||
public void sendInvitation(String address, String personal_message)
|
||||
throws AccessError, DataException, EmailException
|
||||
{
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
throw new AccessError("You must be logged in to send an invitation.");
|
||||
|
||||
CommunityData my_comm = getData();
|
||||
|
@ -1245,13 +1245,12 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
|||
// Set the remaining variables and replace them.
|
||||
vars.put("community.alias",my_comm.getAlias());
|
||||
vars.put("personal",personal_message);
|
||||
vars.put("fullname",env.getUser().realFullName());
|
||||
String uname = env.getUser().realUserName();
|
||||
vars.put("username",uname);
|
||||
vars.put("fullname",env.getUserProps().propGet("fullname"));
|
||||
vars.put("username",env.getUserName());
|
||||
msg = StringUtil.replaceAllVariables(msg,vars);
|
||||
|
||||
// Get a MailSend object, set it up, and send it.
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUser());
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUserProps());
|
||||
msend.addRecipient(MailSend.RECIP_TO,address);
|
||||
msend.setSubject(subject);
|
||||
msend.setText(msg + "\n");
|
||||
|
@ -1261,7 +1260,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
|||
|
||||
public boolean canSendInvitation()
|
||||
{
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
return false;
|
||||
CommunityData d = getDataNE();
|
||||
if (d==null)
|
||||
|
@ -1404,7 +1403,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
|||
buf.append("\n\n").append(StringUtil.replaceAllVariables(disklaimer,vars));
|
||||
|
||||
// send the mail in the background!
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUser());
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUserProps());
|
||||
msend.setSubject(subject);
|
||||
msend.setText(buf.toString());
|
||||
MailerAgent agent = new MailerAgent(msend,mail_list);
|
||||
|
|
|
@ -201,7 +201,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
this.cache = null;
|
||||
this.confdata = cdata;
|
||||
recalcLevel(new_env.getDefaultRole("Conference.Creator").getLevel());
|
||||
this.pseud = env.getUser().userDefaultPseud();
|
||||
this.pseud = env.getUserProps().propGet("default.pseud");
|
||||
this.last_read = null;
|
||||
this.last_post = null;
|
||||
|
||||
|
@ -308,7 +308,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
else
|
||||
{ // just default everything
|
||||
settings_loaded = false;
|
||||
pseud = env.getUser().userDefaultPseud();
|
||||
pseud = env.getUserProps().propGet("default.pseud");
|
||||
last_read = null;
|
||||
last_post = null;
|
||||
|
||||
|
@ -771,7 +771,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
public void setDefaultPseud(String val) throws DataException
|
||||
{
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
return; // anonymous user can't change pseud
|
||||
if (deleted)
|
||||
throw new DataException("This conference has been deleted.");
|
||||
|
@ -824,7 +824,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
public boolean anyUnread()
|
||||
{
|
||||
if (deleted || env.getUser().userIsAnonymous())
|
||||
if (deleted || env.isAnonymous())
|
||||
return false;
|
||||
Connection conn = null; // pooled database connection
|
||||
Statement stmt = null;
|
||||
|
@ -1020,7 +1020,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
} // end if
|
||||
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
return; // anonymous user can't fixseen
|
||||
|
||||
Connection conn = null;
|
||||
|
@ -1383,7 +1383,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
public boolean canAddToHotlist()
|
||||
{
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
return false;
|
||||
return !(isInHotlist());
|
||||
|
||||
|
@ -1620,7 +1620,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
buf.append("\n\n").append(StringUtil.replaceAllVariables(disklaimer,vars));
|
||||
|
||||
// send the actual E-mail messages in the background
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUser());
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUserProps());
|
||||
msend.setSubject(subject);
|
||||
msend.setText(buf.toString());
|
||||
MailerAgent agent = new MailerAgent(msend,rc);
|
||||
|
@ -1811,7 +1811,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
public void touchRead(Connection conn) throws SQLException
|
||||
{
|
||||
if (deleted || env.getUser().userIsAnonymous())
|
||||
if (deleted || env.isAnonymous())
|
||||
return; // anonymous user can't update squat
|
||||
|
||||
Statement stmt = null;
|
||||
|
@ -1855,7 +1855,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
public void touchPost(Connection conn, java.util.Date post_date) throws SQLException
|
||||
{
|
||||
if (deleted || env.getUser().userIsAnonymous())
|
||||
if (deleted || env.isAnonymous())
|
||||
return; // anonymous user can't update squat
|
||||
|
||||
Statement stmt = null;
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.silverwrist.venice.core.internals.UserBackend;
|
|||
import com.silverwrist.venice.except.*;
|
||||
import com.silverwrist.venice.svc.internal.GlobalSite;
|
||||
import com.silverwrist.venice.util.MailSend;
|
||||
import com.silverwrist.venice.util.PropertyProvider;
|
||||
|
||||
class PersonalMailSend implements MailSend
|
||||
{
|
||||
|
@ -38,14 +39,14 @@ class PersonalMailSend implements MailSend
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
PersonalMailSend(MailSend inner, GlobalSite site, UserBackend user) throws DataException
|
||||
PersonalMailSend(MailSend inner, GlobalSite site, PropertyProvider user_props) throws DataException
|
||||
{
|
||||
this.inner = inner;
|
||||
this.site = site;
|
||||
|
||||
try
|
||||
{ // set the "From" address in advance
|
||||
inner.setFrom(user.realFullName(),user.realEmailAddress());
|
||||
inner.setFrom(user_props.propGet("fullname"),user_props.propGet("email"));
|
||||
|
||||
} // end try
|
||||
catch (EmailException ee)
|
||||
|
@ -55,8 +56,8 @@ class PersonalMailSend implements MailSend
|
|||
} // end catch
|
||||
|
||||
StringBuffer buf = new StringBuffer("uid ");
|
||||
buf.append(user.realUID()).append("; username \"").append(user.realUserName()).append("\"; ip [");
|
||||
buf.append(user.userRemoteAddress()).append("]");
|
||||
buf.append(user_props.propGet("id")).append("; username \"").append(user_props.propGet("name"));
|
||||
buf.append("\"; ip [").append(user_props.propGet("ip.address")).append("]");
|
||||
inner.addHeader("X-Venice-Sender-Info",buf.toString());
|
||||
String[] headers = StringUtil.splitArray(site.getStockMessage("header-disclaimer"),"\r\n");
|
||||
for (int i=0; i<headers.length; i++)
|
||||
|
|
|
@ -490,14 +490,14 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
|||
|
||||
public boolean canHide()
|
||||
{
|
||||
return ( ((creator_uid==env.getUserID()) && (!env.getUser().userIsAnonymous()))
|
||||
return ( ((creator_uid==env.getUserID()) && (!env.isAnonymous()))
|
||||
|| env.getConference().userCanHide());
|
||||
|
||||
} // end canHide
|
||||
|
||||
public boolean canScribble()
|
||||
{
|
||||
return ( ((creator_uid==env.getUserID()) && (!env.getUser().userIsAnonymous()))
|
||||
return ( ((creator_uid==env.getUserID()) && (!env.isAnonymous()))
|
||||
|| env.getConference().userCanScribble());
|
||||
|
||||
} // end canScribble
|
||||
|
@ -510,7 +510,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
|||
|
||||
public void setHidden(boolean flag) throws DataException, AccessError
|
||||
{
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
return; // no-op
|
||||
if ((creator_uid!=env.getUserID()) && !(env.getConference().userCanHide()))
|
||||
{ // we can't change the hidden status!
|
||||
|
@ -578,7 +578,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
|||
|
||||
public void scribble() throws DataException, AccessError
|
||||
{
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
return; // no-op
|
||||
if ((creator_uid!=env.getUserID()) && !(env.getConference().userCanScribble()))
|
||||
{ // we can't scribble this post
|
||||
|
|
|
@ -417,7 +417,7 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
public void setHidden(boolean flag) throws DataException
|
||||
{
|
||||
if ((hidden==flag) || deleted || env.getUser().userIsAnonymous())
|
||||
if ((hidden==flag) || deleted || env.isAnonymous())
|
||||
return; // no-op
|
||||
|
||||
Connection conn = null; // pooled database connection
|
||||
|
@ -496,7 +496,7 @@ class TopicUserContextImpl implements TopicContext
|
|||
if (logger.isDebugEnabled())
|
||||
logger.debug("[raw] setUnreadMessages(" + count + ") entry");
|
||||
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
{ // this is effectively a no-op, but log it
|
||||
logger.debug("reject 1: anonymous user");
|
||||
return;
|
||||
|
@ -1150,7 +1150,7 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
public boolean isBozo(int other_uid) throws DataException
|
||||
{
|
||||
if (deleted || env.getUser().userIsAnonymous() || (other_uid==env.getUserID()))
|
||||
if (deleted || env.isAnonymous() || (other_uid==env.getUserID()))
|
||||
return false; // no-op
|
||||
|
||||
if (bozo_uids==null)
|
||||
|
@ -1182,7 +1182,7 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
public void setBozo(int other_uid, boolean bozo) throws DataException
|
||||
{
|
||||
if (deleted || env.getUser().userIsAnonymous() || (other_uid==env.getUserID()))
|
||||
if (deleted || env.isAnonymous() || (other_uid==env.getUserID()))
|
||||
return; // no-op
|
||||
|
||||
Connection conn = null;
|
||||
|
@ -1249,13 +1249,13 @@ class TopicUserContextImpl implements TopicContext
|
|||
// 1. You can't set bozo filters on a deleted topic.
|
||||
// 2. You can't set bozo filters if you're the anonymous user.
|
||||
// 3. You can't bozo-filter yourself, silly.
|
||||
return !(deleted || env.getUser().userIsAnonymous() || (other_uid==env.getUserID()));
|
||||
return !(deleted || env.isAnonymous() || (other_uid==env.getUserID()));
|
||||
|
||||
} // end canSetBozoFilter
|
||||
|
||||
public List getBozos() throws DataException
|
||||
{
|
||||
if (deleted || env.getUser().userIsAnonymous())
|
||||
if (deleted || env.isAnonymous())
|
||||
return Collections.EMPTY_LIST; // no-op
|
||||
|
||||
if (bozo_uids==null)
|
||||
|
@ -1293,7 +1293,7 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
public void setSubscribed(boolean flag) throws DataException
|
||||
{
|
||||
if ((subscribed==flag) || deleted || env.getUser().userIsAnonymous())
|
||||
if ((subscribed==flag) || deleted || env.isAnonymous())
|
||||
return; // no-op
|
||||
|
||||
Connection conn = null; // pooled database connection
|
||||
|
@ -1478,7 +1478,7 @@ class TopicUserContextImpl implements TopicContext
|
|||
buf.append("\n\n").append(StringUtil.replaceAllVariables(disklaimer,vars));
|
||||
|
||||
// send the actual E-mail messages in the background
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUser());
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUserProps());
|
||||
msend.setSubject(subject);
|
||||
msend.setText(buf.toString());
|
||||
MailerAgent agent = new MailerAgent(msend,rc);
|
||||
|
|
|
@ -28,9 +28,10 @@ import com.silverwrist.venice.db.*;
|
|||
import com.silverwrist.venice.except.*;
|
||||
import com.silverwrist.venice.security.*;
|
||||
import com.silverwrist.venice.svc.ServiceControl;
|
||||
import com.silverwrist.venice.util.MailSend;
|
||||
import com.silverwrist.venice.svc.internal.GlobalSite;
|
||||
import com.silverwrist.venice.util.*;
|
||||
|
||||
class UserContextImpl implements UserContext, UserBackend
|
||||
class UserContextImpl implements UserContext, ServiceProvider, PropertyProvider, UserBackend
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
|
@ -57,6 +58,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private GlobalSite globalsite; // the global site
|
||||
private EnvUser env; // the environment store
|
||||
private String remote_addr; // remote address identifier
|
||||
private int uid = -1; // the user ID we're using
|
||||
|
@ -82,9 +84,10 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
UserContextImpl(EnvEngine env)
|
||||
UserContextImpl(GlobalSite globalsite, EnvEngine env)
|
||||
{
|
||||
this.env = new EnvUser(env,this);
|
||||
this.globalsite = globalsite;
|
||||
this.env = new EnvUser(env,this,this);
|
||||
|
||||
} // end constructor
|
||||
|
||||
|
@ -133,7 +136,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // call through to lower level function
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM userprefs WHERE uid = " + uid + ";");
|
||||
|
||||
|
@ -185,7 +188,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
logger.debug("sendEmailConfirmation(): sending to \"" + my_email + "\"");
|
||||
|
||||
// Create the message to be sent.
|
||||
String message = env.getStockMessage("email-confirm");
|
||||
String message = globalsite.getStockMessage("email-confirm");
|
||||
if (message==null)
|
||||
{ // no message defined? oy!
|
||||
logger.error("internal error condition: email-confirm stock message not defined");
|
||||
|
@ -199,12 +202,12 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
vars.put("confnum",String.valueOf(confirm_num));
|
||||
message = StringUtil.replaceAllVariables(message,vars);
|
||||
|
||||
String subject = env.getStockMessage("email-confirm-subject");
|
||||
String subject = globalsite.getStockMessage("email-confirm-subject");
|
||||
if (subject==null)
|
||||
subject = "Venice Email Confirmation";
|
||||
|
||||
// Create the emailer and send the message.
|
||||
MailSend msend = env.getMailSender();
|
||||
MailSend msend = (MailSend)(globalsite.queryService(MailSend.class));
|
||||
msend.addRecipient(MailSend.RECIP_TO,my_email);
|
||||
msend.setSubject(subject);
|
||||
msend.setText(message);
|
||||
|
@ -245,8 +248,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
// Figure out which of those communities we haven't joined yet and set up to autojoin them.
|
||||
sql.setLength(0);
|
||||
SecurityMonitor smon =
|
||||
(SecurityMonitor)(env.getGlobalSite().queryService(SecurityMonitor.class,"Community"));
|
||||
SecurityMonitor smon = (SecurityMonitor)(globalsite.queryService(SecurityMonitor.class,"Community"));
|
||||
int new_level = smon.getDefaultRole("Community.NewUser").getLevel();
|
||||
for (int i=0; i<tmp_cid.size(); i++)
|
||||
{ // see if the user is already a member of this community
|
||||
|
@ -292,7 +294,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // get a connection and create a statement
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
StringBuffer sql = new StringBuffer();
|
||||
|
||||
|
@ -410,7 +412,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // look for a user name matching this user record
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM users WHERE username = '"
|
||||
+ SQLUtil.encodeString(username) + "';");
|
||||
|
@ -508,18 +510,19 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
{ // the confirmation number is wrong
|
||||
logger.warn("...confirmation number incorrect");
|
||||
ar = new AuditRecord(AuditRecord.VERIFY_FAIL,uid,remote_addr,"Invalid confirmation number");
|
||||
ar.store(env.getGlobalSite());
|
||||
ar.store(globalsite);
|
||||
throw new AccessError("Confirmation number is incorrect. Please try again.");
|
||||
|
||||
} // end if
|
||||
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
Role new_role = env.getDefaultRole("Global.AfterVerify");
|
||||
SecurityMonitor smon = (SecurityMonitor)(globalsite.queryService(SecurityMonitor.class));
|
||||
Role new_role = smon.getDefaultRole("Global.AfterVerify");
|
||||
|
||||
try
|
||||
{ // get a connection and set the user's status to reflect the verification
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
StringBuffer sql = new StringBuffer("UPDATE users SET verify_email = 1, base_lvl = ");
|
||||
sql.append(new_role.getLevel()).append(" WHERE uid = ").append(uid).append(';');
|
||||
|
@ -571,7 +574,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // need to change the user's email confirmation number first
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
// generate new confirmation number
|
||||
|
@ -655,7 +658,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // get a database connection
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
Stashable obj = (Stashable)ci;
|
||||
|
||||
// save the contact information
|
||||
|
@ -688,7 +691,8 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
// generate new confirmation number
|
||||
int new_confirm_num = Generator.get().getNewConfirmationNumber();
|
||||
Role new_role = env.getDefaultRole("Global.Unverified");
|
||||
SecurityMonitor smon = (SecurityMonitor)(globalsite.queryService(SecurityMonitor.class));
|
||||
Role new_role = smon.getDefaultRole("Global.Unverified");
|
||||
|
||||
Statement stmt = null;
|
||||
try
|
||||
|
@ -752,7 +756,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
UserProfileImpl prof = new UserProfileImpl(env,conn,xusername);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...found it!");
|
||||
|
@ -781,7 +785,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
UserProfileImpl prof = new UserProfileImpl(env,conn,xuid);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...found it!");
|
||||
|
@ -817,7 +821,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
String hash_value = Generator.hashPassword(password);
|
||||
StringBuffer sql = new StringBuffer("UPDATE users SET passhash = '");
|
||||
|
@ -859,7 +863,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
StringBuffer sql = new StringBuffer("UPDATE users SET description = '");
|
||||
sql.append(SQLUtil.encodeString(new_descr)).append("' WHERE uid = ").append(uid).append(';');
|
||||
|
@ -993,9 +997,8 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
boolean hide_search = (hide_mode==CommunityContext.HIDE_BOTH);
|
||||
|
||||
// Create the new community's database entries and internal data.
|
||||
CommunityData new_comm = CommunityCoreData.createCommunity(env.getGlobalSite(),env,name,alias,uid,
|
||||
language,synopsis,rules,joinkey,hide_dir,
|
||||
hide_search);
|
||||
CommunityData new_comm = CommunityCoreData.createCommunity(globalsite,env,name,alias,uid,language,
|
||||
synopsis,rules,joinkey,hide_dir,hide_search);
|
||||
|
||||
// Create the community context we return to the user.
|
||||
CommunityContext rc = new CommunityUserContextImpl(env,new_comm);
|
||||
|
@ -1020,7 +1023,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
// retrieve the necessary rows from the sideboxes table
|
||||
|
@ -1063,7 +1066,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("LOCK TABLES sideboxes WRITE;");
|
||||
|
@ -1147,7 +1150,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
// create the update statement
|
||||
|
@ -1192,7 +1195,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
// create the update statement
|
||||
|
@ -1237,7 +1240,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
StringBuffer sql = new StringBuffer("UPDATE users SET tokenauth = '");
|
||||
sql.append(tokenauth).append("' WHERE uid = ").append(uid).append(';');
|
||||
|
@ -1365,7 +1368,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // look for a user record matching this user ID
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM users WHERE uid = " + pending_uid + ";");
|
||||
|
||||
|
@ -1516,7 +1519,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // get a database connection
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
TopicMessageFoundHelper helper = new TopicMessageFoundHelper(conn);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
|
@ -1576,7 +1579,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // get a database connection
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
// create the SQL statement
|
||||
|
@ -1615,65 +1618,102 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
} // end getSearchPostCount
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface UserBackend
|
||||
* Implementations from interface ServiceProvider
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public int realUID()
|
||||
public Object queryService(Class klass)
|
||||
{
|
||||
return uid;
|
||||
if (klass==UserContext.class)
|
||||
return ((UserContext)this);
|
||||
if (klass==PropertyProvider.class)
|
||||
return ((PropertyProvider)this);
|
||||
throw new NoSuchServiceException("UserContext",klass);
|
||||
|
||||
} // end realUID
|
||||
} // end queryService
|
||||
|
||||
public int realBaseLevel()
|
||||
public Object queryService(Class klass, String serviceid)
|
||||
{
|
||||
return level;
|
||||
return this.queryService(klass);
|
||||
|
||||
} // end realBaseLevel
|
||||
} // end queryService
|
||||
|
||||
public String userRemoteAddress()
|
||||
{
|
||||
return remote_addr;
|
||||
|
||||
} // end userRemoteAddress
|
||||
|
||||
public String userDefaultPseud() throws DataException
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("userDefaultPseud() for UID " + uid);
|
||||
if (my_pseud==null)
|
||||
getContactInfo();
|
||||
return my_pseud;
|
||||
|
||||
} // end userDefaultPseud
|
||||
|
||||
public boolean userIsAnonymous()
|
||||
{
|
||||
return is_anon;
|
||||
|
||||
} // end userIsAnonymous
|
||||
|
||||
public String realUserName()
|
||||
{
|
||||
return username;
|
||||
|
||||
} // end realUserName
|
||||
|
||||
public String realEmailAddress() throws DataException
|
||||
{
|
||||
if (my_email==null)
|
||||
getContactInfo();
|
||||
return my_email;
|
||||
|
||||
} // end realEmailAddress
|
||||
|
||||
public String realFullName() throws DataException
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface PropertyProvider
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String propGet(String identifier)
|
||||
{
|
||||
try
|
||||
{ // these properties have to be retrieved specially
|
||||
if (identifier.equals("fullname"))
|
||||
{ // get the full name of the user
|
||||
if (full_name==null)
|
||||
getContactInfo();
|
||||
return full_name;
|
||||
|
||||
} // end realFullName
|
||||
} // end if
|
||||
else if (identifier.equals("email"))
|
||||
{ // get the E-mail address
|
||||
if (my_email==null)
|
||||
getContactInfo();
|
||||
return my_email;
|
||||
|
||||
} // end else if
|
||||
else if (identifier.equals("default.pseud"))
|
||||
{ // get the default pseud
|
||||
if (my_pseud==null)
|
||||
getContactInfo();
|
||||
return my_pseud;
|
||||
|
||||
} // end else if
|
||||
|
||||
} // end try
|
||||
catch (DataException de)
|
||||
{ // if we hit a DataException, return an erroneous value
|
||||
logger.error("DataException in propGet()",de);
|
||||
return "<<error>>";
|
||||
|
||||
} // end catch
|
||||
|
||||
if (identifier.equals("id"))
|
||||
return String.valueOf(uid);
|
||||
else if (identifier.equals("name"))
|
||||
return username;
|
||||
else if (identifier.equals("ip.address"))
|
||||
return remote_addr;
|
||||
else if (identifier.equals("base.level"))
|
||||
return String.valueOf(level);
|
||||
else if (identifier.equals("is.anonymous"))
|
||||
return String.valueOf(is_anon);
|
||||
|
||||
throw new PropertyNotFoundException("UserContext",identifier);
|
||||
|
||||
} // end propGet
|
||||
|
||||
public int propGetInt(String identifier)
|
||||
{
|
||||
if (identifier.equals("id"))
|
||||
return uid;
|
||||
else if (identifier.equals("base.level"))
|
||||
return level;
|
||||
throw new PropertyNotFoundException("UserContext",identifier);
|
||||
|
||||
} // end propGetInt
|
||||
|
||||
public boolean propGetBoolean(String identifier)
|
||||
{
|
||||
if (identifier.equals("is.anonymous"))
|
||||
return is_anon;
|
||||
throw new PropertyNotFoundException("UserContext",identifier);
|
||||
|
||||
} // end propGetBoolean
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface UserBackend
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void saveMRU(String tag, Object data)
|
||||
{
|
||||
|
@ -1695,7 +1735,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM users WHERE is_anon = 1;");
|
||||
if (!(rs.next()))
|
||||
|
@ -1749,7 +1789,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
try
|
||||
{ // get a database connection and call the internal function
|
||||
conn = env.getConnection();
|
||||
conn = globalsite.getConnection(null);
|
||||
autoJoinCommunities(conn);
|
||||
|
||||
} // end try
|
||||
|
|
|
@ -182,7 +182,7 @@ class UserProfileImpl implements UserProfile
|
|||
ResultSet rs = stmt.executeQuery(sql.toString());
|
||||
if (rs.next())
|
||||
{ // load all the record data
|
||||
boolean me_anon = env.getUser().userIsAnonymous();
|
||||
boolean me_anon = env.isAnonymous();
|
||||
given_name = rs.getString("given_name");
|
||||
family_name = rs.getString("family_name");
|
||||
String blort = rs.getString("middle_init");
|
||||
|
@ -437,7 +437,7 @@ class UserProfileImpl implements UserProfile
|
|||
|
||||
public boolean canSendQuickEmail()
|
||||
{
|
||||
return !is_anon && !(env.getUser().userIsAnonymous());
|
||||
return !is_anon && !(env.isAnonymous());
|
||||
|
||||
} // end canSendQuickEmail
|
||||
|
||||
|
@ -446,7 +446,7 @@ class UserProfileImpl implements UserProfile
|
|||
if (logger.isDebugEnabled())
|
||||
logger.debug("Send Quick E-Mail (from uid " + env.getUserID() + " to uid " + uid + ")");
|
||||
|
||||
if (env.getUser().userIsAnonymous())
|
||||
if (env.isAnonymous())
|
||||
{ // we can't send quick emails if we're anonymous!
|
||||
logger.error("sending user is not logged in.");
|
||||
throw new AccessError("You must be logged in to send a quick E-mail message.");
|
||||
|
@ -461,7 +461,7 @@ class UserProfileImpl implements UserProfile
|
|||
} // end if
|
||||
|
||||
// create the emailer object, fill it in, and send it
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUser());
|
||||
MailSend msend = new PersonalMailSend(env.getMailSender(),env.getGlobalSite(),env.getUserProps());
|
||||
msend.addRecipient(MailSend.RECIP_TO,real_email);
|
||||
msend.setSubject(subject);
|
||||
msend.setText(text + "\n");
|
||||
|
|
|
@ -650,7 +650,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
public UserContext createUserContext(String remote_addr) throws DataException
|
||||
{
|
||||
checkInitialized();
|
||||
UserContextImpl uci = new UserContextImpl(env);
|
||||
UserContextImpl uci = new UserContextImpl(globalsite,env);
|
||||
uci.loadAnonymous(remote_addr);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("createUserContext(): context loaded :-)");
|
||||
|
@ -875,7 +875,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
false,confirm_num,new_role,null);
|
||||
|
||||
// create a new context for the user (they're now effectively logged in)
|
||||
UserContextImpl rc = new UserContextImpl(env);
|
||||
UserContextImpl rc = new UserContextImpl(globalsite,env);
|
||||
rc.loadNewUser(remote_addr,rnu.getUserID(),new_role.getLevel(),username,confirm_num,rnu.getCreationDate(),
|
||||
rnu.getCreationDate());
|
||||
rc.autoJoinCommunities(); // EJB 4/14/2001
|
||||
|
|
|
@ -86,34 +86,32 @@ public class EnvCommunity extends EnvUser
|
|||
|
||||
public AuditRecord newAudit(int type, String data1, String data2, String data3, String data4)
|
||||
{
|
||||
return new AuditRecord(type,super.getUserID(),super.getUser().userRemoteAddress(),getCommunityID(),data1,
|
||||
data2,data3,data4);
|
||||
return new AuditRecord(type,super.getUserID(),super.getRemoteAddress(),getCommunityID(),data1,data2,
|
||||
data3,data4);
|
||||
|
||||
} // end newAudit
|
||||
|
||||
public AuditRecord newAudit(int type, String data1, String data2, String data3)
|
||||
{
|
||||
return new AuditRecord(type,super.getUserID(),super.getUser().userRemoteAddress(),getCommunityID(),data1,
|
||||
data2,data3);
|
||||
return new AuditRecord(type,super.getUserID(),super.getRemoteAddress(),getCommunityID(),data1,data2,data3);
|
||||
|
||||
} // end newAudit
|
||||
|
||||
public AuditRecord newAudit(int type, String data1, String data2)
|
||||
{
|
||||
return new AuditRecord(type,super.getUserID(),super.getUser().userRemoteAddress(),getCommunityID(),data1,
|
||||
data2);
|
||||
return new AuditRecord(type,super.getUserID(),super.getRemoteAddress(),getCommunityID(),data1,data2);
|
||||
|
||||
} // end newAudit
|
||||
|
||||
public AuditRecord newAudit(int type, String data1)
|
||||
{
|
||||
return new AuditRecord(type,super.getUserID(),super.getUser().userRemoteAddress(),getCommunityID(),data1);
|
||||
return new AuditRecord(type,super.getUserID(),super.getRemoteAddress(),getCommunityID(),data1);
|
||||
|
||||
} // end newAudit
|
||||
|
||||
public AuditRecord newAudit(int type)
|
||||
{
|
||||
return new AuditRecord(type,super.getUserID(),super.getUser().userRemoteAddress(),getCommunityID());
|
||||
return new AuditRecord(type,super.getUserID(),super.getRemoteAddress(),getCommunityID());
|
||||
|
||||
} // end newAudit
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ import com.silverwrist.venice.except.AccessError;
|
|||
import com.silverwrist.venice.security.AuditRecord;
|
||||
import com.silverwrist.venice.security.Role;
|
||||
import com.silverwrist.venice.security.SecurityMonitor;
|
||||
import com.silverwrist.venice.util.PropertyProvider;
|
||||
import com.silverwrist.venice.util.ServiceProvider;
|
||||
|
||||
public class EnvUser extends EnvEngine
|
||||
{
|
||||
|
@ -48,6 +50,8 @@ public class EnvUser extends EnvEngine
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private ServiceProvider usersvc; // the user service provider
|
||||
private PropertyProvider userprops; // the user property provider
|
||||
private UserBackend user; // the user backend object
|
||||
private SecurityMonitor sm; // security monitor at this level
|
||||
|
||||
|
@ -56,9 +60,11 @@ public class EnvUser extends EnvEngine
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public EnvUser(EnvEngine parent, UserBackend user)
|
||||
public EnvUser(EnvEngine parent, ServiceProvider usersvc, UserBackend user)
|
||||
{
|
||||
super(parent);
|
||||
this.usersvc = usersvc;
|
||||
this.userprops = (PropertyProvider)(usersvc.queryService(PropertyProvider.class));
|
||||
this.user = user;
|
||||
this.sm = (SecurityMonitor)(getGlobalSite().queryService(SecurityMonitor.class));
|
||||
|
||||
|
@ -67,6 +73,8 @@ public class EnvUser extends EnvEngine
|
|||
protected EnvUser(EnvUser other)
|
||||
{
|
||||
super(other);
|
||||
this.usersvc = other.usersvc;
|
||||
this.userprops = other.userprops;
|
||||
this.user = other.user;
|
||||
this.sm = other.sm;
|
||||
|
||||
|
@ -82,7 +90,7 @@ public class EnvUser extends EnvEngine
|
|||
if (symbol.equals(PERM_CREATECOMMUNITY))
|
||||
{ // the Create Community permission test
|
||||
Role r = getEngine().getParamRole(EngineBackend.ROLEP_CREATECOMMUNITY);
|
||||
if (r.isSatisfiedBy(user.realBaseLevel()))
|
||||
if (r.isSatisfiedBy(userprops.propGetInt("base.level")))
|
||||
return true;
|
||||
logger.error("testPermission() fail for permission " + PERM_CREATECOMMUNITY);
|
||||
if (errormsg==null)
|
||||
|
@ -100,7 +108,7 @@ public class EnvUser extends EnvEngine
|
|||
if (symbol.equals(PERM_CREATECOMMUNITY))
|
||||
{ // do the "Create Community" test here
|
||||
Role r = getEngine().getParamRole(EngineBackend.ROLEP_CREATECOMMUNITY);
|
||||
return r.isSatisfiedBy(user.realBaseLevel());
|
||||
return r.isSatisfiedBy(userprops.propGetInt("base.level"));
|
||||
|
||||
} // end if
|
||||
|
||||
|
@ -110,8 +118,9 @@ public class EnvUser extends EnvEngine
|
|||
|
||||
protected int levelSelf()
|
||||
{
|
||||
return user.realBaseLevel();
|
||||
}
|
||||
return userprops.propGetInt("base.level");
|
||||
|
||||
} // end levelSelf
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
|
@ -120,31 +129,31 @@ public class EnvUser extends EnvEngine
|
|||
|
||||
public AuditRecord newAudit(int type, String data1, String data2, String data3, String data4)
|
||||
{
|
||||
return new AuditRecord(type,getUserID(),user.userRemoteAddress(),data1,data2,data3,data4);
|
||||
return new AuditRecord(type,getUserID(),userprops.propGet("ip.address"),data1,data2,data3,data4);
|
||||
|
||||
} // end newAudit
|
||||
|
||||
public AuditRecord newAudit(int type, String data1, String data2, String data3)
|
||||
{
|
||||
return new AuditRecord(type,getUserID(),user.userRemoteAddress(),data1,data2,data3);
|
||||
return new AuditRecord(type,getUserID(),userprops.propGet("ip.address"),data1,data2,data3);
|
||||
|
||||
} // end newAudit
|
||||
|
||||
public AuditRecord newAudit(int type, String data1, String data2)
|
||||
{
|
||||
return new AuditRecord(type,getUserID(),user.userRemoteAddress(),data1,data2);
|
||||
return new AuditRecord(type,getUserID(),userprops.propGet("ip.address"),data1,data2);
|
||||
|
||||
} // end newAudit
|
||||
|
||||
public AuditRecord newAudit(int type, String data1)
|
||||
{
|
||||
return new AuditRecord(type,getUserID(),user.userRemoteAddress(),data1);
|
||||
return new AuditRecord(type,getUserID(),userprops.propGet("ip.address"),data1);
|
||||
|
||||
} // end newAudit
|
||||
|
||||
public AuditRecord newAudit(int type)
|
||||
{
|
||||
return new AuditRecord(type,getUserID(),user.userRemoteAddress());
|
||||
return new AuditRecord(type,getUserID(),userprops.propGet("ip.address"));
|
||||
|
||||
} // end newAudit
|
||||
|
||||
|
@ -152,10 +161,11 @@ public class EnvUser extends EnvEngine
|
|||
{
|
||||
if (testPermissionDynamic(symbol,errormsg))
|
||||
return true;
|
||||
int my_level = userprops.propGetInt("base.level");
|
||||
if (symbol.equals(PERM_CREATECOMMUNITY))
|
||||
{ // the Create Community permission test
|
||||
Role r = getEngine().getParamRole(EngineBackend.ROLEP_CREATECOMMUNITY);
|
||||
if (r.isSatisfiedBy(user.realBaseLevel()))
|
||||
if (r.isSatisfiedBy(my_level))
|
||||
return true;
|
||||
logger.error("testPermission() fail for permission " + PERM_CREATECOMMUNITY);
|
||||
if (errormsg==null)
|
||||
|
@ -164,29 +174,36 @@ public class EnvUser extends EnvEngine
|
|||
|
||||
} // end if
|
||||
|
||||
return sm.testPermission(symbol,user.realBaseLevel(),errormsg);
|
||||
return sm.testPermission(symbol,my_level,errormsg);
|
||||
|
||||
} // end testPermission
|
||||
|
||||
public boolean testPermission(String symbol)
|
||||
{
|
||||
int my_level = userprops.propGetInt("base.level");
|
||||
if (symbol.equals(PERM_CREATECOMMUNITY))
|
||||
{ // do the "Create Community" test here
|
||||
Role r = getEngine().getParamRole(EngineBackend.ROLEP_CREATECOMMUNITY);
|
||||
return r.isSatisfiedBy(user.realBaseLevel());
|
||||
return r.isSatisfiedBy(my_level);
|
||||
|
||||
} // end if
|
||||
|
||||
return sm.testPermission(symbol,user.realBaseLevel());
|
||||
return sm.testPermission(symbol,my_level);
|
||||
|
||||
} // end testPermission
|
||||
|
||||
public boolean satisfy(Role role)
|
||||
{
|
||||
return role.isSatisfiedBy(user.realBaseLevel());
|
||||
return role.isSatisfiedBy(userprops.propGetInt("base.level"));
|
||||
|
||||
} // end satisfy
|
||||
|
||||
public final PropertyProvider getUserProps()
|
||||
{
|
||||
return userprops;
|
||||
|
||||
} // end getProps
|
||||
|
||||
public final UserBackend getUser()
|
||||
{
|
||||
return user;
|
||||
|
@ -195,20 +212,32 @@ public class EnvUser extends EnvEngine
|
|||
|
||||
public final int getUserID()
|
||||
{
|
||||
return user.realUID();
|
||||
return userprops.propGetInt("id");
|
||||
|
||||
} // end getUserID
|
||||
|
||||
public final String getUserName()
|
||||
{
|
||||
return user.realUserName();
|
||||
return userprops.propGet("name");
|
||||
|
||||
} // end getUserName
|
||||
|
||||
public final int getUserBaseLevel()
|
||||
{
|
||||
return user.realBaseLevel();
|
||||
return userprops.propGetInt("base.level");
|
||||
|
||||
} // end getUserBaseLevel
|
||||
|
||||
public final String getRemoteAddress()
|
||||
{
|
||||
return userprops.propGet("ip.address");
|
||||
|
||||
} // end getRemoteAddress
|
||||
|
||||
public final boolean isAnonymous()
|
||||
{
|
||||
return userprops.propGetBoolean("is.anonymous");
|
||||
|
||||
} // end isAnonymous
|
||||
|
||||
} // end class EnvUser
|
||||
|
|
|
@ -21,22 +21,6 @@ import com.silverwrist.venice.except.DataException;
|
|||
|
||||
public interface UserBackend
|
||||
{
|
||||
public abstract int realUID();
|
||||
|
||||
public abstract int realBaseLevel();
|
||||
|
||||
public abstract String userRemoteAddress();
|
||||
|
||||
public abstract String userDefaultPseud() throws DataException;
|
||||
|
||||
public abstract boolean userIsAnonymous();
|
||||
|
||||
public abstract String realUserName();
|
||||
|
||||
public abstract String realEmailAddress() throws DataException;
|
||||
|
||||
public abstract String realFullName() throws DataException;
|
||||
|
||||
public abstract void saveMRU(String tag, Object data);
|
||||
|
||||
} // end interface UserBackend
|
||||
|
|
Loading…
Reference in New Issue
Block a user