public class BasicContextProvider extends Object implements ContextProvider
ContextProvider that implements all the methods in a default way.ContextProvider.AllowingContexts| Constructor and Description |
|---|
BasicContextProvider(MMObjectBuilder... b) |
BasicContextProvider(NodeSearchQuery... q) |
BasicContextProvider(String... b) |
| Modifier and Type | Method and Description |
|---|---|
protected Authorization.QueryCheck |
addAllowingContextsConstraints(List<Constraint> constraints,
User userContext,
Query query,
Operation operation) |
protected Authorization.QueryCheck |
addConstraints(List<Constraint> constraints,
User userContext,
Query query,
Operation operation) |
protected Authorization.QueryCheck |
addSecurityObjectsConstraints(List<Constraint> constraints,
User userContext,
Query query,
Operation operation) |
protected boolean |
allows(MMObjectNode contextNode,
MMObjectNode groupOrUserNode,
Operation operation) |
protected boolean |
canReadAll() |
Authorization.QueryCheck |
check(User userContext,
Query query,
Operation operation) |
protected boolean |
disableContextChecks() |
protected SortedSet<String> |
getAllContexts()
Returns a Set (of Strings) of all existing contexts
|
protected SortedSet<String> |
getAllContextsUnCached() |
protected SortedSet<String> |
getAllowingContexts(User user,
Operation operation) |
protected ContextProvider.AllowingContexts |
getAllowingOrDisallowingContexts(User userContext,
Operation operation) |
String |
getContext(User userContext,
MMObjectNode node) |
String |
getContextName(MMObjectNode contextNode)
Returns the name of the context belonging to a certain context node.
|
protected String |
getContextNameField(String table)
For the given context- builder return which field contains the 'context'.
|
MMObjectNode |
getContextNode(MMObjectNode node)
Returns the MMObjectNode representing the 'context' of a certain other node
|
MMObjectNode |
getContextNode(String context)
Returns the MMObjectNode representing the 'context' which is identifier with the given name.
|
Collection<NodeSearchQuery> |
getContextQueries() |
protected SortedSet<String> |
getDisallowingContexts(User user,
Operation operation)
Returns a Set (of Strings) of all existing contexts for which the given operation is not allowed for the given user.
|
Set<MMObjectNode> |
getGroupsAndUsers(MMObjectNode contextNode,
Operation operation) |
protected Collection<MMObjectNode> |
getGroupsOrUsers(MMObjectNode contextNode,
Operation operation,
MMObjectBuilder groupsOrUsers) |
protected int |
getMaxContextsInQuery() |
Set<String> |
getPossibleContexts(User user) |
Set<String> |
getPossibleContexts(User user,
MMObjectNode node) |
boolean |
grant(User user,
MMObjectNode contextNode,
MMObjectNode groupOrUserNode,
Operation operation) |
protected boolean |
isAllContextsPossible() |
boolean |
mayDo(User user,
MMObjectNode node,
Operation operation) |
boolean |
mayDoOnContext(MMObjectNode userNode,
MMObjectNode contextNode,
Operation operation,
boolean checkOwnRights) |
protected boolean |
mayDoOnContext(User user,
MMObjectNode contextNode,
Operation operation,
boolean checkOwnRights) |
boolean |
mayGrant(User user,
MMObjectNode contextNode,
MMObjectNode groupOrUserNode,
Operation operation)
Whether, or not, the user is allowed to grant the security operation to the group or user on the context
node.
|
boolean |
mayRevoke(User user,
MMObjectNode contextNode,
MMObjectNode groupOrUserNode,
Operation operation)
Whether, or not, the user is allowed to revoke the security operation to the group or user on the context
node.
|
boolean |
revoke(User user,
MMObjectNode contextNode,
MMObjectNode groupOrUserNode,
Operation operation) |
void |
setContext(User user,
MMObjectNode node,
String context)
Sets the context of the given ode.
|
public BasicContextProvider(NodeSearchQuery... q)
public BasicContextProvider(MMObjectBuilder... b)
public BasicContextProvider(String... b)
protected boolean isAllContextsPossible()
protected boolean canReadAll()
protected int getMaxContextsInQuery()
protected boolean disableContextChecks()
protected String getContextNameField(String table)
public Collection<NodeSearchQuery> getContextQueries()
getContextQueries in interface ContextProviderpublic String getContextName(MMObjectNode contextNode) throws SecurityException
ContextProvidergetContextName in interface ContextProviderSecurityExceptionpublic void setContext(User user, MMObjectNode node, String context)
ContextProvidersetContext in interface ContextProviderprotected SortedSet<String> getAllContextsUnCached() throws SearchQueryException
SearchQueryExceptionprotected SortedSet<String> getAllContexts()
protected SortedSet<String> getDisallowingContexts(User user, Operation operation)
public MMObjectNode getContextNode(MMObjectNode node)
ContextProvidergetContextNode in interface ContextProviderpublic String getContext(User userContext, MMObjectNode node)
getContext in interface ContextProviderpublic MMObjectNode getContextNode(String context)
ContextProvidergetContextNode in interface ContextProviderpublic Set<String> getPossibleContexts(User user, MMObjectNode node) throws SecurityException
getPossibleContexts in interface ContextProviderSecurityExceptionpublic Set<String> getPossibleContexts(User user) throws SecurityException
getPossibleContexts in interface ContextProviderSecurityExceptionpublic boolean mayDo(User user, MMObjectNode node, Operation operation)
mayDo in interface ContextProviderprotected boolean mayDoOnContext(User user, MMObjectNode contextNode, Operation operation, boolean checkOwnRights)
public boolean mayDoOnContext(MMObjectNode userNode, MMObjectNode contextNode, Operation operation, boolean checkOwnRights)
mayDoOnContext in interface ContextProviderpublic boolean mayGrant(User user, MMObjectNode contextNode, MMObjectNode groupOrUserNode, Operation operation)
ContextProvidermayGrant in interface ContextProviderpublic boolean mayRevoke(User user, MMObjectNode contextNode, MMObjectNode groupOrUserNode, Operation operation)
ContextProvidermayRevoke in interface ContextProviderpublic Set<MMObjectNode> getGroupsAndUsers(MMObjectNode contextNode, Operation operation)
protected Collection<MMObjectNode> getGroupsOrUsers(MMObjectNode contextNode, Operation operation, MMObjectBuilder groupsOrUsers)
protected Authorization.QueryCheck addSecurityObjectsConstraints(List<Constraint> constraints, User userContext, Query query, Operation operation)
protected ContextProvider.AllowingContexts getAllowingOrDisallowingContexts(User userContext, Operation operation)
protected Authorization.QueryCheck addAllowingContextsConstraints(List<Constraint> constraints, User userContext, Query query, Operation operation)
protected Authorization.QueryCheck addConstraints(List<Constraint> constraints, User userContext, Query query, Operation operation)
public Authorization.QueryCheck check(User userContext, Query query, Operation operation)
check in interface ContextProviderprotected boolean allows(MMObjectNode contextNode, MMObjectNode groupOrUserNode, Operation operation)
public boolean grant(User user, MMObjectNode contextNode, MMObjectNode groupOrUserNode, Operation operation)
grant in interface ContextProviderpublic boolean revoke(User user, MMObjectNode contextNode, MMObjectNode groupOrUserNode, Operation operation)
revoke in interface ContextProviderMMBase 1.9-SNAPSHOT - ${javadoctimestamp}