001: /*
002: * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/auth/OnlineUser.java,v 1.36 2007/10/09 11:09:12 lexuanttkhtn Exp $
003: * $Author: lexuanttkhtn $
004: * $Revision: 1.36 $
005: * $Date: 2007/10/09 11:09:12 $
006: *
007: * ====================================================================
008: *
009: * Copyright (C) 2002-2007 by MyVietnam.net
010: *
011: * All copyright notices regarding mvnForum MUST remain
012: * intact in the scripts and in the outputted HTML.
013: * The "powered by" text/logo with a link back to
014: * http://www.mvnForum.com and http://www.MyVietnam.net in
015: * the footer of the pages MUST remain visible when the pages
016: * are viewed on the internet or intranet.
017: *
018: * This program is free software; you can redistribute it and/or modify
019: * it under the terms of the GNU General Public License as published by
020: * the Free Software Foundation; either version 2 of the License, or
021: * any later version.
022: *
023: * This program is distributed in the hope that it will be useful,
024: * but WITHOUT ANY WARRANTY; without even the implied warranty of
025: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
026: * GNU General Public License for more details.
027: *
028: * You should have received a copy of the GNU General Public License
029: * along with this program; if not, write to the Free Software
030: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
031: *
032: * Support can be obtained from support forums at:
033: * http://www.mvnForum.com/mvnforum/index
034: *
035: * Correspondence and Marketing Questions can be sent to:
036: * info at MyVietnam net
037: *
038: * @author: Minh Nguyen
039: * @author: Mai Nguyen
040: */
041: package com.mvnforum.auth;
042:
043: import java.sql.Timestamp;
044: import java.util.*;
045:
046: import java.awt.image.BufferedImage;
047:
048: import javax.servlet.http.HttpServletRequest;
049:
050: import net.myvietnam.mvncore.exception.BadInputException;
051:
052: public interface OnlineUser {
053:
054: /**************************************************************
055: * Constants
056: **************************************************************/
057: public static final int AUTHENTICATION_TYPE_UNAUTHENTICATED = 0;
058:
059: public static final int AUTHENTICATION_TYPE_HTML_FORM = 1;
060:
061: public static final int AUTHENTICATION_TYPE_SESSION = 2;
062:
063: public static final int AUTHENTICATION_TYPE_COOKIE = 3;
064:
065: public static final int AUTHENTICATION_TYPE_REALM = 4;
066:
067: public static final int AUTHENTICATION_TYPE_CUSTOMIZATION = 5;
068:
069: /**************************************************************
070: * Methods
071: **************************************************************/
072: /**
073: * Get the numeric member id of this user
074: *
075: * @return int the numeric member id of this user
076: */
077: public int getMemberID();
078:
079: /**
080: * Get the memberName that is used to login
081: *
082: * @return String the memberName that is used to login
083: */
084: public String getMemberName();
085:
086: /**
087: * Check if this user is guest (not login yet) or already authenticated
088: *
089: * @return boolean true if this user is guest (not login yet)
090: */
091: public boolean isGuest();
092:
093: /**
094: * Check if this user is already authenticated
095: *
096: * @return boolean true if this user is already authenticated
097: */
098: public boolean isMember();
099:
100: /**
101: * Check if this user prefer the invisible mode
102: *
103: * @return boolean true if this user prefer the invisible mode
104: */
105: public boolean isInvisibleMember();
106:
107: /**
108: * Check if this member's password is expired. For single sign on, this method should always return false
109: *
110: * @return boolean true if password is expired
111: */
112: public boolean isPasswordExpired();
113:
114: /**
115: * Get the authentication type that user did used to login
116: *
117: * @return int the authentication type
118: */
119: public int getAuthenticationType();
120:
121: /**
122: * Get the permission that this user currently has
123: *
124: * @return MVNForumPermission
125: */
126: public MVNForumPermission getPermission();
127:
128: /**
129: * Reload the permission from the underlying database
130: */
131: public void reloadPermission();
132:
133: /**
134: * Reload the user's profile from the underlying database
135: */
136: public void reloadProfile();
137:
138: /**
139: * Get the current action of this user in the system
140: *
141: * @return OnlineUserAction
142: */
143: public OnlineUserAction getOnlineUserAction();
144:
145: public java.util.Date convertGMTDate(java.util.Date gmtDate);
146:
147: public Timestamp convertGMTTimestamp(Timestamp gmtTimestamp);
148:
149: public String getGMTDateFormat(java.util.Date gmtDate);
150:
151: public String getGMTDateFormat(java.util.Date gmtDate,
152: boolean adjustTimeZone);
153:
154: public String getGMTTimestampFormat(Timestamp gmtTimestamp);
155:
156: public String getGMTTimestampFormat(Timestamp gmtTimestamp,
157: boolean adjustTimeZone);
158:
159: public String getTimeZoneFormat();
160:
161: /**
162: * Get the current timezone of this user
163: * @return current timezone of this user
164: */
165: public double getTimeZone();
166:
167: /**
168: * Get the current locale of this user
169: *
170: * @return Locale the current locale of this user
171: */
172: public Locale getLocale();
173:
174: /**
175: * Get the current locale name of this user
176: *
177: * @return String the current locale name of this user
178: */
179: public String getLocaleName();
180:
181: /**
182: * Set the locale name for the current online user
183: * @param localeName String
184: */
185: public void setLocaleName(String localeName);
186:
187: //public boolean getGender();
188:
189: /**
190: * Get the timestampt of the last time this user login
191: *
192: * @return Timestamp
193: */
194: public Timestamp getLastLogonTimestamp();
195:
196: /**
197: * Get the IP of the last time this user login
198: *
199: * @return String
200: */
201: public String getLastLogonIP();
202:
203: /**
204: * Get the number of items that shown in one page for this user
205: *
206: * @return int the number of items that shown in one page
207: */
208: public int getPostsPerPage();
209:
210: /**
211: * Get the number of new private messages of this user.
212: * @return int the number of new private messages of this user
213: */
214: public int getNewMessageCount();
215:
216: /**
217: * Update the new message count value. The implementation
218: * should provide an effectively method if parameter force is false
219: * since this method is called many time.<p>
220: * In case force is true, update it immediately
221: * @return boolean values. It's true if the new message count
222: * greater than the current message count
223: */
224: public boolean updateNewMessageCount(boolean force);
225:
226: /**
227: * Get the number of private messages that shown in one page for this user
228: *
229: * @return int the number of items that shown in one page
230: */
231: public int getMessagesPerPage();
232:
233: /**
234: * Get the full ABSOLUTE path of the css file
235: *
236: * @return String the full ABSOLUTE path of the css file
237: */
238: public String getCssPath();
239:
240: /**
241: * Get the full ABSOLUTE path of the css file
242: *
243: * @return String the full ABSOLUTE path of the css file,
244: * this method can customize the path based on parameter in request
245: */
246: public String getCssPath(HttpServletRequest request);
247:
248: /**
249: * Get the full ABSOLUTE path of the logo file
250: *
251: * @return String the full ABSOLUTE path of the logo file
252: */
253: public String getLogoPath();
254:
255: /**
256: * Build a new captcha, this method must be called before using some
257: * action that need captcha validation.
258: */
259: public void buildNewCaptcha();
260:
261: /**
262: * Destroy the current captcha, this method must be called after validate
263: * the captcha
264: */
265: public void destroyCurrentCaptcha();
266:
267: /**
268: * Get the captcha image to challenge the user
269: *
270: * @return BufferedImage the captcha image to challenge the user
271: */
272: public BufferedImage getCurrentCaptchaImage();
273:
274: /**
275: * Validate the anwser of the captcha from user
276: *
277: * @param anwser String the captcha anwser from user
278: * @return boolean true if the answer is valid, otherwise return false
279: */
280: public boolean validateCaptchaResponse(String anwser);
281:
282: /**
283: * Check to make sure that the captcha answer is correct
284: *
285: * @param answer String the captcha answer to check
286: * @throws BadInputException in case the captcha answer is not correct
287: */
288: public void ensureCorrectCaptchaResponse(String answer)
289: throws BadInputException;
290:
291: public void setCssPath(String path);
292:
293: public void setLogoPath(String path);
294:
295: public void setXMPPConnection(Object conn);
296:
297: public Object getXMPPConnection();
298:
299: public void setParticipants(Object conn);
300:
301: public Set getParticipants();
302:
303: public void setWaitingList(Object conn);
304:
305: public Set getWaitingList();
306:
307: public void removeParticipant(Object conn);
308:
309: public void removeWaiting(Object conn);
310:
311: }
|