org.mmbase.security.implementation.cloud
Class Verify

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

public class Verify
extends Authorization

Simple authorization implemenation for 'cloud' security implemenation based only on an mmbasusers builder. Read-rights on everything for everybody. User named 'admin' has rank administrator and may do everything. Normal users have no rights on a limited set of 'admin' builders. Normal users may do everything on their 'own' nodes, and on nodes with the owner field '[shared]'.

Version:
$Id: Verify.java 35335 2009-05-21 08:14:41Z michiel $
Author:
Eduard Witteveen

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, int nodeid, int srcnodeid, int dstnodeid, Operation operation)
          This method should be overrided by an extending class.
 boolean check(UserContext user, int nodeid, Operation operation)
          This method should be overrided by an extending class.
 Authorization.QueryCheck check(UserContext user, Query query, Operation operation)
          Checks rights on a query.
 void create(UserContext user, int nodeid)
          This method should be overrided by an extending class.
 String getContext(UserContext user, int nodeid)
          This method could be overrided by an extending class.
 Set<String> getPossibleContexts(UserContext user, 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 user, 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 user, int nodeid)
          This method should be overrided by an extending class.
 
Methods inherited from class org.mmbase.security.Authorization
check, getPossibleContexts, 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

create

public void create(UserContext user,
                   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:
user - 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 user,
                   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:
user - 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 user,
                   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:
user - 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 user,
                     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:
user - 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 user,
                     int nodeid,
                     int srcnodeid,
                     int dstnodeid,
                     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:
user - 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.
srcnodeid - The id of the (new) source node of the relation.
dstnodeid - 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 user,
                         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:
user - 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 user,
                                       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:
user - 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

check

public Authorization.QueryCheck check(UserContext user,
                                      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:
user - 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).


MMBase 2.0-SNAPSHOT - null