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

java.lang.Object
  extended byorg.mmbase.util.functions.FunctionProvider
      extended byorg.mmbase.module.core.MMTable
          extended byorg.mmbase.module.core.MMObjectBuilder
              extended byorg.mmbase.security.implementation.cloudcontext.builders.Users
All Implemented Interfaces:
EventListener, NodeEventListener, RelationEventListener

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.48 2006/02/17 14:08:55 pierre Exp $
Author:
Eduard Witteveen, Pierre van Rooden, Michiel Meeuwissen

Field Summary
protected  Function encodeFunction
           
static String FIELD_DEFAULTCONTEXT
           
static String FIELD_LAST_LOGON
           
static String FIELD_PASSWORD
           
static String FIELD_STATUS
           
static String FIELD_USERNAME
           
static String FIELD_VALID_FROM
           
static String FIELD_VALID_TO
           
protected static Cache rankCache
           
protected  Function rankFunction
           
static String STATUS_RESOURCE
           
protected static Cache userCache
           
static long VALID_TO_DEFAULT
           
 
Fields inherited from class org.mmbase.module.core.MMObjectBuilder
AGE_PARAMETERS, broadCastChanges, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, EVENT_TYPE_LOCAL, EVENT_TYPE_REMOTE, FIELD_NUMBER, FIELD_OBJECT_TYPE, FIELD_OWNER, fields, genericBlobCache, getFunctions, GUI_PARAMETERS, guiFunction, infoFunction, internalVersion, nodeCache, oType, searchAge, SYSTEM_OWNER, TEMPNODE_DEFAULT_SIZE, temporaryNodes, TMP_FIELD_NUMBER, virtual, WRAP_PARAMETERS, wrapFunction
 
Fields inherited from class org.mmbase.module.core.MMTable
maxNodesFromQuery, mmb, storageConnector, tableName
 
Fields inherited from class org.mmbase.util.functions.FunctionProvider
functions
 
Constructor Summary
Users()
           
 
Method Summary
 boolean check()
           
 String encode(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  Object executeFunction(MMObjectNode node, String function, List args)
          Executes a function on the field of a node, and returns the result.
 MMObjectNode getAnonymousUser()
           
static Users getBuilder()
           
 String getDefaultContext(MMObjectNode node)
           
 Rank getRank(MMObjectNode userNode)
           
 MMObjectNode getUser(String userName)
          Gets the usernode by userName (the 'identifier').
 MMObjectNode getUser(String userName, String password)
          Gets the usernode and check its credential (password only, currently)
 MMObjectNode getUser(String userName, String password, boolean encode)
           
 MMObjectNode getUserByRank(String rank, String userName)
           
 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(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(String machine, String number, String builder, String ctype)
           
 boolean nodeLocalChanged(String machine, String number, String builder, String ctype)
          Called when a local node is changed.
 boolean nodeRemoteChanged(String machine, String number, String builder, 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, String field, Object originalValue)
          Sets a key/value pair in the main values of this node.
 String toString(MMObjectNode n)
          Implements for MMObjectNode
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addEventListener, addField, addLocalObserver, addRemoteObserver, broadcastChanges, checkAddTmpField, clearBlobCache, commit, create, createAlias, createAlias, delete, equals, executeFunction, fieldLocalChanged, getAncestors, getBlobCache, getClassName, getConfigFile, getConfigResource, getDataTypeCollector, getDBKey, getDBState, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getEmptyNode, getField, getFieldNames, getFields, getFields, getFunction, getFunctionParameters, getFunctions, getGUIIndicator, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getInternalVersion, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNodeFromCache, getNodeGUIIndicator, getNumber, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hasField, hashCode, hashCode, hostname_function, insert, isExtensionOf, isNodeCached, isVirtual, newFunctionInstance, notify, notify, preCommit, process, putTmpNode, removeEventListener, removeField, removeLocalObserver, removeNode, removeRelations, removeRemoteObserver, removeSyncNodes, removeTmpNode, replace, safeCache, sendFieldChangeSignal, setDescription, setDescriptions, setFields, setInitParameter, setMaintainer, setParentBuilder, setPluralNames, setSearchAge, setSingularNames, setUniqueValue, setUniqueValue, setValue, setVersion, setXMLPath, testValidData, toString, update, updateFields, wrap
 
Methods inherited from class org.mmbase.module.core.MMTable
count, count, created, getFullTableName, getMMBase, getNode, getNodes, getNodes, getNodes, getNodeType, getStorageConnector, getTableName, search, searchVector, setMMBase, setTableName, size
 
Methods inherited from class org.mmbase.util.functions.FunctionProvider
addFunction, createParameters, getFunction, getFunctions, getFunctionValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_STATUS

public static final String FIELD_STATUS
See Also:
Constant Field Values

FIELD_USERNAME

public static final String FIELD_USERNAME
See Also:
Constant Field Values

FIELD_PASSWORD

public static final String FIELD_PASSWORD
See Also:
Constant Field Values

FIELD_DEFAULTCONTEXT

public static final String FIELD_DEFAULTCONTEXT
See Also:
Constant Field Values

FIELD_VALID_FROM

public static final String FIELD_VALID_FROM
See Also:
Constant Field Values

FIELD_VALID_TO

public static final String FIELD_VALID_TO
See Also:
Constant Field Values

FIELD_LAST_LOGON

public static final 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 String STATUS_RESOURCE
See Also:
Constant Field Values

rankCache

protected static Cache rankCache

userCache

protected static Cache userCache

encodeFunction

protected Function encodeFunction

rankFunction

protected Function rankFunction
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,
                        String field,
                        Object originalValue)
Description copied from class: MMObjectBuilder
Sets a key/value pair in the main values of this node. Note that if this node is a node in cache, the changes are immediately visible to everyone, even if the changes are not committed. The fieldname is added to the (public) 'changed' vector to track changes.

Overrides:
setValue in class MMObjectBuilder
Parameters:
field - the name of the field to change
node - The node on which to change the field (the new value is in this node)
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(String userName,
                            String password)
Gets the usernode and check its credential (password only, currently)

Returns:
the authenticated user, or null
Throws:
SecurityException

getUser

public MMObjectNode getUser(String userName,
                            String password,
                            boolean encode)

getUser

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


getUserByRank

public MMObjectNode getUserByRank(String rank,
                                  String userName)
Parameters:
rank - Rank to be searched. Never null.
userName - Username to match or null
Since:
MMBase-1.8

insert

public int insert(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 String getDefaultContext(MMObjectNode node)
See Also:
User.getOwnerField()

getUserName

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

encode

public String encode(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.

check

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

executeFunction

protected Object executeFunction(MMObjectNode node,
                                 String function,
                                 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 String toString(MMObjectNode n)
Description copied from class: MMObjectBuilder
Implements for MMObjectNode

Overrides:
toString in class MMObjectBuilder

nodeLocalChanged

public boolean nodeLocalChanged(String machine,
                                String number,
                                String builder,
                                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(String machine,
                                 String number,
                                 String builder,
                                 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(String machine,
                           String number,
                           String builder,
                           String ctype)


MMBase build 1.8.1.20060716