code: private Permission permissionForMethod(String method) {
          switch (method.toUpperCase()) {
          case "GET":
              return Permission.READ;
          case "PUT":
          case "DELETE":
              return Permission.UPDATE;
          case "POST":
              return Permission.APPEND;
          default:
              throw new RuntimeException("Unexpected REST method: " + method);
          }
      }
docs: Map an HTTP method to the permission needed to execute it.