001 /** =====================================================================
002 *
003 * File Name : $Id: AuthenticationDetails.java,v 1.4 2008/01/15 11:08:17 cb Exp $
004 *
005 * Description
006 * -----------
007 *
008 * See javadoc comment
009 *
010 * =====================================================================
011 *
012 * @Author : Craige Bevil
013 * Control Software Group
014 * Isaac Newton Group of Telescopes
015 *
016 * =====================================================================
017 *
018 * Modification Log
019 *
020 * Vers Date Author Reason
021 * ---- ---- ------ ------
022 * 1 C.Bevil First Release
023 *
024 * Commissioning Notes
025 * -------------------
026 *
027 * None
028 *
029 * =====================================================================
030 *
031 * @Version : $Id: AuthenticationDetails.java,v 1.4 2008/01/15 11:08:17 cb Exp $
032 *
033 * @Author : $Author: cb $
034 *
035 * Header : $Header: /opt/INGsrc/src/CVS/softproj/FaultDatabase/src/FaultDatabase/FaultDatabase/src/GWTApplication/client/AuthenticationDetails.java,v 1.4 2008/01/15 11:08:17 cb Exp $
036 *
037 * Log : $Log: AuthenticationDetails.java,v $
038 * Log : Revision 1.4 2008/01/15 11:08:17 cb
039 * Log : Ran through PMD and sorted out the javadoc so that we could export the
040 * Log : javadoc to the javadoc repository.
041 * Log :
042 * Log : Revision 1.3 2007/08/17 14:21:23 cb
043 * Log : Comments
044 * Log :
045 * Log : Revision 1.2 2007/08/01 13:00:08 cb
046 * Log : First prototype after import
047 * Log :
048 * Log : Revision 1.1.1.1 2007/06/01 08:33:26 cb
049 * Log : Imported using TkCVS
050 * Log :
051 *
052 * =====================================================================*/
053
054 package GWTApplication.client;
055
056 import com.google.gwt.user.client.rpc.*;
057 import java.util.*;
058
059 /**
060 * This is a entity class which is used to carry the authentication
061 * data which will be sent back from the server after the user logs
062 * onto the system.
063 */
064
065 public class AuthenticationDetails implements IsSerializable {
066
067 /**
068 * These are priviledge levels which is associated with the
069 * user. There are several privilege levels available within the
070 * application ranging from guest user to fault database
071 * administrator.
072 * @gwt.typeArgs <java.lang.String>
073 */
074
075 public ArrayList PriviledgeLevels = new ArrayList();
076
077 /**
078 * This is the users email address
079 */
080
081 public String UserEmailAddress;
082
083 /**
084 * This is the christian name of the user
085 */
086
087 public String Name;
088
089 /**
090 * The surname of the authenticated user
091 */
092
093 public String Surname;
094
095 /**
096 * This is the user identifier of the user which he uses to
097 * authenticates himself.
098 */
099
100 public String UserId;
101
102 /**
103 * Will be used for ascertaining whether or not a user has a
104 * the specific priviledge level.
105 * @param DemandedPriviledgeLevel This is the level of priviledge
106 * which we want to know the user reaches.
107 * @return boolean True if the user has this level of priviledge.
108 */
109
110 public boolean hasPriviledgeLevel (final String DemandedPriviledgeLevel) {
111
112 if (PriviledgeLevels == null) {
113 return false;
114 }
115
116 for (int i=0; i < PriviledgeLevels.size();i++) {
117 if (((String)PriviledgeLevels.get(i)).equals(DemandedPriviledgeLevel)) {
118 return true;
119 }
120 }
121
122 return false;
123 }
124
125 /**
126 * A constructor
127 */
128
129 public AuthenticationDetails () {
130 PriviledgeLevels.add(FaultDatabaseConstants.DEFAULTPRIVILEDGE);
131 UserId = FaultDatabaseConstants.DEFAULTUSER;
132 }
133 }