code: private boolean isValidUserAccess(UserDefinition userDef, Permission permNeeded) {
          Set<Permission> permList = userDef.getPermissions();
          if (permList.size() == 0 || permList.contains(Permission.ALL)) {
              return true;
          }
          switch (permNeeded) {
          case APPEND:
              return permList.contains(Permission.APPEND) || permList.contains(Permission.UPDATE);
          case READ:
              return permList.contains(Permission.READ);
          case UPDATE:
              return permList.contains(Permission.UPDATE);
          default:
              return false;
          }
      }
docs: Validate user's permission vs. the given required permission.