docs: void grant(SchemaObject object, Right right, Grantee grantor,
                 boolean withGrant) {
  
          final HsqlName name            = object.getName();
          final Right    grantableRights = grantor.getAllGrantableRights(object);
          Right          existingRight   = null;
  
          if (right == Right.fullRights) {
              if (grantableRights.isEmpty()) {
                  return;    // has no rights
              }
  
              right = grantableRights;
          } else {
              if (!grantableRights.contains(right)) {
                  throw Error.error(ErrorCode.X_0L000);
              }
          }
  
          Iterator it = directRightsMap.get(name);
  
          while (it.hasNext()) {
              Right existing = (Right) it.next();
  
              if (existing.grantor == grantor) {
                  existingRight = existing;
  
                  existingRight.add(right);
  
                  break;
              }
          }
  
          if (existingRight == null) {
              existingRight         = right.duplicate();
              existingRight.grantor = grantor;
              existingRight.grantee = this;
  
              directRightsMap.put(name, existingRight);
          }
  
          if (withGrant) {
              if (existingRight.grantableRights == null) {
                  existingRight.grantableRights = right.duplicate();
              } else {
                  existingRight.grantableRights.add(right);
              }
          }
  
          if (!grantor.isSystem) {
  
              // based on assumption that there is no need to access
              grantor.grantedRightsMap.put(name, existingRight);
          }
  
          updateAllRights();
      }