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

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

public class Groups
extends MMObjectBuilder

Groups of users. A group can also contain other groups. Containing is arranged by the 'containsrel' relations type.

Version:
$Id: Groups.java,v 1.14 2004/02/25 19:39:23 michiel Exp $
Author:
Eduard Witteveen, Pierre van Rooden, Michiel Meeuwissen

Field Summary
protected static Cache containsCache
           
 
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
Groups()
           
 
Method Summary
protected  boolean contains(MMObjectNode containingGroupNode, int containedObject)
          Checks wether group or user identified by number is contained by group (also indirectly)
protected  boolean contains(MMObjectNode containingGroupNode, int containedObject, java.util.Set recurse)
          Checks wether group or user identified by number is contained by group.
protected  boolean contains(MMObjectNode containingGroup, MMObjectNode groupOrUser)
           
 boolean contains(MMObjectNode group, User user)
          Checks wether a a certain user is part of a certain group, either directly or indirectly.
 boolean equals(MMObjectNode o1, MMObjectNode o2)
          Implements equals for nodes (this is in MMObjectBuilder because you cannot override MMObjectNode)
static Groups getBuilder()
           
 java.util.SortedSet getGroups(int containedObject)
          Returns all groups, which are (directly or indirectly) containing the given object (user/group)
 boolean init()
          Initializes this builder The property 'mmb' needs to be set for the builder before this method can be called.
 void setDefaults(MMObjectNode node)
          unused, ie untested public void addGroup(User user, MMObjectNode group, Verify verify) { for (Enumeration enumeration = user.getNode().getRelations(); enumeration.hasMoreElements();) { MMObjectNode relation = getNode(((MMObjectNode)enumeration.nextElement()).getNumber()); if (relation.parent instanceof ContainsRel) { MMObjectNode source = relation.getNodeValue("snumber"); MMObjectNode destination = relation.getNodeValue("dnumber"); if (destination.getNumber() == user.getNode().getNumber() && source.getBuilder() == this) { MMObjectNode newRelation = ContainsRel.getBuilder().grantRightsTo(group, source); verify.create(user, newRelation.getNumber()); } } } }
 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, 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, getParameterDefinition, 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, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, nodeLocalChanged, nodeRemoteChanged, 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, 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

containsCache

protected static Cache containsCache
Constructor Detail

Groups

public Groups()
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 Groups getBuilder()
Returns:
the MMObjectBuilder mmbasegroups casted to a Groups

contains

public boolean contains(MMObjectNode group,
                        User user)
Checks wether a a certain user is part of a certain group, either directly or indirectly.

To Do:
This could perhaps be just as logicly be implemented in Users rather than Groups (and groups becomes Dummy).

contains

protected boolean contains(MMObjectNode containingGroup,
                           MMObjectNode groupOrUser)

contains

protected boolean contains(MMObjectNode containingGroupNode,
                           int containedObject)
Checks wether group or user identified by number is contained by group (also indirectly)


contains

protected boolean contains(MMObjectNode containingGroupNode,
                           int containedObject,
                           java.util.Set recurse)
Checks wether group or user identified by number is contained by group.


getGroups

public java.util.SortedSet getGroups(int containedObject)
Returns all groups, which are (directly or indirectly) containing the given object (user/group)


setDefaults

public void setDefaults(MMObjectNode node)
unused, ie untested public void addGroup(User user, MMObjectNode group, Verify verify) { for (Enumeration enumeration = user.getNode().getRelations(); enumeration.hasMoreElements();) { MMObjectNode relation = getNode(((MMObjectNode)enumeration.nextElement()).getNumber()); if (relation.parent instanceof ContainsRel) { MMObjectNode source = relation.getNodeValue("snumber"); MMObjectNode destination = relation.getNodeValue("dnumber"); if (destination.getNumber() == user.getNode().getNumber() && source.getBuilder() == this) { MMObjectNode newRelation = ContainsRel.getBuilder().grantRightsTo(group, source); verify.create(user, newRelation.getNumber()); } } } }

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

toString

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

Overrides:
toString in class MMObjectBuilder

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


MMBase build 1.7.1.20041002