Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
@Override
public boolean authorizeOperationauthorize(StringPrincipal regionNameprincipal, OperationContextGeodePermission contextpermission) {
  switch (context.getOperationCode()) {
    case PUT:
      // cast to PutOperationContext
      breakResource resource = permission.getResource();
  Operation operation case QUERY:
      // cast to QueryOperationContext
      break= permission.getOperation();
    case READ:if(principalHasAccessToPerformGivenOperationOnGivenResource() {
    case WRITE:
    case MANAGE:
      // Must be JMX or CLI - no need to cast; just use the 'context' as is
      breakreturn true;
  }
  return false;
}


Note that any JMX or CLI contexts are not associated with a specific sub-type of OperationContext and can be handled without having to cast the context parameter.

...