|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fr.gouv.culture.sdx.utils.AbstractSdxObject fr.gouv.culture.sdx.user.UserInformation
public class UserInformation
Basic user information used in sessions.
This class handles the username, the groups the user belongs to, and the preferred locale. If the locale is not set for a user, the user information object will refer to the application's default locale.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject |
---|
SdxObject.ConfigurationNode |
Field Summary | |
---|---|
static java.lang.String |
ANONYMOUS_USERNAME
The anonymous user name |
static java.lang.String |
CLASS_NAME_SUFFIX
|
protected java.lang.String |
host
Possible remote host externally setted to inform toSAX() |
protected java.lang.String |
ip
Possible remote IP externally setted to inform toSAX() |
static java.lang.String |
SESSION_PROPERTY
The session property name for user information. |
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
---|
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized |
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable |
---|
DEFAULT_ENCODING |
Constructor Summary | |
---|---|
UserInformation()
Creates the object A super.getLog() must be set and then this object must be setUp. |
Method Summary | |
---|---|
java.lang.String |
getAppId()
|
protected java.lang.String |
getClassNameSuffix()
Tells whether this user may admin an application. |
java.lang.String |
getEmail()
|
java.lang.String |
getFirstname()
Returns the firstname. |
java.util.Hashtable |
getGroups()
Returns the list of groups this user belongs to. |
java.lang.String |
getHost()
Get an host if setted |
java.lang.String |
getIp()
Get an IP if setted |
java.lang.String |
getLastname()
Returns the lastname. |
java.util.Locale |
getPreferredLocale()
Returns the preferred locale. |
protected boolean |
initToSax()
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML |
protected void |
initVolatileObjectsToSax()
Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called |
boolean |
isAdmin()
Returns isAdmin. |
boolean |
isMember(java.lang.String groupname)
Returns whether this user is member of a group. |
boolean |
isMember(java.lang.String[] groupnames)
Returns whether this user is member of at least one of the groups. |
boolean |
isMember(java.lang.String[] groupnames,
boolean all)
Test whether this user is member of some groups. |
boolean |
isSuperuser()
Returns true if this user is an SDX superuser. |
void |
setEmail(java.lang.String email)
|
void |
setFirstname(java.lang.String firstname)
Sets the firstname (may be null ). |
void |
setGroups(java.util.Hashtable groups)
Sets the groups the user belongs to. |
void |
setHost(java.lang.String host)
Set a remote Host externally, probably from acceptRequest |
void |
setIp(java.lang.String ip)
Set an IP externally, probably from acceptRequest |
void |
setLastname(java.lang.String lastname)
Sets the firstname (may be null ). |
void |
setPreferredLocale(java.util.Locale preferredLocale)
Sets the preferred locale (may not be null ). |
void |
setUp(java.lang.String appId,
java.lang.String id,
java.util.Hashtable groups,
java.util.Locale locale,
java.lang.String firstname,
java.lang.String lastname,
java.lang.String email,
java.lang.String adminGroup)
Creates user information. |
void |
toSAX(org.xml.sax.ContentHandler handler)
Sends information about this anonymous user. |
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
---|
configure, configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, verifyConfigurationResources |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASS_NAME_SUFFIX
protected java.lang.String ip
protected java.lang.String host
public static final java.lang.String SESSION_PROPERTY
public static final java.lang.String ANONYMOUS_USERNAME
Constructor Detail |
---|
public UserInformation()
A super.getLog() must be set and then this object must be setUp.
AbstractSdxObject.enableLogging(org.apache.avalon.framework.logger.Logger)
,
setUp(java.lang.String, java.lang.String, java.util.Hashtable, java.util.Locale, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
Method Detail |
---|
public void setUp(java.lang.String appId, java.lang.String id, java.util.Hashtable groups, java.util.Locale locale, java.lang.String firstname, java.lang.String lastname, java.lang.String email, java.lang.String adminGroup) throws SDXException
id
- The username.groups
- The groups it belongs to (may be null or empty).locale
- Thhye user's preferred locale.
If logging is desired the super.getLog() should be set after creation.
SDXException
- An exception if the username or the locale are null.AbstractSdxObject.enableLogging(org.apache.avalon.framework.logger.Logger)
public java.util.Hashtable getGroups()
public void setGroups(java.util.Hashtable groups) throws SDXException
groups
- The list of group names (may not be null
).
SDXException
public boolean isAdmin()
public java.lang.String getFirstname()
public void setFirstname(java.lang.String firstname) throws SDXException
null
).
SDXException
public java.lang.String getLastname()
public void setLastname(java.lang.String lastname) throws SDXException
null
).
SDXException
public java.util.Locale getPreferredLocale()
public void setPreferredLocale(java.util.Locale preferredLocale) throws SDXException
null
).
preferredLocale
- The locale
SDXException
public java.lang.String getEmail()
public void setEmail(java.lang.String email)
public java.lang.String getAppId()
public boolean isMember(java.lang.String[] groupnames, boolean all)
groupnames
- The list of groups.all
- If true
, the user must be member of each groups ; otherwise of at least one of them.public boolean isMember(java.lang.String[] groupnames)
groupnames
- The list of group names.public boolean isMember(java.lang.String groupname)
groupname
- The name of the group.public void setIp(java.lang.String ip)
ip
- public java.lang.String getIp()
public void setHost(java.lang.String host)
host
- public java.lang.String getHost()
public void toSAX(org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException
The information sent is basically a user definition with nested groups
toSAX
in interface org.apache.excalibur.xml.sax.XMLizable
toSAX
in class AbstractSdxObject
handler
- The handler where to send events.
org.xml.sax.SAXException
public boolean isSuperuser()
true
if this user is an SDX superuser.
This class always return false
. Subclasses such as SuperuserInformation
may return true
.
protected java.lang.String getClassNameSuffix()
getClassNameSuffix
in class AbstractSdxObject
app
- The application ID.admin
- If true, user may admin.protected boolean initToSax()
AbstractSdxObject
initToSax
in class AbstractSdxObject
protected void initVolatileObjectsToSax()
initVolatileObjectsToSax
in class AbstractSdxObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |