org.mmbase.security.implementation.cloudcontext
Class Verify

java.lang.Object
  extended by org.mmbase.security.Configurable
      extended by org.mmbase.security.Authorization
          extended by org.mmbase.security.implementation.cloudcontext.Verify

public class Verify
extends Authorization

Implementation of Authorization. Most implementation is delegated to the Contexts builder.

Version:
$Id: Verify.java 40042 2009-11-30 21:17:00Z michiel $
Author:
Eduard Witteveen, Pierre van Rooden, Michiel Meeuwissen
See Also:
Contexts

Nested Class Summary
 
Nested classes/interfaces inherited from class org.mmbase.security.Authorization
Authorization.QueryCheck
 
Field Summary
 
Fields inherited from class org.mmbase.security.Authorization
COMPLETE_CHECK, NO_CHECK
 
Fields inherited from class org.mmbase.security.Configurable
configResource, configWatcher, manager
 
Constructor Summary
Verify()
           
 
Method Summary
 boolean check(UserContext user, Action ac, Parameters parameters)
          Checks whether user may do a certain action.
 boolean check(UserContext userContext, int nodeId, int sourceNodeId, int destinationNodeId, Operation operation)
          This method should be overrided by an extending class.
 boolean check(UserContext userContext, int nodeId, Operation operation)
          This method should be overrided by an extending class.
 Authorization.QueryCheck check(UserContext userContext, Query query, Operation operation)
          Checks rights on a query.
 void create(UserContext userContext, int nodeId)
          This method should be overrided by an extending class.
 String getContext(UserContext userContext, int nodeId)
          This method could be overrided by an extending class.
protected  MMObjectNode getContextNode(int nodeId, boolean exception)
          For a certain node, returns the node representing its 'context'.
 ContextProvider getContextProvider()
           
static Verify getInstance()
           
protected  MMObjectNode getNode(int nodeId, boolean exception)
          For a certain node number , return the MMObjectNode representing it
 Set<String> getPossibleContexts(UserContext userContext)
          This method could be overrided by an extending class.
 Set<String> getPossibleContexts(UserContext userContext, int nodeId)
          This method could be overrided by an extending class.
protected  void load()
          This method should be overridden by an extending class.
 void remove(UserContext userContext, int nodeId)
          This method should be overrided by an extending class.
 void setContext(UserContext user, int nodeId, String context)
          This method could be overrided by an extending class.
 void update(UserContext userContext, int nodeId)
          This method should be overrided by an extending class.
 
Methods inherited from class org.mmbase.security.Authorization
verify, verify, verify
 
Methods inherited from class org.mmbase.security.Configurable
load
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Verify

public Verify()
Method Detail

load

protected void load()
Description copied from class: Configurable
This method should be overridden by an extending class. It should further initialize the class. It can optionally retrieve settings from the general security configuration file (available as the 'configResource' member). Security implementations with complicated configuration would typically retrieve a path to their own configuration file only.

Specified by:
load in class Configurable

getInstance

public static final Verify getInstance()
Since:
MMBase-1.9.1

getContextProvider

public ContextProvider getContextProvider()
Since:
MMBase-1.9.1

create

public void create(UserContext userContext,
                   int nodeId)
Description copied from class: Authorization
This method should be overrided by an extending class. It has to be called, when a new Node has been created. This way, the authentication can create default rights for this object, depending on the UserContext and generate logging information.

Specified by:
create in class Authorization
Parameters:
userContext - The UserContext, containing the information about the user.
nodeId - The id of the MMObjectNode, which has just been added to the MMBase cloud.

update

public void update(UserContext userContext,
                   int nodeId)
Description copied from class: Authorization
This method should be overrided by an extending class. It has to be called, when a Node has been changed. This way, the authentication can generate log information for this object, which can be used for accountability

Specified by:
update in class Authorization
Parameters:
userContext - The UserContext, containing the information about the user.
nodeId - The id of the MMObjectNode, which has just been changed in the cloud.

remove

public void remove(UserContext userContext,
                   int nodeId)
Description copied from class: Authorization
This method should be overrided by an extending class. It has to be called, when a Node has been removed from the cloud. This way, the authentication can generate log information for this node, and remove the authorization object which belongs to this node.

Specified by:
remove in class Authorization
Parameters:
userContext - The UserContext, containing the information about the user.
nodeId - The id of the MMObjectNode, which has just been removed in the cloud.

check

public boolean check(UserContext userContext,
                     int nodeId,
                     Operation operation)
Description copied from class: Authorization
This method should be overrided by an extending class. This method checks if an operation is permitted on a certain node done by a certain user.

Specified by:
check in class Authorization
Parameters:
userContext - The UserContext, containing the information the user.
nodeId - The id of the MMObjectNode, which has to be checked. It the action is CREATE then this will be interpreted as a typedef node.
operation - The operation which will be performed.
Returns:
true if the operation is permitted, false if the operation is not permitted,

check

public boolean check(UserContext userContext,
                     int nodeId,
                     int sourceNodeId,
                     int destinationNodeId,
                     Operation operation)
Description copied from class: Authorization
This method should be overrided by an extending class. This method checks if the creation of a certain relation or changing the source or destination of a certain relation done by a certain user is permitted.

Specified by:
check in class Authorization
Parameters:
userContext - The UserContext, containing the information about the user.
nodeId - The id of the relation which has to be checked. If the operation is CREATE then this will be interpreted as the typedef node (extending insrel) for the relation to be created.
sourceNodeId - The id of the (new) source node of the relation.
destinationNodeId - The id of the (new) destination node of the relation.
operation - The operation which will be performed (CREATE (create relation) or CHANGE_RELATION (source and/or destination are changed).
Returns:
true if the operation is permitted, false if the operation is not permitted,

getContext

public String getContext(UserContext userContext,
                         int nodeId)
                  throws SecurityException
Description copied from class: Authorization
This method could be overrided by an extending class. This method returns the context of a specific node.

Specified by:
getContext in class Authorization
Parameters:
userContext - The UserContext, containing the information about the user.
nodeId - The id of the MMObjectNode, which has to be asserted.
Returns:
the context setting of the node.
Throws:
SecurityException - If operation is not allowed(needs read rights)

setContext

public void setContext(UserContext user,
                       int nodeId,
                       String context)
                throws SecurityException
Description copied from class: Authorization
This method could be overrided by an extending class. This method changes the rights on a node, by telling the authorization that it should use the context which is defined.

Specified by:
setContext in class Authorization
Parameters:
user - The UserContext, containing the information about the user.
nodeId - The id of the MMObjectNode, which has to be asserted.
context - The context which rights the node will get
Throws:
SecurityException - If operation is not allowed

getPossibleContexts

public Set<String> getPossibleContexts(UserContext userContext,
                                       int nodeId)
                                throws SecurityException
Description copied from class: Authorization
This method could be overrided by an extending class. This method returns a list of contexts which can be used to change the node.

Specified by:
getPossibleContexts in class Authorization
Parameters:
userContext - The UserContext, containing the information about the user.
nodeId - The id of the MMObjectNode, which has to be asserted.
Returns:
a Set of Strings which represent a context in readable form..
Throws:
SecurityException

getPossibleContexts

public Set<String> getPossibleContexts(UserContext userContext)
                                throws SecurityException
Description copied from class: Authorization
This method could be overrided by an extending class. This method returns a list of contexts availabel to a user when creating or searching for an object. The default implementation returns only the user's own default context.

Overrides:
getPossibleContexts in class Authorization
Parameters:
userContext - The UserContext, containing the information about the user.
Returns:
a Set of Strings which represent a context in readable form..
Throws:
SecurityException

check

public Authorization.QueryCheck check(UserContext userContext,
                                      Query query,
                                      Operation operation)
Description copied from class: Authorization
Checks rights on a query. This means that the query is explored and (if possible) a constraint for it is constructed, which, if appied to the query, makes it return only checked results for the given user. Of course, this will normally only be implemented for the 'READ' operation. The constraint is not applied automaticly. This has to be done by using BasicQuery.setSecurityConstraint().

Overrides:
check in class Authorization
Parameters:
userContext - The UserContext, for which the query must be considered
query - The query to be explored
Returns:
A Authorization.QueryCheck structure (containing whether the constriant is sufficient, and the new constraint or null).

check

public boolean check(UserContext user,
                     Action ac,
                     Parameters parameters)
Description copied from class: Authorization
Checks whether user may do a certain action. Default implemetation simply uses default ActionChecker of the Action itself. Extensions may provide configuration, e.g. make links between groups and/or user object with Action objects, to provide more fine grained control over which users may execute what 'actions'. in the MMBase cloud.

Overrides:
check in class Authorization

getContextNode

protected MMObjectNode getContextNode(int nodeId,
                                      boolean exception)
For a certain node, returns the node representing its 'context'.

Parameters:
nodeId -
exception - If true throw a security exception if a node which such a number could not be found. Otherwise, in that case only log a warning.

getNode

protected MMObjectNode getNode(int nodeId,
                               boolean exception)
For a certain node number , return the MMObjectNode representing it

Parameters:
nodeId -
exception - If true throw a security exception if a node which such a number could not be found. Otherwise, in that case only log a warning.


MMBase 2.0-SNAPSHOT - null