Author: michiel
Date: 2009-05-19 13:40:26 +0200 (Tue, 19 May 2009)
New Revision: 35304
Modified:
mmbase/trunk/applications/cloudcontext/src/org/mmbase/security/implementation/cloudcontext/ContextProvider.java
mmbase/trunk/applications/cloudcontext/src/org/mmbase/security/implementation/cloudcontext/Verify.java
Log:
javadoc and some rationalizations
Modified:
mmbase/trunk/applications/cloudcontext/src/org/mmbase/security/implementation/cloudcontext/ContextProvider.java
===================================================================
---
mmbase/trunk/applications/cloudcontext/src/org/mmbase/security/implementation/cloudcontext/ContextProvider.java
2009-05-19 09:39:03 UTC (rev 35303)
+++
mmbase/trunk/applications/cloudcontext/src/org/mmbase/security/implementation/cloudcontext/ContextProvider.java
2009-05-19 11:40:26 UTC (rev 35304)
@@ -29,6 +29,10 @@
Collection<NodeSearchQuery> getContextQueries();
+
+ /**
+ * Sets the context of the given ode.
+ */
void setContext(User user, MMObjectNode node, String context);
/**
@@ -43,7 +47,7 @@
/**
- * Returns the MMObjectNode representing the 'context' of a certain other
node
+ * Returns the MMObjectNode representing the 'context' which is identifier
with the given name.
*/
MMObjectNode getContextNode(String context);
Modified:
mmbase/trunk/applications/cloudcontext/src/org/mmbase/security/implementation/cloudcontext/Verify.java
===================================================================
---
mmbase/trunk/applications/cloudcontext/src/org/mmbase/security/implementation/cloudcontext/Verify.java
2009-05-19 09:39:03 UTC (rev 35303)
+++
mmbase/trunk/applications/cloudcontext/src/org/mmbase/security/implementation/cloudcontext/Verify.java
2009-05-19 11:40:26 UTC (rev 35304)
@@ -68,7 +68,7 @@
@Override
public boolean check(UserContext userContext, int nodeId, Operation
operation) {
- return getContextProvider().mayDo((User) userContext,
getContextNode(nodeId, true), operation);
+ return getContextProvider().mayDo((User) userContext, getNode(nodeId,
true), operation);
}
@Override public boolean check(UserContext userContext, int nodeId, int
sourceNodeId, int destinationNodeId, Operation operation) {
@@ -87,11 +87,11 @@
}
@Override public void setContext(UserContext user, int nodeId, String
context) throws org.mmbase.security.SecurityException {
- getContextProvider().setContext((User) user, getContextNode(nodeId,
true), context);
+ getContextProvider().setContext((User) user, getNode(nodeId, true),
context);
}
@Override public Set<String> getPossibleContexts(UserContext userContext,
int nodeId) throws org.mmbase.security.SecurityException {
- return getContextProvider().getPossibleContexts((User) userContext,
getContextNode(nodeId, true));
+ return getContextProvider().getPossibleContexts((User) userContext,
getNode(nodeId, true));
}
@Override public Set<String> getPossibleContexts(UserContext userContext)
throws org.mmbase.security.SecurityException {
@@ -112,8 +112,21 @@
/**
* For a certain node, returns the node representing its 'context'.
+ * @param nodeId
+ * @param exception If <code>true</code> throw a security exception if a
node which such a
+ * number could not be found. Otherwise, in that case only log a warning.
*/
protected MMObjectNode getContextNode(int nodeId, boolean exception) {
+ return getContextProvider().getContextNode(getNode(nodeId, exception));
+ }
+
+ /**
+ * For a certain node number , return the MMObjectNode representing it
+ * @param nodeId
+ * @param exception If <code>true</code> throw a security exception if a
node which such a
+ * number could not be found. Otherwise, in that case only log a warning.
+ */
+ protected MMObjectNode getNode(int nodeId, boolean exception) {
MMObjectNode node =
getContextProvider().getContextQueries().iterator().next().getBuilder().getNode(nodeId);
if (node == null) {
if (exception) {
@@ -122,7 +135,7 @@
log.warn("node #" + nodeId + " not found");
}
}
- return getContextProvider().getContextNode(node);
+ return node;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs