org.mmbase.security.implementation.cloudcontext.builders
Class Users

java.lang.Object
  extended byorg.mmbase.module.core.MMTable
      extended byorg.mmbase.module.core.MMObjectBuilder
          extended byorg.mmbase.security.implementation.cloudcontext.builders.Users

public class Users
extends MMObjectBuilder

This MMObjectBuilder implementation belongs to the object type 'mmbaseusers' It contains functionality to MD5 encode passwords, and so on.

Since:
MMBase-1.7
Version:
$Id: Users.java,v 1.27.2.2 2004/09/07 14:39:08 michiel Exp $
Author:
Eduard Witteveen, Pierre van Rooden, Michiel Meeuwissen

Field Summary
static java.lang.String FIELD_DEFAULTCONTEXT
           
static java.lang.String FIELD_LAST_LOGON
           
static java.lang.String FIELD_PASSWORD
           
static java.lang.String FIELD_STATUS
           
static java.lang.String FIELD_USERNAME
           
static java.lang.String FIELD_VALID_FROM
           
static java.lang.String FIELD_VALID_TO
           
static Parameter[] RANK_PARAMETERS
           
protected static Cache rankCache
           
static java.lang.String STATUS_RESOURCE
           
protected static Cache userCache
           
static long VALID_TO_DEFAULT
           
 
Fields inherited from class org.mmbase.module.core.MMObjectBuilder
AGE_PARAMETERS, broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, GUI_PARAMETERS, listCache, nodeCache, OBJ2TYPE_MAX_SIZE, oType, REPLACE_CACHE, searchAge, sortedDBLayout, TEMPNODE_DEFAULT_SIZE, TemporaryNodes, virtual
 
Fields inherited from class org.mmbase.module.core.MMTable
mmb, tableName
 
Constructor Summary
Users()
           
 
Method Summary
 boolean check()
           
protected  java.lang.String encode(java.lang.String s)
          Encodes a password for storage (to avoid plain text passwords).
 boolean equals(MMObjectNode o1, MMObjectNode o2)
          Implements equals for nodes (this is in MMObjectBuilder because you cannot override MMObjectNode)
protected  java.lang.Object executeFunction(MMObjectNode node, java.lang.String function, java.util.List args)
          Executes a function on the field of a node, and returns the result.
 MMObjectNode getAnonymousUser()
           
static Users getBuilder()
           
 java.lang.String getDefaultContext(MMObjectNode node)
           
 Parameter[] getParameterDefinition(java.lang.String function)
          perhaps we need something like this
 Rank getRank(MMObjectNode userNode)
           
 MMObjectNode getUser(java.lang.String userName)
          Gets the usernode by userName (the 'identifier').
 MMObjectNode getUser(java.lang.String userName, java.lang.String password)
          Gets the usernode and check its credential (password only, currently)
 java.lang.String getUserName(MMObjectNode node)
           
 boolean init()
          Initializes this builder The property 'mmb' needs to be set for the builder before this method can be called.
 int insert(java.lang.String owner, MMObjectNode node)
          UserName must be unique, check it also here (to throw nicer exceptions)
protected  void invalidateCaches(int nodeNumber)
           
 boolean isValid(MMObjectNode node)
           
 boolean nodeChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
           
 boolean nodeLocalChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
          Called when a local node is changed.
 boolean nodeRemoteChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
          Called when a remote node is changed.
 void setDefaults(MMObjectNode node)
          Makes sure unique values and not-null's are filed
 boolean setValue(MMObjectNode node, java.lang.String field, java.lang.Object originalValue)
          Notify the cache that the rank of user node changed this is fixed by CacheInvalidator alreayd ? public void rankChanged(MMObjectNode node) { rankCache.remove(node); }
 java.lang.String toString(MMObjectNode n)
          Implements for MMObjectNode
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, commit, convertMMNode2SQL, count, count, create, createAlias, delete, deleteNodeCache, drop, equals, executeFunction, fieldLocalChanged, getAge, getAliasedNode, getAncestors, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getConfigFile, getDBByte, getDBKey, getDBState, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getField, getFieldNames, getFields, getFields, getFunctionParameters, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getMMBase, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRawNodes, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hashCode, hostname_function, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, preCommit, preEdit, process, processSearchResults, putTmpNode, readSearchResults, removeField, removeNode, removeRelations, removeSyncNodes, removeTmpNode, replace, safeCache, safeCommit, safeInsert, search, search, search, searchIn, searchIn, searchIn, searchList, searchList, searchNumbers, searchVector, searchVector, searchVector, searchVector, searchVectorIn, searchVectorIn, searchVectorIn, searchVectorIn, searchWithWhere, sendFieldChangeSignal, setDBLayout_xml, setDescription, setDescriptions, setInitParameter, setMaintainer, setMMBase, setParentBuilder, setPluralNames, setSearchAge, setSingularNames, setTableName, setUniqueValue, setUniqueValue, setValue, setVersion, setXMLPath, setXMLValues, signalNewObject, testValidData, toString, toXML, updateFields, waitUntilNodeChanged, wrap
 
Methods inherited from class org.mmbase.module.core.MMTable
created, getFullTableName, getTableName, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_STATUS

public static final java.lang.String FIELD_STATUS
See Also:
Constant Field Values

FIELD_USERNAME

public static final java.lang.String FIELD_USERNAME
See Also:
Constant Field Values

FIELD_PASSWORD

public static final java.lang.String FIELD_PASSWORD
See Also:
Constant Field Values

FIELD_DEFAULTCONTEXT

public static final java.lang.String FIELD_DEFAULTCONTEXT
See Also:
Constant Field Values

FIELD_VALID_FROM

public static final java.lang.String FIELD_VALID_FROM
See Also:
Constant Field Values

FIELD_VALID_TO

public static final java.lang.String FIELD_VALID_TO
See Also:
Constant Field Values

FIELD_LAST_LOGON

public static final java.lang.String FIELD_LAST_LOGON
See Also:
Constant Field Values

VALID_TO_DEFAULT

public static final long VALID_TO_DEFAULT
See Also:
Constant Field Values

STATUS_RESOURCE

public static final java.lang.String STATUS_RESOURCE
See Also:
Constant Field Values

RANK_PARAMETERS

public static final Parameter[] RANK_PARAMETERS

rankCache

protected static Cache rankCache

userCache

protected static Cache userCache
Constructor Detail

Users

public Users()
Method Detail

init

public boolean init()
Description copied from class: MMObjectBuilder
Initializes this builder The property 'mmb' needs to be set for the builder before this method can be called. The method retrieves data from the TypeDef builder, or adds data to that builder if the current builder is not yet registered.

Overrides:
init in class MMObjectBuilder
Returns:
true if init was completed, false if uncompleted.
See Also:
MMObjectBuilder.create()

getBuilder

public static Users getBuilder()
Warning: No Java Documentation Available.

getRank

public Rank getRank(MMObjectNode userNode)

setValue

public boolean setValue(MMObjectNode node,
                        java.lang.String field,
                        java.lang.Object originalValue)
Notify the cache that the rank of user node changed this is fixed by CacheInvalidator alreayd ? public void rankChanged(MMObjectNode node) { rankCache.remove(node); }

Overrides:
setValue in class MMObjectBuilder
Parameters:
originalValue - the value which was original in the field
Returns:
true When an update is required(when changed), false if original value was set back into the field.

getAnonymousUser

public MMObjectNode getAnonymousUser()
                              throws SecurityException
Throws:
SecurityException
Warning: No Java Documentation Available.

getUser

public MMObjectNode getUser(java.lang.String userName,
                            java.lang.String password)
Gets the usernode and check its credential (password only, currently)

Returns:
the authenticated user, or null
Throws:
SecurityException

getUser

public MMObjectNode getUser(java.lang.String userName)
Gets the usernode by userName (the 'identifier'). Or 'null' if not found.


insert

public int insert(java.lang.String owner,
                  MMObjectNode node)
UserName must be unique, check it also here (to throw nicer exceptions)

Overrides:
insert in class MMObjectBuilder
Parameters:
owner - The administrator creating the node
node - The object to insert. The object need be of the same type as the current builder.
Returns:
An int value which is the new object's unique number, -1 if the insert failed.

getDefaultContext

public java.lang.String getDefaultContext(MMObjectNode node)
See Also:
User.getOwnerField()

getUserName

public java.lang.String getUserName(MMObjectNode node)
Returns:
The string representation the username of the User node.

encode

protected java.lang.String encode(java.lang.String s)
Encodes a password for storage (to avoid plain text passwords).


isValid

public boolean isValid(MMObjectNode node)
Warning: No Java Documentation Available.

setDefaults

public void setDefaults(MMObjectNode node)
Makes sure unique values and not-null's are filed

Overrides:
setDefaults in class MMObjectBuilder
Parameters:
node - The node to set the defaults of.

getParameterDefinition

public Parameter[] getParameterDefinition(java.lang.String function)
Description copied from class: MMObjectBuilder
perhaps we need something like this

Overrides:
getParameterDefinition in class MMObjectBuilder

check

public boolean check()
Warning: No Java Documentation Available.

executeFunction

protected java.lang.Object executeFunction(MMObjectNode node,
                                           java.lang.String function,
                                           java.util.List args)
Description copied from class: MMObjectBuilder
Executes a function on the field of a node, and returns the result. This method is called by the builder's MMObjectBuilder.getValue(org.mmbase.module.core.MMObjectNode, java.lang.String) method. Derived builders should override this method to provide additional functions.

Overrides:
executeFunction in class MMObjectBuilder
See Also:
MMObjectBuilder.executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List)

equals

public boolean equals(MMObjectNode o1,
                      MMObjectNode o2)
Description copied from class: MMObjectBuilder
Implements equals for nodes (this is in MMObjectBuilder because you cannot override MMObjectNode)

Overrides:
equals in class MMObjectBuilder

toString

public java.lang.String toString(MMObjectNode n)
Description copied from class: MMObjectBuilder
Implements for MMObjectNode

Overrides:
toString in class MMObjectBuilder

nodeLocalChanged

public boolean nodeLocalChanged(java.lang.String machine,
                                java.lang.String number,
                                java.lang.String builder,
                                java.lang.String ctype)
Description copied from class: MMObjectBuilder
Called when a local node is changed. Should be called by subclasses if they override it.

Overrides:
nodeLocalChanged in class MMObjectBuilder
Parameters:
machine - Name of the machine that changed the node.
number - Number of the changed node as a String
builder - type of the changed node
ctype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new
Returns:
always true

nodeRemoteChanged

public boolean nodeRemoteChanged(java.lang.String machine,
                                 java.lang.String number,
                                 java.lang.String builder,
                                 java.lang.String ctype)
Description copied from class: MMObjectBuilder
Called when a remote node is changed. Should be called by subclasses if they override it.

Overrides:
nodeRemoteChanged in class MMObjectBuilder
Parameters:
machine - Name of the machine that changed the node.
number - Number of the changed node as a String
builder - type of the changed node
ctype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new
Returns:
always true

invalidateCaches

protected void invalidateCaches(int nodeNumber)

nodeChanged

public boolean nodeChanged(java.lang.String machine,
                           java.lang.String number,
                           java.lang.String builder,
                           java.lang.String ctype)


MMBase build 1.7.4.20050922